@scolladon/tsgit 3.0.0 → 3.1.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 (143) hide show
  1. package/README.md +12 -0
  2. package/dist/cjs/adapters/browser/index.cjs +1 -2
  3. package/dist/cjs/adapters/memory/index.cjs +1 -2
  4. package/dist/cjs/adapters/node/index.cjs +1 -2
  5. package/dist/cjs/chunks/{adapter-detect-D7DFJtuk.cjs → adapter-detect-DW9fsw9d.cjs} +1 -2
  6. package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
  7. package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
  8. package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
  9. package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
  10. package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
  11. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
  12. package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
  13. package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
  14. package/dist/cjs/chunks/{progress-CjhUeyxd.cjs → progress-D8Dqbftk.cjs} +1 -2
  15. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
  16. package/dist/cjs/chunks/{repository-DJNNrfQr.cjs → repository-Ci-BBxk0.cjs} +1 -2
  17. package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
  18. package/dist/cjs/commands/index.cjs +1 -2
  19. package/dist/cjs/index.browser.cjs +1 -2
  20. package/dist/cjs/index.cjs +1 -2
  21. package/dist/cjs/index.default.cjs +1 -2
  22. package/dist/cjs/index.node.cjs +1 -2
  23. package/dist/cjs/operators/index.cjs +0 -1
  24. package/dist/cjs/primitives/index.cjs +1 -2
  25. package/dist/cjs/transport/index.cjs +0 -1
  26. package/dist/esm/adapters/browser/index.js +1 -2
  27. package/dist/esm/adapters/memory/index.js +1 -2
  28. package/dist/esm/adapters/node/index.js +1 -2
  29. package/dist/esm/chunks/{adapter-detect-CTTG6hpk.js → adapter-detect-BkCMnjrI.js} +1 -2
  30. package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
  31. package/dist/esm/chunks/context-CumKOV7K.js +0 -1
  32. package/dist/esm/chunks/error-BotOd-nD.js +1 -0
  33. package/dist/esm/chunks/index-DsvINN8n.js +1 -0
  34. package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
  35. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
  36. package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
  37. package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
  38. package/dist/esm/chunks/{progress-CLPpgZJ6.js → progress-B_AJnOHx.js} +1 -2
  39. package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
  40. package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
  41. package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
  42. package/dist/esm/commands/index.js +1 -2
  43. package/dist/esm/index.browser.js +1 -2
  44. package/dist/esm/index.default.js +1 -2
  45. package/dist/esm/index.js +1 -2
  46. package/dist/esm/index.node.js +1 -2
  47. package/dist/esm/operators/index.js +0 -1
  48. package/dist/esm/primitives/index.js +1 -2
  49. package/dist/esm/transport/index.js +0 -1
  50. package/dist/types/adapters/browser/index.d.cts +1 -1
  51. package/dist/types/adapters/browser/index.d.ts +1 -1
  52. package/dist/types/adapters/memory/index.d.cts +1 -1
  53. package/dist/types/adapters/memory/index.d.ts +1 -1
  54. package/dist/types/adapters/node/index.d.cts +94 -36
  55. package/dist/types/adapters/node/index.d.ts +94 -36
  56. package/dist/types/chunks/{context-D_A7-uau.d.cts → context-CF1YF2S8.d.cts} +48 -2
  57. package/dist/types/chunks/{context-CNtbFlwI.d.ts → context-sIhhtk2u.d.ts} +48 -2
  58. package/dist/types/chunks/{index-E_KapqW9.d.ts → index-B5Dps3fg.d.ts} +32 -3
  59. package/dist/types/chunks/{index-BJDekgCP.d.ts → index-B_A8VLaf.d.ts} +111 -12
  60. package/dist/types/chunks/{index-wwZiot4c.d.cts → index-Dfh8cvEs.d.cts} +32 -3
  61. package/dist/types/chunks/{index-CMLLVz9B.d.cts → index-Dqxddhav.d.cts} +111 -12
  62. package/dist/types/chunks/{progress-hcn9r2H3.d.ts → progress-BjAKfkam.d.ts} +51 -5
  63. package/dist/types/chunks/{progress-Cp-huK45.d.cts → progress-Ldnfb8st.d.cts} +51 -5
  64. package/dist/types/chunks/{reflog-entry-BGJr9VfU.d.cts → reflog-entry-Cqh3QrPH.d.ts} +12 -3
  65. package/dist/types/chunks/{reflog-entry-DecZqJna.d.ts → reflog-entry-Dy-O27Dd.d.cts} +12 -3
  66. package/dist/types/chunks/{repository-Dxhwpzd6.d.ts → repository-D8QBTkEz.d.ts} +5 -5
  67. package/dist/types/chunks/{repository-DASBgOb9.d.cts → repository-D9YrVhcH.d.cts} +5 -5
  68. package/dist/types/commands/index.d.cts +3 -3
  69. package/dist/types/commands/index.d.ts +3 -3
  70. package/dist/types/index.browser.d.cts +6 -6
  71. package/dist/types/index.browser.d.ts +6 -6
  72. package/dist/types/index.d.cts +8 -8
  73. package/dist/types/index.d.ts +8 -8
  74. package/dist/types/index.default.d.cts +6 -6
  75. package/dist/types/index.default.d.ts +6 -6
  76. package/dist/types/index.node.d.cts +6 -6
  77. package/dist/types/index.node.d.ts +6 -6
  78. package/dist/types/primitives/index.d.cts +3 -3
  79. package/dist/types/primitives/index.d.ts +3 -3
  80. package/package.json +90 -24
  81. package/dist/cjs/adapters/browser/index.cjs.map +0 -1
  82. package/dist/cjs/adapters/memory/index.cjs.map +0 -1
  83. package/dist/cjs/adapters/node/index.cjs.map +0 -1
  84. package/dist/cjs/chunks/adapter-detect-D7DFJtuk.cjs.map +0 -1
  85. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs +0 -2
  86. package/dist/cjs/chunks/adler32-CrRRuL2P.cjs.map +0 -1
  87. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs +0 -2
  88. package/dist/cjs/chunks/browser-http-transport-nGm6alox.cjs.map +0 -1
  89. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
  90. package/dist/cjs/chunks/error-CA80UqXF.cjs +0 -2
  91. package/dist/cjs/chunks/error-CA80UqXF.cjs.map +0 -1
  92. package/dist/cjs/chunks/index-01WCH0eg.cjs +0 -2
  93. package/dist/cjs/chunks/index-01WCH0eg.cjs.map +0 -1
  94. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
  95. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs +0 -2
  96. package/dist/cjs/chunks/memory-http-transport-7hpDW8o3.cjs.map +0 -1
  97. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs +0 -2
  98. package/dist/cjs/chunks/node-http-transport-CoqnAvIL.cjs.map +0 -1
  99. package/dist/cjs/chunks/progress-CjhUeyxd.cjs.map +0 -1
  100. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
  101. package/dist/cjs/chunks/repository-DJNNrfQr.cjs.map +0 -1
  102. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs +0 -2
  103. package/dist/cjs/chunks/write-sparse-checkout-DzVubBcI.cjs.map +0 -1
  104. package/dist/cjs/commands/index.cjs.map +0 -1
  105. package/dist/cjs/index.browser.cjs.map +0 -1
  106. package/dist/cjs/index.cjs.map +0 -1
  107. package/dist/cjs/index.default.cjs.map +0 -1
  108. package/dist/cjs/index.node.cjs.map +0 -1
  109. package/dist/cjs/operators/index.cjs.map +0 -1
  110. package/dist/cjs/primitives/index.cjs.map +0 -1
  111. package/dist/cjs/transport/index.cjs.map +0 -1
  112. package/dist/esm/adapters/browser/index.js.map +0 -1
  113. package/dist/esm/adapters/memory/index.js.map +0 -1
  114. package/dist/esm/adapters/node/index.js.map +0 -1
  115. package/dist/esm/chunks/adapter-detect-CTTG6hpk.js.map +0 -1
  116. package/dist/esm/chunks/adler32-BfvKJOAO.js +0 -2
  117. package/dist/esm/chunks/adler32-BfvKJOAO.js.map +0 -1
  118. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js +0 -2
  119. package/dist/esm/chunks/browser-http-transport-DD0YKmIW.js.map +0 -1
  120. package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
  121. package/dist/esm/chunks/error-BD0nFV6t.js +0 -2
  122. package/dist/esm/chunks/error-BD0nFV6t.js.map +0 -1
  123. package/dist/esm/chunks/index-BEI7XKaV.js +0 -2
  124. package/dist/esm/chunks/index-BEI7XKaV.js.map +0 -1
  125. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
  126. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js +0 -2
  127. package/dist/esm/chunks/memory-http-transport-D13LBPvu.js.map +0 -1
  128. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js +0 -2
  129. package/dist/esm/chunks/node-http-transport-doU9Y8WN.js.map +0 -1
  130. package/dist/esm/chunks/progress-CLPpgZJ6.js.map +0 -1
  131. package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
  132. package/dist/esm/chunks/repository-dCH3DdLQ.js +0 -2
  133. package/dist/esm/chunks/repository-dCH3DdLQ.js.map +0 -1
  134. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js +0 -2
  135. package/dist/esm/chunks/write-sparse-checkout-D4tNUXOp.js.map +0 -1
  136. package/dist/esm/commands/index.js.map +0 -1
  137. package/dist/esm/index.browser.js.map +0 -1
  138. package/dist/esm/index.default.js.map +0 -1
  139. package/dist/esm/index.js.map +0 -1
  140. package/dist/esm/index.node.js.map +0 -1
  141. package/dist/esm/operators/index.js.map +0 -1
  142. package/dist/esm/primitives/index.js.map +0 -1
  143. package/dist/esm/transport/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ import{d as t}from"./error-BotOd-nD.js";const e=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],n=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],i=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],s=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],r=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],o=r.length;class h{bytes;bytePos;bitBuffer=0;bitCount=0;constructor(t,e){this.bytes=t,this.bytePos=e}get position(){return this.bytePos}readBits(e){const n=this.peekBits(e);if(n.availableBits<e)throw t("unexpected end of deflate stream");return this.dropBits(e),n.value}peekBits(t){return this.fill(t),{value:this.bitBuffer&(1<<t)-1,availableBits:Math.min(this.bitCount,t)}}dropBits(t){this.bitBuffer>>>=t,this.bitCount-=t,this.ungetSpareBytes()}alignToByte(){this.bitBuffer=0,this.bitCount=0}readBytes(e){if(this.bytePos+e>this.bytes.length)throw t("unexpected end of deflate stream");const n=this.bytes.subarray(this.bytePos,this.bytePos+e);return this.bytePos+=e,n}fill(t){for(;this.bitCount<t&&this.bytePos<this.bytes.length;)this.bitBuffer|=this.bytes[this.bytePos]<<this.bitCount,this.bitCount+=8,this.bytePos+=1}ungetSpareBytes(){const t=Math.floor(this.bitCount/8);0!==t&&(this.bitCount-=8*t,this.bitBuffer&=(1<<this.bitCount)-1,this.bytePos-=t)}}class a{maxBytes;buffer=new Uint8Array(64);length=0;constructor(t){this.maxBytes=t}append(t){this.ensureCapacity(this.length+t.length),this.buffer.set(t,this.length),this.length+=t.length}appendByte(t){this.ensureCapacity(this.length+1),this.buffer[this.length]=t,this.length+=1}copyBackReference(e,n){if(e>this.length)throw t("distance exceeds output");this.ensureCapacity(this.length+n);const i=this.length-e;if(e>=n)return this.buffer.copyWithin(this.length,i,i+n),void(this.length+=n);this.copyOverlapping(i,n)}copyOverlapping(t,e){let n=t;for(let t=0;t<e;t+=1)this.buffer[this.length]=this.buffer[n],this.length+=1,n+=1}toUint8Array(){return this.buffer.subarray(0,this.length)}ensureCapacity(e){if(e>this.maxBytes)throw t("inflated output exceeds safety cap");if(e<=this.buffer.length)return;const n=new Uint8Array(this.nextCapacity(e));n.set(this.buffer.subarray(0,this.length)),this.buffer=n}nextCapacity(t){let e=this.buffer.length;for(;e<t;)e*=2;return Math.min(e,this.maxBytes)}}function u(t){return t[0]|t[1]<<8}function l(e,n){e.alignToByte();const i=u(e.readBytes(2));if(u(e.readBytes(2))!==(65535&~i))throw t("stored block length mismatch");n.append(e.readBytes(i))}function f(e,n){const i=function(t){const e=new Uint16Array(16);for(const n of t)n>0&&(e[n]=e[n]+1);return e}(e);!function(e,n){if("fixed"!==n&&0!==e.maxUsedLength&&0!==e.unusedCodes&&("code-length"===n||1!==e.maxUsedLength))throw t(function(t){return"code-length"===t?"invalid code lengths set":"literal-length"===t?"invalid literal/lengths set":"invalid distances set"}(n))}(function(e){let n=1,i=0;for(let s=1;s<=15;s+=1){const r=e[s];if(r>0&&(i=s),n=2*n-r,n<0)throw t("invalid huffman code lengths")}return{unusedCodes:n,maxUsedLength:i}}(i),n);const s=function(t,e){const n=function(t){const e=new Uint16Array(17);for(let n=1;n<=15;n+=1)e[n+1]=e[n]+t[n];return e}(e),i=new Uint16Array(t.length);return t.forEach((t,e)=>{if(0===t)return;const s=n[t];i[s]=e,n[t]=s+1}),i}(e,i);return{counts:i,symbols:s,root:c(i,s)}}function c(t,e){const n=new Uint8Array(512),i=new Uint16Array(512);let s=0,r=0;for(let o=1;o<=9;o+=1){const h=t[o];for(let t=0;t<h;t+=1)d(n,i,s+t,o,e[r+t]);r+=h,s+=h,s<<=1}return{lengths:n,symbols:i}}function d(t,e,n,i,s){const r=1<<i;for(let o=function(t,e){let n=0;for(let i=0;i<e;i+=1)n=n<<1|t>>i&1;return n}(n,i);o<512;o+=r)t[o]=i,e[o]=s}function y(e,n){const i=e.peekBits(9),s=n.root.lengths[i.value];return 0===s||s>i.availableBits?function(e,n){let i=0,s=0,r=0;for(let t=1;t<=15;t+=1){i|=e.readBits(1);const o=n.counts[t];if(i-s<o)return n.symbols[r+(i-s)];r+=o,s+=o,s<<=1,i<<=1}throw t("invalid huffman code")}(e,n):(e.dropBits(s),n.root.symbols[i.value])}const b=f([[144,8],[112,9],[24,7],[8,8]].flatMap(([t,e])=>Array(t).fill(e)),"fixed"),g=f(Array(30).fill(5),"fixed");function p(r,o,h,a){const u=function(i,s){const r=s-257;if(r>=e.length)throw t("invalid length code");return e[r]+i.readBits(n[r])}(r,a),l=function(e,n){if(n>=i.length)throw t("invalid distance code");return i[n]+e.readBits(s[n])}(r,y(r,h));o.copyBackReference(l,u)}function B(t,e,n,i){for(;;){const s=y(t,n);if(s<256)e.appendByte(s);else{if(256===s)return;p(t,e,i,s)}}}function w(e,n,i,s){const{value:r,count:o}=function(e,n,i){if(16===i){if(0===n.length)throw t("code-length repeat with no previous length");return{value:n[n.length-1],count:e.readBits(2)+3}}return 17===i?{value:0,count:e.readBits(3)+3}:{value:0,count:e.readBits(7)+11}}(e,n,i);if(n.length+o>s)throw t("invalid code-length run");for(let t=0;t<o;t+=1)n.push(r)}function m(t){const e=t.readBits(5)+257,n=t.readBits(5)+1,i=t.readBits(4)+4,s=function(t,e){const n=new Array(o).fill(0);for(let i=0;i<e;i+=1)n[r[i]]=t.readBits(3);return n}(t,i),h=function(t,e,n){const i=[];for(;i.length<n;){const s=y(t,e);s<16?i.push(s):w(t,i,s,n)}return i}(t,f(s,"code-length"),e+n);return{litLenTable:f(h.slice(0,e),"literal-length"),distTable:f(h.slice(e),"distance")}}function v(e,n,i=2147483648){const s=new h(e,n);!function(e){const n=e.readBytes(2),i=n[0],s=n[1];if(8!=(15&i))throw t("unsupported compression method");if(i>>4>7)throw t("invalid window size");if((256*i+s)%31!=0)throw t("invalid zlib header checksum");if(s>>5&1)throw t("preset dictionary not supported")}(s);const r=new a(i);!function(e,n){let i=!1;for(;!i;)switch(i=1===e.readBits(1),e.readBits(2)){case 0:l(e,n);break;case 1:B(e,n,b,g);break;case 2:{const{litLenTable:t,distTable:i}=m(e);B(e,n,t,i);break}default:throw t("reserved block type")}}(s,r);const o=r.toUint8Array();return function(e,n){var i;if(e.alignToByte(),((i=e.readBytes(4))[0]<<24|i[1]<<16|i[2]<<8|i[3])>>>0!==function(t){let e=1,n=0;for(const i of t)e=(e+i)%65521,n=(n+e)%65521;return(n<<16|e)>>>0}(n))throw t("adler32 checksum mismatch")}(s,o),{output:o,bytesConsumed:s.position-n}}export{v as i};
@@ -1,2 +1 @@
1
1
  const e=Object.freeze({digestLength:20,hexLength:40}),t=Object.freeze({digestLength:32,hexLength:64});function n(e,t=Number.POSITIVE_INFINITY){const n=new Map;let l=null,r=null,u=0;function i(e){null!==e.prev?e.prev.next=e.next:l=e.next,null!==e.next?e.next.prev=e.prev:r=e.prev,e.prev=null,e.next=null}function s(e){e.next=l,e.prev=null,null!==l&&(l.prev=e),l=e,null===r&&(r=e)}return{get maxSize(){return e},get currentSize(){return u},get entryCount(){return n.size},get(e){const t=n.get(e);if(void 0!==t)return i(t),s(t),t.value},set(l,o,c){if(c<=0)throw new Error("byteSize must be positive");if(c>e)return;const v=n.get(l);if(void 0!==v)u-=v.byteSize,v.value=o,v.byteSize=c,u+=c,i(v),s(v);else{const e={key:l,value:o,byteSize:c,prev:null,next:null};n.set(l,e),s(e),u+=c}!function(){for(;(u>e||n.size>t)&&null!==r;){const e=r;i(e),n.delete(e.key),u-=e.byteSize}}()},has:e=>n.has(e),delete(e){const t=n.get(e);return void 0!==t&&(i(t),n.delete(e),u-=t.byteSize,!0)},clear(){n.clear(),l=null,r=null,u=0}}}export{e as S,t as a,n as c};
