the editable site (validation-lab)
This commit is contained in:
commit
3ac81d5a52
13454 files changed
+2227005
No files matched your search
@@ -0,0 +1,84 @@
|
||||
import{a as e,t}from"./assets/rolldown-runtime-BWaJ3C7D.js";var n=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),r=t((e=>{
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),i=t((e=>{
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
var t=n(),i=r(),a=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=l,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,l.TYPED_ARRAY_SUPPORT=s(),!l.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function c(e){if(e>o)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return u(e,t,n)}l.poolSize=8192;function u(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return l.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return l.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}l.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function d(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return d(e),e<=0||t===void 0?c(e):typeof n==`string`?c(e).fill(t,n):c(e).fill(t)}l.alloc=function(e,t,n){return f(e,t,n)};function p(e){return d(e),c(e<0?0:y(e)|0)}l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!l.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=c(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=c(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(W(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,l.prototype),r}function v(e){if(l.isBuffer(e)){let t=y(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||G(e.length)?c(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=o)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+o.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),l.alloc(+e)}l.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==l.prototype},l.compare=function(e,t){if(W(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},l.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return l.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=l.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(W(t,Uint8Array))i+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(l.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.lengthLine truncated
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
var n=i(),r=n.Buffer;function a(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(a(n,e),e.Buffer=o);function o(e,t,n){return r(e,t,n)}o.prototype=Object.create(r.prototype),a(r,o),o.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},o.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},o.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},o.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),c=t(((e,t)=>{var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}})),l=t(((e,t)=>{t.exports=TypeError})),u=t(((e,t)=>{t.exports=Object})),d=t(((e,t)=>{t.exports=Error})),f=t(((e,t)=>{t.exports=EvalError})),p=t(((e,t)=>{t.exports=RangeError})),m=t(((e,t)=>{t.exports=ReferenceError})),h=t(((e,t)=>{t.exports=SyntaxError})),g=t(((e,t)=>{t.exports=URIError})),_=t(((e,t)=>{t.exports=Math.abs})),v=t(((e,t)=>{t.exports=Math.floor})),y=t(((e,t)=>{t.exports=Math.max})),b=t(((e,t)=>{t.exports=Math.min})),x=t(((e,t)=>{t.exports=Math.pow})),S=t(((e,t)=>{t.exports=Math.round})),C=t(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),w=t(((e,t)=>{var n=C();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),T=t(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),E=t(((e,t)=>{var n=T();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),D=t(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),ee=t(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),te=t(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=ee();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),O=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),k=t(((e,t)=>{t.exports=u().getPrototypeOf||null})),A=t(((e,t)=>{var n=Object.prototype.toString,r=Math.max,i=`[object Function]`,a=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},o=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},s=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||n.apply(t)!==i)throw TypeError(`Function.prototype.bind called on incompatible `+t);for(var c=o(arguments,1),l,u=function(){if(this instanceof l){var n=t.apply(this,a(c,arguments));return Object(n)===n?n:this}return t.apply(e,a(c,arguments))},d=r(0,t.length-c.length),f=[],p=0;p<d;p++)f[p]=`$`+p;if(l=Function(`binder`,`return function (`+s(f,`,`)+`){ return binder.apply(this,arguments); }`)(u),t.prototype){var m=function(){};m.prototype=t.prototype,l.prototype=new m,m.prototype=null}return l}})),j=t(((e,t)=>{var n=A();t.exports=Function.prototype.bind||n})),M=t(((e,t)=>{t.exports=Function.prototype.call})),ne=t(((e,t)=>{t.exports=Function.prototype.apply})),re=t(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),ie=t(((e,t)=>{var n=j(),r=ne(),i=M();t.exports=re()||n.call(i,r)})),ae=t(((e,t)=>{var n=j(),r=l(),i=M(),a=ie();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),N=t(((e,t)=>{var n=ae(),r=E(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`&&function(e){return s(e==null?e:o(e))}})),P=t(((e,t)=>{var n=O(),r=k(),i=N();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null})),oe=t(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=j().call(n,r)})),se=t(((e,t)=>{var n,r=u(),i=d(),a=f(),o=p(),s=m(),c=h(),C=l(),T=g(),Line truncated
|
||||
/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
(function(t){typeof DO_NOT_EXPORT_CRC>`u`?typeof e==`object`?t(e):typeof define==`function`&&define.amd?define(function(){var e={};return t(e),e}):t({}):t({})})(function(e){e.version=`1.2.2`;function t(){for(var e=0,t=Array(256),n=0;n!=256;++n)e=n,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,e=e&1?-306674912^e>>>1:e>>>1,t[n]=e;return typeof Int32Array<`u`?new Int32Array(t):t}var n=t();function r(e){var t=0,n=0,r=0,i=typeof Int32Array<`u`?new Int32Array(4096):Array(4096);for(r=0;r!=256;++r)i[r]=e[r];for(r=0;r!=256;++r)for(n=e[r],t=256+r;t<4096;t+=256)n=i[t]=n>>>8^e[n&255];var a=[];for(r=1;r!=16;++r)a[r-1]=typeof Int32Array<`u`?i.subarray(r*256,r*256+256):i.slice(r*256,r*256+256);return a}var i=r(n),a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14];function b(e,t){for(var r=t^-1,i=0,a=e.length;i<a;)r=r>>>8^n[(r^e.charCodeAt(i++))&255];return~r}function x(e,t){for(var r=t^-1,i=e.length-15,b=0;b<i;)r=y[e[b++]^r&255]^v[e[b++]^r>>8&255]^_[e[b++]^r>>16&255]^g[e[b++]^r>>>24]^h[e[b++]]^m[e[b++]]^p[e[b++]]^f[e[b++]]^d[e[b++]]^u[e[b++]]^l[e[b++]]^c[e[b++]]^s[e[b++]]^o[e[b++]]^a[e[b++]]^n[e[b++]];for(i+=15;b<i;)r=r>>>8^n[(r^e[b++])&255];return~r}function S(e,t){for(var r=t^-1,i=0,a=e.length,o=0,s=0;i<a;)o=e.charCodeAt(i++),o<128?r=r>>>8^n[(r^o)&255]:o<2048?(r=r>>>8^n[(r^(192|o>>6&31))&255],r=r>>>8^n[(r^(128|o&63))&255]):o>=55296&&o<57344?(o=(o&1023)+64,s=e.charCodeAt(i++)&1023,r=r>>>8^n[(r^(240|o>>8&7))&255],r=r>>>8^n[(r^(128|o>>2&63))&255],r=r>>>8^n[(r^(128|s>>6&15|(o&3)<<4))&255],r=r>>>8^n[(r^(128|s&63))&255]):(r=r>>>8^n[(r^(224|o>>12&15))&255],r=r>>>8^n[(r^(128|o>>6&63))&255],r=r>>>8^n[(r^(128|o&63))&255]);return~r}e.table=n,e.bstr=b,e.buf=x,e.str=S})})),J=t((e=>{var t=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Int32Array<`u`;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!=`object`)throw TypeError(r+`must be non-object`);for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){var t,n,r=0,i,a,o;for(t=0,n=e.length;t<n;t++)r+=e[t].length;for(o=new Uint8Array(r),i=0,t=0,n=e.length;t<n;t++)a=e[t],o.set(a,i),i+=a.length;return o}},i={arraySet:function(e,t,n,r,i){for(var a=0;a<r;a++)e[i+a]=t[n+a]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)})),Y=t((e=>{var t=J(),n=4,r=0,i=1,a=2;function o(e){for(var t=e.length;--t>=0;)e[t]=0}var s=0,c=1,l=2,u=3,d=258,f=29,p=256,m=p+1+f,h=30,g=19,_=2*m+1,v=15,y=16,b=7,x=256,S=16,C=17,w=18,T=[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],E=[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],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ee=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],te=512,O=Array((m+2)*2);o(O);var k=Array(h*2);o(k);var A=Array(te);o(A);var j=Array(d-u+1);o(j);var M=Array(f);o(M);var ne=Array(h);o(ne);function re(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var ie,ae,N;function P(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function oe(e){return e<256?A[e]:A[256+(e>>>7)]}function se(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function F(e,t,n){e.bi_valid>y-n?(e.bi_buf|=t<<e.bi_valid&65535,se(e,e.bi_buf),e.bi_buf=t>>y-e.bi_valid,e.bi_valid+=n-y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function I(e,t,n){F(e,n[t*2],n[t*2+1])}function ce(e,t){var n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1}function le(e){e.bi_valid===16?(se(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function ue(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=v;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<_;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,u>r||(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],d>r||(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}}function de(e,t,n){for(var r=Array(v+1)Line truncated
|
||||
`)}static async _entryToBuffer(e){let t=Buffer.from(e.path),n=ot(e),r=Math.ceil((62+(n?2:0)+t.length+1)/8)*8,i=Buffer.alloc(r),a=new Ve(i),o=Ye(e);return a.writeUInt32BE(o.ctimeSeconds),a.writeUInt32BE(o.ctimeNanoseconds),a.writeUInt32BE(o.mtimeSeconds),a.writeUInt32BE(o.mtimeNanoseconds),a.writeUInt32BE(o.dev),a.writeUInt32BE(o.ino),a.writeUInt32BE(o.mode),a.writeUInt32BE(o.uid),a.writeUInt32BE(o.gid),a.writeUInt32BE(o.size),a.write(e.oid,20,`hex`),a.writeUInt16BE(st(e)),n&&a.writeUInt16BE(ct(e)),a.write(e.path,t.length,`utf8`),i}async toObject(){let t=Buffer.alloc(12),n=new Ve(t);n.write(`DIRC`,4,`utf8`),n.writeUInt32BE(this.entriesFlat.some(ot)?3:2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let t of this.entries)if(r.push(e._entryToBuffer(t)),t.stages.length>1)for(let n of t.stages)n&&n!==t&&r.push(e._entryToBuffer(n));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([t,i]),o=await $e(a);return Buffer.concat([a,Buffer.from(o,`hex`)])}};function ut(e,t,n=!0,r=!0){let i=Ye(e),a=Ye(t);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.mtimeNanoseconds!==a.mtimeNanoseconds||i.ctimeSeconds!==a.ctimeSeconds||i.ctimeNanoseconds!==a.ctimeNanoseconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var dt;function ft(){return dt===void 0&&(dt=new Ne.default({maxPending:1/0})),dt}function pt(e,t){return ft().acquire(e,t)}var mt=Symbol(`IndexCache`);function ht(){return{map:new Map,stats:new Map}}async function gt(e,t,n){let[r,i]=await Promise.all([e.lstat(t),e.read(t)]),a=await lt.from(i);n.map.set(t,a),n.stats.set(t,r)}async function _t(e,t,n){let r=n.stats.get(t);if(r===void 0)return!0;if(r===null)return!1;let i=await e.lstat(t);if(i===null)return!1;if(ut(r,i))return!0;let a=Ye(r),o=Ye(i);return a.mtimeNanoseconds!==o.mtimeNanoseconds||a.ctimeNanoseconds!==o.ctimeNanoseconds}var vt=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:r=!0},i){n[mt]||(n[mt]=ht());let a=`${t}/index`,o,s=[];return await pt(a,async()=>{let t=n[mt];await _t(e,a,t)&&await gt(e,a,t);let c=t.map.get(a);if(s=c.unmergedPaths,s.length&&!r)throw new ze(s);if(o=await i(c),c._dirty){let n=await c.toObject();await e.write(a,n),t.stats.set(a,await e.lstat(a)),c._dirty=!1}}),o}};function yt(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>-1&&(e=e.slice(t+1)),e}function bt(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t===-1?`.`:t===0?`/`:e.slice(0,t)}function xt(e){let t=new Map,n=function(e){if(!t.has(e)){let r={type:`tree`,fullpath:e,basename:yt(e),metadata:{},children:[]};t.set(e,r),r.parent=n(bt(e)),r.parent&&r.parent!==r&&r.parent.children.push(r)}return t.get(e)},r=function(e,r){if(!t.has(e)){let i={type:`blob`,fullpath:e,basename:yt(e),metadata:r,parent:n(bt(e)),children:[]};i.parent&&i.parent.children.push(i),t.set(e,i)}return t.get(e)};n(`.`);for(let t of e)r(t.path,t);return t}var St=class e extends Q{constructor(t){super(`Could not find ${t}.`),this.code=this.name=e.code,this.data={what:t}}};St.code=`NotFoundError`;var Ct=class e extends Q{constructor(t,n,r,i){super(`Object ${t} ${i?`at ${i}`:``}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=e.code,this.data={oid:t,actual:n,expected:r,filepath:i}}};Ct.code=`ObjectTypeError`;var wt=class e extends Q{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=e.code,this.data={value:t}}};wt.code=`InvalidOidError`;var Tt=class e extends Q{constructor(t,n){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=e.code,this.data={ref:t,suggestion:n}}};Tt.code=`InvalidRefNameError`;var Et=class e extends Q{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
|
||||
[remote "${t}"]
|
||||
\tfetch = +refs/heads/*:refs/remotes/origin/*
|
||||
`),this.code=this.name=e.code,this.data={remote:t}}};Et.code=`NoRefspecError`;var Dt=class e{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let t=null;this.parsedConfig=e.trim().split(`
|
||||
`).map(e=>{if(/^\s*#/.test(e))return{line:e,comment:!0};let n=e.indexOf(` `);if(e.startsWith(`^`)){let n=e.slice(1);return this.refs.set(t+`^{}`,n),{line:e,ref:t,peeled:n}}{let r=e.slice(0,n);return t=e.slice(n+1),this.refs.set(t,r),{line:e,ref:t,oid:r}}})}return this}static from(t){return new e(t)}delete(e){this.parsedConfig=this.parsedConfig.filter(t=>t.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
||||
`)+`
|
||||
`}},Ot=class e{constructor({remotePath:e,localPath:t,force:n,matchPrefix:r}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:r})}static from(t){let[n,r,i,a,o]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s=n===`+`,c=i===`*`;if(c!==(o===`*`))throw new $(`Invalid refspec`);return new e({remotePath:r,localPath:a,force:s,matchPrefix:c})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,``)}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,``)}else if(e===this.localPath)return this.remotePath;return null}},kt=class e{constructor(e=[]){this.rules=e}static from(t){let n=[];for(let e of t)n.push(Ot.from(e));return new e(n)}add(e){let t=Ot.from(e);this.rules.push(t)}translate(e){let t=[];for(let n of this.rules)for(let r of e){let e=n.translate(r);e&&t.push([r,e])}return t}translateOne(e){let t=null;for(let n of this.rules){let r=n.translate(e);r&&(t=r)}return t}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,``))}};function At(e,t){let n=e.replace(/\^\{\}$/,``),r=t.replace(/\^\{\}$/,``),i=-(n<r)||+(n>r);return i===0?e.endsWith(`^{}`)?1:-1:i}var jt=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function Mt(e,t){if(typeof e!=`string`)throw TypeError(`Reference name must be a string`);return!jt.test(e)&&(!!t||e.includes(`/`))}
|
||||
/*!
|
||||
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
||||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
* Copyright (c) James Prevett and other ZenFS contributors.
|
||||
*
|
||||
* Windows support added:
|
||||
* - Backslashes are normalised to forward slashes before processing.
|
||||
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
||||
* normalisation, so absolute Windows paths are handled correctly.
|
||||
* - An absolute argument passed to join() resets the accumulated path,
|
||||
* matching Node behaviour and handling worktree gitdir paths properly.
|
||||
*
|
||||
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
||||
* backslashes are normalised to forward slashes and then collapsed by
|
||||
* normalizeString, losing the UNC root. Git on Windows works with
|
||||
* drive-letter paths, so this is not expected to be a practical issue.
|
||||
*/
|
||||
function Nt(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1){if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function Pt(e){return e.length>=2&&/^[a-zA-Z]:/.test(e)?e.slice(0,2):null}function Ft(e){if(!e.length)return`.`;e=e.replace(/\\/g,`/`);let t=Pt(e),n=e[0]===`/`||t!==null&&e[2]===`/`,r=e.at(-1)===`/`,i=Nt(t?e.slice(2):e,!n);if(!i.length){let e=t?n?t+`/`:t:n?`/`:`.`;return r&&!n?e+`/`:e}return r&&(i+=`/`),t?n?`${t}/${i}`:`${t}${i}`:n?`/${i}`:i}function It(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n].replace(/\\/g,`/`);r.length!==0&&(/^[a-zA-Z]:\//.test(r)||t===void 0?t=r:t+=`/`+r)}return t===void 0?`.`:Ft(t)}var Lt=e=>{if(typeof e==`number`)return e;e=e.toLowerCase();let t=parseInt(e);return e.endsWith(`k`)&&(t*=1024),e.endsWith(`m`)&&(t*=1048576),e.endsWith(`g`)&&(t*=1073741824),t},Rt=e=>{if(typeof e==`boolean`)return e;if(e=e.trim().toLowerCase(),e===`true`||e===`yes`||e===`on`)return!0;if(e===`false`||e===`no`||e===`off`)return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},zt={core:{filemode:Rt,bare:Rt,logallrefupdates:Rt,symlinks:Rt,ignorecase:Rt,bigFileThreshold:Lt}},Bt=/^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/,Vt=/^[A-Za-z0-9-.]+$/,Ht=/^([A-Za-z][A-Za-z0-9-]*)(?:\s*=\s*(.*))?$/,Ut=/^[A-Za-z][A-Za-z0-9-]*$/,Wt=e=>{let t=Bt.exec(e);if(t!=null){let[e,n]=t.slice(1);return[e,n&&n.replace(/\\(.)/g,`$1`)]}return null},Gt=e=>{let t=Ht.exec(e);if(t!=null){let[e,n=`true`]=t.slice(1);return[e,qt(n)]}return null},Kt=new Map([[`t`,` `],[`b`,`\b`],[`n`,`
|
||||
`],[`\\`,`\\`],[`"`,`"`]]),qt=e=>{let t=``,n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(!r&&/[ \t\r\v\f]/.test(a))t!==``&&(n+=a);else{if(!r&&(a===`#`||a===`;`))break;t+=n,n=``,a===`\\`&&Kt.has(e[i+1])?t+=Kt.get(e[++i]):a===`"`?r=!r:t+=a}}return t},Jt=e=>{if(typeof e!=`string`)return e;let t=e.startsWith(` `)||e.endsWith(` `)||/[#;]/.test(e)?`"`:``;return`${t}${e.replace(/[\\"\n\t]/g,e=>e===`
|
||||
`?`\\n`:e===` `?`\\t`:`\\${e}`)}${t}`},Yt=e=>e==null?null:e.toLowerCase(),Xt=(e,t,n)=>[Yt(e),t,Yt(n)].filter(e=>e!=null).join(`.`),Zt=e=>{let t=e.split(`.`),n=t.shift(),r=t.pop(),i=t.length?t.join(`.`):void 0;return{section:n,subsection:i,name:r,path:Xt(n,i,r),sectionPath:Xt(n,i,null),isSection:!!n}},Qt=(e,t)=>e.reduce((e,n,r)=>t(n)?r:e,-1),$t=class e{constructor(e){let t=null,n=null;this.parsedConfig=e?e.split(`
|
||||
`).map(e=>{let r=null,i=null,a=e.trim(),o=Wt(a),s=o!=null;if(s)[t,n]=o;else{let e=Gt(a);e!=null&&([r,i]=e)}let c=Xt(t,n,r);return{line:e,isSection:s,section:t,subsection:n,name:r,value:i,path:c}}):[]}static from(t){return new e(t)}async get(e,t=!1){let n=Zt(e).path,r=this.parsedConfig.filter(e=>e.path===n).map(({section:e,name:t,value:n})=>{let r=zt[e]&&zt[e][t];return r?r(n):n});return t?r:r.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(t=>t.isSection&&t.section===e).map(e=>e.subsection)}async deleteSection(e,t){this.parsedConfig=this.parsedConfig.filter(n=>n.section!==e||n.subsection!==t)}async append(e,t){return this.set(e,t,!0)}async set(e,t,n=!1){let{section:r,subsection:i,name:a,path:o,sectionPath:s,isSection:c}=Zt(e),l=Qt(this.parsedConfig,e=>e.path===o);if(t==null)l!==-1&&this.parsedConfig.splice(l,1);else if(l!==-1){let e=this.parsedConfig[l],r=Object.assign({},e,{name:a,value:t,modified:!0});n?this.parsedConfig.splice(l+1,0,r):this.parsedConfig[l]=r}else{let e=this.parsedConfig.findIndex(e=>e.path===s),n={section:r,subsection:i,name:a,value:t,modified:!0,path:o};if(Vt.test(r)&&Ut.test(a)){if(e>=0)this.parsedConfig.splice(e+1,0,n);else{let e={isSection:c,section:r,subsection:i,modified:!0,path:s};this.parsedConfig.push(e,n)}}}}toString(){return this.parsedConfig.map(({line:e,section:t,subsection:n,name:r,value:i,modified:a=!1})=>a?r!=null&&i!=null?`\t${r} = ${Jt(i)}`:n==null?`[${t}]`:`[${t} "${n}"]`:e).join(`
|
||||
`)}},en=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:`utf8`});return $t.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:`utf8`})}},tn=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],nn=[`config`,`description`,`index`,`shallow`,`commondir`];function rn(e){if(nn.includes(e))throw new Tt(e,`refs/heads/${e}`);if(!Mt(e,!0))throw new Tt(e,Pe.default.clean(e))}var an=class e{static async updateRemoteRefs({fs:t,gitdir:n,remote:r,refs:i,symrefs:a,tags:o,refspecs:s=void 0,prune:c=!1,pruneTags:l=!1}){for(let e of i.values())if(!e.match(/[0-9a-f]{40}/))throw new wt(e);let u=await en.get({fs:t,gitdir:n});if(!s){if(s=await u.getall(`remote.${r}.fetch`),s.length===0)throw new Et(r);s.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let d=kt.from(s),f=new Map,p=d.translate([...i.keys()]),m=[];for(let[e,t]of d.translate([...a.keys()])){let n=d.translateOne(a.get(e));n&&(rn(n),m.push([t,`ref: ${n}`]))}let h=o?[...i.keys()].filter(e=>e.startsWith(`refs/tags`)&&!e.endsWith(`^{}`)):[];for(let[,e]of p)rn(e);for(let[e]of m)rn(e);if(h.forEach(rn),l){let r=await e.listRefs({fs:t,gitdir:n,filepath:`refs/tags`});await e.deleteRefs({fs:t,gitdir:n,refs:r.map(e=>`refs/tags/${e}`)})}for(let r of h)if(!await e.exists({fs:t,gitdir:n,ref:r})){let e=i.get(r);f.set(r,e)}for(let[e,t]of p){let n=i.get(e);f.set(t,n)}for(let[e,t]of m)f.set(e,t);let g=[];if(c){for(let r of d.localNamespaces()){let i=(await e.listRefs({fs:t,gitdir:n,filepath:r})).map(e=>`${r}/${e}`);for(let e of i)f.has(e)||g.push(e)}g.length>0&&await e.deleteRefs({fs:t,gitdir:n,refs:g})}for(let[e,r]of f)await pt(e,async()=>t.write(It(n,e),`${r.trim()}\n`,`utf8`));return{pruned:g}}static async writeRef({fs:e,gitdir:t,ref:n,value:r}){if(rn(n),!r.match(/[0-9a-f]{40}/))throw new wt(r);await pt(n,async()=>e.write(It(t,n),`${r.trim()}\n`,`utf8`))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:r}){rn(n),await pt(n,async()=>e.write(It(t,n),`ref: ${r.trim()}\n`,`utf8`))}static async deleteRef({fs:t,gitdir:n,ref:r}){return e.deleteRefs({fs:t,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){n.forEach(rn),await Promise.all(n.map(n=>e.rm(It(t,n))));let r=await pt(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`})),i=Dt.from(r),a=i.refs.size;for(let e of n)i.refs.has(e)&&i.delete(e);i.refs.size<a&&(r=i.toString(),await pt(`packed-refs`,async()=>e.write(`${t}/packed-refs`,r,{encoding:`utf8`})))}static async resolve({fs:t,gitdir:n,ref:r,depth:i=void 0,visited:a=new Set}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith(`ref: `))return r=r.slice(5),e.resolve({fs:t,gitdir:n,ref:r,depth:i,visited:a});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let o=await e.packedRefs({fs:t,gitdir:n}),s=tn(r).filter(e=>!nn.includes(e));for(let r of s){let s=await pt(r,async()=>await t.read(`${n}/${r}`,{encoding:`utf8`})||o.get(r));if(s){if(a.has(r))throw new $(`Circular reference detected while resolving ref "${r}"`);return a.add(r),e.resolve({fs:t,gitdir:n,ref:s.trim(),depth:i,visited:a})}}throw new St(r)}static async isUnbornBranch({fs:t,gitdir:n,ref:r}){let i;try{i=await e.resolve({fs:t,gitdir:n,ref:`HEAD`,depth:2})}catch(e){if(e instanceof St)return!1;throw e}return i.startsWith(`refs/heads/`)?r===`HEAD`||tn(r).includes(i):!1}static async exists({fs:t,gitdir:n,ref:r}){try{return await e.expand({fs:t,gitdir:n,ref:r}),!0}catch(e){if(e instanceof St)return!1;throw e}}static async expand({fs:t,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await e.packedRefs({fs:t,gitdir:n}),a=tn(r).filter(e=>!nn.includes(e));for(let e of a)if(await pt(e,async()=>t.exists(`${n}/${e}`))||i.has(e))return e;throw new St(r)}static async expandAgainstMap({ref:e,map:t}){let n=tn(e);for(let e of n)if(await t.has(e))return e;throw new St(e)}static resolveAgainstMap({ref:t,fullref:n=t,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:t};if(t.startsWith(`ref: `))return t=t.slice(5),e.resolveAgainstMap({ref:t,fullref:n,depth:r,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:n,oid:t};let a=tn(t);for(let t of a){let n=i.get(t);if(n)return e.resolveAgainstMap({ref:n.trim(),fullref:t,depth:r,map:i})}throw new St(t)}static async packedRefs({fs:e,gitdir:t}){let n=await pt(`packed-refs`,async()=>e.read(`${t}/packed-refs`,{encoding:`utf8`}));return Dt.from(n).refs}static async listRefs({fs:t,gitdir:n,filepath:r}){let i=await e.packedRefs({fs:t,gitdir:n}),a=null;try{a=await t.readdirDeep(`${n}/${r}`),a=a.map(e=>e.replace(`${n}/${r}/`,``))}catch{a=[]}for(let e of i.keys())e.startsWith(r)&&(e=e.replace(r+`/`,``),a.includes(e)||a.push(e));return a.sort(At),a}static async listBranches({fs:t,gitdir:n,remote:r}){return r?e.listRefs({fs:t,gitdir:n,filepath:`refs/remotes/${r}`}):e.listRefs({fs:t,gitdir:n,filepath:`refs/heads`})}static async listTags({fs:t,gitdir:n}){return(await e.listRefs({fs:t,gitdir:n
Line truncated
|
||||
`)}toObject(){let e=[...this._entries];return e.sort(on),Buffer.concat(e.map(e=>{let t=Buffer.from(e.mode.replace(/^0/,``)),n=Buffer.from(` `),r=Buffer.from(e.path,`utf8`),i=Buffer.from([0]),a=Buffer.from(e.oid,`hex`);return Buffer.concat([t,n,r,i,a])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},pn=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\x00`,r=n.length,i=r+t.length,a=new Uint8Array(i);for(let e=0;e<r;e++)a[e]=n.charCodeAt(e);return a.set(t,r),a}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),r=e.slice(0,t).toString(`utf8`),i=e.slice(t+1,n).toString(`utf8`),a=e.length-(n+1);if(parseInt(i)!==a)throw new $(`Length mismatch: expected ${i} bytes but got ${a} instead.`);return{type:r,object:Buffer.from(e.slice(n+1))}}};async function mn({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await e.read(`${t}/${r}`);return i?{object:i,format:`deflated`,source:r}:null}function hn(e,t){let n=new Ve(e),r=gn(n);if(r!==t.byteLength)throw new $(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${t.length} bytes`);let i=gn(n),a,o=vn(n,t);if(o.byteLength===i)a=o;else{let e=[o],r=o.byteLength;for(;!n.eof();){let i=vn(n,t);e.push(i),r+=i.byteLength}if(i!==r)throw new $(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${r} bytes`);a=Buffer.concat(e,i)}return a}function gn(e){let t=0,n=0,r=null;do r=e.readUInt8(),t|=(r&127)<<n,n+=7;while(r&128);return t}function _n(e,t,n){let r=0,i=0;for(;n--;)t&1&&(r|=e.readUInt8()<<i),t>>=1,i+=8;return r}function vn(e,t){let n=e.readUInt8();if(n&128){let r=_n(e,n&15,4),i=_n(e,(n&112)>>4,3);return i===0&&(i=65536),t.slice(r,r+i)}return e.slice(n)}function yn(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function bn(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:yn(e)}var xn=class{constructor(e){if(typeof Buffer>`u`)throw Error(`Missing Buffer dependency`);this.stream=bn(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:t}=await this.stream.next();return e&&(this._ended=!0,!t)?Buffer.alloc(0):(t&&=Buffer.from(t),t)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let t=[this.buffer];for(;this.cursor+e>Sn(t);){let e=await this._next();if(this._ended)break;t.push(e)}this.buffer=Buffer.concat(t)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function Sn(e){return e.reduce((e,t)=>e+t.length,0)}async function Cn(e,t){let n=new xn(e),r=await n.read(4);if(r=r.toString(`utf8`),r!==`PACK`)throw new $(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new $(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let e=n.tell(),{type:r,length:i,ofs:o,reference:s}=await wn(n),c=new Ie.default.Inflate;for(;!c.result;){let l=await n.chunk();if(!l)break;if(c.push(l,!1),c.err)throw new $(`Pako error: ${c.msg}`);if(c.result){if(c.result.length!==i)throw new $(`Inflated object size is different from that stated in packfile.`);await n.undo(),await n.read(l.length-c.strm.avail_in);let u=n.tell();await t({data:c.result,type:r,num:a,offset:e,end:u,reference:s,ofs:o})}}}}async function wn(e){let t=await e.byte(),n=t>>4&7,r=t&15;if(t&128){let n=4;do t=await e.byte(),r|=(t&127)<<n,n+=7;while(t&128)}let i,a;if(n===6){let n=0;i=0;let r=[];do t=await e.byte(),i|=(t&127)<<n,n+=7,r.push(t);while(t&128);a=Buffer.from(r)}return n===7
Line truncated
|
||||
`,e}function Sr(e){let[,t,n,r,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:n,timestamp:Number(r),timezoneOffset:Cr(i)}}function Cr(e){let[,t,n,r]=e.match(/(\+|-)(\d\d)(\d\d)/);return r=(t===`+`?1:-1)*(Number(n)*60+Number(r)),wr(r)}function wr(e){return e===0?e:-e}var Tr=class e{constructor(t){if(typeof t==`string`)this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString(`utf8`);else if(typeof t==`object`)this._tag=e.render(t);else throw new $(`invalid type passed to GitAnnotatedTag constructor`)}static from(t){return new e(t)}static render(e){return`object ${e.object}
|
||||
type ${e.type}
|
||||
tag ${e.tag}
|
||||
tagger ${_r(e.tagger)}
|
||||
|
||||
${e.message}
|
||||
${e.gpgsig?e.gpgsig:``}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||||
|
||||
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
||||
|
||||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||||
`),t=[];for(let n of e)n[0]===` `?t[t.length-1]+=`
|
||||
`+n.slice(1):t.push(n);let n={},r=new Set;for(let e of t){let t=e.slice(0,e.indexOf(` `)),i=e.slice(e.indexOf(` `)+1);r.has(t)||(r.add(t),n[t]=i)}return n.tagger&&=Sr(n.tagger),n.committer&&=Sr(n.committer),n}withoutSignature(){let e=xr(this._tag);return e.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)!==-1)return xr(this._tag.slice(this._tag.indexOf(`-----BEGIN PGP SIGNATURE-----`),this._tag.indexOf(`-----END PGP SIGNATURE-----`)+27))}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return Buffer.from(this._tag,`utf8`)}static async sign(t,n,r){let i=t.payload(),{signature:a}=await n({payload:i,secretKey:r});a=xr(a);let o=i+a;return e.from(o)}};function Er(e){return e.trim().split(`
|
||||
`).map(e=>` `+e).join(`
|
||||
`)+`
|
||||
`}function Dr(e){return e.split(`
|
||||
`).map(e=>e.replace(/^ /,``)).join(`
|
||||
`)}var Or=class e{constructor(t){if(typeof t==`string`)this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString(`utf8`);else if(typeof t==`object`)this._commit=e.render(t);else throw new $(`invalid type passed to GitCommit constructor`)}static fromPayloadSignature({payload:t,signature:n}){let r=e.justHeaders(t),i=e.justMessage(t),a=xr(r+`
|
||||
gpgsig`+Er(n)+`
|
||||
`+i);return new e(a)}static from(t){return new e(t)}toObject(){return Buffer.from(this._commit,`utf8`)}headers(){return this.parseHeaders()}message(){return e.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return xr(e.slice(e.indexOf(`
|
||||
|
||||
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
||||
|
||||
`))}parseHeaders(){let t=e.justHeaders(this._commit).split(`
|
||||
`),n=[];for(let e of t)e[0]===` `?n[n.length-1]+=`
|
||||
`+e.slice(1):n.push(e);let r={parent:[]},i=e=>e.slice(0,e.indexOf(` `)),a=e=>e.slice(e.indexOf(` `)+1);if(n.length===0||i(n[0])!==`tree`)throw new cr(`tree as the first commit header`,i(n[0]||``));r.tree=a(n[0]);let o=1;for(;o<n.length&&i(n[o])===`parent`;)r.parent.push(a(n[o])),o++;let s=new Set([`tree`,`parent`]);for(;o<n.length;o++){let e=i(n[o]);s.has(e)||(s.add(e),r[e]=a(n[o]))}return r.author&&=Sr(r.author),r.committer&&=Sr(r.committer),r}static renderHeaders(e){let t=``;if(e.tree?t+=`tree ${e.tree}\n`:t+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
`,e.parent){if(e.parent.length===void 0)throw new $(`commit 'parent' property should be an array`);for(let n of e.parent)t+=`parent ${n}\n`}let n=e.author;t+=`author ${_r(n)}\n`;let r=e.committer||e.author;return t+=`committer ${_r(r)}\n`,e.gpgsig&&(t+=`gpgsig`+Er(e.gpgsig)),t}static render(t){return e.renderHeaders(t)+`
|
||||
`+xr(t.message)}render(){return this._commit}withoutSignature(){let e=xr(this._commit);if(e.indexOf(`
|
||||
gpgsig`)===-1)return e;let t=e.slice(0,e.indexOf(`
|
||||
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||||
`)+28);return xr(t+`
|
||||
`+n)}isolateSignature(){return Dr(this._commit.slice(this._commit.indexOf(`-----BEGIN PGP SIGNATURE-----`),this._commit.indexOf(`-----END PGP SIGNATURE-----`)+27))}static async sign(t,n,r){let i=t.withoutSignature(),a=e.justMessage(t._commit),{signature:o}=await n({payload:i,secretKey:r});o=xr(o);let s=e.justHeaders(t._commit)+`
|
||||
gpgsig`+Er(o)+`
|
||||
`+a;return e.from(s)}};Array.prototype.flat;async function kr(e,t,n=10){try{await e(t)}catch(r){if(r===null||r.code===`EEXIST`)return;if(r.code!==`ENOENT`)throw r;let i=bt(t);if(i===`.`||i===`/`||i===t)throw r;await kr(e,i,n);for(let r=0;;r++)try{await e(t);return}catch(e){if(e===null||e.code===`EEXIST`)return;if(e.code===`ENOENT`&&r<n){await new Promise(e=>setTimeout(e,0));continue}throw e}}}async function Ar(e,t){let n=await e.readdir(t);n==null?await e.rm(t):n.length?await Promise.all(n.map(n=>{let r=It(t,n);return e.lstat(r).then(t=>{if(t)return t.isDirectory()?Ar(e,r):e.rm(r)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function jr(e){return Mr(e)&&Nr(e.then)&&Nr(e.catch)}function Mr(e){return e&&typeof e==`object`}function Nr(e){return typeof e==`function`}function Pr(e){let t=e.code;return typeof t==`string`?t===`ENOENT`||t===`ENOTDIR`||t.includes(`ENS`):!1}function Fr(e){return jr((e=>{try{return e.readFile().catch(e=>e)}catch(e){return e}})(e))}var Ir=[`readFile`,`writeFile`,`mkdir`,`rmdir`,`unlink`,`stat`,`lstat`,`readdir`,`readlink`,`symlink`];function Lr(e,t){if(Fr(t))for(let n of Ir)e[`_${n}`]=t[n].bind(t);else for(let n of Ir)e[`_${n}`]=(0,Le.default)(t[n].bind(t));Fr(t)?(t.cp&&(e._cp=t.cp.bind(t)),e._rm=t.rm?t.rm.bind(t):t.rmdir.length>1?t.rmdir.bind(t):Ar.bind(null,e)):(t.cp&&(e._cp=(0,Le.default)(t.cp.bind(t))),e._rm=t.rm?(0,Le.default)(t.rm.bind(t)):t.rmdir.length>2?(0,Le.default)(t.rmdir.bind(t)):Ar.bind(null,e))}var Rr=class{constructor(e){if(e._original_unwrapped_fs!==void 0)return e;let t=Object.getOwnPropertyDescriptor(e,`promises`);t&&t.enumerable?Lr(this,e.promises):Lr(this,e),this._original_unwrapped_fs=e}async exists(e,t={}){try{return await this._stat(e),!0}catch(e){if(Pr(e))return!1;throw console.log(`Unhandled error in "FileSystem.exists()" function`,e),e}}async read(e,t={}){let n;try{n=await this._readFile(e,t)}catch(e){if(Pr(e)||e.code===`EISDIR`)return null;throw e}if(n==null)return null;if(t.autocrlf===`true`)try{n=new TextDecoder(`utf8`,{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
|
||||
`),n=new TextEncoder().encode(n)}catch{}return typeof n!=`string`&&(n=Buffer.from(n)),n}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch{await this.mkdir(bt(e)),await this._writeFile(e,t,n)}}async mkdir(e){await kr(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(e){if(e.code!==`ENOENT`)throw e}}async readdir(e){let t;try{t=await this._readdir(e)}catch(e){if(e.code===`ENOTDIR`)return null;if(Pr(e))return[];throw e}return t.sort(We),t}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async t=>{let n=e+`/`+t;return(await this._stat(n)).isDirectory()?this.readdirDeep(n):n}))).reduce((e,t)=>e.concat(t),[])}async lstat(e){try{return await this._lstat(e)}catch(e){if(Pr(e))return null;throw e}}async readlink(e,t={encoding:`buffer`}){try{let n=await this._readlink(e,t);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(e){if(Pr(e))return null;throw e}}async writelink(e,t){return this._symlink(t.toString(`utf8`),e)}};function zr(e,t){if(t===void 0)throw new or(e)}function Br(e){return e.startsWith(`/`)||/^[a-zA-Z]:[\\/]/.test(e)}async function Vr({fsp:e,dotgit:t}){zr(`fsp`,e),zr(`dotgit`,t);let n=await e._stat(t).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return n.isDirectory()?t:n.isFile()?e._readFile(t,`utf8`).then(e=>e.trimRight().substr(8)).then(e=>Br(e)?e:It(bt(t),e)):t}var Hr=class{static async isIgnored({fs:e,dir:t,gitdir:n=It(t,`.git`),filepath:r}){if(yt(r)===`.git`)return!0;if(r===`.`)return!1;let i=``,a=It(n,`info`,`exclude`);await e.exists(a)&&(i=await e.read(a,`utf8`));let o=[{gitignore:It(t,`.gitignore`),filepath:r}],s=r.split(`/`).filter(Boolean);for(let e=1;e<s.length;e++){let n=s.slice(0,e).join(`/`),r=s.slice(e).join(`/`);o.push({gitignore:It(t,n,`.gitignore`),filepath:r})}let c=!1;for(let[t,n]of o.entries()){let r=await e.read(n.gitignore,`utf8`),a=(0,Re.default)();t===0&&a.add(i),a.add(r);let o=bt(n.filepath);if(o!==`.`&&a.ignores(o))return!0;c=c?!a.test(n.filepath).unignored:a.test(n.filepath).ignored}return c}};async function Ur({fs:e,gitdir:t,object:n,format:r,oid:i}){if(r!==`deflated`)throw new $(`GitObjectStoreLoose expects objects to write to be in deflated format`);let a=`${t}/${`objects/${i.slice(0,2)}/${i.slice(2)}`}`;await e.exists(a)||await e.write(a,n)}var Wr=null;async function Gr(e){return Wr===null&&(Wr=qr()),Wr?Kr(e):Ie.default.deflate(e)}async function Kr(e){let t=new CompressionStream(`deflate`),n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function qr(){try{return new CompressionStream(`deflate`).writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function Jr({fs:e,gitdir:t,type:n,object:r,format:i=`content`,oid:a=void 0,dryRun:o=!1}){return i!==`deflated`&&(i!==`wrapped`&&(r=pn.wrap({type:n,object:r})),a=await $e(r),r=Buffer.from(await Gr(r))),o||await Ur({fs:e,gitdir:t,object:r,format:`deflated`,oid:a}),a}async function Yr({fs:e,gitdir:t,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return e.exists(`${t}/${r}`)}async function Xr({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await e.readdir(It(n,`objects/pack`));a=a.filter(e=>e.endsWith(`.idx`));for(let o of a){let a=await Rn({fs:e,cache:t,filename:`${n}/objects/pack/${o}`,getExternalRefDelta:i});if(a.error)throw new $(a.error);if(a.offsets.has(r))return!0}return!1}async function Zr({fs:e,cache:t,gitdir:n,oid:r,format:i=`content`}){let a=r=>Hn({fs:e,cache:t,gitdir:n,oid:r}),o=await Yr({fs:e,gitdir:n,oid:r});return o||=await Xr({fs:e,cache:t,gitdir:n,oid:r,getExternalRefDelta:a}),o}async function Qr({fs:e,gitdir:t,path:n}){return(await en.get({fs:e,gitdir:t})).get(n)}function $r(e,...t){for(let n of t)if(n)for(let t of Object.keys(n)){let r=n[t];r!==void 0&&(e[t]=r)}return e}async function ei({fs:e,gitdir:t,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a=$r({},{name:await Qr({fs:e,gitdir:t,path:`user.name`}),email:await Qr({fs:e,gitdir:t,path:`user.email`})||``,timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},r?r.author:void 0,n);if(a.name!==void 0)return a}async function ti({fs:e,gitdir:t,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),o=$r({},{name:await Qr({fs:e,gitdir:t,path:`user.name`}),email:await Qr({fs:e,gitdir:t,path:`user.email`})||``,timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function ni({fs:e,cache:t,gitdir:n,oid:r}){let{type:i,object:a}=await Hn({fs:e,cache:t,gitdir:n,oid:r});if(i===`tag`)return r=Tr.from(a).parse().object,ni({fs:e,cache:t,gitdir:n,oid:r});if(i!==`commit`)throw new Ct(r,i,`commit`);return{commit:Or.from(a),oid:r}}async function ri({fs:e,cache:t,gitdir:n,oid:r}){let{commit:i,oid:a}=await ni({fs:e,cache:t,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}var ii=`4b825dc642cb6eb9a060e54bf8d6928Line truncated
|
||||
//# sourceMappingURL=git.js.map
|
||||
Reference in new issue
Block a user