@tencent-ai/codebuddy-code 1.24.0-next.f2e76f0.20251105 → 1.25.0-next.42e611b.20251106
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/CHANGELOG.md +267 -3
- package/dist/codebuddy.js +4 -4
- package/package.json +1 -1
- package/product.cloudhosted.json +18 -18
- package/product.internal.json +3 -18
- package/product.ioa.json +12 -25
- package/product.json +13 -26
- package/product.selfhosted.json +3 -18
- package/dist/338.codebuddy.js +0 -1
- package/dist/344.codebuddy.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/codebuddy-code",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0-next.42e611b.20251106",
|
|
4
4
|
"description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
|
|
5
5
|
"main": "lib/node/index.js",
|
|
6
6
|
"typings": "lib/node/index.d.ts",
|
package/product.cloudhosted.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"instructions": "cli-agent-prompt",
|
|
6
6
|
"description": "cli agent",
|
|
7
7
|
"models": [
|
|
8
|
+
"glm-4.6",
|
|
8
9
|
"deepseek-v3.1",
|
|
9
10
|
"deepseek-v3-0324"
|
|
10
11
|
],
|
|
@@ -67,22 +68,7 @@
|
|
|
67
68
|
"name": "compact",
|
|
68
69
|
"instructions": "compact-agent-prompt",
|
|
69
70
|
"description": "compact agent",
|
|
70
|
-
"tools": [
|
|
71
|
-
"Read",
|
|
72
|
-
"Write",
|
|
73
|
-
"Edit",
|
|
74
|
-
"MultiEdit",
|
|
75
|
-
"Bash",
|
|
76
|
-
"Glob",
|
|
77
|
-
"Grep",
|
|
78
|
-
"TodoWrite",
|
|
79
|
-
"WebFetch",
|
|
80
|
-
"WebSearch",
|
|
81
|
-
"NotebookEdit",
|
|
82
|
-
"Task",
|
|
83
|
-
"SlashCommand",
|
|
84
|
-
"Skill"
|
|
85
|
-
],
|
|
71
|
+
"tools": [],
|
|
86
72
|
"tags": [
|
|
87
73
|
"cli",
|
|
88
74
|
"compact"
|
|
@@ -133,6 +119,20 @@
|
|
|
133
119
|
"supportsImages": false,
|
|
134
120
|
"maxAllowedSize": 56000
|
|
135
121
|
},
|
|
122
|
+
{
|
|
123
|
+
"credits": "x0.18 credits",
|
|
124
|
+
"id": "glm-4.6",
|
|
125
|
+
"name": "GLM-4.6",
|
|
126
|
+
"vendor": "f",
|
|
127
|
+
"maxOutputTokens": 32000,
|
|
128
|
+
"maxInputTokens": 168000,
|
|
129
|
+
"supportsToolCall": true,
|
|
130
|
+
"supportsImages": false,
|
|
131
|
+
"disabledMultimodal": true,
|
|
132
|
+
"maxAllowedSize": 168000,
|
|
133
|
+
"supportsReasoning": false,
|
|
134
|
+
"temperature": 1
|
|
135
|
+
},
|
|
136
136
|
{
|
|
137
137
|
"credits": "x0.37 credits",
|
|
138
138
|
"id": "deepseek-v3.1",
|
|
@@ -175,6 +175,6 @@
|
|
|
175
175
|
"productFeatures": {
|
|
176
176
|
"BillingNotice": false
|
|
177
177
|
},
|
|
178
|
-
"commit": "
|
|
179
|
-
"date": "2025-11-
|
|
178
|
+
"commit": "42e611b3b753dfc9338a3c7c41cfc925d1ca8809",
|
|
179
|
+
"date": "2025-11-06T10:05:24.395Z"
|
|
180
180
|
}
|
package/product.internal.json
CHANGED
|
@@ -70,22 +70,7 @@
|
|
|
70
70
|
"name": "compact",
|
|
71
71
|
"instructions": "compact-agent-prompt",
|
|
72
72
|
"description": "compact agent",
|
|
73
|
-
"tools": [
|
|
74
|
-
"Read",
|
|
75
|
-
"Write",
|
|
76
|
-
"Edit",
|
|
77
|
-
"MultiEdit",
|
|
78
|
-
"Bash",
|
|
79
|
-
"Glob",
|
|
80
|
-
"Grep",
|
|
81
|
-
"TodoWrite",
|
|
82
|
-
"WebFetch",
|
|
83
|
-
"WebSearch",
|
|
84
|
-
"NotebookEdit",
|
|
85
|
-
"Task",
|
|
86
|
-
"SlashCommand",
|
|
87
|
-
"Skill"
|
|
88
|
-
],
|
|
73
|
+
"tools": [],
|
|
89
74
|
"tags": [
|
|
90
75
|
"cli",
|
|
91
76
|
"compact"
|
|
@@ -192,6 +177,6 @@
|
|
|
192
177
|
"productFeatures": {
|
|
193
178
|
"BillingNotice": false
|
|
194
179
|
},
|
|
195
|
-
"commit": "
|
|
196
|
-
"date": "2025-11-
|
|
180
|
+
"commit": "42e611b3b753dfc9338a3c7c41cfc925d1ca8809",
|
|
181
|
+
"date": "2025-11-06T10:05:22.118Z"
|
|
197
182
|
}
|
package/product.ioa.json
CHANGED
|
@@ -81,22 +81,7 @@
|
|
|
81
81
|
"name": "compact",
|
|
82
82
|
"instructions": "compact-agent-prompt",
|
|
83
83
|
"description": "compact agent",
|
|
84
|
-
"tools": [
|
|
85
|
-
"Read",
|
|
86
|
-
"Write",
|
|
87
|
-
"Edit",
|
|
88
|
-
"MultiEdit",
|
|
89
|
-
"Bash",
|
|
90
|
-
"Glob",
|
|
91
|
-
"Grep",
|
|
92
|
-
"TodoWrite",
|
|
93
|
-
"WebFetch",
|
|
94
|
-
"WebSearch",
|
|
95
|
-
"NotebookEdit",
|
|
96
|
-
"Task",
|
|
97
|
-
"SlashCommand",
|
|
98
|
-
"Skill"
|
|
99
|
-
],
|
|
84
|
+
"tools": [],
|
|
100
85
|
"tags": [
|
|
101
86
|
"cli",
|
|
102
87
|
"compact"
|
|
@@ -160,7 +145,7 @@
|
|
|
160
145
|
"supportsImages": false,
|
|
161
146
|
"disabledMultimodal": true,
|
|
162
147
|
"maxAllowedSize": 168000,
|
|
163
|
-
"supportsReasoning":
|
|
148
|
+
"supportsReasoning": false,
|
|
164
149
|
"temperature": 1
|
|
165
150
|
},
|
|
166
151
|
{
|
|
@@ -299,21 +284,23 @@
|
|
|
299
284
|
"credits": "x0.20 credits",
|
|
300
285
|
"id": "gemini-2.5-flash",
|
|
301
286
|
"name": "Gemini-2.5-Flash",
|
|
302
|
-
"maxOutputTokens":
|
|
303
|
-
"maxInputTokens":
|
|
287
|
+
"maxOutputTokens": 72000,
|
|
288
|
+
"maxInputTokens": 400000,
|
|
304
289
|
"supportsToolCall": true,
|
|
305
290
|
"supportsImages": true,
|
|
306
|
-
"
|
|
291
|
+
"supportsReasoning": false,
|
|
292
|
+
"maxAllowedSize": 400000
|
|
307
293
|
},
|
|
308
294
|
{
|
|
309
295
|
"credits": "x0.87 credits",
|
|
310
296
|
"id": "gemini-2.5-pro",
|
|
311
297
|
"name": "Gemini-2.5-Pro",
|
|
312
|
-
"maxOutputTokens":
|
|
313
|
-
"maxInputTokens":
|
|
298
|
+
"maxOutputTokens": 72000,
|
|
299
|
+
"maxInputTokens": 400000,
|
|
314
300
|
"supportsToolCall": true,
|
|
315
301
|
"supportsImages": true,
|
|
316
|
-
"
|
|
302
|
+
"supportsReasoning": false,
|
|
303
|
+
"maxAllowedSize": 400000
|
|
317
304
|
},
|
|
318
305
|
{
|
|
319
306
|
"id": "kimi-k2-gf",
|
|
@@ -333,6 +320,6 @@
|
|
|
333
320
|
"productFeatures": {
|
|
334
321
|
"BillingNotice": false
|
|
335
322
|
},
|
|
336
|
-
"commit": "
|
|
337
|
-
"date": "2025-11-
|
|
323
|
+
"commit": "42e611b3b753dfc9338a3c7c41cfc925d1ca8809",
|
|
324
|
+
"date": "2025-11-06T10:05:23.248Z"
|
|
338
325
|
}
|
package/product.json
CHANGED
|
@@ -186,22 +186,24 @@
|
|
|
186
186
|
{
|
|
187
187
|
"credits": "x0.20 credits",
|
|
188
188
|
"id": "gemini-2.5-flash",
|
|
189
|
-
"maxAllowedSize": 80000,
|
|
190
|
-
"maxOutputTokens": 64000,
|
|
191
|
-
"maxInputTokens": 200000,
|
|
192
189
|
"name": "Gemini-2.5-Flash",
|
|
190
|
+
"maxOutputTokens": 72000,
|
|
191
|
+
"maxInputTokens": 400000,
|
|
192
|
+
"supportsToolCall": true,
|
|
193
193
|
"supportsImages": true,
|
|
194
|
-
"
|
|
194
|
+
"supportsReasoning": false,
|
|
195
|
+
"maxAllowedSize": 400000
|
|
195
196
|
},
|
|
196
197
|
{
|
|
197
198
|
"credits": "x0.87 credits",
|
|
198
199
|
"id": "gemini-2.5-pro",
|
|
199
|
-
"maxAllowedSize": 80000,
|
|
200
|
-
"maxOutputTokens": 64000,
|
|
201
|
-
"maxInputTokens": 200000,
|
|
202
200
|
"name": "Gemini-2.5-Pro",
|
|
201
|
+
"maxOutputTokens": 72000,
|
|
202
|
+
"maxInputTokens": 400000,
|
|
203
|
+
"supportsToolCall": true,
|
|
203
204
|
"supportsImages": true,
|
|
204
|
-
"
|
|
205
|
+
"supportsReasoning": false,
|
|
206
|
+
"maxAllowedSize": 400000
|
|
205
207
|
},
|
|
206
208
|
{
|
|
207
209
|
"credits": "x0.37 credits",
|
|
@@ -479,22 +481,7 @@
|
|
|
479
481
|
"name": "compact",
|
|
480
482
|
"instructions": "compact-agent-prompt",
|
|
481
483
|
"description": "compact agent",
|
|
482
|
-
"tools": [
|
|
483
|
-
"Read",
|
|
484
|
-
"Write",
|
|
485
|
-
"Edit",
|
|
486
|
-
"MultiEdit",
|
|
487
|
-
"Bash",
|
|
488
|
-
"Glob",
|
|
489
|
-
"Grep",
|
|
490
|
-
"TodoWrite",
|
|
491
|
-
"WebFetch",
|
|
492
|
-
"WebSearch",
|
|
493
|
-
"NotebookEdit",
|
|
494
|
-
"Task",
|
|
495
|
-
"SlashCommand",
|
|
496
|
-
"Skill"
|
|
497
|
-
],
|
|
484
|
+
"tools": [],
|
|
498
485
|
"tags": [
|
|
499
486
|
"cli",
|
|
500
487
|
"compact"
|
|
@@ -692,6 +679,6 @@
|
|
|
692
679
|
"description": "tool-skill-description"
|
|
693
680
|
}
|
|
694
681
|
],
|
|
695
|
-
"commit": "
|
|
696
|
-
"date": "2025-11-
|
|
682
|
+
"commit": "42e611b3b753dfc9338a3c7c41cfc925d1ca8809",
|
|
683
|
+
"date": "2025-11-06T10:05:20.987Z"
|
|
697
684
|
}
|
package/product.selfhosted.json
CHANGED
|
@@ -69,22 +69,7 @@
|
|
|
69
69
|
"name": "compact",
|
|
70
70
|
"instructions": "compact-agent-prompt",
|
|
71
71
|
"description": "compact agent",
|
|
72
|
-
"tools": [
|
|
73
|
-
"Read",
|
|
74
|
-
"Write",
|
|
75
|
-
"Edit",
|
|
76
|
-
"MultiEdit",
|
|
77
|
-
"Bash",
|
|
78
|
-
"Glob",
|
|
79
|
-
"Grep",
|
|
80
|
-
"TodoWrite",
|
|
81
|
-
"WebFetch",
|
|
82
|
-
"WebSearch",
|
|
83
|
-
"NotebookEdit",
|
|
84
|
-
"Task",
|
|
85
|
-
"SlashCommand",
|
|
86
|
-
"Skill"
|
|
87
|
-
],
|
|
72
|
+
"tools": [],
|
|
88
73
|
"tags": [
|
|
89
74
|
"cli",
|
|
90
75
|
"compact"
|
|
@@ -145,6 +130,6 @@
|
|
|
145
130
|
"productFeatures": {
|
|
146
131
|
"BillingNotice": false
|
|
147
132
|
},
|
|
148
|
-
"commit": "
|
|
149
|
-
"date": "2025-11-
|
|
133
|
+
"commit": "42e611b3b753dfc9338a3c7c41cfc925d1ca8809",
|
|
134
|
+
"date": "2025-11-06T10:05:25.525Z"
|
|
150
135
|
}
|
package/dist/338.codebuddy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.id=338,exports.ids=[338],exports.modules={81338:(t,e,i)=>{i.r(e),i.d(e,{Header:()=>Header,Pack:()=>Pack,PackJob:()=>PackJob,PackSync:()=>PackSync,Parser:()=>Parser,Pax:()=>Pax,ReadEntry:()=>ReadEntry,Unpack:()=>Unpack,UnpackSync:()=>UnpackSync,WriteEntry:()=>WriteEntry,WriteEntrySync:()=>WriteEntrySync,WriteEntryTar:()=>WriteEntryTar,c:()=>Oe,create:()=>Oe,extract:()=>Ei,filesFilter:()=>filesFilter,list:()=>xt,r:()=>wi,replace:()=>wi,t:()=>xt,types:()=>s,u:()=>gi,update:()=>gi,x:()=>Ei});var s={};i.r(s),i.d(s,{code:()=>J,isCode:()=>isCode,isName:()=>isName,name:()=>X});var r=i(24434),n=i(79896),h=i(26022);const o=n.writev,a=Symbol("_autoClose"),l=Symbol("_close"),c=Symbol("_ended"),d=Symbol("_fd"),u=Symbol("_finished"),m=Symbol("_flags"),p=Symbol("_flush"),f=Symbol("_handleChunk"),y=Symbol("_makeBuf"),b=Symbol("_mode"),E=Symbol("_needDrain"),w=Symbol("_onerror"),g=Symbol("_onopen"),R=Symbol("_onread"),_=Symbol("_onwrite"),S=Symbol("_open"),v=Symbol("_path"),O=Symbol("_pos"),k=Symbol("_queue"),T=Symbol("_read"),L=Symbol("_readSize"),N=Symbol("_reading"),A=Symbol("_remain"),D=Symbol("_size"),I=Symbol("_write"),x=Symbol("_writing"),F=Symbol("_defaultFlag"),P=Symbol("_errored");class ReadStream extends h.n_{[P]=!1;[d];[v];[L];[N]=!1;[D];[A];[a];constructor(t,e){if(super(e=e||{}),this.readable=!0,this.writable=!1,"string"!=typeof t)throw new TypeError("path must be a string");this[P]=!1,this[d]="number"==typeof e.fd?e.fd:void 0,this[v]=t,this[L]=e.readSize||16777216,this[N]=!1,this[D]="number"==typeof e.size?e.size:1/0,this[A]=this[D],this[a]="boolean"!=typeof e.autoClose||e.autoClose,"number"==typeof this[d]?this[T]():this[S]()}get fd(){return this[d]}get path(){return this[v]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[S](){n.open(this[v],"r",((t,e)=>this[g](t,e)))}[g](t,e){t?this[w](t):(this[d]=e,this.emit("open",e),this[T]())}[y](){return Buffer.allocUnsafe(Math.min(this[L],this[A]))}[T](){if(!this[N]){this[N]=!0;const t=this[y]();if(0===t.length)return process.nextTick((()=>this[R](null,0,t)));n.read(this[d],t,0,t.length,null,((t,e,i)=>this[R](t,e,i)))}}[R](t,e,i){this[N]=!1,t?this[w](t):this[f](e,i)&&this[T]()}[l](){if(this[a]&&"number"==typeof this[d]){const t=this[d];this[d]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[w](t){this[N]=!0,this[l](),this.emit("error",t)}[f](t,e){let i=!1;return this[A]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(0===t||this[A]<=0)&&(i=!1,this[l](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return"number"==typeof this[d]&&this[T](),!1;case"error":return!this[P]&&(this[P]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}}class ReadStreamSync extends ReadStream{[S](){let t=!0;try{this[g](null,n.openSync(this[v],"r")),t=!1}finally{t&&this[l]()}}[T](){let t=!0;try{if(!this[N]){for(this[N]=!0;;){const t=this[y](),e=0===t.length?0:n.readSync(this[d],t,0,t.length,null);if(!this[f](e,t))break}this[N]=!1}t=!1}finally{t&&this[l]()}}[l](){if(this[a]&&"number"==typeof this[d]){const t=this[d];this[d]=void 0,n.closeSync(t),this.emit("close")}}}class WriteStream extends r{readable=!1;writable=!0;[P]=!1;[x]=!1;[c]=!1;[k]=[];[E]=!1;[v];[b];[a];[d];[F];[m];[u]=!1;[O];constructor(t,e){super(e=e||{}),this[v]=t,this[d]="number"==typeof e.fd?e.fd:void 0,this[b]=void 0===e.mode?438:e.mode,this[O]="number"==typeof e.start?e.start:void 0,this[a]="boolean"!=typeof e.autoClose||e.autoClose;const i=void 0!==this[O]?"r+":"w";this[F]=void 0===e.flags,this[m]=void 0===e.flags?i:e.flags,void 0===this[d]&&this[S]()}emit(t,...e){if("error"===t){if(this[P])return!1;this[P]=!0}return super.emit(t,...e)}get fd(){return this[d]}get path(){return this[v]}[w](t){this[l](),this[x]=!0,this.emit("error",t)}[S](){n.open(this[v],this[m],this[b],((t,e)=>this[g](t,e)))}[g](t,e){this[F]&&"r+"===this[m]&&t&&"ENOENT"===t.code?(this[m]="w",this[S]()):t?this[w](t):(this[d]=e,this.emit("open",e),this[x]||this[p]())}end(t,e){return t&&this.write(t,e),this[c]=!0,this[x]||this[k].length||"number"!=typeof this[d]||this[_](null,0),this}write(t,e){return"string"==typeof t&&(t=Buffer.from(t,e)),this[c]?(this.emit("error",new Error("write() after end()")),!1):void 0===this[d]||this[x]||this[k].length?(this[k].push(t),this[E]=!0,!1):(this[x]=!0,this[I](t),!0)}[I](t){n.write(this[d],t,0,t.length,this[O],((t,e)=>this[_](t,e)))}[_](t,e){t?this[w](t):(void 0!==this[O]&&"number"==typeof e&&(this[O]+=e),this[k].length?this[p]():(this[x]=!1,this[c]&&!this[u]?(this[u]=!0,this[l](),this.emit("finish")):this[E]&&(this[E]=!1,this.emit("drain"))))}[p](){if(0===this[k].length)this[c]&&this[_](null,0);else if(1===this[k].length)this[I](this[k].pop());else{const t=this[k];this[k]=[],o(this[d],t,this[O],((t,e)=>this[_](t,e)))}}[l](){if(this[a]&&"number"==typeof this[d]){const t=this[d];this[d]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[S](){let t;if(this[F]&&"r+"===this[m])try{t=n.openSync(this[v],this[m],this[b])}catch(t){if("ENOENT"===t?.code)return this[m]="w",this[S]();throw t}else t=n.openSync(this[v],this[m],this[b]);this[g](null,t)}[l](){if(this[a]&&"number"==typeof this[d]){const t=this[d];this[d]=void 0,n.closeSync(t),this.emit("close")}}[I](t){let e=!0;try{this[_](null,n.writeSync(this[d],t,0,t.length,this[O])),e=!1}finally{if(e)try{this[l]()}catch{}}}}var C=i(76760),B=i(73024),M=i(16928);const z=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),dealiasKey=t=>{const e=z.get(t);return e||t},dealias=(t={})=>{if(!t)return{};const e={};for(const[i,s]of Object.entries(t)){e[dealiasKey(i)]=s}return void 0===e.chmod&&!1===e.noChmod&&(e.chmod=!0),delete e.noChmod,e},makeCommand=(t,e,i,s,r)=>Object.assign(((n=[],h,o)=>{Array.isArray(n)&&(h=n,n={}),"function"==typeof h&&(o=h,h=void 0),h=h?Array.from(h):[];const a=dealias(n);if(r?.(a,h),(l=a).sync&&l.file){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return t(a,h)}if((t=>!t.sync&&!!t.file)(a)){const t=e(a,h),i=o||void 0;return i?t.then((()=>i()),i):t}if((t=>!!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return i(a,h)}if((t=>!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback only supported with file option");return s(a,h)}throw new Error("impossible options??");var l}),{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r});var U=i(42613),H=i(20181),W=i(43106),Z=i.t(W,2);const j=W.constants||{ZLIB_VERNUM:4736},G=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},j)),Y=H.Buffer.concat,V=Object.getOwnPropertyDescriptor(H.Buffer,"concat"),noop=t=>t,$=!0===V?.writable||void 0!==V?.set?t=>{H.Buffer.concat=t?noop:Y}:t=>{},K=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const q=Symbol("flushFlag");class ZlibBase extends h.n_{#t=!1;#e=!1;#i;#s;#r;#n;#h;get sawError(){return this.#t}get handle(){return this.#n}get flushFlag(){return this.#i}constructor(t,e){if(!t||"object"!=typeof t)throw new TypeError("invalid options for ZlibBase constructor");super(t),this.#i=t.flush??0,this.#s=t.finishFlush??0,this.#r=t.fullFlushFlag??0;try{this.#n=new Z[e](t)}catch(t){throw new ZlibError(t)}this.#h=t=>{this.#t||(this.#t=!0,this.close(),this.emit("error",t))},this.#n?.on("error",(t=>this.#h(new ZlibError(t)))),this.once("end",(()=>this.close))}close(){this.#n&&(this.#n.close(),this.#n=void 0,this.emit("close"))}reset(){if(!this.#t)return U(this.#n,"zlib binding closed"),this.#n.reset?.()}flush(t){this.ended||("number"!=typeof t&&(t=this.#r),this.write(Object.assign(H.Buffer.alloc(0),{[q]:t})))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#s),this.#e=!0,super.end(i)}get ended(){return this.#e}[K](t){return super.write(t)}write(t,e,i){if("function"==typeof e&&(i=e,e="utf8"),"string"==typeof t&&(t=H.Buffer.from(t,e)),this.#t)return;U(this.#n,"zlib binding closed");const s=this.#n._handle,r=s.close;s.close=()=>{};const n=this.#n.close;let h,o;this.#n.close=()=>{},$(!0);try{const e="number"==typeof t[q]?t[q]:this.#i;h=this.#n._processChunk(t,e),$(!1)}catch(t){$(!1),this.#h(new ZlibError(t))}finally{this.#n&&(this.#n._handle=s,s.close=r,this.#n.close=n,this.#n.removeAllListeners("error"))}if(this.#n&&this.#n.on("error",(t=>this.#h(new ZlibError(t)))),h)if(Array.isArray(h)&&h.length>0){const t=h[0];o=this[K](H.Buffer.from(t));for(let t=1;t<h.length;t++)o=this[K](h[t])}else o=this[K](H.Buffer.from(h));return i&&i(),o}}class Zlib extends ZlibBase{#o;#a;constructor(t,e){(t=t||{}).flush=t.flush||G.Z_NO_FLUSH,t.finishFlush=t.finishFlush||G.Z_FINISH,t.fullFlushFlag=G.Z_FULL_FLUSH,super(t,e),this.#o=t.level,this.#a=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#o!==t||this.#a!==e){this.flush(G.Z_SYNC_FLUSH),U(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,e)=>{"function"==typeof t&&(e=t,t=this.flushFlag),this.flush(t),e?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#o=t,this.#a=e)}}}}class Gzip extends Zlib{#l;constructor(t){super(t,"Gzip"),this.#l=t&&!!t.portable}[K](t){return this.#l?(this.#l=!1,t[9]=255,super[K](t)):super[K](t)}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,e){(t=t||{}).flush=t.flush||G.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||G.BROTLI_OPERATION_FINISH,t.fullFlushFlag=G.BROTLI_OPERATION_FLUSH,super(t,e)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");const e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);const e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);const e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e<i;e++)push(this,t[e]);return this.length}unshift(...t){for(var e=0,i=t.length;e<i;e++)unshift(this,t[e]);return this.length}pop(){if(!this.tail)return;const t=this.tail.value,e=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,e.list=void 0,this.length--,t}shift(){if(!this.head)return;const t=this.head.value,e=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,e.list=void 0,this.length--,t}forEach(t,e){e=e||this;for(let i=this.head,s=0;i;s++)t.call(e,i.value,s,this),i=i.next}forEachReverse(t,e){e=e||this;for(let i=this.tail,s=this.length-1;i;s--)t.call(e,i.value,s,this),i=i.prev}get(t){let e=0,i=this.head;for(;i&&e<t;e++)i=i.next;if(e===t&&i)return i.value}getReverse(t){let e=0,i=this.tail;for(;i&&e<t;e++)i=i.prev;if(e===t&&i)return i.value}map(t,e){e=e||this;const i=new Yallist;for(let s=this.head;s;)i.push(t.call(e,s.value,this)),s=s.next;return i}mapReverse(t,e){e=e||this;var i=new Yallist;for(let s=this.tail;s;)i.push(t.call(e,s.value,this)),s=s.prev;return i}reduce(t,e){let i,s=this.head;if(arguments.length>1)i=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");s=this.head.next,i=this.head.value}for(var r=0;s;r++)i=t(i,s.value,r),s=s.next;return i}reduceReverse(t,e){let i,s=this.tail;if(arguments.length>1)i=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");s=this.tail.prev,i=this.tail.value}for(let e=this.length-1;s;e--)i=t(i,s.value,e),s=s.prev;return i}toArray(){const t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){const t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.head,r=0;for(r=0;s&&r<t;r++)s=s.next;for(;s&&r<e;r++,s=s.next)i.push(s.value);return i}sliceReverse(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.length,r=this.tail;for(;r&&s>e;s--)r=r.prev;for(;r&&s>t;s--,r=r.prev)i.push(r.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let s=this.head;for(let e=0;s&&e<t;e++)s=s.next;const r=[];for(let t=0;s&&t<e;t++)r.push(s.value),s=this.removeNode(s);s?s!==this.tail&&(s=s.prev):s=this.tail;for(const t of i)s=insertAfter(this,s,t);return r}reverse(){const t=this.head,e=this.tail;for(let e=t;e;e=e.prev){const t=e.prev;e.prev=e.next,e.next=t}return this.head=e,this.tail=t,this}}function insertAfter(t,e,i){const s=e,r=e?e.next:t.head,n=new Node(i,s,r,t);return void 0===n.next&&(t.tail=n),void 0===n.prev&&(t.head=n),t.length++,n}function push(t,e){t.tail=new Node(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function unshift(t,e){t.head=new Node(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}class Node{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}}const encodePositive=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=255&t,t=Math.floor(t/256)},encodeNegative=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=255&t;t=Math.floor(t/256),i?e[s-1]=onesComp(r):0===r?e[s-1]=0:(i=!0,e[s-1]=twosComp(r))}},twos=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var n,h=Number(t[r]);s?n=onesComp(h):0===h?n=h:(s=!0,n=twosComp(h)),0!==n&&(i-=n*Math.pow(256,e-r-1))}return i},pos=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);0!==r&&(i+=r*Math.pow(256,e-s-1))}return i},onesComp=t=>255&(255^t),twosComp=t=>1+(255^t)&255,isCode=t=>X.has(t),isName=t=>J.has(t),X=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),J=new Map(Array.from(X).map((t=>[t[1],t[0]])));class Header{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#c="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#d(t)}decode(t,e,i,s){if(e||(e=0),!(t&&t.length>=e+512))throw new Error("need 512 bytes for header");this.path=decString(t,e,100),this.mode=decNumber(t,e+100,8),this.uid=decNumber(t,e+108,8),this.gid=decNumber(t,e+116,8),this.size=decNumber(t,e+124,12),this.mtime=decDate(t,e+136,12),this.cksum=decNumber(t,e+148,12),s&&this.#d(s,!0),i&&this.#d(i);const r=decString(t,e+156,1);if(isCode(r)&&(this.#c=r||"0"),"0"===this.#c&&"/"===this.path.slice(-1)&&(this.#c="5"),"5"===this.#c&&(this.size=0),this.linkpath=decString(t,e+157,100),"ustar\x0000"===t.subarray(e+257,e+265).toString())if(this.uname=decString(t,e+265,32),this.gname=decString(t,e+297,32),this.devmaj=decNumber(t,e+329,8)??0,this.devmin=decNumber(t,e+337,8)??0,0!==t[e+475]){const i=decString(t,e+345,155);this.path=i+"/"+this.path}else{const i=decString(t,e+345,130);i&&(this.path=i+"/"+this.path),this.atime=decDate(t,e+476,12),this.ctime=decDate(t,e+488,12)}let n=256;for(let i=e;i<e+148;i++)n+=t[i];for(let i=e+156;i<e+512;i++)n+=t[i];this.cksumValid=n===this.cksum,void 0===this.cksum&&256===n&&(this.nullBlock=!0)}#d(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e||"linkpath"===t&&e||"global"===t)))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),"Unsupported"===this.#c&&(this.#c="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");const i=this.ctime||this.atime?130:155,s=splitPrefix(this.path||"",i),r=s[0],n=s[1];this.needPax=!!s[2],this.needPax=encString(t,e,100,r)||this.needPax,this.needPax=encNumber(t,e+100,8,this.mode)||this.needPax,this.needPax=encNumber(t,e+108,8,this.uid)||this.needPax,this.needPax=encNumber(t,e+116,8,this.gid)||this.needPax,this.needPax=encNumber(t,e+124,12,this.size)||this.needPax,this.needPax=encDate(t,e+136,12,this.mtime)||this.needPax,t[e+156]=this.#c.charCodeAt(0),this.needPax=encString(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=encString(t,e+265,32,this.uname)||this.needPax,this.needPax=encString(t,e+297,32,this.gname)||this.needPax,this.needPax=encNumber(t,e+329,8,this.devmaj)||this.needPax,this.needPax=encNumber(t,e+337,8,this.devmin)||this.needPax,this.needPax=encString(t,e+345,i,n)||this.needPax,0!==t[e+475]?this.needPax=encString(t,e+345,155,n)||this.needPax:(this.needPax=encString(t,e+345,130,n)||this.needPax,this.needPax=encDate(t,e+476,12,this.atime)||this.needPax,this.needPax=encDate(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let i=e;i<e+148;i++)h+=t[i];for(let i=e+156;i<e+512;i++)h+=t[i];return this.cksum=h,encNumber(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return"Unsupported"===this.#c?this.#c:X.get(this.#c)}get typeKey(){return this.#c}set type(t){const e=String(J.get(t));if(isCode(e)||"Unsupported"===e)this.#c=e;else{if(!isCode(t))throw new TypeError("invalid entry type: "+t);this.#c=t}}}const splitPrefix=(t,e)=>{const i=100;let s,r=t,n="";const h=C.posix.parse(t).root||".";if(Buffer.byteLength(r)<i)s=[r,n,!1];else{n=C.posix.dirname(r),r=C.posix.basename(r);do{Buffer.byteLength(r)<=i&&Buffer.byteLength(n)<=e?s=[r,n,!1]:Buffer.byteLength(r)>i&&Buffer.byteLength(n)<=e?s=[r.slice(0,99),n,!0]:(r=C.posix.join(C.posix.basename(n),r),n=C.posix.dirname(n))}while(n!==h&&void 0===s);s||(s=[t.slice(0,99),"",!0])}return s},decString=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),decDate=(t,e,i)=>numToDate(decNumber(t,e,i)),numToDate=t=>void 0===t?void 0:new Date(1e3*t),decNumber=(t,e,i)=>128&Number(t[e])?(t=>{const e=t[0],i=128===e?pos(t.subarray(1,t.length)):255===e?twos(t):null;if(null===i)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i})(t.subarray(e,e+i)):decSmallNumber(t,e,i),decSmallNumber=(t,e,i)=>{return s=parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8),isNaN(s)?void 0:s;var s},Q={12:8589934591,8:2097151},encNumber=(t,e,i,s)=>void 0!==s&&(s>Q[i]||s<0?(((t,e)=>{if(!Number.isSafeInteger(t))throw Error("cannot encode number outside of javascript safe integer range");t<0?encodeNegative(t,e):encodePositive(t,e)})(s,t.subarray(e,e+i)),!0):(encSmallNumber(t,e,i,s),!1)),encSmallNumber=(t,e,i,s)=>t.write(octalString(s,i),e,i,"ascii"),octalString=(t,e)=>padOctal(Math.floor(t).toString(8),e),padOctal=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",encDate=(t,e,i,s)=>void 0!==s&&encNumber(t,e,i,s.getTime()/1e3),tt=new Array(156).join("\0"),encString=(t,e,i,s)=>void 0!==s&&(t.write(s+tt,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){const t=this.encodeBody();if(""===t)return Buffer.allocUnsafe(0);const e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),s=Buffer.allocUnsafe(i);for(let t=0;t<512;t++)s[t]=0;new Header({path:("PaxHeader/"+(0,C.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(s),s.write(t,512,e,"utf8");for(let t=e+512;t<s.length;t++)s[t]=0;return s}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(void 0===this[t])return"";const e=this[t],i=" "+("dev"===t||"ino"===t||"nlink"===t?"SCHILY.":"")+t+"="+(e instanceof Date?e.getTime()/1e3:e)+"\n",s=Buffer.byteLength(i);let r=Math.floor(Math.log(s)/Math.log(10))+1;s+r>=Math.pow(10,r)&&(r+=1);return r+s+i}static parse(t,e,i=!1){return new Pax(merge(parseKV(t),e),i)}}const merge=(t,e)=>e?Object.assign({},e,t):t,parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null)),parseKVLine=(t,e)=>{const i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;const s=(e=e.slice((i+" ").length)).split("="),r=s.shift();if(!r)return t;const n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),h=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(1e3*Number(h)):/^[0-9]+$/.test(h)?+h:h,t},et="win32"!==(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends h.n_{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=et(t.path),this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?et(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#d(e),i&&this.#d(i,!0)}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");const i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),!!this.ignore||(i>=e?super.write(t):super.write(t.subarray(0,i)))}#d(t,e=!1){t.path&&(t.path=et(t.path)),t.linkpath&&(t.linkpath=et(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e)))))}}const warnMethod=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,t.strict||!1===s.recoverable?i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),s)):(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s))},it=Buffer.from([31,139]),st=Symbol("state"),rt=Symbol("writeEntry"),nt=Symbol("readEntry"),ht=Symbol("nextEntry"),ot=Symbol("processEntry"),at=Symbol("extendedHeader"),lt=Symbol("globalExtendedHeader"),ct=Symbol("meta"),dt=Symbol("emitMeta"),ut=Symbol("buffer"),mt=Symbol("queue"),pt=Symbol("ended"),ft=Symbol("emittedEnd"),yt=Symbol("emit"),bt=Symbol("unzip"),Et=Symbol("consumeChunk"),wt=Symbol("consumeChunkSub"),gt=Symbol("consumeBody"),Rt=Symbol("consumeMeta"),_t=Symbol("consumeHeader"),St=Symbol("consuming"),vt=Symbol("bufferConcat"),Ot=Symbol("maybeEnd"),kt=Symbol("writing"),Tt=Symbol("aborted"),Lt=Symbol("onDone"),Nt=Symbol("sawValidEntry"),At=Symbol("sawNullBlock"),Dt=Symbol("sawEOF"),It=Symbol("closeStream"),parse_noop=()=>!0;class Parser extends r.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[mt]=new Yallist;[ut];[nt];[rt];[st]="begin";[ct]="";[at];[lt];[pt]=!1;[bt];[Tt]=!1;[Nt];[At]=!1;[Dt]=!1;[kt]=!1;[St]=!1;[ft]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(Lt,(()=>{"begin"!==this[st]&&!1!==this[Nt]||this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")})),t.ondone?this.on(Lt,t.ondone):this.on(Lt,(()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")})),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:parse_noop;const e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=t.gzip||void 0===t.brotli?!!e&&void 0:t.brotli,this.on("end",(()=>this[It]())),"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onReadEntry&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){warnMethod(this,t,e,i)}[_t](t,e){let i;void 0===this[Nt]&&(this[Nt]=!1);try{i=new Header(t,e,this[at],this[lt])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock)this[At]?(this[Dt]=!0,"begin"===this[st]&&(this[st]="header"),this[yt]("eof")):(this[At]=!0,this[yt]("nullBlock"));else if(this[At]=!1,i.cksumValid)if(i.path){const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(/^(Symbolic)?Link$/.test(t)||/^(Global)?ExtendedHeader$/.test(t)||!i.linkpath){const t=this[rt]=new ReadEntry(i,this[at],this[lt]);if(!this[Nt])if(t.remain){const onend=()=>{t.invalid||(this[Nt]=!0)};t.on("end",onend)}else this[Nt]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[yt]("ignoredEntry",t),this[st]="ignore",t.resume()):t.size>0&&(this[ct]="",t.on("data",(t=>this[ct]+=t)),this[st]="meta"):(this[at]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[yt]("ignoredEntry",t),this[st]=t.remain?"ignore":"header",t.resume()):(t.remain?this[st]="body":(this[st]="header",t.end()),this[nt]?this[mt].push(t):(this[mt].push(t),this[ht]())))}else this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}[It](){queueMicrotask((()=>this.emit("close")))}[ot](t){let e=!0;if(t)if(Array.isArray(t)){const[e,...i]=t;this.emit(e,...i)}else this[nt]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",(()=>this[ht]())),e=!1);else this[nt]=void 0,e=!1;return e}[ht](){do{}while(this[ot](this[mt].shift()));if(!this[mt].length){const t=this[nt];!t||t.flowing||t.size===t.remain?this[kt]||this.emit("drain"):t.once("drain",(()=>this.emit("drain")))}}[gt](t,e){const i=this[rt];if(!i)throw new Error("attempt to consume body without entry??");const s=i.blockRemain??0,r=s>=t.length&&0===e?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[st]="header",this[rt]=void 0,i.end()),r.length}[Rt](t,e){const i=this[rt],s=this[gt](t,e);return!this[rt]&&i&&this[dt](i),s}[yt](t,e,i){this[mt].length||this[nt]?this[mt].push([t,e,i]):this.emit(t,e,i)}[dt](t){switch(this[yt]("meta",this[ct]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[at]=Pax.parse(this[ct],this[at],!1);break;case"GlobalExtendedHeader":this[lt]=Pax.parse(this[ct],this[lt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[at]??Object.create(null);this[at]=t,t.path=this[ct].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[at]||Object.create(null);this[at]=t,t.linkpath=this[ct].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[Tt]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this[Tt])return i?.(),!1;if((void 0===this[bt]||void 0===this.brotli&&!1===this[bt])&&t){if(this[ut]&&(t=Buffer.concat([this[ut],t]),this[ut]=void 0),t.length<it.length)return this[ut]=t,i?.(),!0;for(let e=0;void 0===this[bt]&&e<it.length;e++)t[e]!==it[e]&&(this[bt]=!1);const e=void 0===this.brotli;if(!1===this[bt]&&e)if(t.length<512){if(!this[pt])return this[ut]=t,i?.(),!0;this.brotli=!0}else try{new Header(t.subarray(0,512)),this.brotli=!1}catch(t){this.brotli=!0}if(void 0===this[bt]||!1===this[bt]&&this.brotli){const e=this[pt];this[pt]=!1,this[bt]=void 0===this[bt]?new Unzip({}):new BrotliDecompress({}),this[bt].on("data",(t=>this[Et](t))),this[bt].on("error",(t=>this.abort(t))),this[bt].on("end",(()=>{this[pt]=!0,this[Et]()})),this[kt]=!0;const s=!!this[bt][e?"end":"write"](t);return this[kt]=!1,i?.(),s}}this[kt]=!0,this[bt]?this[bt].write(t):this[Et](t),this[kt]=!1;const s=!this[mt].length&&(!this[nt]||this[nt].flowing);return s||this[mt].length||this[nt]?.once("drain",(()=>this.emit("drain"))),i?.(),s}[vt](t){t&&!this[Tt]&&(this[ut]=this[ut]?Buffer.concat([this[ut],t]):t)}[Ot](){if(this[pt]&&!this[ft]&&!this[Tt]&&!this[St]){this[ft]=!0;const t=this[rt];if(t&&t.blockRemain){const e=this[ut]?this[ut].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[ut]&&t.write(this[ut]),t.end()}this[yt](Lt)}}[Et](t){if(this[St]&&t)this[vt](t);else if(t||this[ut]){if(t){if(this[St]=!0,this[ut]){this[vt](t);const e=this[ut];this[ut]=void 0,this[wt](e)}else this[wt](t);for(;this[ut]&&this[ut]?.length>=512&&!this[Tt]&&!this[Dt];){const t=this[ut];this[ut]=void 0,this[wt](t)}this[St]=!1}}else this[Ot]();this[ut]&&!this[pt]||this[Ot]()}[wt](t){let e=0;const i=t.length;for(;e+512<=i&&!this[Tt]&&!this[Dt];)switch(this[st]){case"begin":case"header":this[_t](t,e),e+=512;break;case"ignore":case"body":e+=this[gt](t,e);break;case"meta":e+=this[Rt](t,e);break;default:throw new Error("invalid state: "+this[st])}e<i&&(this[ut]?this[ut]=Buffer.concat([t.subarray(e),this[ut]]):this[ut]=t.subarray(e))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[Tt]||(this[bt]?(t&&this[bt].write(t),this[bt].end()):(this[pt]=!0,void 0===this.brotli&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[Ot]())),this}}const stripTrailingSlashes=t=>{let e=t.length-1,i=-1;for(;e>-1&&"/"===t.charAt(e);)i=e,e--;return-1===i?t:t.slice(0,i)},filesFilter=(t,e)=>{const i=new Map(e.map((t=>[stripTrailingSlashes(t),!0]))),s=t.filter,mapHas=(t,e="")=>{const s=e||(0,M.parse)(t).root||".";let r;if(t===s)r=!1;else{const e=i.get(t);r=void 0!==e?e:mapHas((0,M.dirname)(t),s)}return i.set(t,r),r};t.filter=s?(t,e)=>s(t,e)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))},xt=makeCommand((t=>{const e=new Parser(t),i=t.file;let s;try{const r=B.statSync(i),n=t.maxReadSize||16777216;if(r.size<n)e.end(B.readFileSync(i));else{let t=0;const h=Buffer.allocUnsafe(n);for(s=B.openSync(i,"r");t<r.size;){const i=B.readSync(s,h,0,n,t);t+=i,e.write(h.subarray(0,i))}e.end()}}finally{if("number"==typeof s)try{B.closeSync(s)}catch(t){}}}),((t,e)=>{const i=new Parser(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("end",t),B.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new Parser(t)),(t=>new Parser(t)),((t,e)=>{e?.length&&filesFilter(t,e),t.noResume||(t=>{const e=t.onReadEntry;t.onReadEntry=e?t=>{e(t),t.resume()}:t=>t.resume()})(t)})),modeFix=(t,e,i)=>(t&=4095,i&&(t=-19&t|384),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t),{isAbsolute:Ft,parse:Pt}=C.win32,stripAbsolutePath=t=>{let e="",i=Pt(t);for(;Ft(t)||i.root;){const s="/"===t.charAt(0)&&"//?/"!==t.slice(0,4)?"/":i.root;t=t.slice(s.length),e+=s,i=Pt(t)}return[e,t]},Ct=["|","<",">","?",":"],Bt=Ct.map((t=>String.fromCharCode(61440+t.charCodeAt(0)))),Mt=new Map(Ct.map(((t,e)=>[t,Bt[e]]))),zt=new Map(Bt.map(((t,e)=>[t,Ct[e]]))),winchars_encode=t=>Ct.reduce(((t,e)=>t.split(e).join(Mt.get(e))),t),prefixPath=(t,e)=>e?(t=et(t).replace(/^\.(\/|$)/,""),stripTrailingSlashes(e)+"/"+t):et(t),Ut=Symbol("process"),Ht=Symbol("file"),Wt=Symbol("directory"),Zt=Symbol("symlink"),jt=Symbol("hardlink"),Gt=Symbol("header"),Yt=Symbol("read"),Vt=Symbol("lstat"),$t=Symbol("onlstat"),Kt=Symbol("onread"),qt=Symbol("onreadlink"),Xt=Symbol("openfile"),Jt=Symbol("onopenfile"),Qt=Symbol("close"),te=Symbol("mode"),ee=Symbol("awaitDrain"),ie=Symbol("ondrain"),se=Symbol("prefix");class WriteEntry extends h.n_{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#u=!1;constructor(t,e={}){const i=dealias(e);super(),this.path=et(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||16777216,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=et(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?et(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,s=t)}var r;this.win32=!!i.win32||"win32"===process.platform,this.win32&&(this.path=(r=this.path.replace(/\\/g,"/"),Bt.reduce(((t,e)=>t.split(e).join(zt.get(e))),r)),t=t.replace(/\\/g,"/")),this.absolute=et(i.absolute||M.resolve(this.cwd,t)),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});const n=this.statCache.get(this.absolute);n?this[$t](n):this[Vt]()}warn(t,e,i={}){return warnMethod(this,t,e,i)}emit(t,...e){return"error"===t&&(this.#u=!0),super.emit(t,...e)}[Vt](){n.lstat(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[$t](e)}))}[$t](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=getType(t),this.emit("stat",t),this[Ut]()}[Ut](){switch(this.type){case"File":return this[Ht]();case"Directory":return this[Wt]();case"SymbolicLink":return this[Zt]();default:return this.end()}}[te](t){return modeFix(t,"Directory"===this.type,this.portable)}[se](t){return prefixPath(t,this.prefix)}[Gt](){if(!this.stat)throw new Error("cannot write header before stat");"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Header({path:this[se](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[se](this.linkpath):this.linkpath,mode:this[te](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:"Unsupported"===this.type?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Pax({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[se](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[se](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());const t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[Wt](){if(!this.stat)throw new Error("cannot create directory entry without stat");"/"!==this.path.slice(-1)&&(this.path+="/"),this.stat.size=0,this[Gt](),this.end()}[Zt](){n.readlink(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[qt](e)}))}[qt](t){this.linkpath=et(t),this[Gt](),this.end()}[jt](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=et(M.relative(this.cwd,t)),this.stat.size=0,this[Gt](),this.end()}[Ht](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(0===e?.indexOf(this.cwd))return this[jt](e);this.linkCache.set(t,this.absolute)}if(this[Gt](),0===this.stat.size)return this.end();this[Xt]()}[Xt](){n.open(this.absolute,"r",((t,e)=>{if(t)return this.emit("error",t);this[Jt](e)}))}[Jt](t){if(this.fd=t,this.#u)return this[Qt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Yt]()}[Yt](){const{fd:t,buf:e,offset:i,length:s,pos:r}=this;if(void 0===t||void 0===e)throw new Error("cannot read file without first opening");n.read(t,e,i,s,r,((t,e)=>{if(t)return this[Qt]((()=>this.emit("error",t)));this[Kt](e)}))}[Qt](t=()=>{}){void 0!==this.fd&&n.close(this.fd,t)}[Kt](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Qt]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Qt]((()=>this.emit("error",t)))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let e=t;e<this.length&&t<this.blockRemain;e++)this.buf[e+this.offset]=0,t++,this.remain++;const e=0===this.offset&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[ie]():this[ee]((()=>this[ie]()))}[ee](t){this.once("drain",t)}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[ie](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Qt]((t=>t?this.emit("error",t):this.end()));if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Yt]()}}class WriteEntrySync extends WriteEntry{sync=!0;[Vt](){this[$t](n.lstatSync(this.absolute))}[Zt](){this[qt](n.readlinkSync(this.absolute))}[Xt](){this[Jt](n.openSync(this.absolute,"r"))}[Yt](){let t=!0;try{const{fd:e,buf:i,offset:s,length:r,pos:h}=this;if(void 0===e||void 0===i)throw new Error("fd and buf must be set in READ method");const o=n.readSync(e,i,s,r,h);this[Kt](o),t=!1}finally{if(t)try{this[Qt]((()=>{}))}catch(t){}}}[ee](t){t()}[Qt](t=()=>{}){void 0!==this.fd&&n.closeSync(this.fd),t()}}class WriteEntryTar extends h.n_{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,e,i={}){return warnMethod(this,t,e,i)}constructor(t,e={}){const i=dealias(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;const{type:s}=t;if("Unsupported"===s)throw new Error("writing entry that should be ignored");this.type=s,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=et(t.path),this.mode=void 0!==t.mode?this[te](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=void 0!==t.linkpath?et(t.linkpath):void 0,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,r=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new Header({path:this[se](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[se](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new Pax({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[se](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[se](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());const n=this.header?.block;if(!n)throw new Error("failed to encode header");super.write(n),t.pipe(this)}[se](t){return prefixPath(t,this.prefix)}[te](t){return modeFix(t,"Directory"===this.type,this.portable)}write(t,e,i){"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8"));const s=t.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}}const re=Buffer.alloc(1024),ne=Symbol("onStat"),he=Symbol("ended"),oe=Symbol("queue"),ae=Symbol("current"),le=Symbol("process"),ce=Symbol("processing"),de=Symbol("processJob"),ue=Symbol("jobs"),me=Symbol("jobDone"),pe=Symbol("addFSEntry"),fe=Symbol("addTarEntry"),ye=Symbol("stat"),be=Symbol("readdir"),Ee=Symbol("onreaddir"),we=Symbol("pipe"),ge=Symbol("entry"),Re=Symbol("entryOpt"),_e=Symbol("writeEntryClass"),Se=Symbol("write"),ve=Symbol("ondrain");class Pack extends h.n_{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[_e];onWriteEntry;[oe];[ue]=0;[ce]=!1;[he]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=et(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[_e]=WriteEntry,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli){if(t.gzip&&t.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if(t.gzip&&("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new Gzip(t.gzip)),t.brotli&&("object"!=typeof t.brotli&&(t.brotli={}),this.zip=new BrotliCompress(t.brotli)),!this.zip)throw new Error("impossible");const e=this.zip;e.on("data",(t=>super.write(t))),e.on("end",(()=>super.end())),e.on("drain",(()=>this[ve]())),this.on("resume",(()=>e.resume()))}else this.on("drain",this[ve]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter="function"==typeof t.filter?t.filter:()=>!0,this[oe]=new Yallist,this[ue]=0,this.jobs=Number(t.jobs)||4,this[ce]=!1,this[he]=!1}[Se](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&this.add(t),this[he]=!0,this[le](),i&&i(),this}write(t){if(this[he])throw new Error("write after end");return t instanceof ReadEntry?this[fe](t):this[pe](t),this.flowing}[fe](t){const e=et(M.resolve(this.cwd,t.path));if(this.filter(t.path,t)){const i=new PackJob(t.path,e);i.entry=new WriteEntryTar(t,this[Re](i)),i.entry.on("end",(()=>this[me](i))),this[ue]+=1,this[oe].push(i)}else t.resume();this[le]()}[pe](t){const e=et(M.resolve(this.cwd,t));this[oe].push(new PackJob(t,e)),this[le]()}[ye](t){t.pending=!0,this[ue]+=1;const e=this.follow?"stat":"lstat";n[e](t.absolute,((e,i)=>{t.pending=!1,this[ue]-=1,e?this.emit("error",e):this[ne](t,i)}))}[ne](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)||(t.ignore=!0),this[le]()}[be](t){t.pending=!0,this[ue]+=1,n.readdir(t.absolute,((e,i)=>{if(t.pending=!1,this[ue]-=1,e)return this.emit("error",e);this[Ee](t,i)}))}[Ee](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[le]()}[le](){if(!this[ce]){this[ce]=!0;for(let t=this[oe].head;t&&this[ue]<this.jobs;t=t.next)if(this[de](t.value),t.value.ignore){const e=t.next;this[oe].removeNode(t),t.next=e}this[ce]=!1,this[he]&&!this[oe].length&&0===this[ue]&&(this.zip?this.zip.end(re):(super.write(re),super.end()))}}get[ae](){return this[oe]&&this[oe].head&&this[oe].head.value}[me](t){this[oe].shift(),this[ue]-=1,this[le]()}[de](t){if(!t.pending)if(t.entry)t!==this[ae]||t.piped||this[we](t);else{if(!t.stat){const e=this.statCache.get(t.absolute);e?this[ne](t,e):this[ye](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const e=this.readdirCache.get(t.absolute);if(e?this[Ee](t,e):this[be](t),!t.readdir)return}t.entry=this[ge](t),t.entry?t!==this[ae]||t.piped||this[we](t):t.ignore=!0}}}[Re](t){return{onwarn:(t,e,i)=>this.warn(t,e,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[ge](t){this[ue]+=1;try{return new this[_e](t.path,this[Re](t)).on("end",(()=>this[me](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[ve](){this[ae]&&this[ae].entry&&this[ae].entry.resume()}[we](t){t.piped=!0,t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[pe](s+e)}));const e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",(t=>{i.write(t)||e.pause()})):e.on("data",(t=>{super.write(t)||e.pause()}))}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){warnMethod(this,t,e,i)}}class PackSync extends Pack{sync=!0;constructor(t){super(t),this[_e]=WriteEntrySync}pause(){}resume(){}[ye](t){const e=this.follow?"statSync":"lstatSync";this[ne](t,n[e](t.absolute))}[be](t){this[Ee](t,n.readdirSync(t.absolute))}[we](t){const e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[pe](s+e)})),!e)throw new Error("Cannot pipe without source");i?e.on("data",(t=>{i.write(t)})):e.on("data",(t=>{super[Se](t)}))}}const addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?xt({file:C.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await xt({file:C.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>{t.add(e)}}):t.add(s)}t.end()},Oe=makeCommand(((t,e)=>{const i=new PackSync(t),s=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(s),addFilesSync(i,e)}),((t,e)=>{const i=new Pack(t),s=new WriteStream(t.file,{mode:t.mode||438});i.pipe(s);const r=new Promise(((t,e)=>{s.on("error",e),s.on("close",t),i.on("error",e)}));return addFilesAsync(i,e),r}),((t,e)=>{const i=new PackSync(t);return addFilesSync(i,e),i}),((t,e)=>{const i=new Pack(t);return addFilesAsync(i,e),i}),((t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")}));var ke=i(34589),Te=i(77598);const Le="win32"===(process.env.__FAKE_PLATFORM__||process.platform),{O_CREAT:Ne,O_TRUNC:Ae,O_WRONLY:De}=n.constants,Ie=Number(process.env.__FAKE_FS_O_FILENAME__)||n.constants.UV_FS_O_FILEMAP||0,xe=Ie|Ae|Ne|De,Fe=Le&&!!Ie?t=>t<524288?xe:"w":()=>"w",lchownSync=(t,e,i)=>{try{return B.lchownSync(t,e,i)}catch(t){if("ENOENT"!==t?.code)throw t}},chown=(t,e,i,s)=>{B.lchown(t,e,i,(t=>{s(t&&"ENOENT"!==t?.code?t:null)}))},chownrKid=(t,e,i,s,r)=>{if(e.isDirectory())chownr(C.resolve(t,e.name),i,s,(n=>{if(n)return r(n);const h=C.resolve(t,e.name);chown(h,i,s,r)}));else{const n=C.resolve(t,e.name);chown(n,i,s,r)}},chownr=(t,e,i,s)=>{B.readdir(t,{withFileTypes:!0},((r,n)=>{if(r){if("ENOENT"===r.code)return s();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return s(r)}if(r||!n.length)return chown(t,e,i,s);let h=n.length,o=null;const then=r=>{if(!o)return r?s(o=r):0==--h?chown(t,e,i,s):void 0};for(const s of n)chownrKid(t,s,e,i,then)}))},chownrKidSync=(t,e,i,s)=>{e.isDirectory()&&chownrSync(C.resolve(t,e.name),i,s),lchownSync(C.resolve(t,e.name),i,s)},chownrSync=(t,e,i)=>{let s;try{s=B.readdirSync(t,{withFileTypes:!0})}catch(s){const r=s;if("ENOENT"===r?.code)return;if("ENOTDIR"===r?.code||"ENOTSUP"===r?.code)return lchownSync(t,e,i);throw r}for(const r of s)chownrKidSync(t,r,e,i);return lchownSync(t,e,i)},optsArg=t=>{if(t)if("object"==typeof t)t={mode:511,...t};else if("number"==typeof t)t={mode:t};else{if("string"!=typeof t)throw new TypeError("invalid options argument");t={mode:parseInt(t,8)}}else t={mode:511};const e=t,i=t.fs||{};return t.mkdir=t.mkdir||i.mkdir||n.mkdir,t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((s,r)=>e.mkdir(t,i,((t,e)=>t?r(t):s(e))))),t.stat=t.stat||i.stat||n.stat,t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,s)=>e.stat(t,((t,e)=>t?s(t):i(e))))),t.statSync=t.statSync||i.statSync||n.statSync,t.mkdirSync=t.mkdirSync||i.mkdirSync||n.mkdirSync,e},mkdirp_manual_mkdirpManualSync=(t,e,i)=>{const s=(0,M.dirname)(t),r={...optsArg(e),recursive:!1};if(s===t)try{return r.mkdirSync(t,r)}catch(t){if(t&&"EISDIR"!==t.code)throw t;return}try{return r.mkdirSync(t,r),i||t}catch(e){const n=e;if(n&&"ENOENT"===n.code)return mkdirp_manual_mkdirpManualSync(t,r,mkdirp_manual_mkdirpManualSync(s,r,i));if(n&&"EEXIST"!==n.code&&n&&"EROFS"!==n.code)throw e;try{if(!r.statSync(t).isDirectory())throw e}catch(t){throw e}}},Pe=Object.assign((async(t,e,i)=>{const s=optsArg(e);s.recursive=!1;const r=(0,M.dirname)(t);return r===t?s.mkdirAsync(t,s).catch((t=>{if(t&&"EISDIR"!==t.code)throw t})):s.mkdirAsync(t,s).then((()=>i||t),(async e=>{const n=e;if(n&&"ENOENT"===n.code)return Pe(r,s).then((e=>Pe(t,s,e)));if(n&&"EEXIST"!==n.code&&"EROFS"!==n.code)throw e;return s.statAsync(t).then((t=>{if(t.isDirectory())return i;throw e}),(()=>{throw e}))}))}),{sync:mkdirp_manual_mkdirpManualSync}),findMade=async(t,e,i)=>{if(i!==e)return t.statAsync(e).then((t=>t.isDirectory()?i:void 0),(i=>i&&"ENOENT"===i.code?findMade(t,(0,M.dirname)(e),e):void 0))},findMadeSync=(t,e,i)=>{if(i!==e)try{return t.statSync(e).isDirectory()?i:void 0}catch(i){return i&&"ENOENT"===i.code?findMadeSync(t,(0,M.dirname)(e),e):void 0}},mkdirp_native_mkdirpNativeSync=(t,e)=>{const i=optsArg(e);i.recursive=!0;if((0,M.dirname)(t)===t)return i.mkdirSync(t,i);const s=findMadeSync(i,t);try{return i.mkdirSync(t,i),s}catch(e){if(e&&"ENOENT"===e.code)return mkdirp_manual_mkdirpManualSync(t,i);throw e}},Ce=Object.assign((async(t,e)=>{const i={...optsArg(e),recursive:!0};return(0,M.dirname)(t)===t?await i.mkdirAsync(t,i):findMade(i,t).then((e=>i.mkdirAsync(t,i).then((t=>e||t)).catch((e=>{if(e&&"ENOENT"===e.code)return Pe(t,i);throw e}))))}),{sync:mkdirp_native_mkdirpNativeSync}),Be=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,pathArg=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=(0,M.resolve)(t),"win32"===Be){const e=/[*|"<>?:]/,{root:i}=(0,M.parse)(t);if(e.test(t.substring(i.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t},Me=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),ze=+Me[0]>10||10==+Me[0]&&+Me[1]>=12,Ue=ze?t=>optsArg(t).mkdirSync===n.mkdirSync:()=>!1,He=Object.assign(ze?t=>optsArg(t).mkdir===n.mkdir:()=>!1,{sync:Ue}),mkdirpSync=(t,e)=>{t=pathArg(t);const i=optsArg(e);return Ue(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)},We=Object.assign((async(t,e)=>{t=pathArg(t);const i=optsArg(e);return He(i)?Ce(t,i):Pe(t,i)}),{mkdirpSync,mkdirpNative:Ce,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Pe,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:Ce,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Pe,manualSync:mkdirp_manual_mkdirpManualSync,useNative:He,useNativeSync:Ue});class CwdError extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}}const cGet=(t,e)=>t.get(et(e)),cSet=(t,e,i)=>t.set(et(e),i),mkdir=(t,e,i)=>{t=et(t);const s=e.umask??18,r=448|e.mode,h=!!(r&s),o=e.uid,a=e.gid,l="number"==typeof o&&"number"==typeof a&&(o!==e.processUid||a!==e.processGid),c=e.preserve,d=e.unlink,u=e.cache,m=et(e.cwd),done=(e,s)=>{e?i(e):(cSet(u,t,!0),s&&l?chownr(s,o,a,(t=>done(t))):h?n.chmod(t,r,i):i())};if(u&&!0===cGet(u,t))return done();if(t===m)return((t,e)=>{n.stat(t,((i,s)=>{!i&&s.isDirectory()||(i=new CwdError(t,i?.code||"ENOTDIR")),e(i)}))})(t,done);if(c)return We(t,{mode:r}).then((t=>done(null,t??void 0)),done);const p=et(C.relative(m,t)).split("/");mkdir_(m,p,r,u,d,m,void 0,done)},mkdir_=(t,e,i,s,r,h,o,a)=>{if(!e.length)return a(null,o);const l=e.shift(),c=et(C.resolve(t+"/"+l));if(cGet(s,c))return mkdir_(c,e,i,s,r,h,o,a);n.mkdir(c,i,onmkdir(c,e,i,s,r,h,o,a))},onmkdir=(t,e,i,s,r,h,o,a)=>l=>{l?n.lstat(t,((c,d)=>{if(c)c.path=c.path&&et(c.path),a(c);else if(d.isDirectory())mkdir_(t,e,i,s,r,h,o,a);else if(r)n.unlink(t,(l=>{if(l)return a(l);n.mkdir(t,i,onmkdir(t,e,i,s,r,h,o,a))}));else{if(d.isSymbolicLink())return a(new SymlinkError(t,t+"/"+e.join("/")));a(l)}})):mkdir_(t,e,i,s,r,h,o=o||t,a)},mkdirSync=(t,e)=>{t=et(t);const i=e.umask??18,s=448|e.mode,r=!!(s&i),h=e.uid,o=e.gid,a="number"==typeof h&&"number"==typeof o&&(h!==e.processUid||o!==e.processGid),l=e.preserve,c=e.unlink,d=e.cache,u=et(e.cwd),done=e=>{cSet(d,t,!0),e&&a&&chownrSync(e,h,o),r&&n.chmodSync(t,s)};if(d&&!0===cGet(d,t))return done();if(t===u)return(t=>{let e,i=!1;try{i=n.statSync(t).isDirectory()}catch(t){e=t?.code}finally{if(!i)throw new CwdError(t,e??"ENOTDIR")}})(u),done();if(l)return done(mkdirpSync(t,s)??void 0);const m=et(C.relative(u,t)).split("/");let p;for(let t=m.shift(),e=u;t&&(e+="/"+t);t=m.shift())if(e=et(C.resolve(e)),!cGet(d,e))try{n.mkdirSync(e,s),p=p||e,cSet(d,e,!0)}catch(t){const i=n.lstatSync(e);if(i.isDirectory()){cSet(d,e,!0);continue}if(c){n.unlinkSync(e),n.mkdirSync(e,s),p=p||e,cSet(d,e,!0);continue}if(i.isSymbolicLink())return new SymlinkError(e,e+"/"+m.join("/"))}return done(p)},Ze=Object.create(null),{hasOwnProperty:je}=Object.prototype,normalizeUnicode=t=>(je.call(Ze,t)||(Ze[t]=t.normalize("NFD")),Ze[t]),Ge="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform);class PathReservations{#m=new Map;#p=new Map;#f=new Set;reserve(t,e){t=Ge?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,C.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>(t=>{const e=t.split("/").slice(0,-1).reduce(((t,e)=>{const i=t[t.length-1];return void 0!==i&&(e=(0,C.join)(i,e)),t.push(e||"/"),t}),[]);return e})(t))).reduce(((t,e)=>t.concat(e))));this.#p.set(e,{dirs:i,paths:t});for(const i of t){const t=this.#m.get(i);t?t.push(e):this.#m.set(i,[e])}for(const t of i){const i=this.#m.get(t);if(i){const t=i[i.length-1];t instanceof Set?t.add(e):i.push(new Set([e]))}else this.#m.set(t,[new Set([e])])}return this.#y(e)}#b(t){const e=this.#p.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map((t=>this.#m.get(t))),dirs:[...e.dirs].map((t=>this.#m.get(t)))}}check(t){const{paths:e,dirs:i}=this.#b(t);return e.every((e=>e&&e[0]===t))&&i.every((e=>e&&e[0]instanceof Set&&e[0].has(t)))}#y(t){return!(this.#f.has(t)||!this.check(t))&&(this.#f.add(t),t((()=>this.#E(t))),!0)}#E(t){if(!this.#f.has(t))return!1;const e=this.#p.get(t);if(!e)throw new Error("invalid reservation");const{paths:i,dirs:s}=e,r=new Set;for(const e of i){const i=this.#m.get(e);if(!i||i?.[0]!==t)continue;const s=i[1];if(s)if(i.shift(),"function"==typeof s)r.add(s);else for(const t of s)r.add(t);else this.#m.delete(e)}for(const e of s){const i=this.#m.get(e),s=i?.[0];if(i&&s instanceof Set)if(1!==s.size||1!==i.length)if(1===s.size){i.shift();const t=i[0];"function"==typeof t&&r.add(t)}else s.delete(t);else this.#m.delete(e)}return this.#f.delete(t),r.forEach((t=>this.#y(t))),!0}}const Ye=Symbol("onEntry"),Ve=Symbol("checkFs"),$e=Symbol("checkFs2"),Ke=Symbol("pruneCache"),qe=Symbol("isReusable"),Xe=Symbol("makeFs"),Je=Symbol("file"),Qe=Symbol("directory"),ti=Symbol("link"),ei=Symbol("symlink"),ii=Symbol("hardlink"),si=Symbol("unsupported"),ri=Symbol("checkPath"),ni=Symbol("mkdir"),hi=Symbol("onError"),oi=Symbol("pending"),ai=Symbol("pend"),li=Symbol("unpend"),ci=Symbol("ended"),di=Symbol("maybeClose"),ui=Symbol("skip"),mi=Symbol("doChown"),pi=Symbol("uid"),fi=Symbol("gid"),yi=Symbol("checkedCwd"),bi="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),uint32=(t,e,i)=>void 0!==t&&t===t>>>0?t:void 0!==e&&e===e>>>0?e:i,cacheKeyNormalize=t=>stripTrailingSlashes(et(normalizeUnicode(t))).toLowerCase();class Unpack extends Parser{[ci]=!1;[yi]=!1;[oi]=0;reservations=new PathReservations;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[ci]=!0,this[di]()},super(t),this.transform=t.transform,this.dirCache=t.dirCache||new Map,this.chmod=!!t.chmod,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;void 0===t.preserveOwner&&"number"!=typeof t.uid?this.preserveOwner=!(!process.getuid||0!==process.getuid()):this.preserveOwner=!!t.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1024,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||bi,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=et(C.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?"number"==typeof t.processUmask?t.processUmask:process.umask():0,this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",(t=>this[Ye](t)))}warn(t,e,i={}){return"TAR_BAD_ARCHIVE"!==t&&"TAR_ABORT"!==t||(i.recoverable=!1),super.warn(t,e,i)}[di](){this[ci]&&0===this[oi]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ri](t){const e=et(t.path),i=e.split("/");if(this.strip){if(i.length<this.strip)return!1;if("Link"===t.type){const e=et(String(t.linkpath)).split("/");if(!(e.length>=this.strip))return!1;t.linkpath=e.slice(this.strip).join("/")}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(i.includes("..")||bi&&/^[a-z]:\.\.$/i.test(i[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:t,path:e}),!1;const[s,r]=stripAbsolutePath(e);s&&(t.path=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:t,path:e}))}if(C.isAbsolute(t.path)?t.absolute=et(C.resolve(t.path)):t.absolute=et(C.resolve(this.cwd,t.path)),!this.preservePaths&&"string"==typeof t.absolute&&0!==t.absolute.indexOf(this.cwd+"/")&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:et(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&"Directory"!==t.type&&"GNUDumpDir"!==t.type)return!1;if(this.win32){const{root:e}=C.win32.parse(String(t.absolute));t.absolute=e+winchars_encode(String(t.absolute).slice(e.length));const{root:i}=C.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return!0}[Ye](t){if(!this[ri](t))return t.resume();switch(ke.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ve](t);default:return this[si](t)}}[hi](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[li](),e.resume())}[ni](t,e,i){mkdir(et(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e},i)}[mi](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[pi](t){return uint32(this.uid,t.uid,this.processUid)}[fi](t){return uint32(this.gid,t.gid,this.processGid)}[Je](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,s=new WriteStream(String(t.absolute),{flags:Fe(t.size),mode:i,autoClose:!1});s.on("error",(i=>{s.fd&&B.close(s.fd,(()=>{})),s.write=()=>!0,this[hi](i,t),e()}));let r=1;const done=i=>{if(i)return s.fd&&B.close(s.fd,(()=>{})),this[hi](i,t),void e();0==--r&&void 0!==s.fd&&B.close(s.fd,(i=>{i?this[hi](i,t):this[li](),e()}))};s.on("finish",(()=>{const e=String(t.absolute),i=s.fd;if("number"==typeof i&&t.mtime&&!this.noMtime){r++;const s=t.atime||new Date,n=t.mtime;B.futimes(i,s,n,(t=>t?B.utimes(e,s,n,(e=>done(e&&t))):done()))}if("number"==typeof i&&this[mi](t)){r++;const s=this[pi](t),n=this[fi](t);"number"==typeof s&&"number"==typeof n&&B.fchown(i,s,n,(t=>t?B.chown(e,s,n,(e=>done(e&&t))):done()))}done()}));const n=this.transform&&this.transform(t)||t;n!==t&&(n.on("error",(i=>{this[hi](i,t),e()})),t.pipe(n)),n.pipe(s)}[Qe](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode;this[ni](String(t.absolute),i,(i=>{if(i)return this[hi](i,t),void e();let s=1;const done=()=>{0==--s&&(e(),this[li](),t.resume())};t.mtime&&!this.noMtime&&(s++,B.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)),this[mi](t)&&(s++,B.chown(String(t.absolute),Number(this[pi](t)),Number(this[fi](t)),done)),done()}))}[si](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[ei](t,e){this[ti](t,String(t.linkpath),"symlink",e)}[ii](t,e){const i=et(C.resolve(this.cwd,String(t.linkpath)));this[ti](t,i,"link",e)}[ai](){this[oi]++}[li](){this[oi]--,this[di]()}[ui](t){this[li](),t.resume()}[qe](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&!bi}[Ve](t){this[ai]();const e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,(e=>this[$e](t,e)))}[Ke](t){"SymbolicLink"===t.type?(t=>{for(const e of t.keys())t.delete(e)})(this.dirCache):"Directory"!==t.type&&((t,e)=>{e=cacheKeyNormalize(e);for(const i of t.keys()){const s=cacheKeyNormalize(i);s!==e&&0!==s.indexOf(e+"/")||t.delete(i)}})(this.dirCache,String(t.absolute))}[$e](t,e){this[Ke](t);const done=i=>{this[Ke](t),e(i)},checkCwd=()=>{this[ni](this.cwd,this.dmode,(e=>{if(e)return this[hi](e,t),void done();this[yi]=!0,start()}))},start=()=>{if(t.absolute!==this.cwd){const e=et(C.dirname(String(t.absolute)));if(e!==this.cwd)return this[ni](e,this.dmode,(e=>{if(e)return this[hi](e,t),void done();afterMakeParent()}))}afterMakeParent()},afterMakeParent=()=>{B.lstat(String(t.absolute),((e,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[ui](t),void done();if(e||this[qe](t,i))return this[Xe](null,t,done);if(i.isDirectory()){if("Directory"===t.type){const afterChmod=e=>this[Xe](e??null,t,done);return this.chmod&&t.mode&&(4095&i.mode)!==t.mode?B.chmod(String(t.absolute),Number(t.mode),afterChmod):afterChmod()}if(t.absolute!==this.cwd)return B.rmdir(String(t.absolute),(e=>this[Xe](e??null,t,done)))}if(t.absolute===this.cwd)return this[Xe](null,t,done);((t,e)=>{if(!bi)return B.unlink(t,e);const i=t+".DELETE."+(0,Te.randomBytes)(16).toString("hex");B.rename(t,i,(t=>{if(t)return e(t);B.unlink(i,e)}))})(String(t.absolute),(e=>this[Xe](e??null,t,done)))}))};this[yi]?start():checkCwd()}[Xe](t,e,i){if(t)return this[hi](t,e),void i();switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Je](e,i);case"Link":return this[ii](e,i);case"SymbolicLink":return this[ei](e,i);case"Directory":case"GNUDumpDir":return this[Qe](e,i)}}[ti](t,e,i,s){B[i](e,String(t.absolute),(e=>{e?this[hi](e,t):(this[li](),t.resume()),s()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=!0;[Xe](t,e){return super[Xe](t,e,(()=>{}))}[Ve](t){if(this[Ke](t),!this[yi]){const e=this[ni](this.cwd,this.dmode);if(e)return this[hi](e,t);this[yi]=!0}if(t.absolute!==this.cwd){const e=et(C.dirname(String(t.absolute)));if(e!==this.cwd){const i=this[ni](e,this.dmode);if(i)return this[hi](i,t)}}const[e,i]=callSync((()=>B.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[ui](t);if(e||this[qe](t,i))return this[Xe](null,t);if(i.isDirectory()){if("Directory"===t.type){const e=this.chmod&&t.mode&&(4095&i.mode)!==t.mode,[s]=e?callSync((()=>{B.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[Xe](s,t)}const[e]=callSync((()=>B.rmdirSync(String(t.absolute))));this[Xe](e,t)}const[s]=t.absolute===this.cwd?[]:callSync((()=>(t=>{if(!bi)return B.unlinkSync(t);const e=t+".DELETE."+(0,Te.randomBytes)(16).toString("hex");B.renameSync(t,e),B.unlinkSync(e)})(String(t.absolute))));this[Xe](s,t)}[Je](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,oner=i=>{let r;try{B.closeSync(s)}catch(t){r=t}(i||r)&&this[hi](i||r,t),e()};let s;try{s=B.openSync(String(t.absolute),Fe(t.size),i)}catch(t){return oner(t)}const r=this.transform&&this.transform(t)||t;r!==t&&(r.on("error",(e=>this[hi](e,t))),t.pipe(r)),r.on("data",(t=>{try{B.writeSync(s,t,0,t.length)}catch(t){oner(t)}})),r.on("end",(()=>{let e=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date,r=t.mtime;try{B.futimesSync(s,i,r)}catch(s){try{B.utimesSync(String(t.absolute),i,r)}catch(t){e=s}}}if(this[mi](t)){const i=this[pi](t),r=this[fi](t);try{B.fchownSync(s,Number(i),Number(r))}catch(s){try{B.chownSync(String(t.absolute),Number(i),Number(r))}catch(t){e=e||s}}}oner(e)}))}[Qe](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode,s=this[ni](String(t.absolute),i);if(s)return this[hi](s,t),void e();if(t.mtime&&!this.noMtime)try{B.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(s){}if(this[mi](t))try{B.chownSync(String(t.absolute),Number(this[pi](t)),Number(this[fi](t)))}catch(s){}e(),t.resume()}[ni](t,e){try{return mkdirSync(et(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e})}catch(t){return t}}[ti](t,e,i,s){const r=`${i}Sync`;try{B[r](e,String(t.absolute)),s(),t.resume()}catch(e){return this[hi](e,t)}}}const Ei=makeCommand((t=>{const e=new UnpackSync(t),i=t.file,s=B.statSync(i),r=t.maxReadSize||16777216;new ReadStreamSync(i,{readSize:r,size:s.size}).pipe(e)}),((t,e)=>{const i=new Unpack(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("close",t),B.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,e)=>{e?.length&&filesFilter(t,e)})),streamSync=(t,e,i,s,r)=>{const n=new WriteStreamSync(t.file,{fd:s,start:i});e.pipe(n),replace_addFilesSync(e,r)},replace_addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?xt({file:C.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},replace_addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await xt({file:C.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>t.add(e)}):t.add(s)}t.end()},wi=makeCommand(((t,e)=>{const i=new PackSync(t);let s,r,n=!0;try{try{s=B.openSync(t.file,"r+")}catch(e){if("ENOENT"!==e?.code)throw e;s=B.openSync(t.file,"w+")}const h=B.fstatSync(s),o=Buffer.alloc(512);t:for(r=0;r<h.size;r+=512){for(let t=0,e=0;t<512;t+=e){if(e=B.readSync(s,o,t,o.length-t,r+t),0===r&&31===o[0]&&139===o[1])throw new Error("cannot append to compressed archives");if(!e)break t}const e=new Header(o);if(!e.cksumValid)break;const i=512*Math.ceil((e.size||0)/512);if(r+i+512>h.size)break;r+=i,t.mtimeCache&&e.mtime&&t.mtimeCache.set(String(e.path),e.mtime)}n=!1,streamSync(t,i,r,s,e)}finally{if(n)try{B.closeSync(s)}catch(t){}}}),((t,e)=>{e=Array.from(e);const i=new Pack(t),s=new Promise(((s,r)=>{i.on("error",r);let n="r+";const onopen=(h,o)=>h&&"ENOENT"===h.code&&"r+"===n?(n="w+",B.open(t.file,n,onopen)):h||!o?r(h):void B.fstat(o,((n,h)=>{if(n)return B.close(o,(()=>r(n)));((e,i,s)=>{const cb=(t,i)=>{t?B.close(e,(e=>s(t))):s(null,i)};let r=0;if(0===i)return cb(null,0);let n=0;const h=Buffer.alloc(512),onread=(s,o)=>{if(s||void 0===o)return cb(s);if(n+=o,n<512&&o)return B.read(e,h,n,h.length-n,r+n,onread);if(0===r&&31===h[0]&&139===h[1])return cb(new Error("cannot append to compressed archives"));if(n<512)return cb(null,r);const a=new Header(h);if(!a.cksumValid)return cb(null,r);const l=512*Math.ceil((a.size??0)/512);return r+l+512>i?cb(null,r):(r+=l+512,r>=i?cb(null,r):(t.mtimeCache&&a.mtime&&t.mtimeCache.set(String(a.path),a.mtime),n=0,void B.read(e,h,0,512,r,onread)))};B.read(e,h,0,512,r,onread)})(o,h.size,((n,h)=>{if(n)return r(n);const a=new WriteStream(t.file,{fd:o,start:h});i.pipe(a),a.on("error",r),a.on("close",s),replace_addFilesAsync(i,e)}))}));B.open(t.file,n,onopen)}));return s}),(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,e)=>{if(!t.file)throw new TypeError("file is required");if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")})),gi=makeCommand(wi.syncFile,wi.asyncFile,wi.syncNoFile,wi.asyncNoFile,((t,e=[])=>{wi.validate?.(t,e),mtimeFilter(t)})),mtimeFilter=t=>{const e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(e,i)=>!((t.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))}}};
|