2
- //# sourceMappingURL=lru-cache-Cy7C7Lx2.js.map
@@ -0,0 +1 @@
1
+ import{i as t}from"./inflate-BCIXqeeE.js";import{c as s,d as e,f as i,p as r,a as o,u as n,b as h,e as a,h as c,n as l}from"./error-BotOd-nD.js";class d{constructor(){if("undefined"==typeof CompressionStream||"undefined"==typeof DecompressionStream)throw s("CompressionStream/DecompressionStream unavailable")}deflate=async(t,e)=>{try{return await f(t,new CompressionStream("deflate"))}catch(t){throw s(m(t))}};deflateRaw=async(t,e)=>{try{return await f(t,new CompressionStream("deflate-raw"))}catch(t){throw s(m(t))}};inflate=async t=>{try{return await f(t,new DecompressionStream("deflate"))}catch(t){throw e(m(t))}};streamInflate=async(s,e)=>t(s,e);createInflateStream=()=>new DecompressionStream("deflate")}async function f(t,s){const e=s,i=new ReadableStream({start(s){s.enqueue(t),s.close()}}).pipeTo(e.writable).catch(()=>{}),r=e.readable.getReader(),o=[];let n=0;for(;;){const{done:t,value:s}=await r.read();if(t)break;o.push(s),n+=s.length}await i;const h=new Uint8Array(n);let a=0;for(const t of o)h.set(t,a),a+=t.length;return h}function m(t){return t instanceof Error?t.message:String(t)}class y{files=new Map;directories=new Set;symlinks=new Map;times=new Map;rootDir;homePath;xdgPath;systemPath;constructor(t){this.rootDir=t.rootDir,this.homePath=t.home??"/home/user",this.xdgPath=t.xdg??"/home/user/.config",this.systemPath=t.systemConfig??"/etc/gitconfig",this.directories.add(this.rootDir);for(const[s,e]of Object.entries(t.files??{})){const t=this.resolve(s);this.files.set(t,e.slice()),this.touch(t),this.ensureParentDirs(t)}}homedir=()=>this.homePath;xdgConfigHome=()=>this.xdgPath;systemConfigPath=()=>this.systemPath;read=async t=>{const s=this.resolve(t),e=this.files.get(s);if(void 0===e)throw i(t);return e.slice()};readSlice=async(t,s,e)=>{if(s<0||e<0)throw r(t);const o=this.resolve(t),n=this.files.get(o);if(void 0===n)throw i(t);const h=Math.min(s+e,n.length);return n.slice(s,h)};readUtf8=async t=>{const s=await this.read(t);return(new TextDecoder).decode(s)};write=async(t,s)=>{const e=this.resolve(t);this.ensureParentDirs(e),this.files.set(e,s.slice()),this.touch(e)};writeStream=async(t,s)=>{const e=[];for await(const t of s)e.push(t);const i=e.reduce((t,s)=>t+s.length,0),r=new Uint8Array(i);let o=0;for(const t of e)r.set(t,o),o+=t.length;await this.write(t,r)};writeExclusive=async(t,s)=>{const e=this.resolve(t);if(this.files.has(e)||this.symlinks.has(e))throw o(t);this.ensureParentDirs(e),this.files.set(e,s.slice()),this.touch(e)};writeUtf8=async(t,s)=>{await this.write(t,(new TextEncoder).encode(s))};appendUtf8=async(t,s)=>{const e=await this.readExistingUtf8(t);await this.writeUtf8(t,e+s)};async readExistingUtf8(t){const s=this.files.get(this.resolve(t));return(new TextDecoder).decode(s)}exists=async t=>{const s=this.resolve(t);return this.files.has(s)||this.directories.has(s)||this.symlinks.has(s)};static SYMLINK_FOLLOW_LIMIT=40;stat=async t=>this.statFollowing(t,t,0);async statFollowing(t,s,e){if(e>=y.SYMLINK_FOLLOW_LIMIT)throw n("stat",`symlink loop: ${s}`);const i=this.resolve(t),r=this.symlinks.get(i);return void 0!==r?this.statFollowing(r,s,e+1):this.buildStat(i,s)}lstat=async t=>{const s=this.resolve(t),e=this.symlinks.get(s);return void 0!==e?this.makeStatRecord({size:e.length,isFile:!1,isDirectory:!1,isSymbolicLink:!0,times:this.times.get(s)}):this.buildStat(s,t)};readdir=async t=>{const s=this.resolve(t);if(this.files.has(s))throw h(t);if(!this.directories.has(s))throw h(t);const e=`${s}/`,i=new Map;for(const t of this.files.keys())this.addDirectEntry(t,e,i,"file");for(const t of this.symlinks.keys())this.addDirectEntry(t,e,i,"symlink");for(const t of this.directories)t!==s&&this.addDirectEntry(t,e,i,"directory");return Array.from(i.values())};mkdir=async t=>{const s=this.resolve(t);if(this.files.has(s)||this.symlinks.has(s))throw h(t);this.addDirectoryRecursive(s)};rm=async t=>{const s=this.resolve(t);if(this.files.has(s))return this.files.delete(s),void this.times.delete(s);if(this.symlinks.has(s))return this.symlinks.delete(s),void this.times.delete(s);if(this.directories.has(s)){if(this.hasChildren(s))throw a(t);return this.directories.delete(s),void this.times.delete(s)}throw i(t)};rename=async(t,s)=>{const e=this.resolve(t),r=this.resolve(s),o=this.files.get(e),n=this.symlinks.get(e);if(void 0===o&&void 0===n){if(this.directories.has(e))return void this.renameDirectory(e,r);throw i(t)}const h=this.times.get(e);this.ensureParentDirs(r),this.files.delete(r),this.symlinks.delete(r),this.times.delete(r),void 0!==o&&(this.files.delete(e),this.files.set(r,o)),void 0!==n&&(this.symlinks.delete(e),this.symlinks.set(r,n)),this.times.delete(e),this.times.set(r,h)};renameDirectory(t,s){this.ensureParentDirs(s);const e=e=>e===t?s:`${s}${e.slice(t.length)}`,i=s=>{for(const[i,r]of[...s])(i===t||i.startsWith(`${t}/`))&&(s.delete(i),s.set(e(i),r))};for(const s of[...this.directories])(s===t||s.startsWith(`${t}/`))&&(this.directories.delete(s),this.directories.add(e(s)));i(this.files),i(this.symlinks),i(this.times)}readlink=async t=>{const s=this.resolve(t),e=this.symlinks.get(s);if(void 0===e)throw i(t);return e};symlink=async(t,s)=>{const e=this.resolve(s);if(this.files.has(e)||this.symlinks.has(e)||this.directories.has(e))throw o(s);this.ensureParentDirs(e),this.symlinks.set(e,t),this.touch(e)};chmod=async(t,s)=>{this.resolve(t)};rmRecursive=async t=>{const s=this.resolve(t);this.removeLeafEntry(s)||this.directories.has(s)&&this.removeSubtree(s)};removeLeafEntry(t){return this.files.has(t)?(this.files.delete(t),this.times.delete(t),!0):!!this.symlinks.has(t)&&(this.symlinks.delete(t),this.times.delete(t),!0)}removeSubtree(t){const s=`${t}/`,e=w(this.files.keys(),s),i=w(this.symlinks.keys(),s),r=function(t,s,e){const i=[];for(const r of t)(r===s||r.startsWith(e))&&i.push(r);return i}(this.directories,t,s);g(e,this.files,this.times),g(i,this.symlinks,this.times),function(t,s,e){for(const i of t)s.delete(i),e.delete(i)}(r,this.directories,this.times)}openWithNoFollow=async(t,s)=>{const e=this.resolve(t);if(this.symlinks.has(e))throw r(t);if(!this.files.has(e))throw i(t);return this.makeMemoryHandle(e)};makeMemoryHandle(t){return{read:async(s,e,i,r)=>{const o=this.files.get(t),n=r??0,h=Math.min(n+i,o.length),a=o.subarray(n,Math.max(n,h));return s.set(a,e),a.length},write:async s=>{this.files.set(t,s.slice()),this.touch(t)},stat:async()=>this.buildStat(t,t),close:async()=>{}}}resolve(t){const s=function(t,s){const e=(s.startsWith("/")?s:`${t}/${s}`).split("/"),i=[];for(const t of e)""!==t&&"."!==t&&(".."!==t?i.push(t):i.pop());return`/${i.join("/")}`}(this.rootDir,t);if(s!==this.rootDir&&!s.startsWith(`${this.rootDir}/`))throw r(t);return s}ensureParentDirs(t){this.addDirectoryRecursive(u(t))}addDirectoryRecursive(t){let s=t;for(;s.length>=this.rootDir.length;){if(this.files.has(s)||this.symlinks.has(s))throw h(s);if(this.directories.add(s),s===this.rootDir)break;s=u(s)}}touch(t){const s=Date.now();this.times.set(t,{ctimeMs:s,mtimeMs:s})}buildStat(t,s){const e=this.files.get(t);if(void 0!==e)return this.makeStatRecord({size:e.byteLength,isFile:!0,isDirectory:!1,isSymbolicLink:!1,times:this.times.get(t)});if(this.directories.has(t))return this.makeStatRecord({size:0,isFile:!1,isDirectory:!0,isSymbolicLink:!1,times:this.times.get(t)});throw i(s)}makeStatRecord(t){const s=t.times??{ctimeMs:0,mtimeMs:0};return{ctimeMs:s.ctimeMs,mtimeMs:s.mtimeMs,dev:0,ino:0,mode:33188,uid:0,gid:0,size:t.size,isFile:t.isFile,isDirectory:t.isDirectory,isSymbolicLink:t.isSymbolicLink}}hasChildren(t){const s=`${t}/`;for(const t of this.files.keys())if(t.startsWith(s))return!0;for(const t of this.symlinks.keys())if(t.startsWith(s))return!0;for(const e of this.directories)if(e!==t&&e.startsWith(s))return!0;return!1}addDirectEntry(t,s,e,i){if(!t.startsWith(s))return;const r=t.slice(s.length),o=r.indexOf("/"),n=-1===o?r:r.slice(0,o);e.has(n)||e.set(n,-1!==o?{name:n,isFile:!1,isDirectory:!0,isSymbolicLink:!1}:{name:n,isFile:"file"===i,isDirectory:"directory"===i,isSymbolicLink:"symlink"===i})}}function u(t){return t.slice(0,t.lastIndexOf("/"))}function w(t,s){const e=[];for(const i of t)i.startsWith(s)&&e.push(i);return e}function g(t,s,e){for(const i of t)s.delete(i),e.delete(i)}const k={sha1:"SHA-1",sha256:"SHA-256"},v={sha1:20,sha256:32};class p{algorithm;digestLength;subtleAlgo;subtle;constructor(t="sha1"){const s=globalThis.crypto?.subtle;if(void 0===s)throw c("crypto.subtle unavailable");this.subtle=s,this.algorithm=t,this.digestLength=v[t],this.subtleAlgo=k[t]}hash=async t=>{const s=await this.subtle.digest(this.subtleAlgo,t);return new Uint8Array(s)};hashHex=async t=>b(await this.hash(t));createHasher=()=>{const t=[],s=this.subtle,e=this.subtleAlgo;let i=!1;const r=async()=>{if(i)throw c("cannot digest after digest");i=!0;const r=t.reduce((t,s)=>t+s.length,0),o=new Uint8Array(r);let n=0;for(const s of t)o.set(s,n),n+=s.length;const h=await s.digest(e,o);return new Uint8Array(h)};return{update:s=>{if(i)throw c("cannot update after digest");t.push(s.slice())},digest:r,digestHex:async()=>b(await r())}}}function b(t){let s="";for(const e of t)s+=e.toString(16).padStart(2,"0");return s}class D{mocks=new Map;request=async t=>{const s=S(t.method,t.url),e=this.mocks.get(s);if(void 0===e)throw l(`no mock for ${t.url}`);const i=e.body.slice();return{statusCode:e.statusCode,headers:e.headers,body:new ReadableStream({start(t){t.enqueue(i),t.close()}})}};addMockResponse(t){const s={};for(const[e,i]of Object.entries(t.response.headers))s[e.toLowerCase()]=i;this.mocks.set(S(t.method,t.url),{statusCode:t.response.statusCode,headers:s,body:t.response.body.slice()})}clearMocks(){this.mocks.clear()}}function S(t,s){return`${t}:${s}`}export{d as M,p as a,y as b,D as c};
@@ -0,0 +1 @@
1
+ import{spawn as t}from"node:child_process";import{deflateSync as e,deflateRawSync as i,inflateSync as s,createInflate as a}from"node:zlib";import{c as n,d as r,p as o,T as c,f as h,u as l,e as d,b as m,a as p,h as u,n as f}from"./error-BotOd-nD.js";import*as w from"node:fs";import*as y from"node:os";import*as g from"node:path";import{pipeline as v}from"node:stream/promises";import{c as P}from"./lru-cache-Cy7C7Lx2.js";import*as O from"node:fs/promises";import{stat as C}from"node:fs/promises";import{createHash as k}from"node:crypto";import*as N from"node:http";import*as R from"node:https";import{Readable as E,Writable as b}from"node:stream";const D={spawn:t},x=t=>{const e=t.reduce((t,e)=>t+e.length,0),i=new Uint8Array(e);let s=0;for(const e of t)i.set(e,s),s+=e.length;return i};class I{isWindows;ops;constructor(t=process.platform,e=D){this.isWindows="win32"===t,this.ops=e}run(t){return((t,e,i,s)=>new Promise(a=>{const n=t.spawn(e,[i,s.command],{cwd:s.cwd,env:{...process.env,...s.env},stdio:["pipe","pipe","inherit"]}),r=s.signal,o=()=>{n.kill()};r?.addEventListener("abort",o),!0===r?.aborted&&n.kill(),void 0!==s.stdin&&(n.stdin.write(s.stdin),n.stdin.end());const c=[];n.stdout.on("data",t=>{c.push(t)});const h=t=>{r?.removeEventListener("abort",o),a(c.length>0?{exitCode:t,stdout:x(c)}:{exitCode:t})};n.on("error",()=>{h(127)}),n.on("close",t=>{h(t??128)})}))(this.ops,this.isWindows?"cmd":"sh",this.isWindows?"/c":"-c",t)}}function F(t){return t instanceof Error?t.message:String(t)}class S{maxInflatedBytes;constructor(t){this.maxInflatedBytes=t?.maxInflatedBytes??2147483648}deflate=async(t,i)=>{try{return new Uint8Array(void 0===i?e(t):e(t,{level:i}))}catch(t){throw n(F(t))}};deflateRaw=async(t,e)=>{try{return new Uint8Array(void 0===e?i(t):i(t,{level:e}))}catch(t){throw n(F(t))}};inflate=async t=>{try{return new Uint8Array(s(t,{maxOutputLength:this.maxInflatedBytes}))}catch(t){throw r(F(t))}};streamInflate=async(t,e)=>{const i=this.maxInflatedBytes;return new Promise((s,n)=>{const o=a(),c=[];let h=0;const l=t.subarray(e);o.on("data",t=>{if(h+=t.length,h>i)return o.destroy(),void n(r("inflated output exceeds safety cap"));c.push(new Uint8Array(t))}),o.on("end",()=>{const t=o.bytesWritten,e=function(t){const e=t.reduce((t,e)=>t+e.length,0),i=new Uint8Array(e);let s=0;for(const e of t)i.set(e,s),s+=e.length;return i}(c);s({output:e,bytesConsumed:t})}),o.on("error",t=>{n(r(t.message))}),o.end(l)})};createInflateStream=()=>{const t=this.maxInflatedBytes,e=a();let i,s,n=0;return new TransformStream({start(a){i=a,e.on("data",s=>{if(n+=s.length,n>t)return i?.error(r("inflated output exceeds safety cap")),void e.destroy();i?.enqueue(new Uint8Array(s))}),s=new Promise((t,s)=>{e.on("end",()=>{i?.terminate(),t()}),e.on("error",t=>{const e=r(t.message);i?.error(e),s(e)})})},transform(t){e.write(t)},flush:()=>(e.end(),s)})}}class T{get(t){return process.env[t]}}const z=O,L=t=>{if("\\"!==t&&"/"!==t)throw new Error(`PathPolicy: unsupported separator ${JSON.stringify(t)}`);return t},U=(t,e)=>({sep:L(t.sep),caseInsensitive:e,isAbsolute:e=>t.isAbsolute(e),resolve:(...e)=>t.resolve(...e),join:(...e)=>t.join(...e),dirname:e=>t.dirname(e),basename:e=>t.basename(e),rootOf:e=>t.parse(e).root,normalizeForCompare:t=>{return e?(i=t,i.startsWith("\\\\?\\UNC\\")?"\\\\"+i.slice(8):i.startsWith("\\\\?\\")?i.slice(4):i).toLowerCase():t;var i}}),A=U(g.posix,!1),W=U(g.win32,!0),j="win32"===process.platform?W:A;function M(t,e){return{normalized:t,withSep:t+e}}function _(t,e,i=j){return i.isAbsolute(t)?t:i.join(e,t)}function H(t){return t instanceof Error&&"code"in t}function B(t,e,i=j){const s=i.normalizeForCompare(e);return s===t||s.startsWith(t+i.sep)}function G(t,e,i){return t===e||t.startsWith(i)}function q(t,e){switch(t.code){case"ENOENT":return h(e);case"EEXIST":return p(e);case"ENOTDIR":return m(e);case"ENOTEMPTY":return d(e);case"EACCES":case"EPERM":case"ELOOP":case"EISDIR":return o(e);default:return l("filesystem",t.code??"UNKNOWN")}}async function V(t,e){try{return await t()}catch(t){if(H(t))throw q(t,e);throw t}}async function X(t,e=j,i=z){const s=e.rootOf(t),a=t.slice(s.length).split(e.sep).filter(Boolean);for(let t=a.length;t>0;t--){const n=s+a.slice(0,t).join(e.sep);try{const s=await i.realpath(n),r=a.slice(t).join(e.sep);return r.length>0?e.join(s,r):s}catch(t){if(H(t)&&"ENOENT"===t.code)continue;throw t}}const n=await i.realpath(s);return a.length>0?e.join(n,a.join(e.sep)):n}function Y(t){const e={ctimeMs:Number(t.ctimeMs),mtimeMs:Number(t.mtimeMs),dev:Number(t.dev),ino:Number(t.ino),mode:Number(t.mode),uid:Number(t.uid),gid:Number(t.gid),size:Number(t.size),isFile:t.isFile(),isDirectory:t.isDirectory(),isSymbolicLink:t.isSymbolicLink()};return void 0!==t.ctimeNs&&void 0!==t.mtimeNs?{...e,ctimeNs:t.ctimeNs,mtimeNs:t.mtimeNs}:e}class ${rootDir;pathPolicy;fsOps;parentRealpathCache=P(131072,512);canonicalRootPromise=void 0;resolvedCanonicalRootPrefix=void 0;normalizedRootDirPrefix=void 0;constructor(t,e=j,i=z){this.rootDir=t,this.pathPolicy=e,this.fsOps=i}getRootDirPrefix(){return void 0===this.normalizedRootDirPrefix&&(this.normalizedRootDirPrefix=M(this.pathPolicy.normalizeForCompare(this.rootDir),this.pathPolicy.sep)),this.normalizedRootDirPrefix}getNormalizedRootDir(){return this.getRootDirPrefix().normalized}async getCanonicalRoot(){return void 0===this.canonicalRootPromise&&(this.canonicalRootPromise=this.fsOps.realpath(this.rootDir).then(t=>{const e=M(this.pathPolicy.normalizeForCompare(t),this.pathPolicy.sep);return this.resolvedCanonicalRootPrefix=e,e}).catch(t=>{throw this.canonicalRootPromise=void 0,this.resolvedCanonicalRootPrefix=void 0,t})),this.canonicalRootPromise}async resolveCanonicalRoot(){let t=this.resolvedCanonicalRootPrefix;return void 0===t&&(t=await this.getCanonicalRoot()),t}read=async t=>{const e=await this.checkContainment(t,"read");return V(async()=>new Uint8Array(await this.fsOps.readFile(e)),t)};readSlice=async(t,e,i)=>{if(e<0||i<0)throw o(t);const s=await this.checkContainment(t,"read");let a;try{return await V(async()=>{a=await this.fsOps.open(s,"r");const t=Buffer.alloc(i),{bytesRead:n}=await a.read(t,0,i,e);return Uint8Array.from(t.subarray(0,n))},t)}finally{await(a?.close())}};readUtf8=async t=>{const e=await this.checkContainment(t,"read");return V(()=>this.fsOps.readFile(e,"utf-8"),t)};write=async(t,e)=>{const i=await this.checkContainment(t,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await this.fsOps.writeFile(i,e)},t)};writeStream=async(t,e)=>{const i=await this.checkContainment(t,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await v(e,w.createWriteStream(i))},t)};writeExclusive=async(t,e)=>{const i=await this.checkContainment(t,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await this.fsOps.writeFile(i,e,{flag:"wx"})},t)};writeUtf8=async(t,e)=>{const i=await this.checkContainment(t,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await this.fsOps.writeFile(i,e,"utf-8")},t)};appendUtf8=async(t,e)=>{const i=await this.checkContainment(t,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await this.fsOps.appendFile(i,e,"utf-8")},t)};exists=async t=>{const e=this.pathPolicy.resolve(_(t,this.rootDir,this.pathPolicy)),i=this.getNormalizedRootDir(),s=(await this.resolveCanonicalRoot()).normalized;try{if(!B(s,await this.fsOps.realpath(e),this.pathPolicy))throw o(t);return!0}catch(a){if(a instanceof c)throw a;if(H(a)&&"ENOENT"===a.code){if(!B(i,e,this.pathPolicy)&&!B(s,e,this.pathPolicy))throw o(t);return!1}if(H(a))throw q(a,t);throw a}};stat=async t=>{const e=await this.checkContainment(t,"read");return V(async()=>Y(await this.fsOps.stat(e,{bigint:!0})),t)};lstat=async t=>{const e=await this.checkContainment(t,"lstat");return V(async()=>Y(await this.fsOps.lstat(e,{bigint:!0})),t)};readdir=async t=>{const e=await this.checkContainment(t,"read");return V(async()=>(await this.fsOps.readdir(e,{withFileTypes:!0})).map(t=>({name:t.name,isFile:t.isFile(),isDirectory:t.isDirectory(),isSymbolicLink:t.isSymbolicLink()})),t)};mkdir=async t=>{const e=await this.checkContainment(t,"creation");await V(()=>this.fsOps.mkdir(e,{recursive:!0}),t)};rm=async t=>{const e=await this.checkContainment(t,"lstat");await V(()=>this.fsOps.rm(e),t)};rename=async(t,e)=>{const i=await this.checkContainment(t,"read"),s=await this.checkContainment(e,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(s),{recursive:!0}),await this.fsOps.rename(i,s)},t),this.parentRealpathCache.clear()};readlink=async t=>{const e=await this.checkContainment(t,"lstat");return V(()=>this.fsOps.readlink(e),t)};symlink=async(t,e)=>{if(this.pathPolicy.isAbsolute(t)){const i=this.pathPolicy.resolve(t),s=await X(i,this.pathPolicy,this.fsOps),a=this.getNormalizedRootDir(),n=(await this.resolveCanonicalRoot()).normalized;if(!B(a,s,this.pathPolicy)&&!B(n,s,this.pathPolicy))throw o(e)}const i=await this.checkContainment(e,"creation");await V(async()=>{await this.fsOps.mkdir(this.pathPolicy.dirname(i),{recursive:!0}),await this.fsOps.symlink(t,i)},e)};chmod=async(t,e)=>{const i=await this.checkContainment(t,"read");await V(()=>this.fsOps.chmod(i,e),t)};rmRecursive=async t=>{let e;try{e=await this.checkContainment(t,"lstat"),await V(()=>this.fsOps.lstat(e),t)}catch(t){if(t instanceof c&&"FILE_NOT_FOUND"===t.data.code)return;throw t}await this.removeTree(e,t),this.parentRealpathCache.clear()};openWithNoFollow=async(t,e)=>{const i=await this.checkContainment(t,"lstat");if(this.pathPolicy.caseInsensitive&&await this.isSymlinkLeaf(i))throw o(t);const s="write"===e?w.constants.O_WRONLY:w.constants.O_RDONLY;return function(t){let e=!1;return{read:async(e,i,s,a)=>{const{bytesRead:n}=await t.read(e,i,s,a??null);return n},write:async e=>{await t.write(e,0,e.length)},stat:async()=>Y(await t.stat({bigint:!0})),close:async()=>{e||(e=!0,await t.close())}}}(await V(()=>this.fsOps.open(i,s|w.constants.O_NOFOLLOW),t).catch(e=>{if(function(t,e=j){return!!e.caseInsensitive&&t instanceof c&&("PERMISSION_DENIED"===t.data.code||"UNSUPPORTED_OPERATION"===t.data.code)}(e,this.pathPolicy))throw o(t);throw e}))};async isSymlinkLeaf(t){try{return(await this.fsOps.lstat(t)).isSymbolicLink()}catch(t){if(H(t)&&"ENOENT"===t.code)return!1;throw t}}async removeTree(t,e){const i=await V(()=>this.fsOps.lstat(t),e);if(!i.isDirectory()||i.isSymbolicLink())return void await V(()=>this.fsOps.rm(t,{force:!0}),e);const s=await V(()=>this.fsOps.readdir(t,{withFileTypes:!0}),e);await async function(t,e,i){if(0===t.length)return;let s=0;const a=Math.min(8,t.length),n=Array.from({length:a},async()=>{for(;;){const e=s;if(s+=1,e>=t.length)return;const a=t[e];if(void 0===a)return;await i(a)}});await Promise.all(n)}(s,0,i=>this.removeTree(this.pathPolicy.join(t,i.name),e)),await V(()=>this.fsOps.rmdir(t),e)}async resolveForCreation(t,e,i,s){const a=await this.realpathForCreation(e,i,s);let n;try{n={ok:!0,isSymlink:(await this.fsOps.lstat(a)).isSymbolicLink()}}catch(t){n={ok:!1,err:t}}return function(t,e){if(t.ok){if(t.isSymlink)throw o(e);return}const{err:i}=t;if(H(i)){if("ENOENT"===i.code)return;throw q(i,e)}throw i}(n,t),a}async cachedParentRealpath(t,e,i){const s=this.parentRealpathCache.get(t);if(void 0!==s)return s;const a=await this.fsOps.realpath(t),n={realParent:a,contained:this.isContainedInEitherRoot(a,e,i)};return this.parentRealpathCache.set(t,n,t.length+a.length),n}async realpathForCreation(t,e,i){const s=this.pathPolicy.dirname(t),a=this.pathPolicy.basename(t);try{const{realParent:t}=await this.cachedParentRealpath(s,e,i);return this.pathPolicy.join(t,a)}catch(e){if(H(e)&&"ENOENT"===e.code)return X(t,this.pathPolicy,this.fsOps);throw e}}async resolveForMode(t,e,i,s,a){if("read"===i){if(!this.isContainedInEitherRoot(e,s,a))throw o(t);return{real:await this.fsOps.realpath(e),contained:void 0}}if("lstat"===i){const i=this.containmentVerdict(e,s,a);if(!i.contained)throw o(t);const n=this.pathPolicy.dirname(e),r=this.pathPolicy.basename(e),{realParent:c,contained:h}=await this.cachedParentRealpath(n,s,a);return{real:this.pathPolicy.join(c,r),contained:i.isExactRoot?void 0:h}}return{real:await this.resolveForCreation(t,e,s,a),contained:void 0}}isContainedInEitherRoot(t,e,i){return this.containmentVerdict(t,e,i).contained}containmentVerdict(t,e,i){const s=this.pathPolicy.normalizeForCompare(t),a=s===e.normalized||s===i.normalized;return{contained:a||G(s,e.normalized,e.withSep)||G(s,i.normalized,i.withSep),isExactRoot:a}}async checkContainment(t,e){const i=this.pathPolicy.resolve(_(t,this.rootDir,this.pathPolicy)),s=this.getRootDirPrefix(),a=await this.resolveCanonicalRoot();try{const{real:n,contained:r}=await this.resolveForMode(t,i,e,s,a);if(!(r??this.isContainedInEitherRoot(n,s,a)))throw o(t);return n}catch(e){if(e instanceof c)throw e;if(H(e)&&"ENOENT"===e.code)throw h(t);if(H(e))throw q(e,t);throw e}}homedir(){return y.homedir()}xdgConfigHome(){const t=process.env.XDG_CONFIG_HOME;return void 0!==t&&t.length>0?t:g.join(y.homedir(),".config")}systemConfigPath(){return"win32"===process.platform?`${process.env.ProgramData??"C:\\ProgramData"}\\Git\\config`:"/etc/gitconfig"}}const J={sha1:20,sha256:32};class K{algorithm;digestLength;constructor(t="sha1"){this.algorithm=t,this.digestLength=J[t]}hash=async t=>new Uint8Array(k(this.algorithm).update(t).digest());hashHex=async t=>k(this.algorithm).update(t).digest("hex");createHasher=()=>{const t=k(this.algorithm);let e=!1;return{update:i=>{if(e)throw u("cannot update after digest");t.update(i)},digest:async()=>{if(e)throw u("cannot digest after digest");return e=!0,new Uint8Array(t.digest())},digestHex:async()=>{if(e)throw u("cannot digest after digest");return e=!0,t.digest("hex")}}}}const Q={stat:C,spawn:t};class Z{chunks=[];size=0;append(t){const e=t.subarray(0,Math.max(0,1048576-this.size));this.chunks.push(e),this.size+=e.length}value(){return Buffer.concat(this.chunks).toString("utf8")}}class tt{isWindows;ops;constructor(t=process.platform,e=Q){this.isWindows="win32"===t,this.ops=e}async run(t){const e=g.join(t.hooksDir,t.name);return await this.isRunnable(e)?et(this.ops.spawn,e,t):{kind:"skipped"}}async isRunnable(t){let e,i;try{const s=await this.ops.stat(t);e=s.mode,i=s.isFile()}catch{return!1}return!!i&&(this.isWindows||!!(73&e))}}const et=(t,e,i)=>new Promise(s=>{const a=t(e,i.args,{cwd:i.workDir,env:{...process.env,GIT_DIR:i.gitDir,GIT_INDEX_FILE:`${i.gitDir}/index`}}),n=new Z,r=new Z;a.stdout.on("data",t=>{n.append(t)}),a.stderr.on("data",t=>{r.append(t)});const o=i.signal,c=()=>{a.kill()};o?.addEventListener("abort",c),!0===o?.aborted&&a.kill();const h=t=>{o?.removeEventListener("abort",c),s(t)};a.on("error",t=>{h({kind:"ran",exitCode:126,stdout:"",stderr:String(t)})}),a.on("close",t=>{h({kind:"ran",exitCode:t??128,stdout:n.value(),stderr:r.value()})}),a.stdin.on("error",()=>{}),a.stdin.end(i.stdin)});function it(t){const e={};for(const[i,s]of Object.entries(t))void 0!==s&&(e[i.toLowerCase()]=Array.isArray(s)?s.join(", "):s);return e}class st{allowInsecureHttp;constructor(t={}){this.allowInsecureHttp=t.allowInsecureHttp??!1}request=async t=>{const e=new URL(t.url);if("http:"===e.protocol&&!this.allowInsecureHttp)throw f("HTTPS required — set allowInsecureHttp to allow plaintext HTTP");const i="https:"===e.protocol?R:N;return new Promise((s,a)=>{const n={method:t.method,headers:{...t.headers}};void 0!==t.signal&&(n.signal=t.signal);const r=i.request(e,n,t=>{s({statusCode:t.statusCode,headers:it(t.headers),body:E.toWeb(t)})});r.on("error",t=>{a(f(function(t){switch(t.code){case"ENOTFOUND":return"DNS resolution failed";case"ECONNREFUSED":return"Connection refused";case"ETIMEDOUT":return"Connection timed out";default:return"network error"}}(t)))}),void 0!==t.body&&r.write(Buffer.from(t.body)),r.end()})}}const at={spawn:t};class nt{ops;constructor(t=at){this.ops=t}open=async t=>{const e=this.ops.spawn(t.command,t.args,(t=>({env:{...process.env,...t.env},stdio:["pipe","pipe","inherit"],...void 0!==t.signal?{signal:t.signal}:{}}))(t)),i=(t=>new Promise(e=>{t.on("error",()=>e(127)),t.on("close",t=>e(t??128))}))(e);return{stdin:b.toWeb(e.stdin),stdout:E.toWeb(e.stdout),exit:i,close:async()=>{e.kill(),await i}}}}export{I as N,tt as a,T as b,nt as c,st as d,S as e,K as f,$ as g,j as n,D as r};
@@ -1,2 +1 @@
1
- import{s as t}from"./error-BD0nFV6t.js";const e=Object.freeze({start:()=>{},update:()=>{},end:()=>{}}),r=/\x1b\[[0-9;]*m/g,a=/[<>&"']/g,o=e=>{let o=e.replace(r,"");return o=t(o),o=o.replace(a,t=>`&#${t.charCodeAt(0)};`),o},s=t=>{const e=e=>{try{t(e)}catch{}};return{start:(t,r)=>e(((t,e)=>`${o(t)}: start${void 0!==e?`/${e}`:""}`)(t,r)),update:(t,r,a,s)=>e(((t,e,r,a)=>{const s=`${o(t)}: ${e}${void 0!==r?`/${r}`:""}`;return void 0!==a&&""!==a?`${s} ${o(a)}`:s})(t,r,a,s)),end:t=>e((t=>`${o(t)}: done`)(t))}};export{s as c,e as n};
2
- //# sourceMappingURL=progress-CLPpgZJ6.js.map
1
+ import{s as t}from"./error-BotOd-nD.js";const e=Object.freeze({start:()=>{},update:()=>{},end:()=>{}}),r=/\x1b\[[0-9;]*m/g,a=/[<>&"']/g,o=e=>{let o=e.replace(r,"");return o=t(o),o=o.replace(a,t=>`&#${t.charCodeAt(0)};`),o},s=t=>{const e=e=>{try{t(e)}catch{}};return{start:(t,r)=>e(((t,e)=>`${o(t)}: start${void 0!==e?`/${e}`:""}`)(t,r)),update:(t,r,a,s)=>e(((t,e,r,a)=>{const s=`${o(t)}: ${e}${void 0!==r?`/${r}`:""}`;return void 0!==a&&""!==a?`${s} ${o(a)}`:s})(t,r,a,s)),end:t=>e((t=>`${o(t)}: done`)(t))}};export{s as c,e as n};
@@ -1,2 +1 @@
1
1
  const e=e=>({[Symbol.asyncIterator](){const a=e.getReader();return{next:async()=>{const{done:e,value:n}=await a.read();return e?{done:!0,value:void 0}:{done:!1,value:n}},return:async()=>{try{await a.cancel()}catch{}return{done:!0,value:void 0}}}}});export{e as r};
2
- //# sourceMappingURL=readable-stream-CGuf8k1J.js.map
@@ -0,0 +1 @@
1
+ import{i as e,w as t,r as s,b as r,u as a,d as o,e as i,f as n,j as c,O as d,g as l,h as m,k as f,l as h,C as u,M as p,m as w,n as g,o as v,p as y,q as k,s as x,t as b,v as N,x as S,y as D,z as R,A as E,B as I,D as C,E as z}from"./write-sparse-checkout-BwHbNKNS.js";import{T as O,o as j,w as P,u as $,j as T,k as F,l as M,m as W,q as U,r as A,t as L}from"./error-BotOd-nD.js";import{aS as B,p as H,aN as _,o as q,n as G,aD as V,m as Q,l as X,as as Y,ar as Z,aq as J,al as K,k as ee,ak as te,j as se,ad as re,i as ae,a7 as oe,a8 as ie,a6 as ne,a5 as ce,h as de,a0 as le,$ as me,g as fe,X as he,W as ue,V as pe,U as we,T as ge,S as ve,R as ye,Q as ke,f as xe,F as be,E as Ne,e as Se,y as De,z as Re,d as Ee,c as Ie,q as Ce,b as ze,a as Oe,P as je}from"./index-DsvINN8n.js";import{a as Pe,w as $e}from"./adapter-detect-BkCMnjrI.js";import{n as Te}from"./progress-B_AJnOHx.js";import{isIgnored as Fe,bisectMidpoint as Me}from"../primitives/index.js";const We=(t,s,r,a)=>{let o=null;r.subscribe(()=>{});return{resolve:async(r,i)=>{const n=a.current("index"),c=!0===i?.bypassCache;if(!c&&null!==o&&o.cachedGen===n)return o.parsed;const d=e(r.layout.gitDir),l=await(async e=>{try{return await s.stat(e)}catch(e){if(e instanceof O&&"FILE_NOT_FOUND"===e.data.code)return null;throw e}})(d);if(!c&&null!==o&&null!==l&&await(async(e,t,r)=>{return(a=r).size===(o=e.observed).size&&a.ino===o.ino&&a.mtimeMs===o.mtimeMs&&(void 0===a.mtimeNs||void 0===o.mtimeNs||a.mtimeNs===o.mtimeNs)&&(!((e,t)=>void 0===e.mtimeNs||void 0===t.mtimeNs)(r,e.observed)||(async(e,t,r)=>{const a=e.parsed.trailerSha.length;if(0===a||r.size<a)return!1;const o=await(async(e,t,s,r)=>e.readSlice(t,r-s,s))(s,t,a,r.size);return((e,t)=>{if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(e[s]!==t[s])return!1;return!0})(o,e.parsed.trailerSha)})(e,t,r));var a,o})(o,d,l))return o.cachedGen=n,o.parsed;const m=await t.resolve(r,i);return o=null!==l?{parsed:m,observed:l,cachedGen:n}:null,m}}},Ue=e=>e.isSymbolicLink?"120000":73&e.mode?"100755":"100644",Ae=(e,t)=>{const s=(e=>({mode:Ue(e),size:e.size,mtimeMs:e.mtimeMs,...void 0===e.mtimeNs?{}:{mtimeNs:e.mtimeNs},ino:BigInt(e.ino)}))(t);return{source:"workdir",path:e,mode:s.mode,kind:t.isSymbolicLink?"symlink":"file",stat:s}},Le=(e,t)=>((e,t)=>({...t,read:async()=>(await o(e,t.oid)).content}))(e,{source:"index",path:t.path,oid:t.id,mode:t.mode,stage:t.flags.stage,flags:{assumeUnchanged:t.flags.assumeValid,skipWorktree:t.flags.skipWorktree,intentToAdd:t.flags.intentToAdd},cachedStat:{size:t.fileSize,mtimeMs:1e3*t.mtimeSeconds+Math.floor(t.mtimeNanoseconds/1e6),ino:BigInt(t.ino)}}),Be=e=>"120000"===e?"symlink":"160000"===e?"submodule":"file",He=(e,t,s,r)=>((e,t)=>({...t,read:async()=>(await o(e,t.oid)).content}))(e,{source:"tree",path:t,oid:s,mode:r,kind:Be(r)}),_e=new TextEncoder,qe=e=>e.isSymbolicLink?"120000":73&e.mode?"100755":"100644",Ge=(e,t)=>{const s=c(e.layout.workDir,t.path),r=async()=>"symlink"===t.kind?(async(e,t)=>{const s=await e.fs.readlink(t);return _e.encode(s)})(e,s):e.fs.read(s);return{...t,hash:async()=>(async(e,t)=>{const s=_e.encode(`blob ${t.length}\0`),r=new Uint8Array(s.length+t.length);r.set(s,0),r.set(t,s.length);const a=await e.hash.hashHex(r);return d.from(a)})(e,await r()),read:r,readLink:async()=>{if("symlink"!==t.kind)throw $("readLink",`entry is not a symlink (kind=${t.kind})`);return e.fs.readlink(s)},verify:async()=>{const r=await(async(e,t)=>{const s=await e.fs.lstat(t);return{mode:qe(s),size:s.size,mtimeMs:s.mtimeMs,...void 0===s.mtimeNs?{}:{mtimeNs:s.mtimeNs},ino:BigInt(s.ino)}})(e,s);if(!((e,t)=>e.mode===t.mode&&e.size===t.size&&e.mtimeMs===t.mtimeMs)(t.stat,r))throw P(t.path,t.stat,r)}}},Ve=(e,t)=>((e,t)=>{let s=null;return{kind:"tree",entries:async function*(r){const a=await(async r=>{if(null!==s&&!r)return s;const a=await e.treeResolver.resolve(e.ctx,t,{bypassCache:r});return s=a,a})(!0===r?.bypassCache),o={recursive:!1!==r?.recurse,...void 0===r?.maxDepth?{}:{maxDepth:r.maxDepth},...void 0===r?.maxEntries?{}:{maxEntries:r.maxEntries}};for await(const t of i(e.ctx,a,o))n(t.mode)||(void 0===r?.paths||B(r.paths,t.path))&&(yield He(e.ctx,t.path,t.id,t.mode))}}})({ctx:e.ctx,treeResolver:e.treeResolver},t),Qe=async(e,t)=>{const s=await r(e,t);if("commit"!==s.type)throw a("commit",s.type,t);return s.data.tree},Xe=async(e,t)=>{const s=await m(e.ctx,t,{peel:!0}),r=await Qe(e.ctx,s);return Ve(e,r)},Ye=new Set(["FILE_NOT_FOUND","REF_NOT_FOUND"]),Ze=(e,t)=>async()=>(async(e,t)=>{const s=`${e.ctx.layout.gitDir}/${t}`;if(!await e.ctx.fs.exists(s))return null;try{return await Xe(e,t)}catch(e){if(e instanceof O&&Ye.has(e.data.code))return null;throw e}})(e,t),Je=e=>({head:()=>({kind:"commit",entries:async function*(t){const s=await Xe(e,"HEAD");yield*s.entries(t)}}),commit:t=>({kind:"commit",entries:async function*(s){const r=await Qe(e.ctx,t);yield*Ve(e,r).entries(s)}}),tree:t=>Ve(e,t),index:()=>(e=>{let t=null;return{kind:"index",entries:async function*(s){const r=await(async s=>{if(null!==t)return t;const r=await e.indexResolver.resolve(e.ctx,{bypassCache:s});return t=r,r})(!0===s?.bypassCache);let a=0;const o=s?.maxEntries??Number.POSITIVE_INFINITY;for(const t of r.entries){if(a>=o)return;(void 0===s?.paths||B(s.paths,t.path))&&(yield Le(e.ctx,t),a+=1)}}}})({ctx:e.ctx,indexResolver:e.indexResolver}),workdir:t=>((e,t)=>({kind:"workdir",entries:async function*(s){const r=((e,t)=>{const s=t?.paths??e?.paths,r=t?.maxDepth??e?.maxDepth,a=t?.maxEntries??e?.maxEntries,o=t?.signal??e?.signal,i=e?.excludes;return{...void 0===s?{}:{paths:s},...void 0===i?{}:{excludes:i},...void 0===r?{}:{maxDepth:r},...void 0===a?{}:{maxEntries:a},...void 0===o?{}:{signal:o}}})(t,s),a=e.enumerator.enumerate(e.ctx,r);if("verified"===t?.consistency){const t=[];for await(const e of a)t.push(e);for(const s of t)yield Ge(e.ctx,s);return}for await(const t of a)yield Ge(e.ctx,t)}}))({ctx:e.ctx,enumerator:e.workdirEnumerator},t),mergeHead:Ze(e,p),cherryPickHead:Ze(e,u),revertHead:Ze(e,h),fetchHead:Ze(e,f),stashEntry:t=>et(e,t)}),Ke=async(e,t)=>{const s=await r(e,t);if("commit"!==s.type)throw a("commit",s.type,t);return s.data.tree},et=async(e,t)=>{const s=await l(e.ctx,"refs/stash"),o=s[s.length-1-t];if(void 0===o)return null;const i=await r(e.ctx,o.newId);if("commit"!==i.type)throw a("commit",i.type,o.newId);const[,n,c]=i.data.parents;if(void 0===n)return null;const d=await Ke(e.ctx,n),m=void 0!==c?Ve(e,await Ke(e.ctx,c)):null;return f={index:Ve(e,d),workdir:Ve(e,i.data.tree),untracked:m},{kind:"stash",...f};var f},tt=["fs","transport","compressor","hash"],st=e=>{if(null!==e&&"object"==typeof e&&!Object.isFrozen(e)){Object.freeze(e);for(const t of Object.keys(e))st(e[t])}},rt=/^[A-Za-z]:[/\\]/,at=(e,t,s=[])=>{const r="string"==typeof t?[t]:t,a=new Set(s.filter(e=>e.length>0&&!e.split(/[\\/]/).includes(".."))),o=e=>{if(!r.some(t=>it(e,t))&&!a.has(e))throw M(e)};return{read:t=>(o(t),e.read(t)),readSlice:(t,s,r)=>(o(t),e.readSlice(t,s,r)),readUtf8:t=>(o(t),e.readUtf8(t)),write:(t,s)=>(o(t),e.write(t,s)),writeStream:(t,s)=>(o(t),e.writeStream(t,s)),writeExclusive:(t,s)=>(o(t),e.writeExclusive(t,s)),writeUtf8:(t,s)=>(o(t),e.writeUtf8(t,s)),appendUtf8:(t,s)=>(o(t),e.appendUtf8(t,s)),exists:t=>(o(t),e.exists(t)),stat:t=>(o(t),e.stat(t)),lstat:t=>(o(t),e.lstat(t)),readdir:t=>(o(t),e.readdir(t)),mkdir:t=>(o(t),e.mkdir(t)),rm:t=>(o(t),e.rm(t)),rename:(t,s)=>(o(t),o(s),e.rename(t,s)),readlink:t=>(o(t),e.readlink(t)),symlink:(t,s)=>(o(s),e.symlink(t,s)),chmod:(t,s)=>(o(t),e.chmod(t,s)),rmRecursive:t=>(o(t),e.rmRecursive(t)),openWithNoFollow:(t,s)=>(o(t),e.openWithNoFollow(t,s)),homedir:()=>e.homedir(),xdgConfigHome:()=>e.xdgConfigHome(),systemConfigPath:()=>e.systemConfigPath()}},ot=e=>e.replace(/\\/g,"/"),it=(e,t)=>{const s=ot(e),r=ot(t);if(s===r)return!0;const a=r.endsWith("/")?r:`${r}/`;return s.startsWith(a)},nt=(e,t)=>{for(const s of e)if(t||!ct(s))return s;if(0===e.length)throw A("<unresolved>","no DNS records returned");throw A(e[0],"all resolved addresses are in a blocked range")},ct=e=>e.includes(":")?lt(e):dt(e),dt=e=>{const t=(e=>{const t=e.split(".");if(4!==t.length)return;const s=[];for(const e of t){if(!/^\d{1,3}$/.test(e))return;const t=Number(e);if(t>255)return;s.push(t)}return s})(e);if(void 0===t)return!1;const[s,r]=t;return 0===s||10===s||100===s&&r>=64&&r<=127||127===s||169===s&&254===r||172===s&&r>=16&&r<=31||192===s&&168===r||s>=224},lt=e=>{const t=e.toLowerCase(),s=t.match(/::ffff:(?:0:)?(\d+\.\d+\.\d+\.\d+)$/);if(void 0!==s?.[1])return dt(s[1]);const r=t.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);if(void 0!==r?.[1]&&void 0!==r[2]){const e=parseInt(r[1],16),t=parseInt(r[2],16);return dt(`${e>>8}.${255&e}.${t>>8}.${255&t}`)}return!!("::1"===t||"::"===t||t.startsWith("fe80:")||t.startsWith("fe80::")||t.startsWith("ff")||t.startsWith("fc")||t.startsWith("fd"))},mt=(e,t)=>{const s=t?.allowInsecure??!1,r=t?.allowPrivateNetworks??!1,a=t?.dnsResolver??ft;return{request:async t=>(await(async(e,t)=>{(e=>{for(let t=0;t<e.length;t+=1){const s=e.charCodeAt(t);if(10===s||13===s)throw W("contains forbidden control character")}})(e);const s=(e=>{try{return new URL(e)}catch{throw W("not a valid URL")}})(e);((e,t)=>{const s=e.protocol;if("https:"!==s&&("http:"!==s||!t))throw U(s.replace(":",""))})(s,t.allowInsecure??!1),(e=>{if(""!==e.hash)throw W("URL fragment is not allowed")})(s);const r=await t.resolver(s.hostname);return{url:e,pinnedAddress:nt(r,t.allowPrivateNetworks??!1)}})(t.url,{resolver:a,allowInsecure:s,allowPrivateNetworks:r}),e.request(t))}},ft=async()=>[],ht=e=>{const t=[],s=e=>{try{return e()}catch{return}},r=s(()=>e.homedir()),a=s(()=>e.xdgConfigHome()),o=s(()=>e.systemConfigPath());return void 0!==r&&t.push(`${r}/.gitconfig`),void 0!==a&&t.push(`${a}/git/config`),void 0!==o&&o.length>0&&t.push(o),t},ut=e=>{const o=(()=>{const e={index:0,refs:0,objects:0};return{current:t=>e[t],bump:t=>{e[t]+=1}}})(),i=(e=>{const t=new Set;return{emitter:{emit:s=>{e.bump(s);for(const e of t)e(s)}},stream:{subscribe:e=>(t.add(e),{dispose:()=>{t.delete(e)}})}}})(o),n=(e=>{let t=null;return{resolve:(s,r)=>!0===r?.bypassCache?e.resolve(s,r):t??((s,r)=>{const a=e.resolve(s,r).finally(()=>{t=null});return t=a,a})(s,r)}})(We({resolve:e=>s(e)},e.fs,i.stream,o)),c=((e,t={})=>{const s=t.maxSize??256,r=new Map,a=async(t,a,o)=>{const i=await e.resolve(t,a,o);if(r.set(a,i),r.size>s){const e=r.keys().next().value;void 0!==e&&r.delete(e)}return i};return{resolve:async(e,t,s)=>{if(!0===s?.bypassCache)return a(e,t,s);const o=r.get(t);return void 0!==o?(r.delete(t),r.set(t,o),o):a(e,t,s)}}})({resolve:async(e,t)=>{const s=await r(e,t);if("tree"!==s.type)throw a("tree",s.type,t);return s}}),d={enumerate:(e,s)=>async function*(e,s){const r=()=>!0===s.signal?.aborted||!0===e.signal?.aborted;if(r())throw j();const a=s.excludes,o=t(e,{...void 0===s.maxDepth?{}:{maxDepth:s.maxDepth},...void 0===s.maxEntries?{}:{maxEntries:s.maxEntries},...void 0===a?{}:{ignore:a}});for await(const{path:e,stat:t}of o){if(r())throw j();(void 0===s.paths||B(s.paths,e))&&(yield Ae(e,t))}}(e,s)};return Je({ctx:e,indexResolver:n,treeResolver:c,workdirEnumerator:d})},pt=async(e,a)=>{(e=>{if(void 0!==e.cwd&&!(e=>e.startsWith("/")||e.startsWith("\\\\")||rt.test(e))(e.cwd))throw F("cwd","must be an absolute path");const t=e.config;void 0!==t&&((e=>{if(void 0!==e){if(!Number.isInteger(e))throw F("parallelism","must be an integer");if(e<1||e>32)throw F("parallelism",`must be in 1..32 (got ${e})`)}})(t.parallelism),(e=>{if(void 0!==e&&e<1024)throw F("maxResponseBytes",`must be >= 1024 (got ${e})`)})(t.maxResponseBytes),(e=>{if(void 0!==e&&e<0)throw F("breakStaleLockMs",`must be >= 0 (got ${e})`)})(t.breakStaleLockMs),(e=>{if(void 0!==e&&e<1)throw F("maxObjectsPerPack",`must be >= 1 (got ${e})`)})(t.maxObjectsPerPack),(e=>{if(void 0!==e&&e<1)throw F("maxDnsResults",`must be >= 1 (got ${e})`)})(t.maxDnsResults),(e=>{if(void 0!==e&&"function"!=typeof e)throw F("dnsResolver","must be a function")})(t.dnsResolver))})(e);const n=e.cwd??(Pe()?globalThis.process.cwd():"/"),c=((e,t)=>{const s={fs:e.fs??t.fs,hash:e.hash??t.hash,compressor:e.compressor??t.compressor,transport:e.transport??t.transport};if(void 0===s.fs)throw T(t.runtime,"fs adapter missing");if(void 0===s.hash)throw T(t.runtime,"hash adapter missing");if(void 0===s.compressor)throw T(t.runtime,"compressor adapter missing");if(void 0===s.transport)throw T(t.runtime,"transport adapter missing");return s})(e,a),d=!0===e.unsafeRawAdapters?c:{...c,fs:at(c.fs,a.layout.workDir,ht(c.fs)),transport:mt(c.transport,e.config)},l=a.layout.gitDir,f=void 0!==e.config?(h={...e.config},st(h),h):void 0;var h;const u=new AbortController,p=void 0!==e.signal?AbortSignal.any([u.signal,e.signal]):u.signal,O={fs:d.fs,hash:d.hash,compressor:d.compressor,transport:d.transport,progress:e.progress??Te,layout:a.layout,cwd:n,runtime:a.runtime,hashConfig:a.hashConfig,deltaCache:a.deltaCache,signal:p,worktreeFs:t=>{const s=[..."string"==typeof t?[t]:t,l],r=a.makeWorktreeFs?.(s)??c.fs;return!0===e.unsafeRawAdapters?r:at(r,s,ht(r))}},j=void 0!==e.logger?$e(e.logger):void 0;let P;const $=Object.freeze({...O,...(M={config:f,logger:j,hooks:!1===e.hooks?void 0:e.hooks??a.hooks,command:!1===e.command?void 0:e.command??a.command,env:a.env,ssh:a.ssh},{...void 0!==M.config?{config:M.config}:{},...void 0!==M.logger?{logger:M.logger}:{},...void 0!==M.hooks?{hooks:M.hooks}:{},...void 0!==M.command?{command:M.command}:{},...void 0!==M.env?{env:M.env}:{},...void 0!==M.ssh?{ssh:M.ssh}:{}}),promisor:{fetch:e=>je(P).fetch(e)}});var M;P=$;let W,U="OPEN";const A=()=>{if($.signal.aborted)throw L()},B=ut($),We=Object.freeze({snapshot:B,add:(e,t)=>(A(),Oe($,e,t)),archive:e=>(A(),ze($,e)),blame:(e,t)=>(A(),Ce($,e,t)),branch:Ie($,A),bundle:Ee($,A),checkout:e=>(A(),Re($,e)),catFile:e=>(A(),De($,e)),cherryPick:Se($,A),clone:e=>(A(),Ne($,e)),commit:e=>(A(),be($,e)),config:xe($,A),describe:(e,t)=>(A(),ke($,e,t)),diff:e=>(A(),ye($,e??{})),fetch:e=>(A(),ve($,e)),fetchMissing:e=>(A(),ge($,e)),fsck:e=>(A(),we($,e)),grep:e=>(A(),pe($,e)),init:e=>(A(),ue($,e)),log:e=>(A(),he($,e)),merge:fe($,A),mv:(e,t,s)=>(A(),me($,e,t,s)),nameRev:(e,t)=>(A(),le($,e,t)),notes:de($,A),pull:e=>(A(),ce($,e)),push:e=>(A(),ne($,e)),readFileAt:(e,t,s)=>(A(),ie($,e,t,s)),rangeDiff:e=>(A(),oe($,e)),rebase:ae($,A),reflog:e=>(A(),re($,e)),remote:se($,A),reset:e=>(A(),te($,e)),revert:ee($,A),revParse:e=>(A(),K($,e)),rm:(e,t)=>(A(),J($,e,t)),shortlog:e=>(A(),Z($,e)),show:(e,t)=>(A(),Y($,e,t)),sparseCheckout:X($,A),stash:Q($,A),status:()=>(A(),V($)),submodule:G($,A),tag:q($,A),whatchanged:e=>(A(),_($,e)),worktree:H($,A),primitives:Object.freeze({bisectMidpoint:(e,t)=>(A(),Me($,e,t)),catFileBatch:(e,t)=>(A(),z($,e,t)),createCommit:e=>(A(),C($,e)),diffTrees:(e,t,s)=>(A(),I($,e,t,s)),getRepoRoot:()=>(A(),E($)),hashBlob:(e,t)=>(A(),R($,e,t)),isIgnored:e=>(A(),Fe($,e)),mergeBase:(e,t)=>(A(),D($,e,t)),readBlob:(e,t)=>(A(),o($,e,t)),readIndex:()=>(A(),s($)),readObject:(e,t)=>(A(),r($,e,t)),readTree:e=>(A(),S($,e)),resolveRef:(e,t)=>(A(),m($,e,t)),runHook:(e,t)=>(A(),N($,e,t)),streamBlob:(e,t)=>(A(),b($,e,t)),updateRef:(e,t,s)=>(A(),x($,e,t,s)),walkCommits:e=>(A(),k($,e)),walkCommitsByDate:e=>(A(),y($,e)),walkSubmodules:e=>(A(),v($,e)),walkTree:(e,t)=>(A(),i($,e,t)),walkWorkingTree:e=>(A(),t($,e)),writeObject:e=>(A(),g($,e)),writeTree:e=>(A(),w($,e))}),ctx:$,dispose:async()=>{if("DISPOSED"!==U)return void 0!==W||(U="DISPOSING",u.abort(),W=(async()=>{await new Promise(e=>{"function"==typeof setImmediate?setImmediate(e):setTimeout(e,0)}),await(async e=>{await Promise.all(tt.map(t=>(async(e,t)=>{const s=e[t];if("function"==typeof s.dispose)try{await s.dispose()}catch(s){e.logger?.warn?.("disposeAdapters: port dispose threw",{port:t,err:String(s)})}})(e,t)))})($),U="DISPOSED"})()),W}});return We};export{pt as o};
@@ -0,0 +1 @@
1
+ import{T as t,v as e,k as n,x as o,u as r,y as s,o as i,z as a,A as c,B as d,l as u,C as f,D as l,E as h,F as w,G as g,H as p,I as m,J as y,K as v,L as b,M as k,N as x}from"./error-BotOd-nD.js";import{r as I}from"./readable-stream-CGuf8k1J.js";const E=e=>new t({code:"INVALID_OBJECT_ID",value:e}),$=e=>new t({code:"INVALID_OBJECT_HEADER",reason:e}),C=(e,n)=>new t({code:"INVALID_TREE_ENTRY",offset:e,reason:n}),D=e=>new t({code:"INVALID_COMMIT",reason:e}),L=e=>new t({code:"INVALID_TAG",reason:e}),S=(e,n)=>new t({code:"INVALID_IDENTITY",line:e,reason:n}),O=e=>new t({code:"OBJECT_NOT_FOUND",id:e}),A=(e,n)=>new t({code:"OBJECT_HASH_MISMATCH",expected:e,actual:n}),U=(e,n,o)=>new t({code:"UNEXPECTED_OBJECT_TYPE",expected:e,actual:n,id:o}),T=e=>new t({code:"TREE_DEPTH_EXCEEDED",depth:e}),M=(e,n)=>new t({code:"TREE_ENTRY_LIMIT_EXCEEDED",count:e,limit:n}),N=(e,n,o)=>new t({code:"OBJECT_TOO_LARGE",id:e,actualSize:n,limit:o}),_={REGULAR:"100644",EXECUTABLE:"100755",SYMLINK:"120000",DIRECTORY:"40000",GITLINK:"160000"},R=new Set(Object.values(_)),P=new Map([["040000",_.DIRECTORY]]);function F(e){return function(e){if(!R.has(e))throw new t({code:"INVALID_FILE_MODE",value:e});return e}(P.get(e)??e)}function z(t){return t===_.DIRECTORY}function B(t){return t.isSymbolicLink?_.SYMLINK:73&t.mode?_.EXECUTABLE:_.REGULAR}const j=function(){const t=new Uint32Array(256);for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)n=1&n?3988292384^n>>>1:n>>>1;t[e]=n}return t}();function W(t){let e=4294967295;for(let n=0;n<t.length;n++)e=j[255&(e^t[n])]^e>>>8;return(4294967295^e)>>>0}const H=t=>/[a-zA-Z0-9-]/.test(t),G=t=>{if(!/[a-zA-Z]/.test(t[0]))return 0;for(let e=1;e<t.length;e+=1)if(!H(t[e]))return e},K=/[\n\0]/,Y=t=>{const n=t.indexOf(".");if(-1===n)throw e(t,"missing-name");const o=t.slice(0,n),r=t.lastIndexOf("."),s=t.slice(r+1),i=n===r?void 0:t.slice(n+1,r);if(0===o.length&&void 0===i)throw e(t,"empty-section");if(0===s.length)throw e(t,"missing-name");if(o.length>0){const n=G(o);if(void 0!==n)throw e(t,"bad-character",n)}const a=G(s);if(void 0!==a)throw e(t,"bad-character",r+1+a);if(void 0!==i&&K.test(i)){const o=i.search(K);throw e(t,"bad-character",n+1+o)}return{section:o.toLowerCase(),subsection:i,name:s.toLowerCase()}},V=1e6,q=e=>new t({code:"INVALID_INDEX_HEADER",reason:e}),X=(e,n)=>new t({code:"INVALID_INDEX_ENTRY",offset:e,reason:n}),J={assumeValid:!1,stage:0,skipWorktree:!1,intentToAdd:!1},Q=t=>({ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:t.mode,uid:0,gid:0,fileSize:0,id:t.id,flags:{...J,skipWorktree:!0},path:t.path}),Z=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function tt(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=Z[t[n]];return e.join("")}function et(t){if(t.length%2!=0)throw new Error("Hex string must have even length");const e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2){const o=nt(t.charCodeAt(n)),r=nt(t.charCodeAt(n+1));if(-1===o||-1===r)throw new Error(`Invalid hex character at position ${n}`);e[n/2]=o<<4|r}return e}function nt(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:-1}function ot(t,e){const n=Math.min(t.length,e.length);for(let o=0;o<n;o++)if(t[o]!==e[o])return t[o]-e[o];return t.length-e.length}function rt(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function st(t,e,n){for(let o=n;o<t.length;o++)if(t[o]===e)return o;return-1}const it=new TextEncoder,at=new TextDecoder;function ct(t){return it.encode(t)}function dt(t){return at.decode(t)}function ut(t){const e=t.indexOf("\n\n");return-1===e?{headerPart:t,message:""}:{headerPart:t.slice(0,e),message:t.slice(e+2)}}function ft(t,e){if(t.includes("\n")||t.includes(" ")||""===t)throw new Error(`invalid header key: ${t}`);const n=e.split("\n");return[`${t} ${n[0]}`,...n.slice(1).map(t=>` ${t}`)].join("\n")}function lt(t){const e=t.indexOf(" ");return-1===e?{key:t,value:""}:{key:t.slice(0,e),value:t.slice(e+1)}}function ht(t){const e=t.lastIndexOf(">");if(-1===e)throw S(t,"missing closing angle bracket");const n=t.lastIndexOf("<",e);if(-1===n)throw S(t,"missing opening angle bracket");const o=t.slice(0,n),r=o.endsWith(" ")?o.slice(0,-1):o,s=t.slice(n+1,e),i=t.slice(e+1).trim().split(/\s+/);if(i.length<2)throw S(t,"missing timestamp or timezone");const a=Number(i[0]);if(!Number.isSafeInteger(a))throw S(t,"invalid timestamp");const c=i[1];if(!/^[+-]\d{4}$/.test(c))throw S(t,"invalid timezone offset");return{name:r,email:s,timestamp:a,timezoneOffset:c}}const wt=/[\n\r\0]/;function gt(t){const e=`${t.name} <${t.email}>`;if(wt.test(t.name))throw S(e,"name contains forbidden control character");if(wt.test(t.email))throw S(e,"email contains forbidden control character");if(wt.test(t.timezoneOffset))throw S(e,"timezoneOffset contains forbidden control character");if(t.name.includes("<")||t.name.includes(">"))throw S(e,"invalid identity fields");if(t.email.includes("<")||t.email.includes(">"))throw S(e,"invalid identity fields");if(!/^[+-]\d{4}$/.test(t.timezoneOffset))throw S(e,"invalid identity fields");return`${t.name} <${t.email}> ${t.timestamp} ${t.timezoneOffset}`}const pt=/^[0-9a-f]{40}$/,mt=/^[0-9a-f]{64}$/,yt={from(t){if(!pt.test(t)&&!mt.test(t))throw E(t);return t},fromRaw(t){if(20!==t.length&&32!==t.length)throw E(`raw bytes length ${t.length} is not 20 or 32`);return yt.from(tt(t))}},vt=yt.from("0000000000000000000000000000000000000000");yt.from("4b825dc642cb6eb9a060e54bf8d69288fbee4904");const bt={from(t){if(""===t)throw new Error("RefName must not be empty");return t}},kt={from(t){if(""===t)throw new Error("FilePath must not be empty");return t}};function xt(t){const e=[],{data:n}=t;e.push(`tree ${n.tree}`);for(const t of n.parents)e.push(`parent ${t}`);e.push(`author ${gt(n.author)}`),e.push(`committer ${gt(n.committer)}`),void 0!==n.gpgSignature&&e.push(ft("gpgsig",n.gpgSignature));for(const t of n.extraHeaders)e.push(ft(t.key,t.value));return ct(`${e.join("\n")}\n\n${n.message}`)}const It=new Set(["blob","tree","commit","tag"]);function Et(t){const e=st(t,0,0);if(-1===e)throw $("missing null terminator");const n=dt(t.subarray(0,e)),o=n.indexOf(" ");if(-1===o)throw $("missing space between type and size");const r=n.slice(0,o);if(!It.has(r))throw $(`unknown object type: ${r}`);const s=n.slice(o+1),i=Number(s);if(!Number.isFinite(i)||i<0||s!==String(i))throw $(`invalid size: ${s}`);return{type:r,size:i,contentOffset:e+1}}const $t=new Set(["blob","tree","commit","tag"]),Ct=/-----BEGIN (?:PGP|SSH) SIGNATURE-----[\s\S]*-----END (?:PGP|SSH) SIGNATURE-----\n?$/;function Dt(t){const e=[],{data:n}=t;if(e.push(`object ${n.object}`),e.push(`type ${n.objectType}`),""===n.tagName||n.tagName.includes("\n")||n.tagName.includes("\0"))throw L(`invalid tag name: ${n.tagName}`);e.push(`tag ${n.tagName}`),void 0!==n.tagger&&e.push(`tagger ${gt(n.tagger)}`);for(const t of n.extraHeaders)e.push(ft(t.key,t.value));return ct(`${e.join("\n")}\n\n${void 0!==n.gpgSignature?`${n.message}${n.gpgSignature}`:n.message}`)}function Lt(t,e){const n=St(t.entries).map(t=>({mode:ct(t.mode),name:ct(t.name),hash:et(t.id)})),o=n.reduce((t,n)=>t+n.mode.length+1+n.name.length+1+e.digestLength,0),r=new Uint8Array(o);let s=0;for(const t of n)r.set(t.mode,s),s+=t.mode.length,r[s++]=32,r.set(t.name,s),s+=t.name.length,r[s++]=0,r.set(t.hash,s),s+=t.hash.length;return r}function St(t){const e=t.map(t=>({entry:t,sortKey:At(t.name,z(t.mode))}));return e.sort((t,e)=>ot(t.sortKey,e.sortKey)),e.map(t=>t.entry)}function Ot(t,e){return ot(At(t.name,z(t.mode)),At(e.name,z(e.mode)))}function At(t,e){const n=ct(t);if(!e)return n;const o=new Uint8Array(n.length+1);return o.set(n),o[n.length]=47,o}function Ut(t,e,n){const{type:o,size:r,contentOffset:s}=Et(e),i=e.subarray(s);if(i.length!==r)throw $(`size mismatch: header says ${r}, actual content is ${i.length}`);switch(o){case"blob":return function(t,e){return{type:"blob",id:t,content:e}}(t,i);case"tree":return function(t,e,n){const o=[],r=new Set;let s=0;for(;s<e.length;){const t=st(e,32,s);if(-1===t)throw C(s,"missing space after mode");const i=dt(e.subarray(s,t)),a=st(e,0,t+1);if(-1===a)throw C(s,"missing null after name");const c=dt(e.subarray(t+1,a));if(""===c||"."===c||".."===c||c.includes("/"))throw C(s,`invalid entry name: ${c}`);const d=a+1,u=d+n.digestLength;if(u>e.length)throw C(s,"truncated hash");const f=e.subarray(d,u),l=yt.fromRaw(f),h=F(i);if(r.has(c))throw C(s,`duplicate entry name: ${c}`);r.add(c),o.push({mode:h,name:c,id:l}),s=u}return{type:"tree",id:t,entries:o}}(t,i,n);case"commit":return function(t,e){const{headerPart:n,message:o}=ut(dt(e)),r=n.split("\n"),{tree:s,parents:i,author:a,committer:c,nextIndex:d}=function(t){if(!t[0].startsWith("tree "))throw D("first line must be tree");const e=yt.from(t[0].slice(5)),n=[];let o=1;for(;o<t.length&&t[o].startsWith("parent ");)n.push(yt.from(t[o].slice(7))),o++;if(o>=t.length||!t[o].startsWith("author "))throw D("missing author");const r=ht(t[o].slice(7));if(o++,o>=t.length||!t[o].startsWith("committer "))throw D("missing committer");const s=ht(t[o].slice(10));return o++,{tree:e,parents:n,author:r,committer:s,nextIndex:o}}(r),{gpgSignature:u,extraHeaders:f}=function(t,e){return function(t,e,n,o){let r;const s=[];let i=e;for(;i<t.length;){const{key:e,value:a}=lt(t[i]);""===e&&n("unexpected continuation line without preceding header");const c=[a];let d=i;for(let e=i+1;e<t.length;e++){const n=t[e];if(!n.startsWith(" "))break;c.push(n.slice(1)),d=e}i=d+1;const u=c.join("\n");"gpgsig"===e?(void 0!==r&&o("duplicate gpgsig header"),r=u):s.push({key:e,value:u})}return{gpgSignature:r,extraHeaders:s}}(t,e,t=>{throw D(t)},t=>{throw D(t)})}(r,d);return{type:"commit",id:t,data:{tree:s,parents:i,author:a,committer:c,message:o,...void 0!==u?{gpgSignature:u}:{},extraHeaders:f}}}(t,i);case"tag":return function(t,e){const{headerPart:n,message:o}=ut(dt(e)),r=n.split("\n"),{object:s,objectType:i,tagName:a,nextIndex:c}=function(t){if(!t[0].startsWith("object "))throw L("first line must be object");const e=yt.from(t[0].slice(7));if(t.length<2||!t[1].startsWith("type "))throw L("second line must be type");const n=t[1].slice(5);if(!$t.has(n))throw L(`invalid object type: ${n}`);if(t.length<3||!t[2].startsWith("tag "))throw L("third line must be tag name");const o=t[2].slice(4);if(""===o||o.includes("\0")||o.includes("\n"))throw L(`invalid tag name: ${o}`);return{object:e,objectType:n,tagName:o,nextIndex:3}}(r),{tagger:d,nextIndex:u}=function(t,e){return e<t.length&&t[e].startsWith("tagger ")?{tagger:ht(t[e].slice(7)),nextIndex:e+1}:{tagger:void 0,nextIndex:e}}(r,c),{extraHeaders:f}=function(t,e){const n=[];let o=e;for(;o<t.length;){const{key:e,value:r}=lt(t[o]);if(""===e)throw L("unexpected continuation line without preceding header");const s=[r];let i=o;for(let e=o+1;e<t.length;e++){const n=t[e];if(!n.startsWith(" "))break;s.push(n.slice(1)),i=e}o=i+1,n.push({key:e,value:s.join("\n")})}return{extraHeaders:n}}(r,u),{message:l,gpgSignature:h}=function(t){const e=Ct.exec(t);return null===e?{message:t,gpgSignature:void 0}:{message:t.slice(0,e.index),gpgSignature:e[0]}}(o);return{type:"tag",id:t,data:{object:s,objectType:i,tagName:a,...void 0!==d?{tagger:d}:{},message:l,...void 0!==h?{gpgSignature:h}:{},extraHeaders:f}}}(t,i)}}function Tt(t,e){let n;switch(t.type){case"blob":n=t.content;break;case"tree":n=Lt(t,e);break;case"commit":n=xt(t);break;case"tag":n=Dt(t)}const o=ct(`${t.type} ${n.length}\0`),r=new Uint8Array(o.length+n.length);return r.set(o,0),r.set(n,o.length),r}const Mt=(t,e)=>{switch(t.type){case"blob":return t.content.byteLength;case"tree":return Lt(t,e).byteLength;case"commit":return xt(t).byteLength;case"tag":return Dt(t).byteLength}},Nt=new Set(["",".",".."]),_t=new Set([1564,8206,8207,8234,8235,8236,8237,8238,8294,8295,8296,8297]),Rt=t=>""===t?"empty segment rejected":"."===t?"'.' segment rejected":"'..' segment rejected",Pt=t=>t<32||t>=127&&t<=159,Ft=(t,e)=>{if(t.startsWith("/"))throw X(e,"absolute path rejected");const n=(t=>{for(let e=0;e<t.length;e+=1){const n=t.charCodeAt(e);if(92===n)return"backslash rejected";if(Pt(n))return"control character rejected";if(_t.has(n))return"bidi control character rejected"}})(t);if(void 0!==n)throw X(e,n);for(const n of t.split("/"))if(Nt.has(n))throw X(e,Rt(n))};function zt(t,e,n,o){const r=t.getUint16(e+60),s=!!(16384&r);if(s&&3!==n)throw X(e,"extended flag requires index v3");const i=s?2:0;if(e+62+i>o-20)throw X(e,"truncated extended flags");return{flags:(a=r,c=s?t.getUint16(e+62):0,{assumeValid:!!(32768&a),stage:a>>>12&3,skipWorktree:!!(16384&c),intentToAdd:!!(8192&c)}),extendedSize:i};var a,c}function Bt(t,e){for(let n=e;n<t.length;n++)if(0===t[n])return n;return-1}function jt(t,e){const n=t.path,o=e.path;return n<o?-1:n>o?1:0}function Wt(t,e,n,o,r,s){e.setUint32(n,o.ctimeSeconds),e.setUint32(n+4,o.ctimeNanoseconds),e.setUint32(n+8,o.mtimeSeconds),e.setUint32(n+12,o.mtimeNanoseconds),e.setUint32(n+16,o.dev),e.setUint32(n+20,o.ino),e.setUint32(n+24,Number.parseInt(o.mode,8)),e.setUint32(n+28,o.uid),e.setUint32(n+32,o.gid),e.setUint32(n+36,o.fileSize);const i=et(o.id);t.set(i,n+40);const a=Math.min(r.length,4095);e.setUint16(n+60,(o.flags.assumeValid?32768:0)|(s?16384:0)|o.flags.stage<<12|a),s&&e.setUint16(n+62,(o.flags.skipWorktree?16384:0)|(o.flags.intentToAdd?8192:0)),t.set(r,n+62+(s?2:0))}function Ht(t){switch(t.type){case"add":case"rename":case"copy":return t.newPath;case"delete":return t.oldPath;case"modify":case"type-change":return t.path}}function Gt(t){return t===_.REGULAR||t===_.EXECUTABLE?"file":t===_.SYMLINK?"symlink":t===_.DIRECTORY?"directory":"gitlink"}function Kt(t,e){return Gt(t)===Gt(e)}function Yt(t){return"gitlink"===Gt(t)}const Vt=new TextEncoder;function qt(t,e){return ot(Vt.encode(t),Vt.encode(e))}function Xt(t,e){const n=t.map(t=>({item:t,key:Vt.encode(e(t))}));return n.sort((t,e)=>ot(t.key,e.key)),n.map(t=>t.item)}function Jt(t){return 32===t||9===t}function Qt(t){const e=t.length-1;return e>=0&&10===t[e]?e:t.length}function Zt(t,e){const n=function(t,e){return e.ignoreCrAtEol||"all"===e.mode||"change"===e.mode||"at-eol"===e.mode?function(t){const e=Qt(t),n=e-1;if(n<0||13!==t[n])return t;const o=new Uint8Array(t.length-1);return o.set(t.subarray(0,n)),e<t.length&&(o[n]=10),o}(t):t}(t,e);switch(e.mode){case"all":return function(t){const e=Qt(t),n=[];for(let o=0;o<e;o++){const e=t[o];Jt(e)||n.push(e)}return e<t.length&&n.push(10),new Uint8Array(n)}(n);case"change":return function(t){const e=Qt(t),n=[];let o=!1;for(let r=0;r<e;r++){const e=t[r];Jt(e)?o||(n.push(32),o=!0):(o=!1,n.push(e))}return n.length>0&&32===n[n.length-1]&&n.pop(),e<t.length&&n.push(10),new Uint8Array(n)}(n);case"at-eol":return function(t){const e=Qt(t);let n=e;for(;n>0&&Jt(t[n-1]);)n--;if(n===e&&e===t.length)return t;const o=new Uint8Array(n+(e<t.length?1:0));return o.set(t.subarray(0,n)),e<t.length&&(o[n]=10),o}(n);case"none":return n}}const te={mode:"none",ignoreCrAtEol:!1};function ee(t,e){return 0===Qt(Zt(t,e))}const ne=65536,oe=1e5;function re(t){const e=[];let n=0;for(let o=0;o<t.length;o++)10===t[o]&&(e.push(t.subarray(n,o+1)),n=o+1);return n<t.length&&e.push(t.subarray(n)),e}function se(t){return function(t){const e=Math.min(t.length,8e3);for(let n=0;n<e;n++)if(0===t[n])return!0;return!1}(t)||function(t){let e=0,n=0;for(let o=0;o<t.length;o++){if(e++,e>=65536)return!0;if(10===t[o]){if(n++,n>=oe)return!0;e=0}}return e>0&&(n++,n>=oe)}(t)}function ie(t,e,n,o){return o===-n||t[o-1+e]<t[o+1+e]}function ae(t,e,n,o,r,s,i){let a=ie(n,o,r,s)?n[s+1+o]:n[s-1+o]+1,c=a-s;for(;a<t.length&&c<e.length&&i(t[a],e[c]);)a++,c++;return{x:a,y:c}}function ce(t){const e=[];let n=0,o=0,r=0;for(;r<t.length;){const s=t[r],i=n,a=o;for(;t[r]===s;)"equal"===s?(n++,o++):"delete"===s?n++:o++,r++;e.push({kind:"equal"===s?"common":"delete"===s?"ours-only":"theirs-only",oursStart:i,oursEnd:n,theirsStart:a,theirsEnd:o})}return e}function de(t,e,n){const o=n?.lineKey,r=o?(t,e)=>function(t,e,n){return rt(Zt(t,n),Zt(e,n))}(t,e,o):rt,s=re(t),i=re(e),a=s.length,c=i.length;if(0===a&&0===c)return{hunks:[{kind:"common",oursStart:0,oursEnd:0,theirsStart:0,theirsEnd:0}],oursLines:s,theirsLines:i,degraded:!1};const d=function(t,e,n){const o=t.length,r=e.length;if(o+r>5e4)return;const s=o+r,i=s,a=new Array(2*s+1).fill(0),c=[],d=1e3*s;let u=0;for(let s=0;;s++){const f=2*s+1,l=new Array(f);for(let t=0;t<f;t++)l[t]=a[i-s+t];c.push(l);for(let f=-s;f<=s;f+=2){if(u++,u>d)return;const l=ae(t,e,a,i,s,f,n);if(a[f+i]=l.x,l.x>=o&&l.y>=r)return{trace:c,totalD:s}}}}(s,i,r);return void 0===d?function(t,e){const n=[];return t.length>0&&n.push({kind:"ours-only",oursStart:0,oursEnd:t.length,theirsStart:0,theirsEnd:0}),e.length>0&&n.push({kind:"theirs-only",oursStart:t.length,oursEnd:t.length,theirsStart:0,theirsEnd:e.length}),{hunks:n,oursLines:t,theirsLines:e,degraded:!0}}(s,i):{hunks:ce(function(t,e,n){const o=[];let r=t,s=e;for(let t=n.length-1;t>0;t--){const e=n[t],i=t,a=r-s,c=ie(e,i,t,a)?a+1:a-1,d=e[c+i],u=d-c;for(;r>d&&s>u;)o.push("equal"),r--,s--;o.push(r===d?"insert":"delete"),r===d?s--:r--}for(;r>0;)o.push("equal"),r--;return o.reverse(),o}(a,c,d.trace)),oursLines:s,theirsLines:i,degraded:!1}}const ue=6e4,fe=107927;function le(t){const e=new Map,n=t.length;let o=0,r=0,s=0;for(let i=0;i<n;i++){const n=t[i],a=o;if(o=(o<<7^r>>>25)+n>>>0,r=(r<<7^a>>>25)>>>0,s++,s>=64||10===n){const t=(o+Math.imul(r,97))%fe;e.set(t,(e.get(t)??0)+s),s=0,o=0,r=0}}if(s>0){const t=(o+Math.imul(r,97))%fe;e.set(t,(e.get(t)??0)+s)}return e}function he(t,e){let n=0;for(const[o,r]of t){const t=e.get(o)??0;t>0&&(n+=Math.min(r,t))}return n}function we(t){return 100*t/ue|0}function ge(t,e){const n=e.get(t.newId);if(void 0===n||1!==n.length)return;const o=n[0];return{rename:{type:"rename",oldPath:o.oldPath,newPath:t.newPath,oldId:o.oldId,newId:t.newId,oldMode:o.oldMode,newMode:t.newMode,similarity:{score:ue,maxScore:ue}},consumedDelete:o}}function pe(t,e,n){if("ours-only"===e.kind){for(let o=e.oursStart;o<e.oursEnd;o++)if(!ee(t.oursLines[o],n))return!0;return!1}for(let o=e.theirsStart;o<e.theirsEnd;o++)if(!ee(t.theirsLines[o],n))return!0;return!1}function me(t,e,n){return"theirs-only"!==e.kind?0:void 0===n||pe(t,e,n)?e.theirsEnd-e.theirsStart:0}function ye(t,e,n){return"ours-only"!==e.kind?0:void 0===n||pe(t,e,n)?e.oursEnd-e.oursStart:0}const ve=(t,e,n)=>{const o=n?.numstatBinaryOverride;if("binary"===o||void 0===o&&(se(t)||se(e)))return{added:0,deleted:0,binary:!0};const r=n?.lineKey,s=de(t,e,void 0!==r?{lineKey:r}:void 0),i=!0===n?.ignoreBlankLines?r??te:void 0;let a=0,c=0;for(const t of s.hunks)a+=me(s,t,i),c+=ye(s,t,i);return{added:a,deleted:c,binary:!1}};function be(t){return{type:"add",newPath:t.name,newId:t.id,newMode:t.mode}}function ke(t){return{type:"delete",oldPath:t.name,oldId:t.id,oldMode:t.mode}}function xe(t,e){if(t.id!==e.id||t.mode!==e.mode)return Kt(t.mode,e.mode)?{type:"modify",path:t.name,oldId:t.id,newId:e.id,oldMode:t.mode,newMode:e.mode}:{type:"type-change",path:t.name,oldId:t.id,newId:e.id,oldMode:t.mode,newMode:e.mode}}function Ie(t){return void 0===t?[]:St(t.entries)}function Ee(t,e){const n=Ie(t),o=Ie(e),r=[];let s=0,i=0;for(;s<n.length&&i<o.length;){const t=n[s],e=o[i],a=Ot(t,e);if(a<0)r.push(ke(t)),s++;else if(a>0)r.push(be(e)),i++;else{const n=xe(t,e);void 0!==n&&r.push(n),s++,i++}}for(;s<n.length;)r.push(ke(n[s])),s++;for(;i<o.length;)r.push(be(o[i])),i++;return{changes:r}}const $e=(t,e,n)=>{const o=((t,e,n)=>{let o;for(let r=0;r<t.length;r+=1){const s=t[r];s.directoryOnly&&!n||s.compiled.test(e)&&(o={rule:s,index:r})}return o})(t,e,n);return void 0===o?{verdict:"unset"}:{verdict:o.rule.negated?"unignored":"ignored",ruleIndex:o.index}},Ce=(t,e)=>{if(""===e)return t;const n=`${e}/`;return t.startsWith(n)?t.slice(n.length):void 0},De=(t,e,n)=>{let o={verdict:"unset"};for(const r of t){const t=Ce(e,r.basedir);if(void 0===t)continue;const s=$e(r.rules,t,n);void 0!==s.ruleIndex&&(o={verdict:s.verdict,level:r,ruleIndex:s.ruleIndex})}return o},Le={kind:"star-slash"},Se=(t,e)=>{const n=t[e];return"*"===n?((t,e)=>{if("*"!==t[e+1])return{token:{kind:"star"},next:e+1};const n=e+2;return"/"===t[n]?{token:{kind:"star-slash"},next:n+1}:{token:{kind:"star-star"},next:n}})(t,e):"?"===n?{token:{kind:"single"},next:e+1}:{token:{kind:"literal",char:n},next:e+1}},Oe=(t,e,n)=>{switch(t.kind){case"literal":return((t,e,n)=>{const o=new Uint8Array(e.length+1);for(let r=0;r<e.length;r++)e[r]===t&&1===n[r+1]&&(o[r]=1);return o})(t.char,e,n);case"single":return((t,e)=>{const n=new Uint8Array(t.length+1);for(let o=0;o<t.length;o++)"/"!==t[o]&&1===e[o+1]&&(n[o]=1);return n})(e,n);case"star":return((t,e)=>{const n=new Uint8Array(t.length+1);n[t.length]=1===e[t.length]?1:0;for(let o=t.length-1;o>=0;o--)n[o]=1===e[o]||"/"!==t[o]&&1===n[o+1]?1:0;return n})(e,n);case"star-star":return((t,e)=>{const n=new Uint8Array(t.length+1);n[t.length]=1===e[t.length]?1:0;for(let o=t.length-1;o>=0;o--)n[o]=1===e[o]||1===n[o+1]?1:0;return n})(e,n);case"star-slash":return((t,e)=>{const n=new Uint8Array(t.length+1);for(let o=t.length-1;o>=0;o--)n[o]="/"===t[o]&&1===e[o+1]||1===n[o+1]?1:0;const o=new Uint8Array(t.length+1);for(let r=0;r<=t.length;r++)o[r]=1===e[r]||1===n[r]?1:0;return o})(e,n)}},Ae=(t,e)=>{const n=(t=>{const e=[];let n=0;for(;n<t.length;){const o=Se(t,n);e.push(o.token),n=o.next}return e})(t);return{test:t=>((t,e,n)=>{let o=((t,e)=>{const n=new Uint8Array(t.length+1);if(n[t.length]=1,e)for(let e=0;e<t.length;e++)"/"===t[e]&&(n[e]=1);return n})(n,!0===e.withDirSuffix);for(let e=t.length-1;e>=0;e--)o=Oe(t[e],n,o);return e.anchored||(o=Oe(Le,n,o)),1===o[0]})(n,e,t)}},Ue=t=>t.includes("*")||t.includes("?"),Te=t=>{let e=t.length;for(;e>0&&32===t.charCodeAt(e-1)&&!(e>=2&&92===t.charCodeAt(e-2));)e-=1;return t.slice(0,e)},Me=t=>t.replace(/\\(.)/g,"$1"),Ne=t=>{if(""===t)return;if(/^\s*$/.test(t))return;if(t.startsWith("#"))return;const e=Te(t),n=e.startsWith("!"),o=n?e.slice(1):e,r=o.endsWith("/"),s=r?o.slice(0,-1):o,i=s.startsWith("/")||s.includes("/"),a=s.startsWith("/")?s.slice(1):s;return{negated:n,anchored:i,directoryOnly:r,cleanPattern:Me(a)}},_e=e=>new t({code:"INVALID_REFLOG_ENTRY",reason:e}),Re=e=>new t({code:"REFLOG_NOT_FOUND",ref:e}),Pe=(e,n,o)=>new t({code:"REFLOG_ENTRY_OUT_OF_RANGE",ref:e,requested:n,available:o}),Fe=/[\n\r]/;function ze(t){if(Fe.test(t.message))throw _e("message contains a line break");const e=gt(t.identity),n=`${t.oldId} ${t.newId} ${e}`;return""===t.message?`${n}\n`:`${n}\t${t.message}\n`}function Be(t){const e=t.indexOf("\t"),n=-1===e?t:t.slice(0,e),o=-1===e?"":t.slice(e+1);if(" "!==n[40]||" "!==n[81])throw _e("misplaced field separator");return{oldId:We(n.slice(0,40)),newId:We(n.slice(41,81)),identity:function(t){try{return ht(t)}catch{throw _e("invalid identity")}}(n.slice(82)),message:o}}function je(t){return t.replace(/[\r\n]+/g," ").trim()}function We(t){try{return yt.from(t)}catch{throw _e("invalid object id")}}const He=["refs/heads/","refs/remotes/","refs/notes/"];const Ge=e=>new t({code:"INVALID_REF",reason:e}),Ke=e=>new t({code:"INVALID_PACKED_REFS",reason:e}),Ye=e=>new t({code:"REF_NOT_FOUND",name:e}),Ve=(e,n)=>new t({code:"REF_CHAIN_TOO_DEEP",depth:e,chain:n}),qe=e=>new t({code:"REF_CYCLE_DETECTED",chain:e}),Xe=new Set(["~","^",":","?","*","[","\\"," "]);function Je(t){if(""===t)throw Ge("ref name must not be empty");if(t.startsWith("/")||t.endsWith("/"))throw Ge("ref name must not start or end with /");if(t.startsWith("-"))throw Ge("ref name must not start with -");if("@"===t)throw Ge("ref name must not be single @");if(t.includes(".."))throw Ge("ref name must not contain ..");if(t.includes("//"))throw Ge("ref name must not contain consecutive slashes");if(t.includes("@{"))throw Ge("ref name must not contain @{");if(t.endsWith("."))throw Ge("ref name must not end with .");!function(t){for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n<=31||127===n)throw Ge("ref name contains forbidden character");const o=t[e];if(void 0!==o&&Xe.has(o))throw Ge("ref name contains forbidden character");if(n>=8234&&n<=8238||n>=8294&&n<=8297)throw Ge("ref name contains forbidden Unicode override")}}(t);const e=t.split("/");for(const t of e){if(t.startsWith("."))throw Ge("ref name component must not start with .");if(t.endsWith(".lock"))throw Ge("ref name component must not end with .lock")}return t}function Qe(t){try{return Je(t),!0}catch{return!1}}function Ze(t){const e=t.replace(/[\r\n]+$/,"");if(""===e)throw Ge("empty ref content");if(e.startsWith("ref: ")){const t=e.slice(5);if(""===t)throw Ge("empty symbolic ref target");return{type:"symbolic",target:Je(t)}}return{type:"direct",target:yt.from(e)}}function tn(t){return`ref: ${t}\n`}const en="MERGE_HEAD",nn="MERGE_MSG",on="ORIG_HEAD",rn="CHERRY_PICK_HEAD",sn="REVERT_HEAD",an="REBASE_HEAD",cn="FETCH_HEAD",dn=new Set(["HEAD",on,cn,en,rn,sn,"BISECT_HEAD"]),un=["refs/bisect/","refs/worktree/","refs/rewritten/"],fn=t=>{const e=t.split("/"),n=[];for(let t=e.length-1;t>0;t-=1)n.push(e.slice(0,t).join("/"));return n},ln=t=>{const e=t.replace(/\\/g,"/").replace(/^\/+/,"").replace(/\/+$/,"");for(const n of e.split("/"))hn(n,t);return e},hn=(t,e)=>{const o=e.slice(0,128);if(""===t||"."===t||".."===t)throw n("patterns",`cone directory has an invalid segment: ${o}`);if(t.includes("*")||t.includes("?"))throw n("patterns",`cone directory must not contain glob metacharacters: ${o}`);if(/[\n\r\0]/.test(t))throw n("patterns",`cone directory must not contain control characters: ${o}`)},wn=t=>{const e=new Set(t.map(ln)),n=new Set;for(const t of e)for(const o of fn(t))e.has(o)||n.add(o);return{mode:"cone",recursive:e,parents:n}},gn=t=>{const e=[...t.parents,...t.recursive].sort();let n="";for(const o of e)n+=`/${o}/\n`,t.parents.has(o)&&(n+=`!/${o}/*/\n`);return"/*\n!/*/\n"+n},pn=t=>{if(!t.startsWith("/")||!t.endsWith("/"))return;const e=t.slice(1,-1);return""===e||e.startsWith("!")?void 0:e},mn=(t,e)=>{const n=(t=>{if(t.directoryOnly)return!0;const e=t.cleanPattern.split("/"),n=e[e.length-1];return!n.includes("*")&&!n.includes("?")})(t);return{source:e,negated:t.negated,matcher:Ae(t.cleanPattern,{anchored:t.anchored,withDirSuffix:n})}},yn=new TextEncoder,vn=t=>{const e=t.split("\n").map(t=>t.replace(/\r$/,"")),o=[];for(const t of e){if(yn.encode(t).byteLength>256)throw n("patterns","pattern exceeds max length 256 bytes");const e=Ne(t);if(void 0!==e){if(o.length>=2048)throw n("patterns","pattern file exceeds max 2048 patterns");o.push(mn(e,t))}}return o},bn=(t,e)=>{if(e){const e=(t=>{const e=t.split("\n").map(t=>t.replace(/\r$/,""));if("/*"!==e[0]||"!/*/"!==e[1])return;const n=new Set,o=new Set;let r=2;for(;r<e.length;){const t=e[r];if(""===t){r+=1;continue}const s=pn(t);if(void 0===s)return;r+=1,e[r]===`!/${s}/*/`?(o.add(s),r+=1):n.add(s)}return{mode:"cone",recursive:n,parents:o}})(t);return void 0!==e?{spec:e,degraded:!1}:{spec:{mode:"no-cone",rules:vn(t)},degraded:!0}}return{spec:{mode:"no-cone",rules:vn(t)},degraded:!1}},kn=t=>{return"cone"===t.mode?(t=>e=>{const n=(t=>{const e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)})(e);if(""===n)return!0;if(t.parents.has(n))return!0;let o=n;for(;;){if(t.recursive.has(o))return!0;const e=o.lastIndexOf("/");if(-1===e)return!1;o=o.slice(0,e)}})(t):(e=t.rules,t=>{let n=!1;for(const o of e)o.matcher.test(t)&&(n=!o.negated);return n});var e},xn=e=>new t({code:"INVALID_PACK_HEADER",reason:e}),In=e=>new t({code:"INVALID_PACK_INDEX",reason:e}),En=(e,n)=>new t({code:"INVALID_PACK_ENTRY",offset:e,reason:n}),$n=e=>new t({code:"INVALID_DELTA",reason:e}),Cn=e=>new t({code:"DELTA_CHAIN_TOO_DEEP",depth:e});function Dn(t,e){if(e>=t.length)throw $n("truncated variable-length integer");let n=0,o=0,r=e,s=0,i=t[r];for(n=(127&i)<<o>>>0,o+=7,s+=1;128&i;){if(s>=5)throw $n("variable-length integer too long");if(r+=1,r>=t.length)throw $n("truncated variable-length integer");i=t[r],n=(n|(127&i)<<o)>>>0,o+=7,s+=1}return{value:n,nextOffset:r+1}}function Ln(t,e,n){const o=function(t){let e=0;return 1&t&&(e+=1),2&t&&(e+=1),4&t&&(e+=1),8&t&&(e+=1),16&t&&(e+=1),32&t&&(e+=1),64&t&&(e+=1),e}(n);if(e+o>t.length)throw $n(`COPY instruction truncated: needs ${o} bytes at position ${e}`);let r=e,s=0,i=0;return 1&n&&(s|=t[r],r+=1),2&n&&(s|=t[r]<<8,r+=1),4&n&&(s|=t[r]<<16,r+=1),8&n&&(s=(s|16777216*t[r])>>>0,r+=1),16&n&&(i|=t[r],r+=1),32&n&&(i|=t[r]<<8,r+=1),64&n&&(i|=t[r]<<16,r+=1),0===i&&(i=65536),{offset:s,size:i,nextPos:r}}function Sn(t,e,n,o,r){if(t+e>n)throw $n(`COPY out of bounds: offset=${t} size=${e} exceeds base length ${n}`);if(o+e>r)throw $n(`COPY overflows target: position=${o} size=${e} exceeds target length ${r}`)}function On(t,e,n,o,r,s){if(0===n)throw $n("INSERT with N=0 is reserved");if(e+n>t.length)throw $n(`INSERT data truncated: needs ${n} bytes at position ${e}`);if(r+n>s)throw $n(`INSERT overflows target: position=${r} size=${n} exceeds target length ${s}`);return o.set(t.subarray(e,e+n),r),{nextPos:e+n,nextResultPos:r+n}}function An(t,e){const{value:n,nextOffset:o}=Dn(e,0),{value:r,nextOffset:s}=Dn(e,o);!function(t,e,n){if(t.length!==e)throw $n(`source length mismatch: expected ${e}, got ${t.length}`);if(n>2147483648)throw $n(`target length ${n} exceeds maximum allowed size`)}(t,n,r);const i=new Uint8Array(r);let a=0,c=s;for(;c<e.length;){const n=e[c];if(c+=1,128&n){const{offset:o,size:s,nextPos:d}=Ln(e,c,n);c=d,Sn(o,s,t.length,a,r),i.set(t.subarray(o,o+s),a),a+=s}else{const t=On(e,c,n,i,a,r);c=t.nextPos,a=t.nextResultPos}}if(a!==r)throw $n(`underfill: produced ${a} bytes but target length is ${r}`);return i}const Un=1346454347;function Tn(t,e,n){const{type:o,size:r,nextPos:s}=function(t,e){if(e>=t.length)throw En(e,"unexpected end of header");let n=e;const o=t[n],r=o>>4&7;let s=15&o,i=4,a=0;for(;128&t[n];){if(a+=1,a>5)throw En(e,"size encoding too long");if(n+=1,n>=t.length)throw En(e,"unexpected end of header");s|=(127&t[n])<<i,i+=7}return{type:r,size:s,nextPos:n+1}}(t,e);if(function(t,e){if(5===t)throw En(e,"reserved type 5");if(t<1||t>7)throw En(e,`unknown type ${t}`)}(o,e),6===o){const{distance:n,nextPos:o}=function(t,e,n){if(e>=t.length)throw En(n,"unexpected end of OFS_DELTA distance");let o=e,r=127&t[o],s=0;for(;128&t[o];){if(s+=1,s>4)throw En(n,"OFS_DELTA distance encoding too long");if(o+=1,o>=t.length)throw En(n,"unexpected end of OFS_DELTA distance");r=r+1<<7|127&t[o]}return{distance:r,nextPos:o+1}}(t,s,e);return{type:6,size:r,dataOffset:o,baseDistance:n}}if(7===o){const o=s+n.digestLength;if(o>t.length)throw En(e,"unexpected end of REF_DELTA base id");return{type:7,size:r,dataOffset:o,baseId:tt(t.subarray(s,o))}}return{type:o,size:r,dataOffset:s}}function Mn(t,e){const n=[];let o=(7&t)<<4|15&e,r=e>>>4;for(r>0&&(o|=128),n.push(o);r>0;){let t=127&r;r>>>=7,r>0&&(t|=128),n.push(t)}return new Uint8Array(n)}const Nn=1032,_n=20;function Rn(t,e){return t._view.getUint32(8+4*e)}function Pn(t,e,n){const o=Nn+e*_n,r=t._bytes;for(let t=0;t<_n;t+=1){const e=r[o+t]-n[t];if(0!==e)return e}return 0}function Fn(t,e){const n=t._view.getUint32(t.smallOffsetsTableOffset+4*e);if(2147483648&n){const e=2147483647&n,o=t.largeOffsetsTableOffset+8*e;if(o+8>t.trailerOffset)throw In(`large offset index ${e} out of range`);const r=t._view.getUint32(o),s=t._view.getUint32(o+4);if(r>2097151)throw In(`pack offset exceeds safe JavaScript number range: high word=${r}`);return 4294967296*r+s}return n}function zn(t,e){const n=et(e),o=n[0];let r=0===o?0:Rn(t,o-1),s=Rn(t,o);for(;r<s;){const e=r+s>>>1,o=Pn(t,e,n);if(o<0)r=e+1;else{if(!(o>0))return Fn(t,e);s=e}}}const Bn=/^[0-9a-f]+$/;function jn(t,e){if(e.length<4)throw In(`prefix too short: minimum 4 hex chars, got ${e.length}`);if(e.length>40)throw In(`prefix too long: maximum 40 hex chars, got ${e.length}`);if(!Bn.test(e))throw In("prefix contains non-hex characters");const n=e.padEnd(40,"0"),o=e.padEnd(40,"f"),r=et(n),s=et(o),i=r[0],a=0===i?0:Rn(t,i-1),c=Rn(t,s[0]),d=function(t,e,n,o){let r=e,s=n;for(;r<s;){const e=r+s>>>1;Pn(t,e,o)<0?r=e+1:s=e}return r}(t,a,c,r),u=function(t,e,n,o){let r=e,s=n;for(;r<s;){const e=r+s>>>1;Pn(t,e,o)<=0?r=e+1:s=e}return r}(t,a,c,s),f=[];for(let e=d;e<u;e++){const n=Nn+e*_n,o=t._bytes.subarray(n,n+_n);f.push(tt(o))}return f}function Wn(t){const e=[];for(let n=0;n<t.objectCount;n++){const o=Nn+n*_n,r=t._bytes.subarray(o,o+_n);e.push(tt(r))}return e}function Hn(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}function Gn(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let o=0;for(const e of t)n.set(e,o),o+=e.length;return n}const Kn=t=>t.layout.workDir,Yn=t=>t.layout.commonDir??t.layout.gitDir,Vn=(t,e)=>(t=>dn.has(t)||un.some(e=>t.startsWith(e)))(e)?t.layout.gitDir:Yn(t),qn=(t,e)=>`${t}/objects/${function(t){return`${t.slice(0,2)}/${t.slice(2)}`}(e)}`,Xn=(t,e)=>`${t}/${e}`,Jn=t=>`${t}/index`,Qn=(t,e)=>`${t}/objects/${e}`,Zn=(t,e)=>`${t}/logs/${e}`,to=t=>`${t}/info/sparse-checkout`,eo=".lock";async function no(e,n,o,r){const s=`${o}${eo}`;try{await e.fs.writeExclusive(s,r)}catch(e){if(function(e){return e instanceof t&&"FILE_EXISTS"===e.data.code}(e))throw new t({code:"REF_LOCKED",name:n});throw e}try{await e.fs.rename(s,o)}catch(n){try{await e.fs.rm(s)}catch(e){if(!function(e){return e instanceof t&&"FILE_NOT_FOUND"===e.data.code}(e))throw e}throw n}}let oo=new WeakMap;const ro=t=>so(t).then(t=>t.parsed),so=t=>{const e=oo.get(t);if(void 0!==e)return e;const n=ao(t);return oo.set(t,n),n},io=t=>{oo.delete(t)},ao=async t=>{const e=`${Yn(t)}/config`,n=await co(t,e);if(void 0===n)return{parsed:{},tokens:[],source:e};const o=bo(n,e);return{parsed:Ko(So(o)),tokens:o,source:e}},co=async(e,n)=>{try{return await e.fs.readUtf8(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return;throw e}},uo=(t,e,n,o)=>t.toLowerCase()===n.toLowerCase()&&e===o,fo=async(t,e,n,o)=>{const{tokens:r,source:s}=await so(t),i=new Set(o.map(t=>t.toLowerCase()));let a=!1;for(const t of r){if("header"===t.kind){a=uo(t.section,t.subsection,e,n);continue}if(!a||"entry"!==t.kind||null!==t.value)continue;const o=t.key.toLowerCase();if(!i.has(o))continue;const r=e.toLowerCase();return{key:void 0===n?`${r}.${o}`:`${r}.${n}.${o}`,source:s,line:t.startLine+1}}},lo=async(t,e,n,{requireSubsection:o=!1}={})=>{const{tokens:r,source:s}=await so(t),i=new Set(n.map(t=>t.toLowerCase())),a=e.toLowerCase();let c,d=!1;for(const t of r){if("header"===t.kind){d=t.section.toLowerCase()===a,c=t.subsection;continue}if(!d||"entry"!==t.kind||null!==t.value)continue;if(o&&void 0===c)continue;const e=t.key.toLowerCase();if(i.has(e))return{key:void 0===c?`${a}.${e}`:`${a}.${c}.${e}`,source:s,line:t.startLine+1}}},ho=new Set(["loosecompression","compression"]),wo=async t=>{const{tokens:e,source:n}=await so(t);let o=!1;for(const t of e){if("header"===t.kind){o=uo(t.section,t.subsection,"core",void 0);continue}if(!o||"entry"!==t.kind)continue;const e=t.key.toLowerCase();if(!ho.has(e))continue;const r=`core.${e}`,s=t.startLine+1;if(null===t.value)return{key:r,source:n,line:s,failure:{kind:"numeric",value:"",reason:"invalid unit"}};const i=xr(t.value);if(!i.ok)return{key:r,source:n,line:s,failure:{kind:"numeric",value:t.value,reason:i.reason}};if(i.value<-1||i.value>9)return{key:r,source:n,line:s,failure:{kind:"zlib",level:i.value}}}},go=t=>t>="a"&&t<="z"||t>="A"&&t<="Z",po=t=>go(t)||t>="0"&&t<="9"||"-"===t,mo=t=>" "===t||"\t"===t,yo=(t,e,n,r)=>{const s=t[e];if(n>=s.length||!go(s[n]))throw o(e+1,r);let i=n+1;for(;i<s.length&&po(s[i]);)i+=1;const a=s.slice(n,i);for(;i<s.length&&mo(s[i]);)i+=1;const c={key:a,value:null,nextLineIdx:e+1};if(i>=s.length)return c;const d=s[i];if("\r"===d&&i===s.length-1)return c;if("="!==d)throw o(e+1,r);const u=Uo(t,e,i+1,r);return{key:a,value:u.value,nextLineIdx:u.nextLineIdx}},vo=(t,e)=>{let n=e;for(;n<t.length&&mo(t[n]);)n+=1;return n},bo=(t,e)=>ko(t.split("\n"),t.endsWith("\n"),e),ko=(t,e,n)=>{const o=[],r=e?t.length-1:t.length;let s=0;for(;s<r;)s=xo(o,t,s,n);return o},xo=(t,e,n,r)=>{const s=e[n];if(""===Ro(s).trim())return t.push(""===s.trim()?{kind:"blank",line:n}:{kind:"comment",line:n}),n+1;const i=Fo(s);if("header"===i.parse.kind)return Eo(t,e,n,i,r);if("malformed"===i.parse.kind)throw o(n+1,r,i.parse.partialName);return Io(t,e,n,r)},Io=(t,e,n,o)=>{const r=vo(e[n],0),s=yo(e,n,r,o);return t.push({kind:"entry",key:s.key,value:s.value,startLine:n,endLine:s.nextLineIdx}),s.nextLineIdx},Eo=(t,e,n,r,s)=>{const i=e[n];let a=r,c=Do(i,a.endOffset);for(;"["===i[c];){if($o(t,a,n,!1),a=Fo(i,c),"header"!==a.parse.kind)throw o(n+1,s,Co(a.parse));c=Do(i,a.endOffset)}const d=i[c],u="#"===d||";"===d;if($o(t,a,n,u),c>=i.length||u)return n+1;const f=yo(e,n,c,s);return t.push({kind:"entry",key:f.key,value:f.value,startLine:n,endLine:f.nextLineIdx,sharesHeaderLine:!0,startCol:c}),f.nextLineIdx},$o=(t,e,n,o)=>{const r=e.parse;t.push({kind:"header",section:r.section,subsection:r.subsection,line:n,hasComment:o})},Co=t=>"malformed"===t.kind?t.partialName:void 0,Do=(t,e)=>{let n=e;for(;n<t.length&&Ao.has(t[n]);)n+=1;return n},Lo=(t,e)=>So(bo(t,e)),So=t=>{const e=[],n={section:"",subsection:void 0,entries:[]};let o=n;for(const n of t)"header"===n.kind?(o={section:n.section,subsection:n.subsection,entries:[]},e.push(o)):"entry"===n.kind&&o.entries.push({key:n.key,value:n.value});return n.entries.length>0?[n,...e]:e},Oo=new Map([["n","\n"],["t","\t"],["b","\b"],["\\","\\"],['"','"']]),Ao=new Set([" ","\t","\r"]),Uo=(t,e,n,r)=>{const s={lineIdx:e,col:n},i={out:"",trimLen:-1,inQuotes:!1,inComment:!1};for(;s.lineIdx<t.length;){if(s.col>=t[s.lineIdx].length){if(i.inQuotes)throw o(s.lineIdx+1,r);return _o(i,s.lineIdx+1)}To(t,s,i,r)}return _o(i,s.lineIdx)},To=(t,e,n,o)=>{const r=t[e.lineIdx][e.col];if(e.col+=1,!n.inComment)if(n.inQuotes||!Ao.has(r))if(n.inQuotes||"#"!==r&&";"!==r)if("\\"!==r){if('"'===r)return n.inQuotes=!n.inQuotes,void(n.trimLen=-1);n.out+=r,n.trimLen=-1}else Mo(t,e,n,o);else n.inComment=!0;else No(n,r)},Mo=(t,e,n,r)=>{const s=t[e.lineIdx];if(e.col>=s.length)return e.lineIdx+=1,void(e.col=0);const i=Oo.get(s[e.col]);if(void 0===i)throw o(e.lineIdx+1,r);e.col+=1,n.out+=i,n.trimLen=-1},No=(t,e)=>{""!==t.out&&(-1===t.trimLen&&(t.trimLen=t.out.length),t.out+=e)},_o=(t,e)=>({value:-1===t.trimLen?t.out:t.out.slice(0,t.trimLen),nextLineIdx:e}),Ro=t=>{const e=[Po(t,"#"),Po(t,";")].filter(t=>t>=0);return 0===e.length?t:t.slice(0,Math.min(...e))},Po=(t,e)=>{let n=!1;for(let o=0;o<t.length;o+=1){const r=t[o];if(n&&"\\"===r)o+=1;else if('"'===r)n=!n;else if(!n&&r===e)return o}return-1},Fo=(t,e=0)=>{const n=vo(t,e);if("["!==t[n])return Bo;const o=n+1,r=t.indexOf("]",o),s=zo(t,o,r);return-1===s?Wo(t,o,r):Ho(t,o,s)},zo=(t,e,n)=>{const o=-1===n?t.length:n;for(let n=e;n<o;n+=1)if('"'===t[n])return n;return-1},Bo={parse:{kind:"not-header"},endOffset:0},jo=/^[A-Za-z0-9.-]+$/,Wo=(t,e,n)=>{if(-1===n)return Bo;const o=t.slice(e,n);return jo.test(o)?{parse:{kind:"header",section:o,subsection:void 0},endOffset:n+1}:Bo},Ho=(t,e,n)=>{const{parse:o,closeQuoteAt:r}=((t,e,n)=>{const o=t.slice(e,n).trim(),r=o.toLowerCase(),s=n>e?t[n-1]:void 0;return void 0!==s&&Ao.has(s)?((t,e,n,o)=>{const r=((t,e)=>{let n="",o=e+1;for(;o<t.length;){const e=t[o];if("\\"!==e){if('"'===e)return{subsection:n,closeQuoteAt:o};n+=e,o+=1}else{if(o+1>=t.length)return{partial:n};n+=t[o+1],o+=2}}return{partial:n}})(t,e);return"partial"in r?{parse:{kind:"malformed",partialName:`${o}.${r.partial}`}}:t.startsWith("]",r.closeQuoteAt+1)?{parse:{kind:"header",section:n,subsection:r.subsection},closeQuoteAt:r.closeQuoteAt}:{parse:{kind:"malformed",partialName:`${o}.${r.subsection}`}}})(t,n,o,r):{parse:{kind:"malformed",partialName:r}}})(t,e,n);return"header"!==o.kind||void 0===r?{parse:o,endOffset:0}:{parse:o,endOffset:r+2}},Go=(t,e)=>{void 0!==e.subsection?((t,e,n)=>{"remote"===e.section?Qo(t,n,e):"branch"===e.section?tr(t,n,e):"submodule"===e.section?er(t,n,e):"merge"===e.section?nr(t,n,e):"diff"===e.section?or(t,n,e):"filter"===e.section?sr(t,n,e):"gpg"===e.section&&gr(t,n,e)})(t,e,e.subsection):"remote"===e.section?Zo(t,e):"core"===e.section?Vo(t,e):"user"===e.section?Xo(t,e):"extensions"===e.section?ir(t,e):"commit"===e.section?ar(t,e):"tag"===e.section?cr(t,e):"push"===e.section?lr(t,e):"gpg"===e.section&&wr(t,e)},Ko=t=>{const e={};for(const n of t)Go(e,n);return pr(e)},Yo=(t,e,n)=>"bare"===e?{...t,bare:yr(n)}:"logallrefupdates"===e?{...t,logAllRefUpdates:qo(n)}:"sparsecheckout"===e?{...t,sparseCheckout:yr(n)}:"sparsecheckoutcone"===e?{...t,sparseCheckoutCone:yr(n)}:null!==n?"excludesfile"===e?{...t,excludesFile:n}:"attributesfile"===e?{...t,attributesFile:n}:"hookspath"===e?{...t,hooksPath:n}:"notesref"===e?{...t,notesRef:n}:"sshcommand"===e?{...t,sshCommand:n}:"loosecompression"===e||"compression"===e?((t,e,n)=>{const o=xr(n);if(o.ok){if("loosecompression"===e)return{...t,looseCompression:o.value,looseCompressionFromLoose:!0};if(!0!==t.looseCompressionFromLoose)return{...t,looseCompression:o.value}}})(t,e,n):void 0:void 0,Vo=(t,e)=>{for(const{key:n,value:o}of e.entries){const e=Yo(t.core??{},n.toLowerCase(),o);void 0!==e&&(t.core=e)}},qo=t=>null!==t&&"always"===t.toLowerCase()?"always":yr(t),Xo=(t,e)=>{for(const{key:n,value:o}of e.entries)null!==o&&("name"===n?t.user={...t.user,name:o}:"email"===n?t.user={...t.user,email:o}:"signingkey"===n.toLowerCase()&&(t.user={...t.user,signingKey:o}))},Jo=(t,e,n)=>{const o=e.toLowerCase();"url"===o?null!==n&&(t.url=n):"pushurl"===o?null!==n&&(t.pushUrl=n):"fetch"===o?null!==n&&(t.fetch??=[],t.fetch.push(n)):"promisor"===o?t.promisor=yr(n):"partialclonefilter"===o&&null!==n&&(t.partialCloneFilter=n)},Qo=(t,e,n)=>{t.remote??=new Map;const o=t.remote.get(e)??{},r={...o,fetch:o.fetch?[...o.fetch]:[]};for(const{key:t,value:e}of n.entries)Jo(r,t,e);t.remote.set(e,(t=>{const e={};return void 0!==t.url&&(e.url=t.url),void 0!==t.pushUrl&&(e.pushUrl=t.pushUrl),void 0!==t.fetch&&t.fetch.length>0&&(e.fetch=t.fetch),void 0!==t.promisor&&(e.promisor=t.promisor),void 0!==t.partialCloneFilter&&(e.partialCloneFilter=t.partialCloneFilter),e})(r))},Zo=(t,e)=>{for(const{key:n,value:o}of e.entries)null!==o&&"pushdefault"===n.toLowerCase()&&(t.remotePushDefault=o)},tr=(t,e,n)=>{t.branch??=new Map;const o={...t.branch.get(e)??{}};for(const{key:t,value:e}of n.entries)null!==e&&("remote"===t?o.remote=e:"merge"===t?o.merge=e:"pushremote"===t.toLowerCase()&&(o.pushRemote=e));t.branch.set(e,o)},er=(t,e,n)=>{t.submodule??=new Map;const o={...t.submodule.get(e)??{}};for(const{key:t,value:e}of n.entries){const n=t.toLowerCase();"url"===n?null!==e&&(o.url=e):"active"===n?o.active=yr(e):"update"===n&&null!==e&&(o.update=e)}t.submodule.set(e,o)},nr=(t,e,n)=>{t.merge??=new Map;const o={...t.merge.get(e)??{}};for(const{key:t,value:e}of n.entries){if(null===e)continue;const n=t.toLowerCase();"name"===n?o.name=e:"driver"===n?o.driver=e:"recursive"===n&&(o.recursive=e)}t.merge.set(e,o)},or=(t,e,n)=>{t.diff??=new Map;const o={...t.diff.get(e)??{}};for(const{key:t,value:e}of n.entries){const n=t.toLowerCase();if("textconv"===n){if(null===e)continue;o.textconv=e}else"cachetextconv"===n&&(o.cachetextconv=yr(e))}t.diff.set(e,o)},rr=(t,e,n)=>{const o=e.toLowerCase();"required"!==o?null!==n&&("clean"===o?t.clean=n:"smudge"===o?t.smudge=n:"process"===o&&(t.process=n)):t.required=yr(n)},sr=(t,e,n)=>{t.filter??=new Map;const o={...t.filter.get(e)??{}};for(const{key:t,value:e}of n.entries)rr(o,t,e);t.filter.set(e,o)},ir=(t,e)=>{for(const{key:n,value:o}of e.entries)"partialclone"===n.toLowerCase()&&null!==o&&(t.extensions={...t.extensions,partialClone:o})},ar=(t,e)=>{for(const{key:n,value:o}of e.entries)"gpgsign"===n.toLowerCase()&&(t.commit={...t.commit,gpgSign:yr(o)})},cr=(t,e)=>{for(const{key:n,value:o}of e.entries)"gpgsign"===n.toLowerCase()&&(t.tag={...t.tag,gpgSign:yr(o)})},dr=t=>null!==t&&"if-asked"===t.toLowerCase()?"if-asked":yr(t)?"true":"false",ur=t=>"tracking"===t?"upstream":"nothing"===t||"current"===t||"upstream"===t||"simple"===t||"matching"===t?t:void 0,fr=async t=>{const{tokens:e,source:n}=await so(t);let o=!1;for(const t of e)if("header"!==t.kind){if(o&&"entry"===t.kind&&"default"===t.key.toLowerCase()&&null!==t.value&&void 0===ur(t.value))return{key:"push.default",source:n,line:t.startLine+1,value:t.value}}else o=uo(t.section,t.subsection,"push",void 0)},lr=(t,e)=>{for(const{key:n,value:o}of e.entries)if("gpgsign"===n.toLowerCase())t.push={...t.push,gpgSign:dr(o)};else if("default"===n.toLowerCase()){const e=ur(o);void 0!==e&&(t.push={...t.push,default:e})}},hr=t=>"openpgp"===t||"ssh"===t||"x509"===t,wr=(t,e)=>{for(const{key:n,value:o}of e.entries){if(null===o)continue;const e=n.toLowerCase();"format"===e&&hr(o)?t.gpg={...t.gpg,format:o}:"program"===e&&(t.gpg={...t.gpg,program:o})}},gr=(t,e,n)=>{if("ssh"===e)for(const{key:e,value:o}of n.entries)"program"===e.toLowerCase()&&null!==o&&(t.gpg={...t.gpg,ssh:{...t.gpg?.ssh,program:o}})},pr=t=>{const e={},n=(t=>{if(void 0!==t)return{...void 0!==t.bare?{bare:t.bare}:{},...void 0!==t.excludesFile?{excludesFile:t.excludesFile}:{},...void 0!==t.attributesFile?{attributesFile:t.attributesFile}:{},...void 0!==t.logAllRefUpdates?{logAllRefUpdates:t.logAllRefUpdates}:{},...void 0!==t.hooksPath?{hooksPath:t.hooksPath}:{},...void 0!==t.notesRef?{notesRef:t.notesRef}:{},...void 0!==t.sparseCheckout?{sparseCheckout:t.sparseCheckout}:{},...void 0!==t.sparseCheckoutCone?{sparseCheckoutCone:t.sparseCheckoutCone}:{},...void 0!==t.looseCompression?{looseCompression:t.looseCompression}:{},...void 0!==t.sshCommand?{sshCommand:t.sshCommand}:{}}})(t.core);void 0!==n&&(e.core=n);const o=(t=>{if(void 0!==t)return void 0!==t.name&&void 0!==t.email||void 0!==t.signingKey?{...void 0!==t.name?{name:t.name}:{},...void 0!==t.email?{email:t.email}:{},...void 0!==t.signingKey?{signingKey:t.signingKey}:{}}:void 0})(t.user);return void 0!==o&&(e.user=o),void 0!==t.remote&&t.remote.size>0&&(e.remote=t.remote),void 0!==t.remotePushDefault&&(e.remotePushDefault=t.remotePushDefault),void 0!==t.extensions&&(e.extensions=t.extensions),void 0!==t.branch&&t.branch.size>0&&(e.branch=t.branch),void 0!==t.submodule&&t.submodule.size>0&&(e.submodule=t.submodule),void 0!==t.merge&&t.merge.size>0&&(e.merge=t.merge),((t,e)=>{void 0!==t.diff&&t.diff.size>0&&(e.diff=t.diff),void 0!==t.filter&&t.filter.size>0&&(e.filter=t.filter)})(t,e),((t,e)=>{void 0!==t.commit&&(e.commit=t.commit),void 0!==t.tag&&(e.tag=t.tag),void 0!==t.push&&(e.push=t.push),void 0!==t.gpg&&(e.gpg=t.gpg)})(t,e),e},mr=new Set(["true","yes","on","1"]),yr=t=>null===t||mr.has(t.toLowerCase()),vr=BigInt("9223372036854775807"),br=BigInt("-9223372036854775808"),kr=new Map([["k",BigInt(1024)],["K",BigInt(1024)],["m",BigInt(1024)*BigInt(1024)],["M",BigInt(1024)*BigInt(1024)],["g",BigInt(1024)*BigInt(1024)*BigInt(1024)],["G",BigInt(1024)*BigInt(1024)*BigInt(1024)]]),xr=t=>{const e=(t??"").replace(/^[ \t]+/,""),n="+"===e[0]||"-"===e[0]?e.slice(1):e,o=(t=>{const e=/^0[xX][0-9a-fA-F]+/.exec(t);if(null!==e)return{token:e[0],radix:16};if("0"===t[0])return{token:/^0[0-7]*/.exec(t)[0],radix:8};const n=/^[0-9]+/.exec(t);return null===n?null:{token:n[0],radix:10}})(n);if(null===o)return{ok:!1,reason:"invalid unit"};const r=n.slice(o.token.length),s=""===r?BigInt(1):kr.get(r);if(void 0===s)return{ok:!1,reason:"invalid unit"};const i=((t,e)=>{const n=(16===e?t.slice(2):8===e?t.slice(1):t).replace(/^0+/,"");return n.length>32?null:""===n?BigInt(0):BigInt(`${16===e?"0x":8===e?"0o":""}${n}`)})(o.token,o.radix);if(null===i)return{ok:!1,reason:"out of range"};const a=("-"===e[0]?-i:i)*s;return a<br||a>vr?{ok:!1,reason:"out of range"}:{ok:!0,value:Number(a)}};async function Ir(t){const e=await ro(t),{name:n,email:o}=(r=e.user,void 0!==r?.name&&void 0!==r?.email?{name:r.name,email:r.email}:{name:"tsgit",email:"tsgit@localhost"});var r;return{name:n,email:o,timestamp:Math.floor(Date.now()/1e3),timezoneOffset:"+0000"}}const Er=1024,$r=268435456,Cr=256,Dr=1e6,Lr=1048576,Sr=100;async function Or(t,e,n){await t.fs.appendUtf8(Zn(Vn(t,e),e),ze(n))}async function Ar(t,e){const n=Zn(Vn(t,e),e);if(!await t.fs.exists(n))return[];if((await t.fs.stat(n)).size>16777216)throw _e("reflog file exceeds 16777216 bytes");return(await t.fs.readUtf8(n)).split("\n").filter(t=>""!==t).map(Be)}async function Ur(t,e){return t.fs.exists(Zn(Vn(t,e),e))}async function Tr(t,e,n){const o=n.map(ze).join("");await t.fs.writeUtf8(Zn(Vn(t,e),e),o)}async function Mr(t,e){const n=Zn(Vn(t,e),e);await t.fs.exists(n)&&await t.fs.rm(n)}async function Nr(t){const e=`${t.layout.gitDir}/logs`;return await t.fs.exists(e)?_r(t,e,""):[]}async function _r(t,e,n){const o=await t.fs.readdir(e),r=[];for(const s of o){const o=""===n?s.name:`${n}/${s.name}`;s.isDirectory?r.push(...await _r(t,`${e}/${s.name}`,o)):r.push(o)}return r}async function Rr(t,e,n,o,r){if(!await async function(t,e){if(await Ur(t,e))return!0;return function(t,e){return"always"===e.logAllRefUpdates||!1!==e.logAllRefUpdates&&(!0===e.logAllRefUpdates||!0!==e.bare)&&function(t){return"HEAD"===t||He.some(e=>t.startsWith(e))}(t)}(e,(await ro(t)).core??{})}(t,e))return;const s=await Ir(t);await Or(t,e,{oldId:n,newId:o,identity:s,message:je(r)})}const Pr=new WeakMap;function Fr(t){let e=Pr.get(t);return void 0===e&&(e=function(t){let e;const n=e=>Vn(t,e);async function o(){const n=`${Yn(t)}/packed-refs`;if(!await t.fs.exists(n))return{entries:[],peeling:"none",sorted:!1};const o=await t.fs.stat(n),r=`${o.mtimeMs}:${o.size}`;if(void 0!==e&&e.mtimeKey===r)return e.parsed;const s=function(t){if(""===t)return{entries:[],peeling:"none",sorted:!1};const e=t.split("\n"),{peeling:n,sorted:o,startIndex:r}=function(t){const e=t[0];if(e?.startsWith("# pack-refs with:")){const t=e.slice(17).trim(),n=""===t?[]:t.split(/\s+/),o=n.includes("peeled");return{peeling:n.includes("fully-peeled")?"fully":o?"tags":"none",sorted:n.includes("sorted"),startIndex:1}}return{peeling:"none",sorted:!1,startIndex:0}}(e);return{entries:function(t,e){const n=[];for(let o=e;o<t.length;o++){const e=t[o];if(void 0===e||""===e||e.startsWith("#"))continue;if(e.startsWith("^")){if(0===n.length)throw Ke("peel line without preceding ref entry");const t=yt.from(e.slice(1)),o=n.length-1;n[o]={...n[o],peeled:t};continue}const r=e.indexOf(" ");if(-1===r)throw Ke(`invalid ref line format: ${e.slice(0,80)}`);const s=e.slice(0,r),i=e.slice(r+1),a=yt.from(s);n.push({name:bt.from(i),id:a})}return n}(e,r),peeling:n,sorted:o}}(await t.fs.readUtf8(n));return e={parsed:s,mtimeKey:r},s}async function r(e){const o=Xn(n(e),e);if(await t.fs.exists(o))return t.fs.readUtf8(o)}return{async resolveDirect(t){const e=await r(t);if(void 0!==e){const t=Ze(e);return"symbolic"===t.type?{kind:"symbolic",target:t.target}:{kind:"direct",id:t.target}}const n=await o();for(const e of n.entries)if(e.name===t)return{kind:"direct",id:e.id};return{kind:"missing"}},async writeLoose(e,o){const r=Xn(n(e),e);await t.fs.writeUtf8(r,function(t){return`${t}\n`}(o))},async removeLoose(e){const o=Xn(n(e),e);await t.fs.exists(o)&&await t.fs.rm(o)},isLoose:async e=>t.fs.exists(Xn(n(e),e)),readLooseRaw:async t=>r(t),getPackedRefs:o}}(t),Pr.set(t,e)),e}const zr="HEAD";async function Br(e,n,o,s){Je(n);const i=Xn(e.layout.gitDir,n),a=Fr(e),c=await a.resolveDirect(n);if(void 0!==s.expected){const e="direct"===c.kind?c.id:"absent";if(s.expected!==e)throw((e,n,o)=>new t({code:"REF_UPDATE_CONFLICT",name:e,expected:n,actual:o}))(n,s.expected,e)}if(!0===s.delete)return await async function(t,e){if(await t.isLoose(e))return void await t.removeLoose(e);if("direct"===(await t.resolveDirect(e)).kind)throw r("delete-packed-ref","deleting packed-only refs requires packed-refs rewrite");throw Ye(e)}(a,n),void await Mr(e,n);const d="direct"===c.kind?c.id:vt,u=(new TextEncoder).encode(`${o}\n`);await no(e,n,i,u),d!==o&&await Rr(e,n,d,o,s.reflogMessage),await async function(t,e,n,o,r,s){const i=await e.resolveDirect(zr);"symbolic"===i.kind&&i.target===n&&await Rr(t,zr,o,r,s)}(e,a,n,d,o,s.reflogMessage)}const jr=(t,e)=>t.endsWith("/")?`${t}${e}`:`${t}/${e}`,Wr=new Map([["binary",new Map([["diff",!1],["merge",!1],["text",!1]])]]),Hr=(t,e)=>{const n=new Map;for(const[o,r]of t){const t=!0===r?e.get(o):void 0;if(n.set(o,r),void 0!==t)for(const[e,o]of t)n.set(e,o)}return n},Gr=t=>"t"===t?"\t":"n"===t?"\n":"r"===t?"\r":t,Kr=t=>{if(t.startsWith('"')){const{value:e,end:n}=(t=>{let e="",n=1;for(;n<t.length;){const o=t[n];if("\\"===o){const o=t[n+1];if(void 0===o)break;e+=Gr(o),n+=2;continue}if('"'===o){n+=1;break}e+=o,n+=1}return{value:e,end:n}})(t);return{pattern:e,rest:t.slice(n)}}const e=t.search(/\s/);return-1===e?{pattern:t,rest:""}:{pattern:t.slice(0,e),rest:t.slice(e)}},Yr=t=>t.split(/\s+/).filter(t=>""!==t),Vr=t=>{if(t.startsWith("-")){const e=t.slice(1);return""===e?void 0:{name:e,value:!1}}if(t.startsWith("!")){const e=t.slice(1);return""===e?void 0:{name:e,value:"unspecified"}}const e=t.indexOf("=");if(-1!==e){const n=t.slice(0,e);return""===n?void 0:{name:n,value:{set:t.slice(e+1)}}}return{name:t,value:!0}},qr=t=>{const e=new Map;for(const n of t){const t=Vr(n);void 0!==t&&e.set(t.name,t.value)}return e},Xr=(t,e,n)=>{const{anchored:o,directoryOnly:r,body:s}=(t=>{const e=t.endsWith("/"),n=e?t.slice(0,-1):t;return{anchored:n.includes("/"),directoryOnly:e,body:n.startsWith("/")?n.slice(1):n}})(t);return{pattern:t,anchored:o,directoryOnly:r,lineNumber:n,compiled:Ae(s,{anchored:o}),attributes:qr(Yr(e))}},Jr=t=>{const e=Yr(t),[n,...o]=e;if(void 0!==n)return{name:n,attributes:qr(o)}},Qr=(t,e,n,o)=>{const r=((t,e)=>{if(""===e)return t;const n=`${e}/`;return t.startsWith(n)?t.slice(n.length):void 0})(e,t.basedir);if(void 0===r)return;let s;for(const e of t.rules){if(!e.compiled.test(r))continue;const t=Hr(e.attributes,o).get(n);void 0!==t&&(s=t)}return s},Zr=(t,e,n,o)=>{for(const r of t){const t=Qr(r,e,n,o);if(void 0!==t)return t}return"unspecified"},ts=(t,e)=>{if("~"===e)return t.layout.homeDir;if(e.startsWith("~/")){if(void 0===t.layout.homeDir)return;return`${t.layout.homeDir}/${e.slice(2)}`}return e},es=async(e,n,o,r)=>{let s;try{s=await e.fs.lstat(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return;throw e}if(s.isFile&&!s.isSymbolicLink){if(s.size>o)throw r((t=>{const e=t.lastIndexOf("/");return-1===e?t:t.slice(e+1)})(n),s.size,o);return e.fs.readUtf8(n)}},ns=async(t,e)=>{const n=await es(t,e,1048576,s);return void 0===n?void 0:(t=>{const e=[],n=[],o=t.split("\n");for(let t=0;t<o.length;t+=1){const r=o[t].trim();if(""===r||r.startsWith("#"))continue;if(r.startsWith("[attr]")){const t=Jr(r.slice(6));void 0!==t&&n.push(t);continue}const{pattern:s,rest:i}=Kr(r);e.push(Xr(s,i,t+1))}return{rules:e,macros:n}})(n)},os=(t,e)=>ns(t,jr(t.layout.workDir,""===e?".gitattributes":`${e}/.gitattributes`)),rs=async t=>{const e=await(t=>ns(t,`${Yn(t)}/info/attributes`))(t),n=await(async t=>{const e=(await ro(t)).core?.attributesFile;if(void 0===e||""===e)return;const n=ts(t,e);return void 0!==n?ns(t,n):void 0})(t),o=await os(t,""),r=((t,e=Wr)=>{const n=new Map(e);for(const e of t)n.set(e.name,e.attributes);return n})([...e?.macros??[],...o?.macros??[],...n?.macros??[]]),s=new Map([["",o]]),i=async e=>{if(s.has(e))return s.get(e);const n=await os(t,e);return s.set(e,n),n};return{sourcesForPath:async t=>{const o=[];void 0!==e&&o.push({basedir:"",rules:e.rules});for(const e of(t=>{const e=t.split("/");e.pop();const n=[];for(let t=e.length;t>=1;t-=1)n.push(e.slice(0,t).join("/"));return n.push(""),n})(t)){const t=await i(e);void 0!==t&&o.push({basedir:e,rules:t.rules})}return void 0!==n&&o.push({basedir:"",rules:n.rules}),{sources:o,macros:r}}}},ss=t=>void 0!==t.command?rs(t):Promise.resolve(void 0),is=async(t,e)=>{const n=Tt(e,t.hashConfig);return{bytes:n,id:await t.hash.hashHex(n)}},as=new TextDecoder,cs=async(t,e)=>{await t.fs.lstat(e).then(()=>!0).catch(()=>!1)&&await t.fs.rm(e)},ds=async(t,e,n,o)=>{await cs(t,e),await t.fs.write(e,n),void 0!==o&&await t.fs.chmod(e,o===_.EXECUTABLE?493:420)},us=async(t,e,n)=>{await ds(t,jr(t.layout.workDir,e),n)},fs=async(t,e,n,o)=>{const r=jr(t.layout.workDir,e);if(o===_.SYMLINK)return await cs(t,r),void await t.fs.symlink(as.decode(n),r);o!==_.GITLINK?await ds(t,r,n,o):await t.fs.mkdir(r)},ls=async(t,e,n,o)=>{await cs(t,e),await t.fs.writeStream(e,n),void 0!==o&&await t.fs.chmod(e,o===_.EXECUTABLE?493:420)},hs=async(t,e,n)=>{await ls(t,jr(t.layout.workDir,e),n)},ws=async(t,e)=>{const n=jr(t.layout.workDir,e);await cs(t,n)},gs="empty from",ps="too many seeds";function ms(t){return 0===t.length}function ys(t){return t.length>1024}function vs(t){return!!(t.includes("\0")||t.includes("\r")||t.includes("\n\n")||t.startsWith("\n")||t.endsWith("\n"))}function bs(t){return 0===t.length||!!(t.includes("\0")||t.includes("\r")||t.includes("\n"))||!(!t.includes(" ")&&!t.includes("\t"))}const ks="index file exceeds 256 MiB",xs="pack .idx file exceeds 64 MiB";function Is(t){return t>268435456}function Es(t){return t>67108864}function $s(t,e=5){return t>e}function Cs(t,e=5){return t>e}function Ds(t){return"160000"===t}function Ls(t,e){return t>e}const Ss=/^[0-9a-f]{40}$/,Os=/^[0-9a-f]{64}$/;function As(t){return Ss.test(t)||Os.test(t)}function Us(t){return t.isFile&&t.name.endsWith(".idx")&&!(e=t.name).includes("/")&&!e.includes("\\")&&!e.includes("..");var e}async function Ts(t,e,n){const o=`${e}/${n}`,r=await async function(t,e){if(Es((await t.fs.stat(e)).size))throw In(xs);const n=await t.fs.read(e);if(Es(n.length))throw In(xs);return n}(t,o),s=function(t){if(t.length<1032)throw In("truncated: file too short for header and fanout");const e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.getUint32(0);if(4285812579!==n)throw In(`invalid magic: expected 0xff744f63, got 0x${n.toString(16).padStart(8,"0")}`);const o=e.getUint32(4);if(2!==o)throw In(`unsupported version: expected 2, got ${o}`);!function(t){let e=0;for(let n=0;n<256;n++){const o=t.getUint32(8+4*n);if(o<e)throw In(`non-monotonic fanout at index ${n}: ${e} > ${o}`);e=o}}(e);const r=e.getUint32(1028),s=Nn+r*_n,i=s+4*r,a=i+4*r,c=t.length-40,d=Nn+r*_n+4*r+4*r+40;if(t.length<d)throw In(`truncated: expected at least ${d} bytes for ${r} objects, got ${t.length}`);return{objectCount:r,crc32TableOffset:s,smallOffsetsTableOffset:i,largeOffsetsTableOffset:a,trailerOffset:c,_bytes:t,_view:e}}(r),i=n.slice(0,-4),a=`${e}/${i}.pack`;let c;return{name:i,index:s,packPath:a,idxPath:o,offsetTable:async()=>{if(void 0!==c)return c;const e=(await t.fs.stat(a)).size,n=function(t){const e=[];for(let n=0;n<t.objectCount;n+=1)e.push(Fn(t,n));return e}(s),o=[...n].sort((t,e)=>t-e),r=e-t.hashConfig.digestLength;if(r<0)throw In("pack file too small to contain a trailer");return c={sortedOffsets:o,packFileSize:e,trailerStart:r},c}}}function Ms(t,e){const{sortedOffsets:n,trailerStart:o}=t,r=function(t,e){let n=0,o=t.length;for(;n<o;){const r=n+o>>>1;t[r]<e?n=r+1:o=r}return n}(n,e);if(r>=n.length||n[r]!==e)throw In("offset not in pack index: corrupt index");return r===n.length-1?o:n[r+1]}function Ns(t){let e;async function n(){if(void 0!==e)return e;const n=`${Yn(t)}/objects/pack`;if(!await t.fs.exists(n))return e=[],e;const o=await t.fs.readdir(n),r=[];for(const e of o)Us(e)&&r.push(await Ts(t,n,e.name));return e=r,e}return{all:n,refresh(){e=void 0},async lookup(t){const e=await n();for(const n of e){const e=zn(n.index,t);if(void 0!==e)return{pack:n,offset:e}}}}}async function _s(t,e,n,o,r){Fs(t);const s=await async function(t,e){const n=qn(Yn(t),e);if(!await t.fs.exists(n))return;const o=await t.fs.read(n);return t.compressor.inflate(o)}(t,n);if(void 0!==s)return Fs(t),function(t,e,n){if(void 0===n)return;const{contentOffset:o}=Et(e),r=e.length-o;if(r>n)throw N(t,r,n)}(n,s,r),Bs(t,n,s,o);Fs(t);const i=await e.lookup(n);if(void 0===i)throw O(n);Fs(t);const a=await js(t,e,i,n,r);return Fs(t),Bs(t,n,a,o)}function Rs(t,e,n){if(void 0!==n&&e>n)throw N(t,e,n)}function Ps(t,e,n,o){if(void 0===n)return;if(1!==o)return;const r=function(t){const{nextOffset:e}=Dn(t,0),{value:n}=Dn(t,e);return n}(e);if(r>n)throw N(t,r,n)}function Fs(t){if(!0===t.signal?.aborted)throw i()}async function zs(t,e){const n=qn(Yn(t),e);if(await t.fs.exists(n))return t.fs.read(n)}async function Bs(t,e,n,o){if(o){const o=await t.hash.hashHex(n);if(Fs(t),o!==e)throw A(e,o)}return Ut(e,n,t.hashConfig)}async function js(t,e,n,o,r){const s=await async function(t,e,n,o,r){const s=[];let i=n,a=0;const c=await n.pack.offsetTable();for(;;){Fs(t);const n=Ms(c,i.offset);if(n>c.packFileSize)throw In("next offset exceeds pack file size: corrupt index");const{header:d,chunk:u,headerEndInChunk:f}=await Hs(t,i,n);if(Ws(d))return Rs(o,d.size,r),{deltas:s,baseContent:await t.compressor.inflate(u.subarray(f)),baseType:d.type};if(a+=1,a>50)throw Cn(a);const l=await t.compressor.inflate(u.subarray(f));if(Ps(o,l,r,a),6===d.type){const t=i.offset-d.baseDistance;if(t<0)throw O(o);s.push({instructions:l,resolvedBaseId:void 0}),i={pack:i.pack,offset:t};continue}if(7===d.type){const n=d.baseId;s.push({instructions:l,resolvedBaseId:n});const o=await Gs(t,e,n,r);return{deltas:s,baseContent:o.content,baseType:o.type}}throw O(o)}}(t,e,n,o,r);let i=s.baseContent;for(let t=s.deltas.length-1;t>=0;t-=1){const e=s.deltas[t];if(void 0===e)break;i=An(i,e.instructions)}if(void 0!==r&&i.length>r)throw N(o,i.length,r);const a=function(t,e,n){const o=function(t,e){switch(t){case 1:return"commit";case 2:return"tree";case 3:return"blob";case 4:return"tag";default:throw O(e)}}(e,n),r=`${o} ${t.length}\0`,s=(new TextEncoder).encode(r),i=new Uint8Array(s.length+t.length);return i.set(s,0),i.set(t,s.length),i}(i,s.baseType,o);return Vs(t.deltaCache,o,a),a}function Ws(t){return 1===t.type||2===t.type||3===t.type||4===t.type}async function Hs(t,e,n){const o=n-e.offset;if(o<=0)throw In("slice length ≤ 0: next offset not beyond entry offset");const r=await t.fs.readSlice(e.pack.packPath,e.offset,o),s=Tn(r,0,t.hashConfig);return{header:s,chunk:r,headerEndInChunk:s.dataOffset}}async function Gs(t,e,n,o){const r=t.deltaCache.get(n);if(void 0!==r)return function(t,e,n){if(void 0===n)return;const o=e.indexOf(0);if(o<0)return;const r=e.length-(o+1);if(r>n)throw N(t,r,n)}(n,r,o),Ks(r,n);const s=Tt(await _s(t,e,n,!1,o),t.hashConfig);return Vs(t.deltaCache,n,s),Ks(s,n)}function Ks(t,e){const n=t.indexOf(0);if(n<0)throw O(e);const o=t.subarray(0,n).indexOf(32);if(o<0)throw O(e);const r=(new TextDecoder).decode(t.subarray(0,o));return{content:t.subarray(n+1),type:Ys(r,e)}}function Ys(t,e){switch(t){case"commit":return 1;case"tree":return 2;case"blob":return 3;case"tag":return 4;default:throw O(e)}}function Vs(t,e,n){t.set(e,n,n.length)}const qs=new WeakMap,Xs=new WeakMap;function Js(t){let e=qs.get(t);return void 0===e&&(e=Ns(t),qs.set(t,e)),e}async function Qs(e,n,o){const r=o?.verifyHash??!0,s=Js(e);try{return await _s(e,s,n,r,o?.maxBytes)}catch(i){const a=e.promisor;if(void 0===a||!function(e){return e instanceof t&&"OBJECT_NOT_FOUND"===e.data.code}(i))throw i;if(!await async function(t,e,n){const o=function(t){let e=Xs.get(t);return void 0===e&&(e=new Map,Xs.set(t,e)),e}(t),r=o.get(n);if(void 0!==r)return r;const s=e.fetch([n]).then(t=>t.attempted);o.set(n,s);try{return await s}finally{o.delete(n)}}(e,a,n))throw i;return s.refresh(),_s(e,s,n,r,o?.maxBytes)}}async function Zs(t,e,n){const o=await Qs(t,e,n);if("blob"!==o.type)throw U("blob",o.type,e);return o}const ti={kind:"identity"},ei=async(t,e,n)=>{const{sources:o,macros:r}=await e.sourcesForPath(n);return((t,e)=>!1===e||!0===e||"unspecified"===e?Promise.resolve(ti):(async(t,e)=>{const n=(await ro(t)).filter?.get(e);return void 0===n?ti:{kind:"external",name:e,...void 0!==n.clean&&{clean:n.clean},...void 0!==n.smudge&&{smudge:n.smudge},required:n.required??!1}})(t,e.set))(t,Zr(o,n,"filter",r))},ni=async(t,e,n,o)=>{const{gitDir:r,workDir:s}=t.layout,i=await e.run({command:n,cwd:s,env:{GIT_DIR:r},stdin:o,...void 0!==t.signal?{signal:t.signal}:{}});return 0!==i.exitCode?{ok:!1,exitCode:i.exitCode}:{ok:!0,bytes:i.stdout??new Uint8Array(0)}};async function oi(t,e,n){const o=n?.verifyHash??!0;if(!0===t.signal?.aborted)throw i();const r=await zs(t,e);if(void 0!==r)return function(t,e,n,o){const r=async function*(t,e,n,o){const r=o?t.hash.createHasher():void 0,s=n[Symbol.asyncIterator](),a=await s.next();if(!0===a.done)throw $(`inflate stream produced no output for object ${e}`);const c=await async function(t,e,n){let o=n;for(;;){const n=o.indexOf(0);if(-1!==n){const{type:e}=Et(o);if("blob"!==e)throw U("blob",e,t);return{headerBytes:o.subarray(0,n+1),content:o.subarray(n+1)}}const r=await e.next();if(!0===r.done)throw $(`no NUL terminator found in inflated object ${t}`);o=ii(o,r.value)}}(e,s,a.value);r?.update(c.headerBytes),c.content.length>0&&(r?.update(c.content),yield c.content);for await(const e of{[Symbol.asyncIterator]:()=>s}){if(!0===t.signal?.aborted)throw i();r?.update(e),yield e}await ri(r,e)}(t,e,si(t,n),o);return Object.assign(r,{materialised:!1})}(t,e,r,o);const s=Js(t),a=await s.lookup(e);if(void 0===a)throw O(e);const c=Ms(await a.pack.offsetTable(),a.offset),{header:d,chunk:u,headerEndInChunk:f}=await Hs(t,a,c);if(Ws(d)){if(3!==d.type)throw U("blob",function(t){switch(t){case 1:return"commit";case 2:return"tree";case 4:return"tag"}}(d.type),e);return function(t,e,n,o,r){const s=async function*(t,e,n,o,r){const s=r?t.hash.createHasher():void 0;if(void 0!==s){const t=(new TextEncoder).encode(`blob ${o}\0`);s.update(t)}for await(const e of n){if(!0===t.signal?.aborted)throw i();s?.update(e),yield e}await ri(s,e)}(t,e,si(t,n),o,r);return Object.assign(s,{materialised:!1})}(t,e,u.subarray(f),d.size,o)}return async function(t,e,n,o){const{type:r,contentOffset:s}=Et(n);if("blob"!==r)throw U("blob",r,e);const i=n.subarray(0,s),a=n.subarray(s);return Object.assign(async function*(){const n=o?t.hash.createHasher():void 0;n?.update(i),a.length>0&&(n?.update(a),yield a),await ri(n,e)}(),{materialised:!0})}(t,e,await js(t,s,a,e,void 0),o)}async function ri(t,e){if(void 0===t)return;const n=await t.digestHex();if(n!==e)throw A(e,n)}function si(t,e){const n=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(t.compressor.createInflateStream());return I(n)}function ii(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}const ai=async(e,n,o)=>!!await e.fs.exists(n)&&!await(async(e,n,o)=>{let r;try{r=await e.fs.read(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return!0;throw e}const{id:s}=await is(e,{type:"blob",content:r});return s===o})(e,n,o),ci=async(t,e,n)=>{const o=jr(e,n.path);if("update"===n.kind||"delete"===n.kind){if(void 0===n.previousId)return;return await ai(t,o,n.previousId)?{class:"local-changes",path:n.path}:void 0}if("add"===n.kind)return await(async(t,e)=>t.fs.exists(e))(t,o)?{class:"untracked",path:n.path}:void 0},di=async(t,e,n,o)=>{const r=jr(e,n.path);if("noop"!==n.kind)if("delete"!==n.kind){if(void 0!==n.id)return await(async(t,e,n,o,r)=>{if(o===_.GITLINK)return void await fs(t,e,new Uint8Array,o);if(o===_.SYMLINK){const r=await Zs(t,n);return void await fs(t,e,r.content,o)}if(void 0!==r&&void 0!==t.command){const s=await ei(t,r,e);if("external"===s.kind&&void 0!==s.smudge){const r=await Zs(t,n),i=await ni(t,t.command,s.smudge,r.content);if(!i.ok){if(s.required)throw c(e,s.name,i.exitCode);return void await fs(t,e,r.content,o)}return void await fs(t,e,i.bytes,o)}}const s=await oi(t,n);await(async(t,e,n,o)=>{await ls(t,jr(t.layout.workDir,e),n,o)})(t,e,s,o)})(t,n.path,n.id,n.mode,o),(async(t,e,n,o,r)=>{const s=await t.fs.lstat(e);return{ctimeSeconds:Math.floor(s.ctimeMs/1e3),ctimeNanoseconds:Number(s.ctimeNs??0n)%1e9,mtimeSeconds:Math.floor(s.mtimeMs/1e3),mtimeNanoseconds:Number(s.mtimeNs??0n)%1e9,dev:s.dev,ino:s.ino,mode:r,uid:s.uid,gid:s.gid,fileSize:s.size,id:o,flags:J,path:n}})(t,r,n.path,n.id,n.mode)}else await cs(t,r)},ui=async(t,e)=>{const{changeset:n,force:o,workdir:r}=e;if(!o){const e=await(async(t,e,n)=>{const o=[],r=[];for(const s of n.entries){const n=await ci(t,e,s);void 0!==n&&("local-changes"===n.class?o.push(n.path):r.push(n.path))}return{localChanges:o.sort(qt),untracked:r.sort(qt)}})(t,r,n);if(e.localChanges.length>0||e.untracked.length>0)throw a(e)}let s;return(async(t,e,n,o)=>{const r=[];let s=0,i=0;for(const a of e.entries){const c=void 0!==t.command?await o():void 0,d=await di(t,n,a,c);"delete"===a.kind?i+=1:"add"!==a.kind&&"update"!==a.kind||(s+=1,void 0!==d&&r.push(d)),"noop"!==a.kind&&t.progress.update("checkout:materialize",s+i,e.stats.add+e.stats.update+e.stats.delete,a.path)}return{writtenEntries:r,written:s,deleted:i}})(t,n,r,()=>s??=rs(t))},fi=(t,e,n)=>void 0===e&&void 0!==n?{kind:"add",path:t,mode:n.mode,id:n.id,previousId:void 0,previousMode:void 0}:void 0!==e&&void 0===n?{kind:"delete",path:t,mode:e.mode,id:void 0,previousId:e.id,previousMode:e.mode}:{kind:e.id===n.id&&e.mode===n.mode?"noop":"update",path:t,mode:n.mode,id:n.id,previousId:e.id,previousMode:e.mode},li=(t,e)=>{const n=(t=>{const e=new Map;for(const n of t.entries)0===n.flags.stage&&e.set(n.path,{id:n.id,mode:n.mode});return e})(t),o=(t=>{const e=new Map;for(const n of t)e.set(n.path,n);return e})(e),r=new Set;for(const t of n.keys())r.add(t);for(const t of o.keys())r.add(t);const s=[],i={add:0,update:0,delete:0,noop:0};for(const t of[...r].sort()){const e=fi(t,n.get(t),o.get(t));s.push(e),i[e.kind]+=1}return{entries:s,stats:i}};async function*hi(t,e,n){const o={ctx:t,recursive:n?.recursive??!0,maxDepth:n?.maxDepth??1024,maxEntries:n?.maxEntries??V},r="string"==typeof e?await async function(t,e){const n=await Qs(t,e);if("tree"!==n.type)throw U("tree",n.type,e);return n}(t,e):e;yield*wi(o,{value:0},r,"",0,[])}async function*wi(e,n,o,r,s,a){if(a.includes(o.id))throw new t({code:"TREE_CYCLE_DETECTED",id:o.id});if(function(t,e){return t>e}(s,e.maxDepth))throw T(s);const c=[...a,o.id];for(const t of o.entries){if(e.ctx.signal?.aborted)throw i();const o=""===r?t.name:`${r}/${t.name}`;if(n.value+=1,Ls(n.value,e.maxEntries))throw M(n.value,e.maxEntries);if(yield{path:o,id:t.id,mode:t.mode},!gi(e.recursive,t.mode))continue;const a=await Qs(e.ctx,t.id);"tree"===a.type&&(yield*wi(e,n,a,o,s+1,c))}}function gi(t,e){return!!t&&z(e)}const pi=(t,e)=>t.filter(t=>e.has(t.path)),mi=(t,e,n)=>e.get(t)??n.get(t),yi=t=>{const e={add:0,update:0,delete:0,noop:0};for(const n of t)e[n.kind]+=1;return e},vi=async(t,e)=>{const n=await(async(t,e)=>{const n=[];for await(const o of hi(t,e))o.mode!==_.DIRECTORY&&n.push({path:o.path,id:o.id,mode:o.mode});return n})(t,e.targetTree),o=((t,e)=>{if(void 0!==e.paths)return{target:pi(t,e.paths),indexForDiff:{...e.currentIndex,entries:pi(e.currentIndex.entries,e.paths)},excluded:[]};const n=e.sparse;if(void 0!==n){const o=[],r=[];for(const e of t)(n(e.path)?o:r).push(e);return{target:o,indexForDiff:{...e.currentIndex,entries:e.currentIndex.entries.filter(t=>!t.flags.skipWorktree)},excluded:r}}return{target:t,indexForDiff:e.currentIndex,excluded:[]}})(n,e),r=li(o.indexForDiff,o.target),s=!0===e.forceRewriteAll?(t=>{const e=t.entries.map(t=>"noop"===t.kind?{...t,kind:"update"}:t);return{entries:e,stats:yi(e)}})(r):r,i=await ui(t,{changeset:s,force:e.force??!1,workdir:t.layout.workDir}),a=((t,e,n,o)=>{const r=(t=>{const e=new Map;for(const n of t)e.set(n.path,n);return e})(t),s=(t=>{const e=new Map;for(const n of t.entries)0===n.flags.stage&&e.set(n.path,n);return e})(e),i=((t,e)=>{if(void 0===e)return[];const n=[];for(const[o,r]of t)e.has(o)||n.push(r);return n})(s,o);for(const t of n){const e=mi(t.path,r,s);void 0!==e&&i.push(e)}return i.sort((t,e)=>t.path<e.path?-1:1),i})(i.writtenEntries,e.currentIndex,o.target,e.paths);var c;return{newIndexEntries:0===o.excluded.length?a:(c=[...a,...o.excluded.map(Q)],[...c].sort(jt)),written:i.written,deleted:i.deleted}};async function bi(t){const e=Jn(t.layout.gitDir);if(!await t.fs.exists(e))return{version:2,entries:[],extensions:[],trailerSha:new Uint8Array(0)};if(Is((await t.fs.stat(e)).size))throw q(ks);const n=await t.fs.read(e);if(Is(n.length))throw q(ks);const o=t.hashConfig.digestLength;if(n.length<o)throw q("file is shorter than the hash trailer");const r=n.subarray(0,n.length-o),s=tt(n.subarray(n.length-o));if(await t.hash.hashHex(r)!==s)throw q("index trailer checksum mismatch");return function(t){if(t.length<12)throw q("truncated header");const e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1145655875!==e.getUint32(0))throw q("invalid signature: expected DIRC");const n=e.getUint32(4);if(2!==n&&3!==n)throw q(`unsupported version: ${n}`);const o=e.getUint32(8);if(62*o>t.length-12-20)throw q(`entry count ${o} exceeds file capacity`);let r=12;const s=[];for(let i=0;i<o;i++){const o=r;if(r+62>t.length-20)throw X(r,"truncated entry");const i=e.getUint32(r),a=e.getUint32(r+4),c=e.getUint32(r+8),d=e.getUint32(r+12),u=e.getUint32(r+16),f=e.getUint32(r+20),l=e.getUint32(r+24),h=e.getUint32(r+28),w=e.getUint32(r+32),g=e.getUint32(r+36),p=tt(t.subarray(r+40,r+60)),m=e.getUint16(r+60),{flags:y,extendedSize:v}=zt(e,r,n,t.length),b=F(l.toString(8));r+=62+v;const k=Bt(t,r);if(-1===k)throw X(o,"missing NUL terminator");const x=4095&m,I=dt(t.subarray(r,4095===x?k:r+x));Ft(I,o),r=k+1,r=o+(r-o+7&-8),s.push({ctimeSeconds:i,ctimeNanoseconds:a,mtimeSeconds:c,mtimeNanoseconds:d,dev:u,ino:f,mode:b,uid:h,gid:w,fileSize:g,id:p,flags:y,path:kt.from(I)})}const i=function(t,e,n){const o=[],r=t.length-20;for(;e+8<=r;){const s=dt(t.subarray(e,e+4)),i=n.getUint32(e+4);if(e+8+i>r)throw X(e,"extension size exceeds remaining bytes");const a=s.charCodeAt(0);if(a>=97&&a<=122){const t=s.replace(/[^\x20-\x7e]/g,"?");throw X(e,`mandatory extension '${t}' not supported`)}const c=t.slice(e+8,e+8+i);o.push({signature:s,data:c}),e+=8+i}return o}(t,r,e);return{version:n,entries:s,extensions:i,trailerSha:t.slice(t.length-20)}}(n)}const ki=1048576,xi=new TextDecoder,Ii=async e=>{const n=to(e.layout.gitDir);let o;try{o=await e.fs.read(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return;throw e}if(o.byteLength>ki)throw d("info/sparse-checkout",o.byteLength,ki);return xi.decode(o)},Ei=async t=>{const e=await ro(t);if(!0!==e.core?.sparseCheckout)return;const n=!0===e.core.sparseCheckoutCone,o=await Ii(t),r=bn(o??"",n);return r.degraded&&void 0!==o&&t.logger?.warn?.(".git/info/sparse-checkout is not cone-shaped; falling back to non-cone matching"),kn(r.spec)},$i=(e,n)=>new t(void 0===n?{code:"RESOURCE_LOCKED",resource:"index",path:e}:{code:"RESOURCE_LOCKED",resource:"index",path:e,mtimeMs:n}),Ci=async(e,n={})=>{const o=`${Jn(e.layout.gitDir)}${eo}`,r=Jn(e.layout.gitDir),s=n.now??(()=>Date.now()),i=e.config?.breakStaleLockMs;try{await e.fs.writeExclusive(o,new Uint8Array)}catch(n){if(!(n instanceof t)||"FILE_EXISTS"!==n.data.code)throw n;if(void 0===i)throw $i(o,await Di(e,o));await Li(e,o,i,s)}return Si(e,o,r)},Di=async(t,e)=>{try{return(await t.fs.lstat(e)).mtimeMs}catch{return}},Li=async(e,n,o,r)=>{const s=await Di(e,n);if(void 0===s)return void await e.fs.writeExclusive(n,new Uint8Array);const i=r()-s;if(i<0)throw $i(n,s);if(i<o)throw $i(n,s);await e.fs.rm(n);try{await e.fs.writeExclusive(n,new Uint8Array)}catch(o){if(o instanceof t&&"FILE_EXISTS"===o.data.code)throw $i(n,await Di(e,n));throw o}},Si=(e,n,o)=>{let r=!1,s=!1;return{release:async()=>{if(!r&&!s){s=!0;try{await e.fs.rm(n)}catch(e){if(!(e instanceof t)||"FILE_NOT_FOUND"!==e.data.code)throw e}}},commit:async t=>{if(r||s)return;const i=function(t){const e=[...t.entries].sort(jt),n=e.map(t=>{const e=ct(t.path),n=t.flags.skipWorktree||t.flags.intentToAdd;return{entry:t,pathBytes:e,extended:n,paddedLength:62+(n?2:0)+e.length+8&-8}}),o=t.extensions.map(t=>({ext:t,sigBytes:ct(t.signature),totalLength:8+t.data.length})),r=12+n.reduce((t,e)=>t+e.paddedLength,0)+o.reduce((t,e)=>t+e.totalLength,0),s=new Uint8Array(r),i=new DataView(s.buffer),a=n.some(t=>t.extended)?3:2;i.setUint32(0,1145655875),i.setUint32(4,a),i.setUint32(8,e.length);let c=12;for(const{entry:t,pathBytes:e,extended:o,paddedLength:r}of n)Wt(s,i,c,t,e,o),c+=r;for(const{ext:t,sigBytes:e,totalLength:n}of o)s.set(e,c),i.setUint32(c+4,t.data.length),s.set(t.data,c+8),c+=n;return s}({entries:[...t],extensions:[]}),a=await e.hash.hash(i),c=new Uint8Array(i.length+a.length);c.set(i,0),c.set(a,i.length),await e.fs.write(n,c),await e.fs.rename(n,o),r=!0}}},Oi=new TextEncoder,Ai=new Set([".git"]),Ui=t=>{""===t&&Mi(t),_i(t)>4096&&Mi(t),t.startsWith("/")&&Mi(t),t.includes("\\")&&Mi(t),t.includes("\0")&&Mi(t);const e=t.split("/");for(const n of e)Ni(n,t);return t},Ti=t=>{const e=t.toLowerCase();return!!Ai.has(e)||".git"===e.replace(/[. ]+$/,"")},Mi=t=>{throw u(t)},Ni=(t,e)=>{""===t&&Mi(e),"."!==t&&".."!==t||Mi(e),_i(t)>255&&Mi(e),Ti(t)&&Mi(e),t.includes(":")&&Mi(e);for(let n=0;n<t.length;n+=1){const o=t.charCodeAt(n);(o<=31||127===o)&&Mi(e)}},_i=t=>Oi.encode(t).length,Ri=(t,e)=>""===t?e:`${t}/${e}`;async function*Pi(t,e){const n={ctx:t,maxDepth:e?.maxDepth??4096,maxEntries:e?.maxEntries??V,ignore:e?.ignore};yield*Fi(n,{value:0},"",0,!0)}async function*Fi(t,e,n,o,r){if(o>t.maxDepth)throw T(o);const s=await t.ctx.fs.readdir(Bi(t,n));if(r||!s.some(ji))for(const r of s){if(t.ctx.signal?.aborted)throw i();Ti(r.name)||(yield*zi(t,e,n,o,r))}}async function*zi(t,e,n,o,r){const s=Ri(n,r.name);if(Ui(s),r.isDirectory&&!r.isSymbolicLink){if(void 0!==t.ignore&&await t.ignore(s,!0))return;return void(yield*Fi(t,e,s,o+1,!1))}if(!r.isFile&&!r.isSymbolicLink)return;if(void 0!==t.ignore&&await t.ignore(s,!1))return;if(e.value+=1,e.value>t.maxEntries)throw M(e.value,t.maxEntries);const i=await t.ctx.fs.lstat(jr(t.ctx.layout.workDir,s));yield{path:s,stat:i}}const Bi=(t,e)=>""===e?t.ctx.layout.workDir:jr(t.ctx.layout.workDir,e),ji=t=>!!Ti(t.name)&&(t.isDirectory||t.isFile&&!t.isSymbolicLink);async function Wi(e,n){if(e.signal?.aborted)throw i();const{bytes:o,id:r}=await is(e,n),s=n.id;if(""!==s&&s!==r)throw A(n.id,r);if(e.signal?.aborted)throw i();const a=await ro(e),c=a.core?.looseCompression,d=r.slice(0,2);await e.fs.mkdir(Qn(e.layout.gitDir,d));const u=qn(e.layout.gitDir,r),f=void 0!==c&&c>=-1&&c<=9?await e.compressor.deflate(o,c):await e.compressor.deflate(o);try{await e.fs.writeExclusive(u,f)}catch(e){if(function(e){return e instanceof t&&"FILE_EXISTS"===e.data.code}(e))return r;throw e}return r}const Hi=async(t,e)=>{const n=jr(t.layout.workDir,""===e?".gitignore":`${e}/.gitignore`);return Gi(t,n)},Gi=async(t,e)=>{const n=await es(t,e,1048576,f);return void 0===n?void 0:(t=>{const e=[],n=t.split("\n");for(let t=0;t<n.length;t+=1){const o=n[t],r=Ne(o);if(void 0===r)continue;const{negated:s,anchored:i,directoryOnly:a,cleanPattern:c}=r;e.push({pattern:Me(Te(o)),negated:s,directoryOnly:a,anchored:i,lineNumber:t+1,compiled:Ae(c,{anchored:i})})}return e})(n)},Ki=async t=>{const e=[],n=await(async t=>{const e=await ro(t),n=e.core?.excludesFile;if(void 0===n||""===n)return;const o=ts(t,n);return void 0!==o?Gi(t,o):void 0})(t);void 0!==n&&e.push({basedir:"",rules:n,kind:"global"});const o=await(async t=>Gi(t,`${Yn(t)}/info/exclude`))(t);void 0!==o&&e.push({basedir:"",rules:o,kind:"info"});const r=await Hi(t,"");void 0!==r&&e.push({basedir:"",rules:r,kind:"gitignore"});const s=new Map;return{base:e,loadDirRules:async e=>{const n=s.get(e);if(void 0!==n)return n;const o=await Hi(t,e)??[];return s.set(e,o),o}}},Yi=async t=>{const e=await Ki(t),n=[...e.base],o=new Set([]);return async(t,r)=>{for(const r of Vi(t)){if(o.has(r))continue;o.add(r);const t=await e.loadDirRules(r);t.length>0&&n.push({basedir:r,rules:t})}return"ignored"===((t,e,n)=>De(t,e,n).verdict)(n,t,r)}},Vi=t=>{const e=t.split("/");if(e.length<=1)return[];const n=[];for(let t=1;t<e.length;t+=1)n.push(e.slice(0,t).join("/"));return n};async function qi(t,e,n){const o=n?.maxSymbolicDepth??5,r=n?.maxPeelDepth??5,s=n?.peel??!1,i=Fr(t),a=await async function(t,e,n){const o=[];let r=e,s=0;for(;;){if("HEAD"!==r&&Je(r),o.includes(r))throw qe([...o,r]);o.push(r);const e=await t.resolveDirect(r);if("missing"===e.kind)throw Ye(r);if("direct"===e.kind)return e.id;if(s+=1,$s(s,n))throw Ve(s,o);r=e.target}}(i,e,o);return s?async function(t,e,n){let o=e,r=0;for(;;){const e=await Qs(t,o);if("tag"!==e.type)return o;if(r+=1,Cs(r,n))throw Ve(r,[]);o=e.data.object}}(t,a,r):a}async function Xi(t,e){let n=As(e)?e:await qi(t,e),o=await Qs(t,n),r=0;for(;"commit"===o.type||"tag"===o.type;){if(r+=1,r>5)throw Ve(r,[]);n="commit"===o.type?o.data.tree:o.data.object,o=await Qs(t,n)}if("tree"!==o.type)throw U("tree",o.type,n);return o}const Ji=t=>t-1>>1,Qi=t=>2*t+1,Zi=t=>2*t+2,ta=(t,e,n)=>{const o=t[e];t[e]=t[n],t[n]=o},ea=(t,e,n,o)=>o<t.length&&e(t[o],t[n])?o:n;class na{less;values=[];constructor(t){this.less=t}push(t){this.values.push(t),((t,e)=>{let n=this.values.length-1;for(;n>0&&e(t[n],t[Ji(n)]);)ta(t,n,Ji(n)),n=Ji(n)})(this.values,this.less)}pop(){if(0===this.values.length)return;const t=this.values[0],e=this.values.pop();return this.values.length>0&&(this.values[0]=e,((t,e)=>{let n=0;for(;;){const o=Qi(n);if(o>=t.length)return;const r=ea(t,e,o,Zi(n));if(!e(t[r],t[n]))return;ta(t,n,r),n=r}})(this.values,this.less)),t}size(){return this.values.length}entries(){return this.values}}const oa=(t,e)=>t.date>e.date||t.date===e.date&&t.oid<e.oid,ra=32;async function sa(t,e,n){const o=new Array(t.length);let r=0;const s=async()=>{for(;r<t.length;){const e=r++;o[e]=await n(t[e])}},i=Math.min(e,t.length),a=[];for(let t=0;t<i;t++)a.push(s());return await Promise.all(a),o}async function ia(t,e){return sa(e,32,async e=>({id:e,bytes:(await Zs(t,e)).content}))}function aa(t,e){const n=[];for(const e of t)n.push({oldPath:e.oldPath,oldId:e.oldId,oldMode:e.oldMode});for(const t of e)"modify"!==t.type&&"type-change"!==t.type||Yt(t.oldMode)||n.push({oldPath:t.path,oldId:t.oldId,oldMode:t.oldMode});return n}function ca(t,e){const n=new Map;for(const o of t){if(n.has(o))continue;const t=e.get(o);void 0!==t&&n.set(o,{chunkMap:le(t),size:t.length})}return n}function da(t,e,n,o,r){if(function(t,e,n){const o=Math.max(t,e),r=Math.min(t,e);return o*(ue-n)<(o-r)*ue}(t.size,e.size,n))return;const s=function(t,e,n,o){const r=Math.max(e,o);if(0===r)return ue;if(0===e||0===o)return 0;const s=he(t,n);return Math.trunc(s*ue/r)}(t.chunkMap,t.size,e.chunkMap,e.size);s>=n&&function(t,e){if(t.length<4)return void t.push(e);let n=0;for(let e=1;e<t.length;e++){const o=t[e],r=t[n];void 0!==o&&void 0!==r&&o.score<r.score&&(n=e)}const o=t[n];void 0!==o&&e.score>o.score&&(t[n]=e)}(r,{...o,score:s})}function ua(t,e,n){return{type:"rename",oldPath:t.oldPath,newPath:e.newPath,oldId:t.oldId,newId:e.newId,oldMode:t.oldMode,newMode:e.newMode,similarity:{score:n,maxScore:ue}}}function fa(t,e,n){return{type:"copy",oldPath:t.oldPath,newPath:e.newPath,oldId:t.oldId,newId:e.newId,oldMode:t.oldMode,newMode:e.newMode,similarity:{score:n,maxScore:ue}}}async function la(t,e){const{adds:n,deletes:o,threshold:r,copyThreshold:s,copies:i,copySources:a}=e;if(0===o.length&&0===a.length)return null;const c=[...o.map(t=>t.oldId),...a.map(t=>t.oldId)],d=await async function(t,e,n){const[o,r]=await Promise.all([ia(t,e),ia(t,n.map(t=>t.newId))]),s=new Map(o.map(t=>[t.id,t.bytes])),i=new Map(r.map(t=>[t.id,t.bytes]));return{srcFingerprints:ca(e,s),dstFingerprints:ca(n.map(t=>t.newId),i)}}(t,c,n),u=function(t){const e=new Set,n=new Set,o=[];for(const r of t)if(!n.has(r.add))if("rename"===r.kind){if(e.has(r.src))continue;e.add(r.src),n.add(r.add),o.push({kind:"rename",change:ua(r.src,r.add,r.score),del:r.src,add:r.add})}else n.add(r.add),o.push({kind:"copy",change:fa(r.src,r.add,r.score),add:r.add});return o}(function(t,e,n,o,r,s,{srcFingerprints:i,dstFingerprints:a}){const c=function(t,e,n,o,r){const s=[];for(const i of e){const e=o.get(i.newId);if(void 0===e)continue;const a=[];for(const o of t){const t=n.get(o.oldId);void 0!==t&&da(t,e,r,{kind:"rename",src:o,add:i,score:0},a)}for(const t of a)s.push(t)}return s}(t,e,i,a,r),d="off"!==o?function(t,e,n,o,r){const s=[];for(const i of e){const e=o.get(i.newId);if(void 0===e)continue;const a=[];for(const o of t){const t=n.get(o.oldId);void 0!==t&&da(t,e,r,{kind:"copy",src:o,add:i,score:0},a)}for(const t of a)s.push(t)}return s}(n,e,i,a,s):[],u=[...c,...d];return u.sort((t,e)=>e.score!==t.score?e.score-t.score:"rename"===t.kind&&"copy"===e.kind?-1:"copy"===t.kind&&"rename"===e.kind?1:0),u}(o,n,a,i,r,s,d)),f=u.filter(t=>"rename"===t.kind),l=u.filter(t=>"copy"===t.kind);return{renames:f.map(t=>t.change),copyChanges:l.map(t=>t.change),consumedDeletes:new Set(f.map(t=>t.del)),consumedAdds:new Set(u.map(t=>t.add))}}function ha(t,e){const n=t.length,o=Math.max(n,e.length),{srcCopied:r,literalAdded:s}=function(t,e){const n=e.length;if(0===t.length||0===n)return{srcCopied:0,literalAdded:n};const o=he(le(t),le(e));return{srcCopied:o,literalAdded:n-o}}(t,e),i=n-r,a=Math.min(i+s,o);return{computedBreakScore:o>0?Math.trunc(a*ue/o):0,dissimilarity:n>0?Math.trunc(i*ue/n):0}}function wa(t,e,n){const o=new Map(e.map(t=>[t.original.path,t])),r=[];for(const e of t.changes){const t="modify"===e.type&&n.has(e.path)?o.get(e.path):void 0;void 0!==t?r.push(t.del,t.add):r.push(e)}return{changes:r}}function ga(t,e){return t.dissimilarity>=e?{...t.original,broken:{score:t.dissimilarity,maxScore:ue}}:t.original}function pa(t,e,n){if(0===e.length)return t;const{presentDels:o,presentAdds:r}=function(t,e){const n=new Set(e.map(t=>t.del)),o=new Set(e.map(t=>t.add)),r=new Set,s=new Set;for(const e of t)"delete"===e.type&&n.has(e)?r.add(e):"add"===e.type&&o.has(e)&&s.add(e);return{presentDels:r,presentAdds:s}}(t,e),s=new Set,i=[];for(const t of e){const e=o.has(t.del),a=r.has(t.add);(e||a)&&e&&a&&(s.add(t.del),s.add(t.add),i.push(ga(t,n)))}return 0===s.size?t:[...t.filter(t=>!s.has(t)),...i]}function ma(t,e,n){return 0===e.length?{changes:Xt(t,Ht)}:{changes:Xt(pa(t,e,n),Ht)}}async function ya(t,e,n,o){const{threshold:r,copyThreshold:s,limit:i,copies:a,breakRewrites:c}=function(t){const e=t?.threshold??3e4;return{threshold:e,copyThreshold:t?.copyThreshold??e,limit:t?.limit??1e3,copies:t?.copies??"off",breakRewrites:t?.breakRewrites??!1}}(n),d=function(t){return function(t){return{breakScore:t.score,mergeScore:0===t.merge?36e3:t.merge}}(!1!==t&&void 0!==t?t:{score:3e4,merge:36e3}).mergeScore}(c),{broken:u,workingDiff:f}=await async function(t,e,n){if(!1===n||void 0===n)return{broken:[],workingDiff:e};const o=0!==n.score?n.score:3e4,r=await async function(t,e,n){const o=e.changes.filter(t=>"modify"===t.type&&!Yt(t.oldMode));if(0===o.length)return{broken:[],patchedDiff:e};const{records:r,paths:s}=await async function(t,e,n){const o=e.flatMap(t=>[t.oldId,t.newId]),r=await ia(t,o),s=new Map(r.map(t=>[t.id,t.bytes])),i=[],a=new Set;for(const t of e){const e=s.get(t.oldId)??new Uint8Array(0),o=s.get(t.newId)??new Uint8Array(0),{computedBreakScore:r,dissimilarity:c}=ha(e,o);r<n||(i.push({original:t,del:{type:"delete",oldPath:t.path,oldId:t.oldId,oldMode:t.oldMode},add:{type:"add",newPath:t.path,newId:t.newId,newMode:t.newMode},dissimilarity:c}),a.add(t.path))}return{records:i,paths:a}}(t,o,n);return 0===r.length?{broken:[],patchedDiff:e}:{broken:r,patchedDiff:wa(e,r,s)}}(t,e,o);return{broken:r.broken,workingDiff:r.patchedDiff}}(t,e,c),l=function(t,e={}){const n=e.limit??1e3,o=e.maxSameIdDeletes??100,{adds:r,deletes:s,other:i}=function(t){const e=[],n=[],o=[];for(const r of t)"add"===r.type?e.push(r):"delete"===r.type?n.push(r):o.push(r);return{adds:e,deletes:n,other:o}}(t.changes);if(r.length*s.length>n)return t;const a=function(t,e){const n=new Map;for(const e of t){const t=n.get(e.oldId);void 0===t?n.set(e.oldId,[e]):t.push(e)}const o=new Map;for(const[t,r]of n)r.length<=e&&o.set(t,r);return o}(s,o),c=new Set,d=[],u=[];for(const t of r){const e=ge(t,a);void 0===e?u.push(t):(d.push(e.rename),c.add(e.consumedDelete))}const f=s.filter(t=>!c.has(t));return{changes:Xt([...u,...f,...d,...i],Ht)}}(f,{...n,limit:Number.MAX_SAFE_INTEGER}),{adds:h,deletes:w,other:g}=function(t){const e=[],n=[],o=[];for(const r of t)"add"===r.type?Yt(r.newMode)?o.push(r):e.push(r):"delete"===r.type?Yt(r.oldMode)?o.push(r):n.push(r):o.push(r);return{adds:e,deletes:n,other:o}}(l.changes);if(!(h.length>0&&w.length>0||"off"!==a&&h.length>0))return ma(l.changes,u,d);const p=function(t,e,n,o,r,s){if("off"===t)return[];if("on"===t)return aa(n,o);const i=void 0!==r?function(t){const e=[];for(const[n,o]of t)Yt(o.mode)||e.push({oldPath:n,oldId:o.id,oldMode:o.mode});return e}(r):aa(n,o);return 0!==s&&e.length*i.length>s*s?aa(n,o):i}(a,h,w,g,o,i);return ma(0!==i&&h.length*(w.length+p.length)>i*i?l.changes:function(t,e,n,o){const r=o?.consumedDeletes??new Set,s=o?.consumedAdds??new Set,i=o?.renames??[],a=o?.copyChanges??[];return[...t.filter(t=>!s.has(t)),...e.filter(t=>!r.has(t)),...i,...a,...n]}(h,w,g,await la(t,{adds:h,deletes:w,threshold:r,copyThreshold:s,copies:a,copySources:p})),u,d)}const va=async(t,e)=>{const n=new Map;for await(const o of hi(t,e))o.mode!==_.DIRECTORY&&n.set(o.path,{id:o.id,mode:o.mode});return{entries:n}},ba=new Uint8Array(0),ka={},xa={patch:"binary",numstat:"binary"},Ia={patch:"text",numstat:"text"},Ea={patch:"text",numstat:"binary"},$a=new TextEncoder;function Ca(t){return $a.encode(`Subproject commit ${t}\n`)}async function Da(t,e,n){return Yt(e)?Ca(n):(await Zs(t,n)).content}async function La(t,e,n,o){const{sources:r,macros:s}=await e.sourcesForPath(n),i=Zr(r,n,"diff",s);let a,c=!1;var d,u;return!1!==i&&!0!==i&&"unspecified"!==i&&(a=await async function(t,e){const n=(await ro(t)).diff?.get(e),o=n?.textconv;return void 0!==o&&""!==o?o:void 0}(t,i.set),c=void 0!==a),{pair:(d=i,u={textconvConfigured:c,rawIsBinary:!!c&&await o()},!1===d?xa:!0===d?Ia:"unspecified"===d?ka:u.textconvConfigured?u.rawIsBinary?Ea:Ia:ka),command:a}}async function Sa(t,e,n,o,r,s,i){return Yt(s)?i:(async(t,e,n,o,r)=>{const s=`${t.layout.gitDir}/TEXTCONV_INPUT_${r}`;await t.fs.write(s,o);try{return(await e.run({command:`${n} ${s}`,cwd:t.layout.workDir,env:{GIT_DIR:t.layout.gitDir},...void 0!==t.signal?{signal:t.signal}:{}})).stdout??ba}finally{await t.fs.rm(s)}})(t,e,n,i,`${r}_${a=Ht(o),a.replace(/[^a-zA-Z0-9]/g,"_").slice(0,64)}`);var a}function Oa(t,e){return{...t,...void 0!==e.patch?{patchBinaryOverride:e.patch}:{},...void 0!==e.numstat?{numstatBinaryOverride:e.numstat}:{}}}async function Aa(t,e,n,o,r,s,i,a){return void 0===e.runner||void 0===n?[r,s]:Promise.all([Sa(t,e.runner,n,o,"old",i,r),Sa(t,e.runner,n,o,"new",a,s)])}async function Ua(t,e,n){let o;const r=!0===n?.applyTextconv?{runner:t.command,getProvider:()=>o??=rs(t)}:void 0;return sa(e,32,e=>async function(t,e,n){return"add"===e.type?async function(t,e,n){if(Yt(e.newMode))return{change:e,newContent:Ca(e.newId)};const o=(await Zs(t,e.newId)).content;if(void 0===n)return{change:e,newContent:o};const r=await n.getProvider(),{pair:s,command:i}=await La(t,r,Ht(e),()=>se(o));return Oa({change:e,newContent:void 0!==n.runner&&void 0!==i?await Sa(t,n.runner,i,e,"new",e.newMode,o):o},s)}(t,e,n):"delete"===e.type?async function(t,e,n){if(Yt(e.oldMode))return{change:e,oldContent:Ca(e.oldId)};const o=(await Zs(t,e.oldId)).content;if(void 0===n)return{change:e,oldContent:o};const r=await n.getProvider(),{pair:s,command:i}=await La(t,r,Ht(e),()=>se(o));return Oa({change:e,oldContent:void 0!==n.runner&&void 0!==i?await Sa(t,n.runner,i,e,"old",e.oldMode,o):o},s)}(t,e,n):"rename"===e.type||"copy"===e.type?async function(t,e,n){if(e.similarity.score===ue){if(void 0===n)return{change:e};const o=await n.getProvider(),{pair:r}=await La(t,o,Ht(e),async()=>!Yt(e.newMode)&&se((await Zs(t,e.newId)).content));return Oa({change:e},r)}const[o,r]=await Promise.all([Zs(t,e.oldId),Zs(t,e.newId)]);if(void 0===n)return{change:e,oldContent:o.content,newContent:r.content};const s=await n.getProvider(),{pair:i,command:a}=await La(t,s,Ht(e),()=>se(o.content)||se(r.content)),[c,d]=await Aa(t,n,a,e,o.content,r.content,e.oldMode,e.newMode);return Oa({change:e,oldContent:c,newContent:d},i)}(t,e,n):e.oldId!==e.newId||Yt(e.oldMode)||Yt(e.newMode)?async function(t,e,n){const[o,r]=await Promise.all([Da(t,e.oldMode,e.oldId),Da(t,e.newMode,e.newId)]);if(void 0===n)return{change:e,oldContent:o,newContent:r};const s=Yt(e.oldMode)?new Uint8Array(0):o,i=Yt(e.newMode)?new Uint8Array(0):r,a=await n.getProvider(),{pair:c,command:d}=await La(t,a,Ht(e),()=>se(s)||se(i)),[u,f]=await Aa(t,n,d,e,o,r,e.oldMode,e.newMode);return Oa({change:e,oldContent:u,newContent:f},c)}(t,e,n):async function(t,e,n){const o=(await Zs(t,e.oldId)).content;if(void 0===n)return{change:e,oldContent:o,newContent:o};const r=await n.getProvider(),{pair:s,command:i}=await La(t,r,Ht(e),()=>se(o)),[a,c]=await Aa(t,n,i,e,o,o,e.oldMode,e.newMode);return Oa({change:e,oldContent:a,newContent:c},s)}(t,e,n)}(t,e,r))}const Ta=new Uint8Array(0);async function Ma(t,e,n,o){const[r,s]=await Promise.all([Ra(t,e),Ra(t,n)]),i=!0===o?.recursive?await async function(t,e,n){const[o,r]=await Promise.all([Pa(t,e),Pa(t,n)]);return Ee(o,r)}(t,r,s):Ee(r,s),a=!0===o?.detectRenames?await ya(t,i,o.renameOptions,await async function(t,e,n){if("harder"!==n?.copies||void 0===e)return;return(await va(t,e)).entries}(t,r,o.renameOptions)):i,c={mode:(d=o??{}).ignoreWhitespace??"none",ignoreCrAtEol:d.ignoreCrAtEol??!1};var d;const u="none"!==(f=c).mode||f.ignoreCrAtEol;var f;const l=!0===o?.ignoreBlankLines,h=!0===o?.withStat;return u||h?async function(t,e,n,o,r,s){const i=await Ua(t,e.changes,{applyTextconv:!0}),a=[];for(const t of i){const e=ve(t.oldContent??Ta,t.newContent??Ta,Na(n,o,r,t.numstatBinaryOverride));o&&_a(t.change,e)||a.push(s?{...t.change,...e}:t.change)}return{changes:a}}(t,a,c,u,l,h):a}function Na(t,e,n,o){const r=void 0!==o?{numstatBinaryOverride:o}:{};return e?{lineKey:t,ignoreBlankLines:n,...r}:n?{ignoreBlankLines:n,...r}:void 0!==o?{numstatBinaryOverride:o}:void 0}function _a(t,e){return"modify"===t.type&&0===e.added&&0===e.deleted&&!e.binary}async function Ra(t,e){if(void 0!==e)return"string"==typeof e?Xi(t,e):e}async function Pa(t,e){if(void 0===e)return;const n=await va(t,e),o=Array.from(n.entries,([t,e])=>({name:t,mode:e.mode,id:e.id}));return{type:"tree",id:e.id,entries:o}}const Fa=async(t,e)=>{const n=[];for(const o of e.oids){const e=await Qs(t,o);n.push(await za(t,e))}const o=function(t){const e=function(t,e){const n=new Uint8Array(12),o=new DataView(n.buffer);return o.setUint32(0,Un),o.setUint32(4,2),o.setUint32(8,e),n}(0,t.length),n=[e],o=[];let r=e.length;for(const e of t){const t=Hn(Mn(e.type,e.uncompressedSize),e.compressedData),s=W(t);o.push({crc32:s,offset:r}),n.push(t),r+=t.length}return{data:Gn(n),entries:o}}(n),r=await t.hash.hash(o.data),s=tt(r),i=new Uint8Array(o.data.length+r.length);return i.set(o.data,0),i.set(r,o.data.length),{bytes:i,sha:s,objectCount:n.length}},za=async(t,e)=>{const n=Tt(e,t.hashConfig),o=n.indexOf(0),r=n.subarray(o+1),s=await t.compressor.deflate(r);return{type:Ba(e.type),uncompressedSize:r.length,compressedData:s}},Ba=t=>{switch(t){case"commit":return 1;case"tree":return 2;case"blob":return 3;case"tag":return 4}},ja=(e,n)=>{if(e.emitted.has(n))return!1;if(e.emitted.size>=e.cap)throw new t({code:"PACK_TOO_LARGE",objectCount:e.emitted.size+1,limit:e.cap});return e.emitted.add(n),!0},Wa=async(t,e,n)=>{let o=e;for(let e=0;e<16;e+=1){const e=await Qs(t,o);if("tag"!==e.type)return o;n(o),o=e.data.object}return o},Ha=async(t,e,n)=>{try{const o=await Qs(t,e,{verifyHash:n.verifyHash});return"commit"===o.type?o:void 0}catch(t){if(n.ignoreMissing&&Ga(t))return void n.missing.add(e);throw t}},Ga=e=>e instanceof t&&"OBJECT_NOT_FOUND"===e.data.code;async function*Ka(t,e){!function(t){if(ms(t.from))throw l(gs);if(ys(t.from))throw l(ps)}(e);const n=e.order??"topo",o=e.ignoreMissing??!1,r=e.verifyHash??!0,s={queue:[...e.from],visited:new Set,missing:new Set,until:new Set(e.until??[]),shallow:e.shallow??new Set};for(;s.queue.length>0;){if(t.signal?.aborted)throw i();const e=s.queue.shift();if(s.visited.has(e)||s.until.has(e))continue;const a=await Ha(t,e,{verifyHash:r,ignoreMissing:o,missing:s.missing});void 0!==a&&(s.visited.add(e),yield a,Ya(s,a,n))}}function Ya(t,e,n){if(t.shallow.has(e.id))return;const o="first-parent"===n&&e.data.parents.length>0?[e.data.parents[0]]:e.data.parents;for(const e of o)if(!(t.visited.has(e)||t.missing.has(e)||t.until.has(e))){if(t.queue.length>=65536)throw l("walk queue exceeds bound");t.queue.push(e)}}async function Va(t){const e=new Set;await t.fs.exists(`${t.layout.gitDir}/HEAD`)&&e.add("HEAD");for(const n of await async function(t){const e=`${t.layout.gitDir}/refs`;return await t.fs.exists(e)?qa(t,e,"refs"):[]}(t))e.add(n);for(const n of(await Fr(t).getPackedRefs()).entries)e.add(n.name);return[...e]}async function qa(t,e,n){const o=await t.fs.readdir(e),r=[];for(const s of o){const o=`${n}/${s.name}`;s.isDirectory?r.push(...await qa(t,`${e}/${s.name}`,o)):r.push(o)}return r}const Xa=(t,e)=>t.some(t=>!(4&(e.get(t.oid)??0))),Ja=async(t,e,n)=>{const o=new Map,r=new na(oa),s=async(e,n)=>{var s;o.set(e,(o.get(e)??0)|n),r.push({oid:e,date:(s=await t(e),s?.data.committer.timestamp??0),value:void 0})};await s(e,1);for(const t of n)await s(t,2);for(;Xa(r.entries(),o);){const{oid:e}=r.pop();let n=7&(o.get(e)??0);3===n&&(o.set(e,8|(o.get(e)??0)),n|=4);const i=await t(e);for(const t of i?.data.parents??[])((o.get(t)??0)&n)!==n&&await s(t,n)}return o},Qa=async(t,e)=>{const n=[...new Set(e)];if(n.length<=1)return n;const o=[];for(const e of n){const r=n.filter(t=>t!==e);2&((await Ja(t,e,r)).get(e)??0)||o.push(e)}return o},Za=async(t,e,n)=>{if(0===n.length)return[e];const o=(t=>{const e=[];for(const[n,o]of t)8&o&&e.push(n);return e})(await Ja(t,e,n));return Qa(t,o)},tc=async(t,e,n)=>{if(0===e.length)throw l("mergeBase requires at least one commit");const o=(t=>{const e=new Map;return async n=>{if(!e.has(n)){const o=await Qs(t,n);e.set(n,"commit"===o.type?o:void 0)}return e.get(n)}})(t),r=[...n?.octopus?await(async(t,e)=>{let n=[e[0]];for(let o=1;o<e.length;o+=1){const r=[];for(const s of n)r.push(...await Za(t,e[o],[s]));n=r}return Qa(t,n)})(o,e):await Za(o,e[0],e.slice(1))].sort();return!0===n?.all?r:r.slice(0,1)},ec=new TextEncoder,nc=new Set(["side-band-64k","side-band"]),oc=async(t,e,n)=>{t.progress.start(n.progressOp);try{const o=await ic(t,e,n);return 0===o.packBytes.length?rc(o.shallow,o.unshallow):await sc(t,o,n)}finally{t.progress.end(n.progressOp)}},rc=(t,e)=>({packPath:"",idxPath:"",objectCount:0,packSha:"",shallow:t,unshallow:e}),sc=async(t,e,n)=>{const o=await uc(e.packBytes,t),r=await fc(t,e.packBytes);if(0===r.length)return rc(e.shallow,e.unshallow);const s=await kc(t,r,o),i=await xc(t,e.packBytes,s,o,r.length,!0===n.promisor);return function(t){qs.get(t)?.refresh()}(t),{...i,shallow:e.shallow,unshallow:e.unshallow}},ic=async(t,e,n)=>e(t,n),ac=async(t,e,n)=>{const o=t.config?.maxResponseBytes??536870912,r=[];let s=0,i=0;for await(const a of n){if(s+a.byteLength>o)throw cc(o);r.push(a),s+=a.byteLength,s-i>=65536&&(t.progress.update(e.progressOp,s),i=s)}0!==s&&s!==i&&t.progress.update(e.progressOp,s);const a=new Uint8Array(s);let c=0;for(const t of r)a.set(t,c),c+=t.byteLength;return a},cc=e=>new t({code:"PACK_TOO_LARGE",objectCount:0,limit:e}),dc=t=>t.some(t=>nc.has(t)),uc=async(t,e)=>{const n=e.hash.digestLength;if(t.length<12+n)throw xn("trailer mismatch: pack too short for header + trailer");const o=t.length-n,r=t.subarray(0,o),s=t.subarray(o),i=await e.hash.hashHex(r),a=tt(s);if(i!==a)throw xn(`trailer mismatch: expected ${i}, got ${a}`);return i},fc=async(t,e,n)=>{const o=await lc(t,e);return(await hc(t,o,n)).slice().sort((t,e)=>t.offset-e.offset).map(t=>({id:t.id,crc32:t.crc32,offset:t.offset}))},lc=async(e,n)=>{const o=function(t){if(t.length<12)throw xn("truncated: pack header requires 12 bytes");const e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.getUint32(0);if(n!==Un)throw xn(`invalid magic: expected 0x5041434b, got 0x${n.toString(16).padStart(8,"0")}`);const o=e.getUint32(4);if(2!==o)throw xn(`unsupported version: expected 2, got ${o}`);return{version:o,objectCount:e.getUint32(8)}}(n),r=e.config?.maxObjectsPerPack??5e7;if(o.objectCount>r)throw new t({code:"PACK_TOO_LARGE",objectCount:o.objectCount,limit:r});const s=n.length-e.hash.digestLength,i=[];let a=12;for(let t=0;t<o.objectCount;t+=1){const t=Tn(n,a,e.hashConfig),o=await e.compressor.streamInflate(n,t.dataOffset),r=t.dataOffset+o.bytesConsumed;if(r>s)throw xn("entry extends past pack trailer");const c=W(n.subarray(a,r));i.push({offset:a,header:t,inflated:o.output,crc32:c}),a=r}if(a!==s)throw xn("extra bytes between last entry and trailer");return i},hc=async(t,e,n)=>{const o=new Map,r=new Map;let s=e;for(;s.length>0;){const e=[];let i=!1;for(const a of s){const s=await pc(t,a,o,r,n);void 0===s?e.push(a):(o.set(s.offset,s),r.set(s.id,s),i=!0)}if(!i)throw wc(e);s=e}return[...o.values()]},wc=t=>{const e=t[0];if(void 0===e)return xn("unresolved deltas: empty queue (internal invariant violated)");const n=gc(e.header);return xn(void 0!==n?`unresolved REF_DELTA: base ${n} not in pack`:`unresolved entry at offset ${e.offset}`)},gc=t=>{if(!yc(t)&&6!==t.type)return t.baseId},pc=async(t,e,n,o,r)=>{if(yc(e.header)){const n=vc(e.header.type);return{id:await bc(t,n,e.inflated),type:n,content:e.inflated,crc32:e.crc32,offset:e.offset}}if(6===e.header.type){const o=e.offset-e.header.baseDistance;if(o<12)throw xn(`OFS_DELTA at offset ${e.offset} points before pack body: distance ${e.header.baseDistance}`);const r=n.get(o);if(void 0===r)return;return mc(t,e,r)}const s=o.get(e.header.baseId);if(void 0!==s)return mc(t,e,s);if(void 0===r)return;const i=await r(e.header.baseId);return void 0!==i?mc(t,e,{type:i.type,content:i.content}):void 0},mc=async(t,e,n)=>{const o=An(n.content,e.inflated);return{id:await bc(t,n.type,o),type:n.type,content:o,crc32:e.crc32,offset:e.offset}},yc=t=>1===t.type||2===t.type||3===t.type||4===t.type,vc=t=>{switch(t){case 1:return"commit";case 2:return"tree";case 3:return"blob";case 4:return"tag"}},bc=async(t,e,n)=>{const o=ec.encode(`${e} ${n.length}\0`),r=new Uint8Array(o.length+n.length);return r.set(o,0),r.set(n,o.length),t.hash.hashHex(r)},kc=async(t,e,n)=>{const o=function(t,e){if(20!==e.length)throw In(`packChecksum must be 20 bytes, got ${e.length}`);const n=t.map(t=>({shaBytes:et(t.id),entry:t}));n.sort((t,e)=>ot(t.shaBytes,e.shaBytes));const o=n.length;let r=0;for(const t of n)t.entry.offset>2147483647&&(r+=1);const s=20*o,i=4*o,a=4*o,c=1032+s+i+a+8*r+20,d=new Uint8Array(c),u=new DataView(d.buffer);u.setUint32(0,4285812579),u.setUint32(4,2);const f=new Uint32Array(256);for(const{shaBytes:t}of n)f[t[0]]+=1;const l=new Uint32Array(256);let h=0;for(let t=0;t<256;t++)h+=f[t],l[t]=h;for(let t=0;t<256;t++)u.setUint32(8+4*t,l[t]);for(let t=0;t<o;t++)d.set(n[t].shaBytes,1032+20*t);const w=1032+s;for(let t=0;t<o;t++)u.setUint32(w+4*t,n[t].entry.crc32);const g=w+i;let p=0;const m=g+a;for(let t=0;t<o;t++){const e=n[t].entry.offset;if(e>2147483647){u.setUint32(g+4*t,2147483648|p);const n=Math.floor(e/4294967296),o=e>>>0;u.setUint32(m+8*p,n),u.setUint32(m+8*p+4,o),p+=1}else u.setUint32(g+4*t,e)}return d.set(e,c-20),d}(e.map(t=>({id:t.id,crc32:t.crc32,offset:t.offset})),et(n)),r=et(await t.hash.hashHex(o)),s=new Uint8Array(o.length+r.length);return s.set(o,0),s.set(r,o.length),s},xc=async(t,e,n,o,r,s)=>{const i=`${t.layout.gitDir}/objects/pack`;await t.fs.mkdir(i);const a=`${i}/pack-${o}.pack`,c=`${i}/pack-${o}.idx`;return await t.fs.writeExclusive(a,e),await t.fs.writeExclusive(c,n),s&&await t.fs.writeExclusive(`${i}/pack-${o}.promisor`,new Uint8Array(0)),{packPath:a,idxPath:c,objectCount:r,packSha:o}},Ic=t=>{if(t.signal?.aborted)throw i()},Ec=async(e,n,o)=>{try{return((t,e,n)=>({ok:!0,id:e,type:n.type,size:Mt(n,t.hashConfig),object:n}))(e,n,await Qs(e,n,o))}catch(e){if((e=>e instanceof t&&"OBJECT_NOT_FOUND"===e.data.code)(e))return(t=>({ok:!1,id:t,reason:"missing"}))(n);throw e}};async function*$c(t,e,n){const o=void 0===n?.maxBytes?void 0:{maxBytes:n.maxBytes};for await(const n of e){Ic(t);const e=await Ec(t,n,o);yield e,Ic(t)}}const Cc=async(t,e,n,o)=>{const r=await fo(t,e,n,o);if(void 0!==r)throw h(r.key,r.source,r.line)},Dc=(t,e)=>{const n=`${e.gitDir}/hooks`;return void 0===t?n:""===t?`${e.gitDir}/.tsgit-no-hooks`:t.startsWith("~/")?void 0===e.homeDir?n:`${e.homeDir}/${t.slice(2)}`:(o=t).startsWith("/")||/^[A-Za-z]:[\\/]/.test(o)?t:jr(e.workDir,t);var o},Lc=async(t,e,n)=>{const o=t.hooks;if(void 0===o)return;await Cc(t,"core",void 0,["hookspath"]);const r=await ro(t),s={name:e,hooksDir:Dc(r.core?.hooksPath,t.layout),workDir:t.layout.workDir,gitDir:t.layout.gitDir,args:n.args??[],stdin:n.stdin??"",...void 0!==t.signal?{signal:t.signal}:{}};return o.run(s)},Sc=async(t,e,n={})=>{const o=await Lc(t,e,n);if(void 0!==o&&"skipped"!==o.kind&&0!==o.exitCode)throw w(e,o.exitCode,o.stderr)},Oc=async(t,e,n={})=>{await Lc(t,e,n)};async function Ac(t,e){if(e.length>V)throw M(e.length,V);return Wi(t,{type:"tree",id:"",entries:e})}const Uc=t=>{let e=0;for(const n of t)"/"===n&&(e+=1);if(e>4096)throw T(e)},Tc=async(t,e)=>{const{files:n,subdirs:o}=(t=>{const e=[],n=new Map;for(const o of t){const t=o.path.indexOf("/");if(-1===t){e.push(o);continue}const r=o.path.slice(0,t),s=o.path.slice(t+1),i=n.get(r),a={path:s,id:o.id,mode:o.mode};void 0===i?n.set(r,[a]):i.push(a)}return{files:e,subdirs:n}})(e),r=[];for(const t of n)r.push({name:t.path,id:t.id,mode:t.mode});for(const[e,n]of o){const o=await Tc(t,n);r.push({name:e,id:o,mode:_.DIRECTORY})}return Ac(t,r)},Mc=async(t,e)=>Tc(t,(t=>{const e=[];for(const n of t)0===n.flags.stage&&(Ft(n.path,-1),Uc(n.path),e.push({path:n.path,id:n.id,mode:n.mode}));return e})(e)),Nc=t=>"unchanged"!==t&&"absent"!==t,_c=new TextEncoder,Rc=async(t,e,n)=>{const o=jr(t.layout.workDir,e.path),r=await t.fs.lstat(o).catch(()=>{});if(void 0===r)return{status:"absent"};const s=B(r);if(e.mode!==_.GITLINK&&!Kt(s,e.mode))return{status:"type-changed",worktreeMode:s};try{const i=r.isSymbolicLink?_c.encode(await t.fs.readlink(o)):await t.fs.read(o),a=r.isSymbolicLink||void 0===n||void 0===t.command?i:await(async(t,e,n,o,r)=>{const s=await ei(t,n,o);if("external"!==s.kind||void 0===s.clean)return r;const i=await ni(t,e,s.clean,r);return i.ok?i.bytes:r})(t,t.command,n,e.path,i),{id:c}=await is(t,{type:"blob",id:"",content:a});return c!==e.id?{status:"modified",worktreeMode:s}:{status:s===e.mode?"unchanged":"mode-changed",worktreeMode:s}}catch{return{status:"modified",worktreeMode:s}}},Pc=async(t,e,n)=>(await Rc(t,e,n)).status;async function Fc(t,e){if(e.message.includes("\0"))throw D("message contains NUL");var n,o;if(o=e.message,(new TextEncoder).encode(o).byteLength>16777216)throw D("message exceeds 16 MiB");if(void 0!==e.gpgSignature&&((n=e.gpgSignature).includes("\0")||n.includes("\r")))throw D("gpgSignature contains header-boundary chars");if(void 0!==e.extraHeaders)for(const t of e.extraHeaders){if(bs(t.key))throw D("extraHeader key contains forbidden characters");if(vs(t.value))throw D("extraHeader value contains header-boundary chars")}return gt(e.author),gt(e.committer),Wi(t,{type:"commit",id:"",data:{tree:e.tree,parents:e.parents,author:e.author,committer:e.committer,message:e.message,...void 0!==e.gpgSignature?{gpgSignature:e.gpgSignature}:{},extraHeaders:e.extraHeaders??[]}})}const zc=t=>`${t.layout.gitDir}/shallow`,Bc=e=>e instanceof t&&"FILE_NOT_FOUND"===e.data.code,jc=async t=>{let e;try{e=await t.fs.readUtf8(zc(t))}catch(t){if(Bc(t))return new Set;throw t}const n=new Set;for(const t of e.split("\n")){const e=t.trim();0!==e.length&&Hc(e)&&n.add(yt.from(e))}return n},Wc=/^[0-9a-f]{40}([0-9a-f]{24})?$/i,Hc=t=>Wc.test(t),Gc=async(t,e)=>{const n=new Set(await jc(t));for(const t of e.shallow)n.add(t);for(const t of e.unshallow)n.delete(t);const o=zc(t);if(0===n.size)return void await Yc(t,o);const r=[...n].sort(),s=(new TextEncoder).encode(r.map(t=>`${t}\n`).join(""));await Kc(t,o,s)},Kc=async(t,e,n)=>{const o=(t=>`${t.layout.gitDir}/shallow.lock`)(t);await t.fs.writeExclusive(o,n);try{await t.fs.rename(o,e)}catch(e){try{await t.fs.rm(o)}catch(t){if(!Bc(t))throw t}throw e}},Yc=async(t,e)=>{try{await t.fs.rm(e)}catch(t){if(Bc(t))return;throw t}},Vc=(t,e)=>{const n=e.toLowerCase();if(""===t.section&&void 0===t.subsection)return n;const o=t.section.toLowerCase();return void 0===t.subsection?`${o}.${n}`:`${o}.${t.subsection}.${n}`},qc=(t,e)=>t.section.toLowerCase()===e.section&&(void 0===e.subsection?void 0===t.subsection:t.subsection===e.subsection),Xc=(t,e)=>{const n=[];for(const o of t)if(qc(o,e))for(const t of o.entries)t.key.toLowerCase()===e.name&&n.push({value:t.value});return n},Jc=["system","global","local","worktree"],Qc=async(t,e)=>{try{return await t.fs.exists(e)}catch{return!1}},Zc=(e,n)=>{try{return n()}catch(n){if(n instanceof t&&"UNSUPPORTED_OPERATION"===n.data.code)throw g(e,"browser-adapter");throw n}},td=async(e,n)=>{if("local"===n)return`${Yn(e)}/config`;if("worktree"===n){if(!await(async e=>{const n=`${Yn(e)}/config`,o=await(async(e,n)=>{try{return await e.fs.readUtf8(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return;throw e}})(e,n);if(void 0===o)return!1;const r=Lo(o,n);for(const t of r)if("extensions"===t.section.toLowerCase()&&void 0===t.subsection)for(const e of t.entries)if("worktreeconfig"===e.key.toLowerCase())return"true"===e.value;return!1})(e))throw g("worktree","worktree-extension-unset");return`${e.layout.gitDir}/config.worktree`}if("global"===n){const t=Zc("global",()=>e.fs.xdgConfigHome()),n=Zc("global",()=>e.fs.homedir()),o=`${t}/git/config`;if(await Qc(e,o))return o;const r=`${n}/.gitconfig`;return await Qc(e,r),r}const o=Zc("system",()=>e.fs.systemConfigPath());if(0===o.length)throw p();return o};let ed=new WeakMap;const nd=t=>{ed.delete(t)},od=(e,n)=>{const o=(t=>{const e=ed.get(t);if(void 0!==e)return e;const n=new Map;return ed.set(t,n),n})(e),r=o.get(n);if(void 0!==r)return r;const s=(async(e,n)=>{const o=await td(e,n);try{const t=await e.fs.readUtf8(o);return Lo(t,o)}catch(e){if(e instanceof t){const t=e.data.code;if("FILE_NOT_FOUND"===t||"PERMISSION_DENIED"===t)return[]}throw e}})(e,n);return o.set(n,s),s},rd=async(e,n)=>{try{return{scope:n,sections:await od(e,n)}}catch(e){if(e instanceof t){const t=e.data.code;if("CONFIG_SCOPE_NOT_AVAILABLE"===t)return;if("CONFIG_SYSTEM_PATH_UNRESOLVED"===t)return}throw e}},sd=async({ctx:t,scope:e})=>{if(void 0!==e)return(await od(t,e)).map(t=>({scope:e,section:t}));const n=[];for(const e of Jc){const o=await rd(t,e);void 0!==o&&n.push(o)}return(t=>{const e=new Map;for(const{scope:n,sections:o}of t)e.set(n,o);const n=[];for(const t of Jc){const o=e.get(t);if(void 0!==o)for(const e of o)n.push({scope:t,section:e})}return n})(n)},id=async(t,e,n)=>{if(void 0!==n){const o=await od(t,n);return Xc(o,e).map(t=>({value:t.value,scope:n}))}return((t,e)=>{const n=[];for(const{scope:o,section:r}of t)if(qc(r,e))for(const t of r.entries)t.key.toLowerCase()===e.name&&n.push({value:t.value,scope:o});return n})((await sd({ctx:t})).map(({scope:t,section:e})=>({scope:t,section:e})),e)},ad=async({ctx:t,key:e,scope:n})=>{const o=Y(e),r=await id(t,o,n);if(0===r.length)return{key:e,value:void 0};if(r.length>1)throw m(e,r.length,"read",n);const[s]=r;return{key:e,value:s.value,scope:s.scope}},cd=async({ctx:t,key:e,scope:n})=>{const o=Y(e);return{key:e,values:await id(t,o,n)}},dd=(t,e)=>`\t${t} = ${(t=>{const e=t.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("\n","\\n").replaceAll("\t","\\t");return(t=>t.startsWith(" ")||t.endsWith(" ")||t.includes(";")||t.includes("#")||t.includes("\r"))(t)?`"${e}"`:e})(e)}`,ud=(t,e)=>void 0===e?`[${t}]`:`[${t} "${(t=>t.replaceAll("\\","\\\\").replaceAll('"','\\"'))(e)}"]`,fd=(t,e)=>{if(/[\n\r\0]/.test(e))throw n("config",`${t} must not contain a newline or NUL`)},ld=t=>{if(t.includes("\0"))throw n("config","value must not contain a NUL byte")},hd=t=>{if(/[\n\0]/.test(t))throw n("config","subsection must not contain a newline or NUL")},wd=t=>{if(/[\s\0[\]"\\]/.test(t))throw n("config","section must not contain whitespace, NUL, brackets, quotes, or backslashes")},gd=(t,e)=>{if(""===t&&void 0===e)throw n("config","section name must not be empty without a subsection")},pd=t=>void 0===t.subsection?t.section:`${t.section}.${t.subsection}`,md=t=>{const e=Fo(t);if("header"===e.parse.kind)return{rawName:pd(e.parse),endOffset:e.endOffset}},yd=(t,e)=>{for(let n=0;n<t.length;n+=1)if(md(t[n])?.rawName===e)return n;return-1},vd=(t,e)=>{const n=t.split("\n"),o=[];let r=!1;for(const t of n){const n=md(t);void 0===n||(r=n.rawName===e),r||o.push(t)}return((t,e)=>""===t[t.length-1]&&e.length>0&&""!==e[e.length-1]?[...e,""]:e)(n,o).join("\n")},bd=(t,e,n)=>{wd(n.section),gd(n.section,n.subsection),void 0!==n.subsection&&hd(n.subsection);const o=t.split("\n").map(t=>{const o=md(t);return void 0===o||o.rawName!==e?t:((t,e,n)=>{const o=ud(n.section,n.subsection),r=Do(t,e);return r>=t.length?o:`${o}\n\t${t.slice(r)}`})(t,o.endOffset,n)});return o.join("\n")},kd=async(e,n)=>{try{return await e.fs.readUtf8(n)}catch(e){if(e instanceof t&&"FILE_NOT_FOUND"===e.data.code)return"";throw e}},xd=async({ctx:t,oldName:e,newName:o,scope:r})=>{const s=(t=>{if(""===t)throw n("config",`invalid section name: ${t}`);const e=t.indexOf("."),o=-1===e?t:t.slice(0,e);if(o.length>0&&!/^[a-zA-Z0-9-]+$/.test(o))throw n("config",`invalid section name: ${t}`);return-1===e?{section:o}:{section:o,subsection:t.slice(e+1)}})(o);void 0!==s.subsection&&hd(s.subsection);const i=r??"local",a=await td(t,i),c=await kd(t,a);if(-1===yd(c.split("\n"),e))throw y(e,i);const d=bd(c,e,s);await t.fs.writeUtf8(a,d),io(t),nd(t)},Id=async({ctx:t,sectionName:e,scope:n})=>{const o=n??"local",r=await td(t,o),s=await kd(t,r);if(-1===yd(s.split("\n"),e))throw y(e,o);const i=vd(s,e);await t.fs.writeUtf8(r,i),io(t),nd(t)},Ed=(t,e)=>({sectionLc:t.toLowerCase(),subsection:e}),$d=(t,e)=>t.section.toLowerCase()===e.sectionLc&&t.subsection===e.subsection,Cd=(t,e)=>{let n,o,r=!1;for(const s of t)"header"===s.kind?(r&&(n=o),r=$d(s,e),o=r?s.line+1:void 0):r&&"entry"===s.kind&&(o=s.endLine);return r&&(n=o),n},Dd=(t,e,n,o)=>{const r=o.endsWith("\n")?t.length-1:t.length,s=Math.min(e,r),i=[...t.slice(0,s),n,...t.slice(s)];return s===t.length&&i.push(""),i},Ld=(t,e,n,o,r)=>{wd(e),gd(e,n),fd("key",o),ld(r),void 0!==n&&hd(n);const s=t.split("\n"),i=ko(s,t.endsWith("\n")),a=Ed(e,n),c=((t,e,n)=>{const o=n.toLowerCase();let r=!1;for(const n of t)if("header"===n.kind)r=$d(n,e);else if(r&&"entry"===n.kind&&n.key.toLowerCase()===o)return n})(i,a,o);if(void 0!==c)return((t,e,n,o)=>{const r=n.sharesHeaderLine?((t,e)=>{for(const n of t)if("header"===n.kind&&n.line===e.startLine)return n})(e,n):void 0,s=void 0!==r?[ud(r.section,r.subsection),o]:[o],i=[...t.slice(0,n.startLine),...s,...t.slice(n.endLine)];return(n.endLine===t.length?[...i,""]:i).join("\n")})(s,i,c,dd(o,r));const d=Cd(i,a);return void 0===d?`${""===t?"":t.endsWith("\n")?t:`${t}\n`}${ud(e,n)}\n${dd(o,r)}\n`:Dd(s,d,dd(o,r),t).join("\n")},Sd=(t,e,n)=>Ld(t,"core",void 0,e,n),Od=t=>[t.header.line,...t.bodyTokens.flatMap(t=>"entry"===t.kind?Ad([t]):[t.line])],Ad=t=>t.flatMap(t=>Array.from({length:t.endLine-t.startLine},(e,n)=>t.startLine+n)),Ud=(t,e,n,o)=>{wd(e),void 0!==n&&hd(n),fd("key",o);const r=t.split("\n"),s=Ed(e,n),i=(t=>{const e=[];for(let n=0;n<t.length;n++){const o=t[n];if("header"!==o.kind)continue;const r=[];let s=n+1;for(;s<t.length&&"header"!==t[s].kind;)r.push(t[s]),s++;e.push({header:o,bodyTokens:r}),n=s-1}return e})(ko(r,t.endsWith("\n"))),a=o.toLowerCase(),c=i.filter(t=>$d(t.header,s)).map(t=>((t,e)=>{const n=((t,e)=>t.bodyTokens.flatMap(t=>"entry"===t.kind&&t.key.toLowerCase()===e?[{startLine:t.startLine,endLine:t.endLine}]:[]))(t,e);return 0===n.length?{excluded:[]}:((t,e)=>t.header.hasComment||t.bodyTokens.some(t=>"comment"===t.kind||"entry"===t.kind&&t.key.toLowerCase()!==e))(t,e)?n.some(e=>e.startLine===t.header.line)?{excluded:Ad(n).filter(e=>e!==t.header.line),headerRewrite:{line:t.header.line,text:ud(t.header.section,t.header.subsection)}}:{excluded:Ad(n)}:{excluded:Od(t)}})(t,a));return((t,e)=>{const n=new Set(e.flatMap(t=>t.excluded)),o=new Map(e.flatMap(t=>t.headerRewrite?[[t.headerRewrite.line,t.headerRewrite.text]]:[]));if(0===n.size&&0===o.size)return;const r=[];for(const[e,s]of t.entries())n.has(e)||r.push(o.get(e)??s);return(n.has(t.length-1)?[...r,""]:r).join("\n")})(r,c)??t},Td=async(t,e)=>{const n=`${t.layout.gitDir}/config`,o=await kd(t,n);Pd(o,n);const r=e.reduce((t,e)=>Ld(t,e.section,e.subsection,e.key,e.value),o);await t.fs.writeUtf8(n,r),io(t)},Md=async(t,e)=>{await Td(t,Object.entries(e).map(([t,e])=>({section:"core",key:t,value:e})))},Nd=(t,e)=>"set"===e.kind?Ld(t,e.section,e.subsection,e.key,e.value):"appendEntry"===e.kind?_d(t,e.section,e.subsection,e.key,e.value):"removeEntry"===e.kind?Ud(t,e.section,e.subsection,e.key):"removeSection"===e.kind?vd(t,pd({section:e.section,subsection:e.subsection})):bd(t,pd({section:e.section,subsection:e.from}),{section:e.section,subsection:e.to}),_d=(t,e,n,o,r)=>{wd(e),gd(e,n),fd("key",o),ld(r),void 0!==n&&hd(n);const s=t.split("\n"),i=ko(s,t.endsWith("\n")),a=Ed(e,n),c=Cd(i,a);return void 0===c?`${""===t?"":t.endsWith("\n")?t:`${t}\n`}${ud(e,n)}\n${dd(o,r)}\n`:Dd(s,c,dd(o,r),t).join("\n")},Rd=async(t,e)=>{const n=`${t.layout.gitDir}/config`,o=await kd(t,n);Pd(o,n);const r=e.reduce(Nd,o);await t.fs.writeUtf8(n,r),io(t)},Pd=(e,n)=>{try{return Lo(e,n)}catch(e){if(e instanceof t&&"CONFIG_PARSE_ERROR"===e.data.code&&void 0!==e.data.partialSectionName)throw b(e.data.partialSectionName,n);throw e}},Fd=async({ctx:t,key:e,value:n,scope:o})=>{const r=Y(e);((t,e)=>{for(let n=0;n<e.length;n+=1)if(0===e.charCodeAt(n))throw v(t,n)})(e,n);const s=o??"local";await(async(t,e)=>{const o=await td(t,e),s=await kd(t,o);Pd(s,o);const i=Ld(s,r.section,r.subsection,r.name,n);await t.fs.writeUtf8(o,i),io(t),nd(t)})(t,s)},zd=async({ctx:t,key:e,scope:n})=>{const o=Y(e),r=n??"local",s=await td(t,r),i=await kd(t,s),a=Pd(i,s),c=Xc(a,o);if(0===c.length)return;if(c.length>1)throw m(e,c.length,"remove",r);const d=Ud(i,o.section,o.subsection,o.name);await t.fs.writeUtf8(s,d),io(t),nd(t)},Bd=async({ctx:t,key:e,scope:n})=>{const o=Y(e),r=n??"local",s=await td(t,r),i=await kd(t,s),a=Pd(i,s);if(0===Xc(a,o).length)return;const c=Ud(i,o.section,o.subsection,o.name);await t.fs.writeUtf8(s,c),io(t),nd(t)},jd=t=>`'${t.replaceAll("'","'\\''")}'`,Wd=new Uint8Array(0),Hd=new TextDecoder,Gd=/-----BEGIN (?:PGP|SSH) SIGNATURE-----[\s\S]*-----END (?:PGP|SSH) SIGNATURE-----/,Kd=t=>t.keyOverride??t.signingKey??t.fallbackIdent,Yd=t=>Gd.test(t),Vd=e=>e instanceof t&&"FILE_NOT_FOUND"===e.data.code,qd=async(t,e)=>{try{await t.fs.rm(e)}catch(t){if(!Vd(t))throw t}},Xd=async(t,e,n)=>{const o=t.command;return void 0===o?{ok:!1,reason:"off-node"}:"x509"===n.format?{ok:!1,reason:"unsupported-format"}:"ssh"===n.format?(async(t,e,n,o)=>{const r=o.program??"ssh-keygen",s=`${t.layout.gitDir}/GIT_SIGNING_BUFFER`,i=`${s}.sig`;await t.fs.write(s,n);try{if(0!==(await e.run({command:`${jd(r)} -Y sign -n git -f ${jd(o.selector)} ${jd(s)}`,cwd:t.layout.workDir,env:{GIT_DIR:t.layout.gitDir},...void 0!==t.signal?{signal:t.signal}:{}})).exitCode)return{ok:!1,reason:"signer-failed"};const n=await(async(t,e)=>{try{return Hd.decode(await t.fs.read(e))}catch(t){if(Vd(t))return;throw t}})(t,i);return void 0!==n&&Yd(n)?{ok:!0,armor:n}:{ok:!1,reason:"signer-failed"}}finally{await qd(t,s),await qd(t,i)}})(t,o,e,n):(async(t,e,n,o)=>{const r=o.program??"gpg",s=await e.run({command:`${jd(r)} --status-fd=2 -bsau ${jd(o.selector)}`,cwd:t.layout.workDir,env:{GIT_DIR:t.layout.gitDir},stdin:n,...void 0!==t.signal?{signal:t.signal}:{}}),i=Hd.decode(s.stdout??Wd);return 0===s.exitCode&&Yd(i)?{ok:!0,armor:i}:{ok:!1,reason:"signer-failed"}})(t,o,e,n)},Jd=(t,e)=>e?t.data.parents.slice(0,1):t.data.parents;async function*Qd(t,e){const n=e.shallow??new Set,o={heap:new na(oa),seen:new Set(e.from),until:new Set(e.until??[]),firstParent:e.firstParent??!1,read:Zd(t,e)};for(await tu(o);o.heap.size()>0;){if(t.signal?.aborted)throw i();const{value:e}=o.heap.pop();yield{commit:e,frontierEmpty:0===o.heap.size(),frontier:()=>o.heap.entries().map(t=>t.oid)},n.has(e.id)||await eu(o,e)}}const Zd=(t,e)=>{const n=e.verifyHash??!0,o=e.ignoreMissing??!1,r=new Set;return e=>Ha(t,e,{verifyHash:n,ignoreMissing:o,missing:r})},tu=async t=>{for(const e of t.seen)t.until.has(e)||await nu(t,e)},eu=async(t,e)=>{for(const n of Jd(e,t.firstParent))t.seen.has(n)||t.until.has(n)||(t.seen.add(n),await nu(t,n))},nu=async(t,e)=>{const n=await t.read(e);void 0!==n&&t.heap.push({oid:e,date:n.data.committer.timestamp,value:n})},ou=async e=>{const n=await qi(e,"HEAD").catch(e=>{if(!(e instanceof t&&"REF_NOT_FOUND"===e.data.code))throw e});if(void 0===n)return;const o=await Qs(e,n);if("commit"!==o.type)throw U("commit",o.type,n);return va(e,o.data.tree)},ru=async(t,e)=>void 0!==await Js(t).lookup(e)||t.fs.exists(qn(Yn(t),e));async function su(t,e){const n=!1!==e?.includePacks,o=new Set;return await async function(t,e){const n=Yn(t);for(const o of iu){const r=Qn(n,o);if(!await t.fs.exists(r))continue;const s=await t.fs.readdir(r);for(const t of s)t.isFile&&e.add(`${o}${t.name}`)}}(t,o),n&&await async function(t,e){const n=Js(t),o=await n.all();for(const t of o)for(const n of Wn(t.index))e.add(n)}(t,o),[...o].sort()}const iu=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),au=/^[A-Za-z]:/,cu=t=>{if(t.startsWith("-"))return!0;if(t.includes("\\"))return!0;if((t=>{for(let e=0;e<t.length;e+=1){const n=t.charCodeAt(e);if(n<=31)return!0;if(127===n)return!0}return!1})(t))return!0;if(au.test(t))return!0;for(const e of t.split("/")){if(""===e)return!0;if("."===e)return!0;if(".."===e)return!0}return!1},du=(t,e)=>void 0!==e?{...t,stage:0,skipWorktree:!1}:{...t,stage:0},uu=(t,e)=>t.path<e.path?-1:t.path>e.path?1:0,fu=async(t,e)=>{const n=(t=>{const e=new Map;for(const n of t.entries)0===n.flags.stage&&e.set(n.path,n);return e})(e.currentIndex),o=await(async(t,e)=>{const n=[];for await(const o of hi(t,e))o.mode!==_.DIRECTORY&&n.push({path:o.path,id:o.id,mode:o.mode});return n})(t,e.targetTree),r=o.map(t=>((t,e,n)=>{if(void 0!==n&&!n(t.path))return Q(t);const o=e.get(t.path);return void 0!==o&&o.id===t.id&&o.mode===t.mode?{...o,flags:du(o.flags,n)}:(t=>({ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:t.mode,uid:0,gid:0,fileSize:0,id:t.id,flags:J,path:t.path}))(t)})(t,n,e.sparse));return r.sort(uu),r};async function lu(t,e){return gt(e.tagger),Wi(t,{type:"tag",id:"",data:{object:e.object,objectType:e.objectType,tagName:e.tagName,tagger:e.tagger,message:e.message,...void 0!==e.gpgSignature?{gpgSignature:e.gpgSignature}:{},extraHeaders:e.extraHeaders??[]}})}async function*hu(t,e){const n={emitted:new Set,cap:e.maxObjects??Dr},o=await(async(t,e,n)=>{const o=[];for(const r of n){const n=await Wa(t,r,t=>{ja(e,t)});o.push(n)}return o})(t,n,e.wants);for(const t of n.emitted)yield t;yield*async function*(t,e,n,o){for await(const r of Ka(t,{from:n,until:o,ignoreMissing:!0})){ja(e,r.id)&&(yield r.id),ja(e,r.data.tree)&&(yield r.data.tree);for await(const n of hi(t,r.data.tree,{recursive:!0}))Ds(n.mode)||ja(e,n.id)&&(yield n.id)}}(t,n,o,e.haves)}const wu=async(t,e,n={})=>{if(t.signal?.aborted)throw i();if(e.byteLength>$r)throw k("(hashBlob-content)",e.byteLength,$r);const{id:o}=await is(t,{type:"blob",content:e});return!0!==n.write?o:Wi(t,{type:"blob",id:o,content:e})},gu={kind:"empty"},pu=()=>({slots:Array.from({length:16},()=>gu),preserved:[]}),mu=t=>({kind:"internal",node:t}),yu=(t,e,n)=>({...t,slots:t.slots.map((t,o)=>o===e?n:t)}),vu=(t,e)=>Number.parseInt(t.charAt(e),16),bu=t=>"note"===t.kind?t.key:t.prefix,ku=(t,e,n)=>{const o=bu(e),r=vu(o,n),s=t.slots[r];if("empty"===s.kind)return yu(t,r,e);if("internal"===s.kind)return yu(t,r,mu(ku(s.node,e,n+1)));if(bu(s)===o)return yu(t,r,e);const i=ku(ku(pu(),s,n+1),e,n+1);return yu(t,r,mu(i))},xu=(t,e,n)=>[...e.slice(n+1)].reduceRight((t,e)=>mu(yu(pu(),vu(e,0),t)),mu(t)),Iu=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,Eu=/^[0-9a-f]{2}$/,$u=(t,e)=>{const n=[];return{...t.reduce((t,o)=>{const r=((t,e)=>{const n=e+t.name;return!z(t.mode)&&Iu.test(n)?{kind:"note",key:yt.from(n),val:t.id}:z(t.mode)&&Eu.test(t.name)?{kind:"subtree",prefix:n,oid:t.id}:null})(o,e);return null===r?(n.push(o),t):ku(t,r,e.length)},pu()),preserved:n}},Cu=t=>$u(t,""),Du=async(t,e)=>$u(await e(t.oid),t.prefix);async function Lu(e,n){const o=new Map,r=t=>{const n=o.get(t);if(void 0!==n)return n;const r=async function(t,e){const n=await Qs(t,e);if("tree"!==n.type)throw U("tree",n.type,e);return n.entries}(e,t);return o.set(t,r),r},s=await qi(e,n).catch(e=>{if(!(e instanceof t&&"REF_NOT_FOUND"===e.data.code))throw e});if(void 0===s)return{trie:Cu([]),read:r,notesCommitOid:void 0,notesTreeOid:void 0};const i=await Qs(e,s);if("commit"!==i.type)throw U("commit",i.type,s);const a=i.data.tree,c=await Qs(e,a);if("tree"!==c.type)throw U("tree",c.type,a);return{trie:Cu(c.entries),read:r,notesCommitOid:s,notesTreeOid:a}}const Su=async t=>{const e=await Xi(t,"HEAD"),n=await Ci(t);try{const o=await bi(t),r=await vi(t,{targetTree:e.id,currentIndex:o});return await n.commit(r.newIndexEntries),r}finally{await n.release()}},Ou="refs/notes/",Au=`${Ou}commits`,Uu=t=>{if(!t.startsWith(Ou))throw x(t);return t};async function Tu(t,e){if(void 0!==e)return Je((t=>t.startsWith(Ou)?t:t.startsWith("notes/")?`refs/${t}`:`${Ou}${t}`)(e));const n=t.env?.get("GIT_NOTES_REF");if(void 0!==n)return Je(Uu(n));const o=await ro(t),r=o.core?.notesRef;return void 0!==r?Je(Uu(r)):Au}async function*Mu(t,e){Nu(e.from);for await(const n of Qd(t,e))yield n.commit}const Nu=t=>{if(ms(t))throw l(gs);if(ys(t))throw l(ps)},_u=(t,e,n)=>{const o=`${t.layout.gitDir}/modules/${e}`,r=jr(t.layout.workDir,n),{promisor:s,hooks:i,...a}=t;return Object.freeze({...a,layout:Object.freeze({workDir:r,gitDir:o,bare:!1,...void 0!==t.layout.homeDir?{homeDir:t.layout.homeDir}:{}}),cwd:r})},Ru=async(t,e,n,o=new Set)=>{if(void 0===e)return;const r=`${t.layout.gitDir}/modules/${e}`;return!o.has(r)&&await t.fs.exists(`${r}/HEAD`)?_u(t,e,n):void 0},Pu=(t,e,n)=>_u(t,e,n),Fu=(t,e)=>{if(null===e.value)return t;const n=e.key.toLowerCase();return"path"===n?{...t,path:e.value}:"url"===n?{...t,url:e.value}:"update"===n?{...t,update:e.value}:"branch"===n?{...t,branch:e.value}:t},zu=t=>{if("submodule"!==t.section)return;if(void 0===t.subsection)return;if(cu(t.subsection))return;const e=t.entries.reduce(Fu,{});return{name:t.subsection,...void 0!==e.path?{path:e.path}:{},...void 0!==e.url?{url:e.url}:{},...void 0!==e.update?{update:e.update}:{},...void 0!==e.branch?{branch:e.branch}:{}}},Bu=t=>{const e=[];for(const n of Lo(t,".gitmodules")){const t=zu(n);void 0!==t&&e.push(t)}return e},ju=bt.from("HEAD"),Wu=new TextDecoder;async function*Hu(t,e){const n=e?.ref??ju,o=!0===e?.recursive,r=e?.maxDepth??100,s=await Xi(t,n),i=new Set([t.layout.gitDir]);yield*Gu(t,s,0,void 0,"",i,o,r)}async function*Gu(t,e,n,o,r,s,i,a){const c=await Yu(t,e);for await(const d of hi(t,e,{recursive:!0})){if(d.mode!==_.GITLINK)continue;const e=Ri(r,d.path),u=c.get(d.path);if(yield Ku(u,d.path,d.id,e,n,o),!i)continue;if(n>=a)continue;const f=await Ru(t,u?.name,d.path,s);if(void 0===f)continue;const l=await Vu(f,d.id);if(void 0===l)continue;const h=new Set(s).add(f.layout.gitDir);yield*Gu(f,l,n+1,e,e,h,i,a)}}const Ku=(t,e,n,o,r,s)=>({name:t?.name??e,path:o,commit:n,depth:r,...void 0!==t?.url?{url:t.url}:{},...void 0!==t?.branch?{branch:t.branch}:{},...void 0!==s?{parent:s}:{}}),Yu=async(t,e)=>{const n=e.entries.find(t=>".gitmodules"===t.name);if(void 0===n)return new Map;if(n.mode!==_.REGULAR&&n.mode!==_.EXECUTABLE)return new Map;const o=await Zs(t,n.id,{maxBytes:Lr}),r=Wu.decode(o.content),s=new Map;for(const t of Bu(r))void 0!==t.path&&s.set(t.path,t);return s},Vu=async(e,n)=>{try{return await Xi(e,n)}catch(e){if(e instanceof t&&"OBJECT_NOT_FOUND"===e.data.code)return;throw e}},qu=(t,e)=>[...Array.from({length:e},(e,n)=>t.slice(2*n,2*n+2)),t.slice(2*e)].join("/"),Xu=t=>Array.from({length:t.length/2},(e,n)=>t.slice(2*n,2*n+2)).join("/"),Ju=async(t,e,n,o,r,s)=>{return"empty"===t.kind?[]:"note"===t.kind?[{name:qu(t.key,r),mode:_.REGULAR,oid:t.val}]:"internal"===t.kind?(await Qu(t.node,n,o+1,r,s+(i=e,i.toString(16)))).entries:o<2*r?[{name:Xu(t.prefix),mode:_.DIRECTORY,oid:t.oid}]:(await Qu(await Du(t,n),n,t.prefix.length,r,t.prefix)).entries;var i},Qu=async(t,e,n,o,r)=>{const s=((t,e,n)=>e%2!=0||e>2*n?n:t.slots.every(t=>{return"subtree"===(e=t.kind)||"internal"===e;var e})?n+1:n)(t,n,o),i=[];for(const[o,a]of t.slots.entries())i.push(...await Ju(a,o,e,n,s,r));const a=t.preserved.map(t=>((t,e)=>({name:""===e?t.name:`${Xu(e)}/${t.name}`,mode:t.mode,oid:t.id}))(t,r));return{entries:[...i,...a]}};async function Zu(t,e){const n=await((t,e,n=0,o=0)=>Qu(t,e,n,o,""))(e.trie,e.read);return Fc(t,{tree:await tf(t,n.entries),parents:void 0!==e.prevCommitOid?[e.prevCommitOid]:[],author:e.author,committer:e.author,message:e.message})}async function tf(t,e){const n=[],o=new Map;for(const t of e){const e=t.name.indexOf("/");if(-1===e)n.push({id:t.oid,mode:t.mode,name:t.name});else{const n=t.name.slice(0,e),r=t.name.slice(e+1),s=o.get(n)??[];s.push({name:r,mode:t.mode,oid:t.oid}),o.set(n,s)}}const r=[];for(const[e,n]of o){const o=await tf(t,n);r.push({id:o,mode:_.DIRECTORY,name:e})}return Ac(t,St([...n,...r]))}const ef=async(t,e)=>{await t.fs.mkdir(`${t.layout.gitDir}/info`),await t.fs.writeUtf8(to(t.layout.gitDir),e)};export{on as $,Kn as A,Ma as B,rn as C,Fc as D,$c as E,kt as F,Xt as G,qt as H,V as I,Kt as J,Ht as K,re as L,en as M,de as N,yt as O,se as P,we as Q,bt as R,J as S,ue as T,ee as U,te as V,Ue as W,Ae as X,rt as Y,Gt as Z,nn as _,_ as a,Qe as a$,an as a0,Ye as a1,Ze as a2,fo as a3,wo as a4,ro as a5,Ei as a6,Ci as a7,vi as a8,Ui as a9,Dr as aA,Va as aB,Fa as aC,uc as aD,fc as aE,Tt as aF,Et as aG,Oc as aH,Rr as aI,Mc as aJ,Zr as aK,lo as aL,rs as aM,Nc as aN,Pc as aO,fs as aP,va as aQ,ws as aR,us as aS,hs as aT,Lo as aU,Cc as aV,ac as aW,dc as aX,jd as aY,oc as aZ,Gc as a_,ss as aa,Yi as ab,$r as ac,ei as ad,ni as ae,B as af,O as ag,Qn as ah,Yn as ai,Js as aj,jn as ak,Fr as al,Ur as am,Pe as an,Je as ao,na as ap,oa as aq,tn as ar,no as as,Xn as at,Tr as au,vt as av,Wa as aw,ja as ax,T as ay,Ds as az,Qs as b,Su as b$,Td as b0,Xd as b1,Kd as b2,xt as b3,ad as b4,cd as b5,sd as b6,Vc as b7,Id as b8,xd as b9,mu as bA,ku as bB,xu as bC,pu as bD,gu as bE,Tu as bF,Lu as bG,Zu as bH,S as bI,Ua as bJ,Rd as bK,ui as bL,ai as bM,Ii as bN,Md as bO,bn as bP,wn as bQ,gn as bR,ef as bS,kn as bT,Mr as bU,Ir as bV,Or as bW,je as bX,D as bY,fu as bZ,Pu as b_,Fd as ba,zd as bb,Bd as bc,Cs as bd,ou as be,Rc as bf,Qd as bg,Jd as bh,ru as bi,Cr as bj,Er as bk,qn as bl,Ns as bm,cu as bn,st as bo,ot as bp,zs as bq,Nr as br,su as bs,sa as bt,ra as bu,ne as bv,Q as bw,vu as bx,Du as by,yu as bz,W as c,Nd as c0,Lr as c1,Bu as c2,Ru as c3,As as c4,Sr as c5,lu as c6,Dt as c7,Ri as c8,fr as c9,hu as ca,Re as cb,Ki as cc,De as cd,Au as ce,ki as cf,li as cg,io as ch,nd as ci,jc as cj,Ld as ck,Sd as cl,to as cm,Zs as d,hi as e,z as f,Ar as g,qi as h,Jn as i,jr as j,cn as k,sn as l,Ac as m,Wi as n,Hu as o,Mu as p,Ka as q,bi as r,Br as s,oi as t,U as u,Sc as v,Pi as w,Xi as x,tc as y,wu as z};
@@ -1,2 +1 @@
1
- export{a as add,b as archive,c as bindBranchNamespace,d as bindBundleNamespace,e as bindCherryPickNamespace,f as bindConfigNamespace,g as bindMergeNamespace,h as bindNotesNamespace,i as bindRebaseNamespace,j as bindRemoteNamespace,k as bindRevertNamespace,l as bindSparseCheckoutNamespace,m as bindStashNamespace,n as bindSubmoduleNamespace,o as bindTagNamespace,p as bindWorktreeNamespace,q as blame,r as branchCreate,s as branchDelete,t as branchList,u as branchRename,v as bundleCreate,w as bundleListHeads,x as bundleVerify,y as catFile,z as checkout,A as cherryPickAbort,B as cherryPickContinue,C as cherryPickRun,D as cherryPickSkip,E as clone,F as commit,G as configGet,H as configGetAll,I as configGetRegexp,J as configList,K as configRemoveSection,L as configRenameSection,M as configSet,N as configUnset,O as configUnsetAll,P as createPromisorRemote,Q as describe,R as diff,S as fetch,T as fetchMissing,U as fsck,V as grep,W as init,X as log,Y as mergeAbort,Z as mergeContinue,_ as mergeRun,$ as mv,a0 as nameRev,a1 as notesAdd,a2 as notesList,a3 as notesRead,a4 as notesRemove,a5 as pull,a6 as push,a7 as rangeDiff,a8 as readFileAt,a9 as rebaseAbort,aa as rebaseContinue,ab as rebaseRun,ac as rebaseSkip,ad as reflog,ae as remoteAdd,af as remoteList,ag as remoteRemove,ah as remoteRename,ai as remoteSetUrl,aj as remoteShow,ak as reset,al as revParse,am as revertAbort,an as revertContinue,ao as revertRun,ap as revertSkip,aq as rm,ar as shortlog,as as show,at as sparseCheckoutAdd,au as sparseCheckoutDisable,av as sparseCheckoutList,aw as sparseCheckoutReapply,ax as sparseCheckoutSet,ay as stashApply,az as stashDrop,aA as stashList,aB as stashPop,aC as stashPush,aD as status,aE as submoduleAdd,aF as submoduleDeinit,aG as submoduleInit,aH as submoduleList,aI as submoduleSync,aJ as submoduleUpdate,aK as tagCreate,aL as tagDelete,aM as tagList,aN as whatchanged,aO as worktreeAdd,aP as worktreeList,aQ as worktreeMove,aR as worktreeRemove}from"../chunks/index-BEI7XKaV.js";import"../chunks/error-BD0nFV6t.js";import"../chunks/write-sparse-checkout-D4tNUXOp.js";import"../chunks/readable-stream-CGuf8k1J.js";import"../transport/index.js";
2
- //# sourceMappingURL=index.js.map
1
+ export{a as add,b as archive,c as bindBranchNamespace,d as bindBundleNamespace,e as bindCherryPickNamespace,f as bindConfigNamespace,g as bindMergeNamespace,h as bindNotesNamespace,i as bindRebaseNamespace,j as bindRemoteNamespace,k as bindRevertNamespace,l as bindSparseCheckoutNamespace,m as bindStashNamespace,n as bindSubmoduleNamespace,o as bindTagNamespace,p as bindWorktreeNamespace,q as blame,r as branchCreate,s as branchDelete,t as branchList,u as branchRename,v as bundleCreate,w as bundleListHeads,x as bundleVerify,y as catFile,z as checkout,A as cherryPickAbort,B as cherryPickContinue,C as cherryPickRun,D as cherryPickSkip,E as clone,F as commit,G as configGet,H as configGetAll,I as configGetRegexp,J as configList,K as configRemoveSection,L as configRenameSection,M as configSet,N as configUnset,O as configUnsetAll,P as createPromisorRemote,Q as describe,R as diff,S as fetch,T as fetchMissing,U as fsck,V as grep,W as init,X as log,Y as mergeAbort,Z as mergeContinue,_ as mergeRun,$ as mv,a0 as nameRev,a1 as notesAdd,a2 as notesList,a3 as notesRead,a4 as notesRemove,a5 as pull,a6 as push,a7 as rangeDiff,a8 as readFileAt,a9 as rebaseAbort,aa as rebaseContinue,ab as rebaseRun,ac as rebaseSkip,ad as reflog,ae as remoteAdd,af as remoteList,ag as remoteRemove,ah as remoteRename,ai as remoteSetUrl,aj as remoteShow,ak as reset,al as revParse,am as revertAbort,an as revertContinue,ao as revertRun,ap as revertSkip,aq as rm,ar as shortlog,as as show,at as sparseCheckoutAdd,au as sparseCheckoutDisable,av as sparseCheckoutList,aw as sparseCheckoutReapply,ax as sparseCheckoutSet,ay as stashApply,az as stashDrop,aA as stashList,aB as stashPop,aC as stashPush,aD as status,aE as submoduleAdd,aF as submoduleDeinit,aG as submoduleInit,aH as submoduleList,aI as submoduleSync,aJ as submoduleUpdate,aK as tagCreate,aL as tagDelete,aM as tagList,aN as whatchanged,aO as worktreeAdd,aP as worktreeList,aQ as worktreeMove,aR as worktreeRemove}from"../chunks/index-DsvINN8n.js";import"../chunks/error-BotOd-nD.js";import"../chunks/write-sparse-checkout-BwHbNKNS.js";import"../chunks/readable-stream-CGuf8k1J.js";import"../transport/index.js";
@@ -1,2 +1 @@
1
- import{B as s,a as r,b as e,c as t}from"./chunks/browser-http-transport-DD0YKmIW.js";import{S as o,c as p}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as h}from"./chunks/repository-dCH3DdLQ.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-CTTG6hpk.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-CLPpgZJ6.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-D4tNUXOp.js";import"./chunks/adler32-BfvKJOAO.js";import"./chunks/error-BD0nFV6t.js";import"./chunks/index-BEI7XKaV.js";import"./transport/index.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./primitives/index.js";const m=async a=>{const i=a.gitDirName??".git",n={fs:new t(a.rootHandle),hash:new s,compressor:new e,transport:new r,runtime:"browser",layout:{workDir:"/",gitDir:`/${i}`,bare:a.bare??!1},hashConfig:o,deltaCache:p(a.deltaCacheMaxBytes??16777216,a.deltaCacheMaxEntries??65536)},{rootHandle:c,gitDirName:m,bare:d,deltaCacheMaxBytes:u,deltaCacheMaxEntries:j,...l}=a;return h({cwd:"/",...l},n)};export{m as openRepository};
2
- //# sourceMappingURL=index.browser.js.map
1
+ import{B as s,a as r,b as e,c as t}from"./chunks/browser-http-transport-CSxAte5h.js";import{S as o,c as p}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as h}from"./chunks/repository-DyxknzvE.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-BkCMnjrI.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-B_AJnOHx.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-BwHbNKNS.js";import"./chunks/inflate-BCIXqeeE.js";import"./chunks/error-BotOd-nD.js";import"./chunks/index-DsvINN8n.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./transport/index.js";import"./primitives/index.js";const m=async a=>{const i=a.gitDirName??".git",n={fs:new t(a.rootHandle),hash:new s,compressor:new e,transport:new r,runtime:"browser",layout:{workDir:"/",gitDir:`/${i}`,bare:a.bare??!1},hashConfig:o,deltaCache:p(a.deltaCacheMaxBytes??16777216,a.deltaCacheMaxEntries??65536)},{rootHandle:c,gitDirName:m,bare:d,deltaCacheMaxBytes:u,deltaCacheMaxEntries:j,...l}=a;return h({cwd:"/",...l},n)};export{m as openRepository};
@@ -1,2 +1 @@
1
- import{M as s,a as r,b as o,c as e}from"./chunks/memory-http-transport-D13LBPvu.js";import{a as t,S as m,c as p}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as h}from"./chunks/repository-dCH3DdLQ.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-CTTG6hpk.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-CLPpgZJ6.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-D4tNUXOp.js";import"./chunks/adler32-BfvKJOAO.js";import"./chunks/error-BD0nFV6t.js";import"./chunks/index-BEI7XKaV.js";import"./transport/index.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./primitives/index.js";const u="/repo",f=async(a={})=>{const i=a.algorithm??"sha1",n={fs:new o(void 0===a.files?{rootDir:u}:{rootDir:u,files:a.files}),hash:new r(i),compressor:new s,transport:new e,runtime:"memory",layout:{workDir:u,gitDir:"/repo/.git",bare:!1},hashConfig:"sha256"===i?t:m,deltaCache:p(16777216)},{files:c,algorithm:d,...f}=a;return h({cwd:u,...f},n)};export{f as openRepository};
2
- //# sourceMappingURL=index.default.js.map
1
+ import{M as s,a as r,b as o,c as e}from"./chunks/memory-http-transport-caqmMGR1.js";import{a as t,S as m,c as p}from"./chunks/lru-cache-Cy7C7Lx2.js";import{o as h}from"./chunks/repository-DyxknzvE.js";export{d as detectRuntime,i as isBrowser,a as isNode}from"./chunks/adapter-detect-BkCMnjrI.js";export{c as consoleProgress,n as noopProgress}from"./chunks/progress-B_AJnOHx.js";export{F as FilePath,O as ObjectId,R as RefName}from"./chunks/write-sparse-checkout-BwHbNKNS.js";import"./chunks/inflate-BCIXqeeE.js";import"./chunks/error-BotOd-nD.js";import"./chunks/index-DsvINN8n.js";import"./chunks/readable-stream-CGuf8k1J.js";import"./transport/index.js";import"./primitives/index.js";const u="/repo",f=async(a={})=>{const i=a.algorithm??"sha1",n={fs:new o(void 0===a.files?{rootDir:u}:{rootDir:u,files:a.files}),hash:new r(i),compressor:new s,transport:new e,runtime:"memory",layout:{workDir:u,gitDir:"/repo/.git",bare:!1},hashConfig:"sha256"===i?t:m,deltaCache:p(16777216)},{files:c,algorithm:d,...f}=a;return h({cwd:u,...f},n)};export{f as openRepository};