@wp-playground/storage 3.0.18 → 3.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var an=Object.create;var Ut=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var cn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty;var ln=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of fn(e))!un.call(r,a)&&a!==t&&Ut(r,a,{get:()=>e[a],enumerable:!(i=sn(e,a))||i.enumerable});return r};var Pt=(r,e,t)=>(t=r!=null?an(cn(r)):{},ln(e||!r||!r.__esModule?Ut(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("@php-wasm/util"),hn=require("octokit"),pn=require("crc-32"),lt=require("pako"),se=require("@php-wasm/stream-compression"),oe=require("@zip.js/zip.js");function yn(r){return new hn.Octokit({auth:r})}function dn(r,e=""){e.length&&!e.endsWith("/")&&(e+="/");const t={};for(const i of r)i.path.startsWith(e)&&(t[i.path.substring(e.length)]=i.content);return t}async function sr(r,e,t,i,a,f={}){f.progress||(f.progress={foundFiles:0,downloadedFiles:0});const{onProgress:u}=f,s=[],h=[],{data:d}=await r.rest.repos.getContent({owner:e,repo:t,path:a,ref:i});if(!Array.isArray(d))throw new Error(`Expected the list of files to be an array, but got ${typeof d}`);for(const w of d)w.type==="file"?(++f.progress.foundFiles,u==null||u(f.progress),s.push(mn(r,e,t,i,w).then(v=>(++f.progress.downloadedFiles,u==null||u(f.progress),v)))):w.type==="dir"&&h.push(sr(r,e,t,i,w.path,f));const y=await Promise.all(s),g=(await Promise.all(h)).flatMap(w=>w);return[...y,...g]}const gn=new te.Semaphore({concurrency:15});async function mn(r,e,t,i,a){const f=await gn.acquire();try{const{data:u}=await r.rest.repos.getContent({owner:e,repo:t,ref:i,path:a.path});if(!("content"in u))throw new Error(`No content found for ${a.path}`);return{name:a.name,path:a.path,content:wn(u.content)}}finally{f()}}function wn(r){const e=window.atob(r),t=e.length,i=new Uint8Array(t);for(let a=0;a<t;a++)i[a]=e.charCodeAt(a);return i}async function bn(r,e,t,i,a){var y;const{data:f}=await r.rest.pulls.get({owner:e,repo:t,pull_number:i}),s=(y=(await r.rest.actions.listWorkflowRuns({owner:e,repo:t,branch:f.head.ref,workflow_id:a})).data.workflow_runs[0])==null?void 0:y.id,h=await r.rest.actions.listWorkflowRunArtifacts({owner:e,repo:t,run_id:s});return(await r.rest.actions.downloadArtifact({owner:e,repo:t,artifact_id:h.data.artifacts[0].id,archive_format:"zip"})).data}async function vn(r,e,t){var f;const{data:i,headers:a}=await r.request("GET /repos/{owner}/{repo}",{owner:e,repo:t});return!(!a["x-oauth-scopes"]||!((f=i.permissions)!=null&&f.push))}async function En(r,e,t,i,a){await r.request("GET /repos/{owner}/{repo}/branches/{branch}",{owner:e,repo:t,branch:i}).then(()=>!0,()=>!1)?await r.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}",{owner:e,repo:t,sha:a,ref:`heads/${i}`}):await r.request("POST /repos/{owner}/{repo}/git/refs",{owner:e,repo:t,sha:a,ref:`refs/heads/${i}`})}async function xn(r,e,t){const i=await r.request("GET /user");return(await r.request("GET /repos/{owner}/{repo}/forks",{owner:e,repo:t})).data.find(u=>u.owner&&u.owner.login===i.data.login)||await r.request("POST /repos/{owner}/{repo}/forks",{owner:e,repo:t}),i.data.login}async function An(r,e,t,i,a,f){const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/commits",{owner:e,repo:t,message:i,tree:f,parents:[a]});return u}async function Bn(r,e,t,i,a){const f=await fr(r,e,t,i,a);if(f.length===0)return null;const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/trees",{owner:e,repo:t,base_tree:i,tree:f});return u}async function fr(r,e,t,i,a){const f=[];for(const[u,s]of a.create)f.push(at(r,e,t,u,s));for(const[u,s]of a.update)f.push(at(r,e,t,u,s));for(const u of a.delete)f.push(ur(r,e,t,i,u));return Promise.all(f).then(u=>u.filter(s=>!!s))}const cr=new te.Semaphore({concurrency:10});async function at(r,e,t,i,a){const f=await cr.acquire();try{if(ArrayBuffer.isView(a))try{const u=new TextDecoder("utf-8",{fatal:!0}).decode(a);return{path:i,content:u,mode:"100644"}}catch{const{data:{sha:u}}=await r.rest.git.createBlob({owner:e,repo:t,encoding:"base64",content:Sn(a)});return{path:i,sha:u,mode:"100644"}}else return{path:i,content:a,mode:"100644"}}finally{f()}}async function ur(r,e,t,i,a){const f=await cr.acquire();try{return await r.request("HEAD /repos/{owner}/{repo}/contents/:path",{owner:e,repo:t,ref:i,path:a}),{path:a,mode:"100644",sha:null}}catch{return}finally{f()}}function Sn(r){const e=[],t=r.byteLength;for(let i=0;i<t;i++)e.push(String.fromCharCode(r[i]));return window.btoa(e.join(""))}async function*Fn(r,e,{exceptPaths:t=[]}={}){if(e=te.normalizePath(e),!await r.isDir(e)){await r.fileExists(e)&&(yield{path:e,read:async()=>await r.readFileAsBuffer(e)});return}const i=[e];for(;i.length;){const a=i.pop();if(!a)return;const f=await r.listFiles(a);for(const u of f){const s=te.joinPaths(a,u);t.includes(s.substring(e.length+1))||(await r.isDir(s)?i.push(s):yield{path:s,read:async()=>await r.readFileAsBuffer(s)})}}}async function In(r,e){const t={create:new Map,update:new Map,delete:new Set},i=new Set;for await(const a of e){i.add(a.path);const f=r.get(a.path),u=await a.read();f?_n(f,u)||t.update.set(a.path,u):t.create.set(a.path,u)}for(const a of r.keys())i.has(a)||t.delete.add(a);return t}function _n(r,e){return r.length===e.length&&r.every((t,i)=>t===e[i])}async function lr(r){return r.type==="local-fs"?r.handle:hr(r.path)}async function hr(r){const e=r.split("/").filter(i=>i.length>0);let t=await navigator.storage.getDirectory();for(const i of e)t=await t.getDirectoryHandle(i,{create:!0});return t}async function Un(r){const t=await(await navigator.storage.getDirectory()).resolve(r);if(t===null)throw new DOMException("Unable to resolve path of OPFS directory handle.","NotFoundError");return"/"+t.join("/")}async function Pn(r){const e=await lr(r);for await(const t of e.keys())await e.removeEntry(t,{recursive:!0})}function $n(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function pr(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:$n(r)}class yr{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=pr(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&&(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;const t=[this.buffer];for(;this.cursor+e>Tn(t);){const i=await this._next();if(this._ended)break;t.push(i)}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 Tn(r){return r.reduce((e,t)=>e+t.length,0)}function On(r,e){const t=e.toString(16);return"0".repeat(r-t.length)+t}class j{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));const t=e.length+4,i=On(4,t);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){const t=new yr(e);return async function(){try{let a=await t.read(4);if(a==null)return!0;if(a=parseInt(a.toString("utf8"),16),a===0||a===1)return null;const f=await t.read(a-4);return f??!0}catch(a){return e.error=a,!0}}}}class ie extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){const t=new ie(e.message);return t.code=e.code,t.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}}class F extends ie{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=F.code,this.data={message:e}}}F.code="InternalError";class he extends ie{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=he.code,this.data={filepath:e}}}he.code="UnsafeFilepathError";function dr(r,e){return-(r<e)||+(r>e)}function gr(r,e){return dr(r.path,e.path)}function kn(r,e){return dr($t(r),$t(e))}function $t(r){return r.mode==="040000"?r.path+"/":r.path}function mr(r){switch(r){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new F(`Unexpected GitTree entry mode: ${r}`)}function Rn(r){const e=[];let t=0;for(;t<r.length;){const i=r.indexOf(32,t);if(i===-1)throw new F(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);const a=r.indexOf(0,t);if(a===-1)throw new F(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let f=r.slice(t,i).toString("utf8");f==="40000"&&(f="040000");const u=mr(f),s=r.slice(i+1,a).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new he(s);const h=r.slice(a+1,a+21).toString("hex");t=a+21,e.push({mode:f,path:s,oid:h,type:u})}return e}function jn(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new F(`Could not understand file mode: ${r}`)}function Cn(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=jn(r.mode),r.type||(r.type=mr(r.mode)),r}class ht{constructor(e){if(Buffer.isBuffer(e))this._entries=Rn(e);else if(Array.isArray(e))this._entries=e.map(Cn);else throw new F("invalid type passed to GitTree constructor");this._entries.sort(gr)}static from(e){return new ht(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
2
- `)}toObject(){const e=[...this._entries];return e.sort(kn),Buffer.concat(e.map(t=>{const i=Buffer.from(t.mode.replace(/^0/,"")),a=Buffer.from(" "),f=Buffer.from(t.path,"utf8"),u=Buffer.from([0]),s=Buffer.from(t.oid,"hex");return Buffer.concat([i,a,f,u,s])}))}entries(){return this._entries}*[Symbol.iterator](){for(const e of this._entries)yield e}}function st({name:r,email:e,timestamp:t,timezoneOffset:i}){return i=Dn(i),`${r} <${e}> ${t} ${i}`}function Dn(r){const e=Nn(Mn(r));r=Math.abs(r);const t=Math.floor(r/60);r-=t*60;let i=String(t),a=String(r);return i.length<2&&(i="0"+i),a.length<2&&(a="0"+a),(e===-1?"-":"+")+i+a}function Nn(r){return Math.sign(r)||(Object.is(r,-0)?-1:1)}function Mn(r){return r===0?r:-r}function V(r){return r=r.replace(/\r/g,""),r=r.replace(/^\n+/,""),r=r.replace(/\n+$/,"")+`
3
- `,r}function Ae(r){const[,e,t,i,a]=r.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:t,timestamp:Number(i),timezoneOffset:Ln(a)}}function Ln(r){let[,e,t,i]=r.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(t)*60+Number(i)),qn(i)}function qn(r){return r===0?r:-r}class ae{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=ae.render(e);else throw new F("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new ae(e)}static render(e){return`object ${e.object}
1
+ "use strict";var nn=Object.create;var _t=Object.defineProperty;var on=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames;var sn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty;var cn=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of an(e))!fn.call(r,a)&&a!==t&&_t(r,a,{get:()=>e[a],enumerable:!(i=on(e,a))||i.enumerable});return r};var Ut=(r,e,t)=>(t=r!=null?nn(sn(r)):{},cn(e||!r||!r.__esModule?_t(t,"default",{value:r,enumerable:!0}):t,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("@php-wasm/util"),un=require("octokit"),ln=require("crc-32"),ut=require("pako"),se=require("@php-wasm/stream-compression"),oe=require("@zip.js/zip.js");function hn(r){return new un.Octokit({auth:r})}function pn(r,e=""){e.length&&!e.endsWith("/")&&(e+="/");const t={};for(const i of r)i.path.startsWith(e)&&(t[i.path.substring(e.length)]=i.content);return t}async function or(r,e,t,i,a,f={}){f.progress||(f.progress={foundFiles:0,downloadedFiles:0});const{onProgress:u}=f,s=[],h=[],{data:d}=await r.rest.repos.getContent({owner:e,repo:t,path:a,ref:i});if(!Array.isArray(d))throw new Error(`Expected the list of files to be an array, but got ${typeof d}`);for(const w of d)w.type==="file"?(++f.progress.foundFiles,u==null||u(f.progress),s.push(dn(r,e,t,i,w).then(v=>(++f.progress.downloadedFiles,u==null||u(f.progress),v)))):w.type==="dir"&&h.push(or(r,e,t,i,w.path,f));const y=await Promise.all(s),g=(await Promise.all(h)).flatMap(w=>w);return[...y,...g]}const yn=new te.Semaphore({concurrency:15});async function dn(r,e,t,i,a){const f=await yn.acquire();try{const{data:u}=await r.rest.repos.getContent({owner:e,repo:t,ref:i,path:a.path});if(!("content"in u))throw new Error(`No content found for ${a.path}`);return{name:a.name,path:a.path,content:gn(u.content)}}finally{f()}}function gn(r){const e=window.atob(r),t=e.length,i=new Uint8Array(t);for(let a=0;a<t;a++)i[a]=e.charCodeAt(a);return i}async function mn(r,e,t,i,a){var y;const{data:f}=await r.rest.pulls.get({owner:e,repo:t,pull_number:i}),s=(y=(await r.rest.actions.listWorkflowRuns({owner:e,repo:t,branch:f.head.ref,workflow_id:a})).data.workflow_runs[0])==null?void 0:y.id,h=await r.rest.actions.listWorkflowRunArtifacts({owner:e,repo:t,run_id:s});return(await r.rest.actions.downloadArtifact({owner:e,repo:t,artifact_id:h.data.artifacts[0].id,archive_format:"zip"})).data}async function wn(r,e,t){var f;const{data:i,headers:a}=await r.request("GET /repos/{owner}/{repo}",{owner:e,repo:t});return!(!a["x-oauth-scopes"]||!((f=i.permissions)!=null&&f.push))}async function bn(r,e,t,i,a){await r.request("GET /repos/{owner}/{repo}/branches/{branch}",{owner:e,repo:t,branch:i}).then(()=>!0,()=>!1)?await r.request("PATCH /repos/{owner}/{repo}/git/refs/{ref}",{owner:e,repo:t,sha:a,ref:`heads/${i}`}):await r.request("POST /repos/{owner}/{repo}/git/refs",{owner:e,repo:t,sha:a,ref:`refs/heads/${i}`})}async function vn(r,e,t){const i=await r.request("GET /user");return(await r.request("GET /repos/{owner}/{repo}/forks",{owner:e,repo:t})).data.find(u=>u.owner&&u.owner.login===i.data.login)||await r.request("POST /repos/{owner}/{repo}/forks",{owner:e,repo:t}),i.data.login}async function En(r,e,t,i,a,f){const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/commits",{owner:e,repo:t,message:i,tree:f,parents:[a]});return u}async function xn(r,e,t,i,a){const f=await ar(r,e,t,i,a);if(f.length===0)return null;const{data:{sha:u}}=await r.request("POST /repos/{owner}/{repo}/git/trees",{owner:e,repo:t,base_tree:i,tree:f});return u}async function ar(r,e,t,i,a){const f=[];for(const[u,s]of a.create)f.push(ot(r,e,t,u,s));for(const[u,s]of a.update)f.push(ot(r,e,t,u,s));for(const u of a.delete)f.push(fr(r,e,t,i,u));return Promise.all(f).then(u=>u.filter(s=>!!s))}const sr=new te.Semaphore({concurrency:10});async function ot(r,e,t,i,a){const f=await sr.acquire();try{if(ArrayBuffer.isView(a))try{const u=new TextDecoder("utf-8",{fatal:!0}).decode(a);return{path:i,content:u,mode:"100644"}}catch{const{data:{sha:u}}=await r.rest.git.createBlob({owner:e,repo:t,encoding:"base64",content:An(a)});return{path:i,sha:u,mode:"100644"}}else return{path:i,content:a,mode:"100644"}}finally{f()}}async function fr(r,e,t,i,a){const f=await sr.acquire();try{return await r.request("HEAD /repos/{owner}/{repo}/contents/:path",{owner:e,repo:t,ref:i,path:a}),{path:a,mode:"100644",sha:null}}catch{return}finally{f()}}function An(r){const e=[],t=r.byteLength;for(let i=0;i<t;i++)e.push(String.fromCharCode(r[i]));return window.btoa(e.join(""))}async function*Bn(r,e,{exceptPaths:t=[]}={}){if(e=te.normalizePath(e),!await r.isDir(e)){await r.fileExists(e)&&(yield{path:e,read:async()=>await r.readFileAsBuffer(e)});return}const i=[e];for(;i.length;){const a=i.pop();if(!a)return;const f=await r.listFiles(a);for(const u of f){const s=te.joinPaths(a,u);t.includes(s.substring(e.length+1))||(await r.isDir(s)?i.push(s):yield{path:s,read:async()=>await r.readFileAsBuffer(s)})}}}async function Sn(r,e){const t={create:new Map,update:new Map,delete:new Set},i=new Set;for await(const a of e){i.add(a.path);const f=r.get(a.path),u=await a.read();f?In(f,u)||t.update.set(a.path,u):t.create.set(a.path,u)}for(const a of r.keys())i.has(a)||t.delete.add(a);return t}function In(r,e){return r.length===e.length&&r.every((t,i)=>t===e[i])}async function cr(r){return r.type==="local-fs"?r.handle:ur(r.path)}async function ur(r){const e=r.split("/").filter(i=>i.length>0);let t=await navigator.storage.getDirectory();for(const i of e)t=await t.getDirectoryHandle(i,{create:!0});return t}async function Fn(r){const t=await(await navigator.storage.getDirectory()).resolve(r);if(t===null)throw new DOMException("Unable to resolve path of OPFS directory handle.","NotFoundError");return"/"+t.join("/")}async function _n(r){const e=await cr(r);for await(const t of e.keys())await e.removeEntry(t,{recursive:!0})}function Un(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function lr(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:Un(r)}class hr{constructor(e){if(typeof Buffer>"u")throw new Error("Missing Buffer dependency");this.stream=lr(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&&(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;const t=[this.buffer];for(;this.cursor+e>Pn(t);){const i=await this._next();if(this._ended)break;t.push(i)}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 Pn(r){return r.reduce((e,t)=>e+t.length,0)}function $n(r,e){const t=e.toString(16);return"0".repeat(r-t.length)+t}class j{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));const t=e.length+4,i=$n(4,t);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){const t=new hr(e);return async function(){try{let a=await t.read(4);if(a==null)return!0;if(a=parseInt(a.toString("utf8"),16),a===0||a===1)return null;const f=await t.read(a-4);return f??!0}catch(a){return e.error=a,!0}}}}class ie extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){const t=new ie(e.message);return t.code=e.code,t.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}}class I extends ie{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=I.code,this.data={message:e}}}I.code="InternalError";class he extends ie{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=he.code,this.data={filepath:e}}}he.code="UnsafeFilepathError";function pr(r,e){return-(r<e)||+(r>e)}function yr(r,e){return pr(r.path,e.path)}function Tn(r,e){return pr(Pt(r),Pt(e))}function Pt(r){return r.mode==="040000"?r.path+"/":r.path}function dr(r){switch(r){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new I(`Unexpected GitTree entry mode: ${r}`)}function On(r){const e=[];let t=0;for(;t<r.length;){const i=r.indexOf(32,t);if(i===-1)throw new I(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);const a=r.indexOf(0,t);if(a===-1)throw new I(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let f=r.slice(t,i).toString("utf8");f==="40000"&&(f="040000");const u=dr(f),s=r.slice(i+1,a).toString("utf8");if(s.includes("\\")||s.includes("/"))throw new he(s);const h=r.slice(a+1,a+21).toString("hex");t=a+21,e.push({mode:f,path:s,oid:h,type:u})}return e}function kn(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new I(`Could not understand file mode: ${r}`)}function Rn(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=kn(r.mode),r.type||(r.type=dr(r.mode)),r}class lt{constructor(e){if(Buffer.isBuffer(e))this._entries=On(e);else if(Array.isArray(e))this._entries=e.map(Rn);else throw new I("invalid type passed to GitTree constructor");this._entries.sort(yr)}static from(e){return new lt(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
2
+ `)}toObject(){const e=[...this._entries];return e.sort(Tn),Buffer.concat(e.map(t=>{const i=Buffer.from(t.mode.replace(/^0/,"")),a=Buffer.from(" "),f=Buffer.from(t.path,"utf8"),u=Buffer.from([0]),s=Buffer.from(t.oid,"hex");return Buffer.concat([i,a,f,u,s])}))}entries(){return this._entries}*[Symbol.iterator](){for(const e of this._entries)yield e}}function at({name:r,email:e,timestamp:t,timezoneOffset:i}){return i=jn(i),`${r} <${e}> ${t} ${i}`}function jn(r){const e=Cn(Dn(r));r=Math.abs(r);const t=Math.floor(r/60);r-=t*60;let i=String(t),a=String(r);return i.length<2&&(i="0"+i),a.length<2&&(a="0"+a),(e===-1?"-":"+")+i+a}function Cn(r){return Math.sign(r)||(Object.is(r,-0)?-1:1)}function Dn(r){return r===0?r:-r}function V(r){return r=r.replace(/\r/g,""),r=r.replace(/^\n+/,""),r=r.replace(/\n+$/,"")+`
3
+ `,r}function Ae(r){const[,e,t,i,a]=r.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:t,timestamp:Number(i),timezoneOffset:Nn(a)}}function Nn(r){let[,e,t,i]=r.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(t)*60+Number(i)),Mn(i)}function Mn(r){return r===0?r:-r}class ae{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=ae.render(e);else throw new I("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new ae(e)}static render(e){return`object ${e.object}
4
4
  type ${e.type}
5
5
  tag ${e.tag}
6
- tagger ${st(e.tagger)}
6
+ tagger ${at(e.tagger)}
7
7
 
8
8
  ${e.message}
9
9
  ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
@@ -19,9 +19,9 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
19
19
  `}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,t,i){const a=e.payload();let{signature:f}=await t({payload:a,secretKey:i});f=V(f);const u=a+f;return ae.from(u)}}function ke(r){return r.trim().split(`
20
20
  `).map(e=>" "+e).join(`
21
21
  `)+`
22
- `}function Gn(r){return r.split(`
22
+ `}function Ln(r){return r.split(`
23
23
  `).map(e=>e.replace(/^ /,"")).join(`
24
- `)}class M{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=M.render(e);else throw new F("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:t}){const i=M.justHeaders(e),a=M.justMessage(e),f=V(i+`
24
+ `)}class M{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=M.render(e);else throw new I("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:t}){const i=M.justHeaders(e),a=M.justMessage(e),f=V(i+`
25
25
  gpgsig`+ke(t)+`
26
26
  `+a);return new M(f)}static from(e){return new M(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return M.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return V(e.slice(e.indexOf(`
27
27
 
@@ -31,45 +31,45 @@ gpgsig`+ke(t)+`
31
31
  `),t=[];for(const a of e)a[0]===" "?t[t.length-1]+=`
32
32
  `+a.slice(1):t.push(a);const i={parent:[]};for(const a of t){const f=a.slice(0,a.indexOf(" ")),u=a.slice(a.indexOf(" ")+1);Array.isArray(i[f])?i[f].push(u):i[f]=u}return i.author&&(i.author=Ae(i.author)),i.committer&&(i.committer=Ae(i.committer)),i}static renderHeaders(e){let t="";if(e.tree?t+=`tree ${e.tree}
33
33
  `:t+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
34
- `,e.parent){if(e.parent.length===void 0)throw new F("commit 'parent' property should be an array");for(const f of e.parent)t+=`parent ${f}
35
- `}const i=e.author;t+=`author ${st(i)}
36
- `;const a=e.committer||e.author;return t+=`committer ${st(a)}
34
+ `,e.parent){if(e.parent.length===void 0)throw new I("commit 'parent' property should be an array");for(const f of e.parent)t+=`parent ${f}
35
+ `}const i=e.author;t+=`author ${at(i)}
36
+ `;const a=e.committer||e.author;return t+=`committer ${at(a)}
37
37
  `,e.gpgsig&&(t+="gpgsig"+ke(e.gpgsig)),t}static render(e){return M.renderHeaders(e)+`
38
38
  `+V(e.message)}render(){return this._commit}withoutSignature(){const e=V(this._commit);if(e.indexOf(`
39
39
  gpgsig`)===-1)return e;const t=e.slice(0,e.indexOf(`
40
40
  gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
41
41
  `)+28);return V(t+`
42
- `+i)}isolateSignature(){const e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return Gn(e)}static async sign(e,t,i){const a=e.withoutSignature(),f=M.justMessage(e._commit);let{signature:u}=await t({payload:a,secretKey:i});u=V(u);const h=M.justHeaders(e._commit)+`
42
+ `+i)}isolateSignature(){const e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return Ln(e)}static async sign(e,t,i){const a=e.withoutSignature(),f=M.justMessage(e._commit);let{signature:u}=await t({payload:a,secretKey:i});u=V(u);const h=M.justHeaders(e._commit)+`
43
43
  gpgsig`+ke(u)+`
44
- `+f;return M.from(h)}}class Hn{static wrap({type:e,object:t}){return Buffer.concat([Buffer.from(`${e} ${t.byteLength.toString()}\0`),Buffer.from(t)])}static unwrap(e){const t=e.indexOf(32),i=e.indexOf(0),a=e.slice(0,t).toString("utf8"),f=e.slice(t+1,i).toString("utf8"),u=e.length-(i+1);if(parseInt(f)!==u)throw new F(`Length mismatch: expected ${f} bytes but got ${u} instead.`);return{type:a,object:Buffer.from(e.slice(i+1))}}}class z{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){const t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){const i=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,i}write(e,t,i){const a=this.buffer.write(e,this._start,t,i);return this._start+=t,a}copy(e,t,i){const a=e.copy(this.buffer,this._start,t,i);return this._start+=a,a}readUInt8(){const e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){const t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){const e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){const t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){const e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){const t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}}function zn(r,e){const t=new z(r),i=Tt(t);if(i!==e.byteLength)throw new F(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);const a=Tt(t);let f;const u=kt(t,e);if(u.byteLength===a)f=u;else{f=Buffer.alloc(a);const s=new z(f);for(s.copy(u);!t.eof();)s.copy(kt(t,e));const h=s.tell();if(a!==h)throw new F(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${h} bytes`)}return f}function Tt(r){let e=0,t=0,i=null;do i=r.readUInt8(),e|=(i&127)<<t,t+=7;while(i&128);return e}function Ot(r,e,t){let i=0,a=0;for(;t--;)e&1&&(i|=r.readUInt8()<<a),e>>=1,a+=8;return i}function kt(r,e){const t=r.readUInt8(),i=128,a=15,f=112;if(t&i){const u=Ot(r,t&a,4);let s=Ot(r,(t&f)>>4,3);return s===0&&(s=65536),e.slice(u,u+s)}else return r.slice(t)}async function Wn(r,e){const t=new yr(r);let i=await t.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new F(`Invalid PACK header '${i}'`);let a=await t.read(4);if(a=a.readUInt32BE(0),a!==2)throw new F(`Invalid packfile version: ${a}`);let f=await t.read(4);if(f=f.readUInt32BE(0),!(f<1))for(;!t.eof()&&f--;){const u=t.tell(),{type:s,length:h,ofs:d,reference:y}=await Vn(t),g=new lt.Inflate;for(;!g.result;){const w=await t.chunk();if(!w)break;if(g.push(w,!1),g.err)throw new F(`Pako error: ${g.msg}`);if(g.result){if(g.result.length!==h)throw new F("Inflated object size is different from that stated in packfile.");await t.undo(),await t.read(w.length-g.strm.avail_in);const v=t.tell();await e({data:g.result,type:s,num:f,offset:u,end:v,reference:y,ofs:d})}}}}async function Vn(r){let e=await r.byte();const t=e>>4&7;let i=e&15;if(e&128){let u=4;do e=await r.byte(),i|=(e&127)<<u,u+=7;while(e&128)}let a,f;if(t===6){let u=0;a=0;const s=[];do e=await r.byte(),a|=(e&127)<<u,u+=7,s.push(e);while(e&128);f=Buffer.from(s)}return t===7&&(f=await r.read(20)),{type:t,length:i,ofs:a,reference:f}}async function Jn(r){return lt.inflate(r)}var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ft={exports:{}};typeof Object.create=="function"?ft.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ft.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var Xn=ft.exports,ct={exports:{}},pt={},_e={};_e.byteLength=Qn;_e.toByteArray=ti;_e.fromByteArray=ii;var W=[],L=[],Kn=typeof Uint8Array<"u"?Uint8Array:Array,Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Zn=Re.length;K<Zn;++K)W[K]=Re[K],L[Re.charCodeAt(K)]=K;L[45]=62;L[95]=63;function br(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function Qn(r){var e=br(r),t=e[0],i=e[1];return(t+i)*3/4-i}function ei(r,e,t){return(e+t)*3/4-t}function ti(r){var e,t=br(r),i=t[0],a=t[1],f=new Kn(ei(r,i,a)),u=0,s=a>0?i-4:i,h;for(h=0;h<s;h+=4)e=L[r.charCodeAt(h)]<<18|L[r.charCodeAt(h+1)]<<12|L[r.charCodeAt(h+2)]<<6|L[r.charCodeAt(h+3)],f[u++]=e>>16&255,f[u++]=e>>8&255,f[u++]=e&255;return a===2&&(e=L[r.charCodeAt(h)]<<2|L[r.charCodeAt(h+1)]>>4,f[u++]=e&255),a===1&&(e=L[r.charCodeAt(h)]<<10|L[r.charCodeAt(h+1)]<<4|L[r.charCodeAt(h+2)]>>2,f[u++]=e>>8&255,f[u++]=e&255),f}function ri(r){return W[r>>18&63]+W[r>>12&63]+W[r>>6&63]+W[r&63]}function ni(r,e,t){for(var i,a=[],f=e;f<t;f+=3)i=(r[f]<<16&16711680)+(r[f+1]<<8&65280)+(r[f+2]&255),a.push(ri(i));return a.join("")}function ii(r){for(var e,t=r.length,i=t%3,a=[],f=16383,u=0,s=t-i;u<s;u+=f)a.push(ni(r,u,u+f>s?s:u+f));return i===1?(e=r[t-1],a.push(W[e>>2]+W[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],a.push(W[e>>10]+W[e>>4&63]+W[e<<2&63]+"=")),a.join("")}var yt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */yt.read=function(r,e,t,i,a){var f,u,s=a*8-i-1,h=(1<<s)-1,d=h>>1,y=-7,g=t?a-1:0,w=t?-1:1,v=r[e+g];for(g+=w,f=v&(1<<-y)-1,v>>=-y,y+=s;y>0;f=f*256+r[e+g],g+=w,y-=8);for(u=f&(1<<-y)-1,f>>=-y,y+=i;y>0;u=u*256+r[e+g],g+=w,y-=8);if(f===0)f=1-d;else{if(f===h)return u?NaN:(v?-1:1)*(1/0);u=u+Math.pow(2,i),f=f-d}return(v?-1:1)*u*Math.pow(2,f-i)};yt.write=function(r,e,t,i,a,f){var u,s,h,d=f*8-a-1,y=(1<<d)-1,g=y>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=i?0:f-1,_=i?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=y):(u=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+g>=1?e+=w/h:e+=w*Math.pow(2,1-g),e*h>=2&&(u++,h/=2),u+g>=y?(s=0,u=y):u+g>=1?(s=(e*h-1)*Math.pow(2,a),u=u+g):(s=e*Math.pow(2,g-1)*Math.pow(2,a),u=0));a>=8;r[t+v]=s&255,v+=_,s/=256,a-=8);for(u=u<<a|s,d+=a;d>0;r[t+v]=u&255,v+=_,u/=256,d-=8);r[t+v-_]|=P*128};/*!
44
+ `+f;return M.from(h)}}class Gn{static wrap({type:e,object:t}){return Buffer.concat([Buffer.from(`${e} ${t.byteLength.toString()}\0`),Buffer.from(t)])}static unwrap(e){const t=e.indexOf(32),i=e.indexOf(0),a=e.slice(0,t).toString("utf8"),f=e.slice(t+1,i).toString("utf8"),u=e.length-(i+1);if(parseInt(f)!==u)throw new I(`Length mismatch: expected ${f} bytes but got ${u} instead.`);return{type:a,object:Buffer.from(e.slice(i+1))}}}class z{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){const t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){const i=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,i}write(e,t,i){const a=this.buffer.write(e,this._start,t,i);return this._start+=t,a}copy(e,t,i){const a=e.copy(this.buffer,this._start,t,i);return this._start+=a,a}readUInt8(){const e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){const t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){const e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){const t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){const e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){const t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}}function qn(r,e){const t=new z(r),i=$t(t);if(i!==e.byteLength)throw new I(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);const a=$t(t);let f;const u=Ot(t,e);if(u.byteLength===a)f=u;else{f=Buffer.alloc(a);const s=new z(f);for(s.copy(u);!t.eof();)s.copy(Ot(t,e));const h=s.tell();if(a!==h)throw new I(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${h} bytes`)}return f}function $t(r){let e=0,t=0,i=null;do i=r.readUInt8(),e|=(i&127)<<t,t+=7;while(i&128);return e}function Tt(r,e,t){let i=0,a=0;for(;t--;)e&1&&(i|=r.readUInt8()<<a),e>>=1,a+=8;return i}function Ot(r,e){const t=r.readUInt8(),i=128,a=15,f=112;if(t&i){const u=Tt(r,t&a,4);let s=Tt(r,(t&f)>>4,3);return s===0&&(s=65536),e.slice(u,u+s)}else return r.slice(t)}async function Hn(r,e){const t=new hr(r);let i=await t.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new I(`Invalid PACK header '${i}'`);let a=await t.read(4);if(a=a.readUInt32BE(0),a!==2)throw new I(`Invalid packfile version: ${a}`);let f=await t.read(4);if(f=f.readUInt32BE(0),!(f<1))for(;!t.eof()&&f--;){const u=t.tell(),{type:s,length:h,ofs:d,reference:y}=await zn(t),g=new ut.Inflate;for(;!g.result;){const w=await t.chunk();if(!w)break;if(g.push(w,!1),g.err)throw new I(`Pako error: ${g.msg}`);if(g.result){if(g.result.length!==h)throw new I("Inflated object size is different from that stated in packfile.");await t.undo(),await t.read(w.length-g.strm.avail_in);const v=t.tell();await e({data:g.result,type:s,num:f,offset:u,end:v,reference:y,ofs:d})}}}}async function zn(r){let e=await r.byte();const t=e>>4&7;let i=e&15;if(e&128){let u=4;do e=await r.byte(),i|=(e&127)<<u,u+=7;while(e&128)}let a,f;if(t===6){let u=0;a=0;const s=[];do e=await r.byte(),a|=(e&127)<<u,u+=7,s.push(e);while(e&128);f=Buffer.from(s)}return t===7&&(f=await r.read(20)),{type:t,length:i,ofs:a,reference:f}}async function Wn(r){return ut.inflate(r)}var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var st={exports:{}};typeof Object.create=="function"?st.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:st.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}};var Jn=st.exports,ft={exports:{}},ht={},_e={};_e.byteLength=Kn;_e.toByteArray=Qn;_e.fromByteArray=ri;var W=[],L=[],Yn=typeof Uint8Array<"u"?Uint8Array:Array,Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var K=0,Xn=Re.length;K<Xn;++K)W[K]=Re[K],L[Re.charCodeAt(K)]=K;L[45]=62;L[95]=63;function mr(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function Kn(r){var e=mr(r),t=e[0],i=e[1];return(t+i)*3/4-i}function Zn(r,e,t){return(e+t)*3/4-t}function Qn(r){var e,t=mr(r),i=t[0],a=t[1],f=new Yn(Zn(r,i,a)),u=0,s=a>0?i-4:i,h;for(h=0;h<s;h+=4)e=L[r.charCodeAt(h)]<<18|L[r.charCodeAt(h+1)]<<12|L[r.charCodeAt(h+2)]<<6|L[r.charCodeAt(h+3)],f[u++]=e>>16&255,f[u++]=e>>8&255,f[u++]=e&255;return a===2&&(e=L[r.charCodeAt(h)]<<2|L[r.charCodeAt(h+1)]>>4,f[u++]=e&255),a===1&&(e=L[r.charCodeAt(h)]<<10|L[r.charCodeAt(h+1)]<<4|L[r.charCodeAt(h+2)]>>2,f[u++]=e>>8&255,f[u++]=e&255),f}function ei(r){return W[r>>18&63]+W[r>>12&63]+W[r>>6&63]+W[r&63]}function ti(r,e,t){for(var i,a=[],f=e;f<t;f+=3)i=(r[f]<<16&16711680)+(r[f+1]<<8&65280)+(r[f+2]&255),a.push(ei(i));return a.join("")}function ri(r){for(var e,t=r.length,i=t%3,a=[],f=16383,u=0,s=t-i;u<s;u+=f)a.push(ti(r,u,u+f>s?s:u+f));return i===1?(e=r[t-1],a.push(W[e>>2]+W[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],a.push(W[e>>10]+W[e>>4&63]+W[e<<2&63]+"=")),a.join("")}var pt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */pt.read=function(r,e,t,i,a){var f,u,s=a*8-i-1,h=(1<<s)-1,d=h>>1,y=-7,g=t?a-1:0,w=t?-1:1,v=r[e+g];for(g+=w,f=v&(1<<-y)-1,v>>=-y,y+=s;y>0;f=f*256+r[e+g],g+=w,y-=8);for(u=f&(1<<-y)-1,f>>=-y,y+=i;y>0;u=u*256+r[e+g],g+=w,y-=8);if(f===0)f=1-d;else{if(f===h)return u?NaN:(v?-1:1)*(1/0);u=u+Math.pow(2,i),f=f-d}return(v?-1:1)*u*Math.pow(2,f-i)};pt.write=function(r,e,t,i,a,f){var u,s,h,d=f*8-a-1,y=(1<<d)-1,g=y>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=i?0:f-1,_=i?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=y):(u=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-u))<1&&(u--,h*=2),u+g>=1?e+=w/h:e+=w*Math.pow(2,1-g),e*h>=2&&(u++,h/=2),u+g>=y?(s=0,u=y):u+g>=1?(s=(e*h-1)*Math.pow(2,a),u=u+g):(s=e*Math.pow(2,g-1)*Math.pow(2,a),u=0));a>=8;r[t+v]=s&255,v+=_,s/=256,a-=8);for(u=u<<a|s,d+=a;d>0;r[t+v]=u&255,v+=_,u/=256,d-=8);r[t+v-_]|=P*128};/*!
45
45
  * The buffer module from node.js, for the browser.
46
46
  *
47
47
  * @author Feross Aboukhadijeh <https://feross.org>
48
48
  * @license MIT
49
- */(function(r){var e=_e,t=yt,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=I,r.INSPECT_MAX_BYTES=50;var a=2147483647;r.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=f(),!s.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 f(){try{var c=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(c,n),c.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function u(c){if(c>a)throw new RangeError('The value "'+c+'" is invalid for option "size"');var n=new Uint8Array(c);return Object.setPrototypeOf(n,s.prototype),n}function s(c,n,o){if(typeof c=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return h(c,n,o)}s.poolSize=8192;function h(c,n,o){if(typeof c=="string")return w(c,n);if(ArrayBuffer.isView(c))return _(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(G(c,ArrayBuffer)||c&&G(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(G(c,SharedArrayBuffer)||c&&G(c.buffer,SharedArrayBuffer)))return P(c,n,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return s.from(l,n,o);var p=B(c);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return s.from(c[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}s.from=function(c,n,o){return h(c,n,o)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function d(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function y(c,n,o){return d(c),c<=0?u(c):n!==void 0?typeof o=="string"?u(c).fill(n,o):u(c).fill(n):u(c)}s.alloc=function(c,n,o){return y(c,n,o)};function g(c){return d(c),u(c<0?0:x(c)|0)}s.allocUnsafe=function(c){return g(c)},s.allocUnsafeSlow=function(c){return g(c)};function w(c,n){if((typeof n!="string"||n==="")&&(n="utf8"),!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=E(c,n)|0,l=u(o),p=l.write(c,n);return p!==o&&(l=l.slice(0,p)),l}function v(c){for(var n=c.length<0?0:x(c.length)|0,o=u(n),l=0;l<n;l+=1)o[l]=c[l]&255;return o}function _(c){if(G(c,Uint8Array)){var n=new Uint8Array(c);return P(n.buffer,n.byteOffset,n.byteLength)}return v(c)}function P(c,n,o){if(n<0||c.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var l;return n===void 0&&o===void 0?l=new Uint8Array(c):o===void 0?l=new Uint8Array(c,n):l=new Uint8Array(c,n,o),Object.setPrototypeOf(l,s.prototype),l}function B(c){if(s.isBuffer(c)){var n=x(c.length)|0,o=u(n);return o.length===0||c.copy(o,0,0,n),o}if(c.length!==void 0)return typeof c.length!="number"||Oe(c.length)?u(0):v(c);if(c.type==="Buffer"&&Array.isArray(c.data))return v(c.data)}function x(c){if(c>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return c|0}function I(c){return+c!=c&&(c=0),s.alloc(+c)}s.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==s.prototype},s.compare=function(n,o){if(G(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),G(o,Uint8Array)&&(o=s.from(o,o.offset,o.byteLength)),!s.isBuffer(n)||!s.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var l=n.length,p=o.length,m=0,b=Math.min(l,p);m<b;++m)if(n[m]!==o[m]){l=n[m],p=o[m];break}return l<p?-1:p<l?1:0},s.isEncoding=function(n){switch(String(n).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}},s.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return s.alloc(0);var l;if(o===void 0)for(o=0,l=0;l<n.length;++l)o+=n[l].length;var p=s.allocUnsafe(o),m=0;for(l=0;l<n.length;++l){var b=n[l];if(G(b,Uint8Array))m+b.length>p.length?s.from(b).copy(p,m):Uint8Array.prototype.set.call(p,b,m);else if(s.isBuffer(b))b.copy(p,m);else throw new TypeError('"list" argument must be an Array of Buffers');m+=b.length}return p};function E(c,n){if(s.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||G(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);var o=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&o===0)return 0;for(var p=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Te(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Ft(c).length;default:if(p)return l?-1:Te(c).length;n=(""+n).toLowerCase(),p=!0}}s.byteLength=E;function $(c,n,o){var l=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(c||(c="utf8");;)switch(c){case"hex":return Zr(this,n,o);case"utf8":case"utf-8":return Et(this,n,o);case"ascii":return Xr(this,n,o);case"latin1":case"binary":return Kr(this,n,o);case"base64":return Jr(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Qr(this,n,o);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}s.prototype._isBuffer=!0;function C(c,n,o){var l=c[n];c[n]=c[o],c[o]=l}s.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)C(this,o,o+1);return this},s.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)C(this,o,o+3),C(this,o+1,o+2);return this},s.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)C(this,o,o+7),C(this,o+1,o+6),C(this,o+2,o+5),C(this,o+3,o+4);return this},s.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?Et(this,0,n):$.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(n){if(!s.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:s.compare(this,n)===0},s.prototype.inspect=function(){var n="",o=r.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(n,o,l,p,m){if(G(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),l===void 0&&(l=n?n.length:0),p===void 0&&(p=0),m===void 0&&(m=this.length),o<0||l>n.length||p<0||m>this.length)throw new RangeError("out of range index");if(p>=m&&o>=l)return 0;if(p>=m)return-1;if(o>=l)return 1;if(o>>>=0,l>>>=0,p>>>=0,m>>>=0,this===n)return 0;for(var b=m-p,S=l-o,U=Math.min(b,S),T=this.slice(p,m),D=n.slice(o,l),O=0;O<U;++O)if(T[O]!==D[O]){b=T[O],S=D[O];break}return b<S?-1:S<b?1:0};function bt(c,n,o,l,p){if(c.length===0)return-1;if(typeof o=="string"?(l=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Oe(o)&&(o=p?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(p)return-1;o=c.length-1}else if(o<0)if(p)o=0;else return-1;if(typeof n=="string"&&(n=s.from(n,l)),s.isBuffer(n))return n.length===0?-1:vt(c,n,o,l,p);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(c,n,o):Uint8Array.prototype.lastIndexOf.call(c,n,o):vt(c,[n],o,l,p);throw new TypeError("val must be string, number or Buffer")}function vt(c,n,o,l,p){var m=1,b=c.length,S=n.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.length<2||n.length<2)return-1;m=2,b/=2,S/=2,o/=2}function U(It,_t){return m===1?It[_t]:It.readUInt16BE(_t*m)}var T;if(p){var D=-1;for(T=o;T<b;T++)if(U(c,T)===U(n,D===-1?0:T-D)){if(D===-1&&(D=T),T-D+1===S)return D*m}else D!==-1&&(T-=T-D),D=-1}else for(o+S>b&&(o=b-S),T=o;T>=0;T--){for(var O=!0,ve=0;ve<S;ve++)if(U(c,T+ve)!==U(n,ve)){O=!1;break}if(O)return T}return-1}s.prototype.includes=function(n,o,l){return this.indexOf(n,o,l)!==-1},s.prototype.indexOf=function(n,o,l){return bt(this,n,o,l,!0)},s.prototype.lastIndexOf=function(n,o,l){return bt(this,n,o,l,!1)};function Gr(c,n,o,l){o=Number(o)||0;var p=c.length-o;l?(l=Number(l),l>p&&(l=p)):l=p;var m=n.length;l>m/2&&(l=m/2);for(var b=0;b<l;++b){var S=parseInt(n.substr(b*2,2),16);if(Oe(S))return b;c[o+b]=S}return b}function Hr(c,n,o,l){return be(Te(n,c.length-o),c,o,l)}function zr(c,n,o,l){return be(rn(n),c,o,l)}function Wr(c,n,o,l){return be(Ft(n),c,o,l)}function Vr(c,n,o,l){return be(nn(n,c.length-o),c,o,l)}s.prototype.write=function(n,o,l,p){if(o===void 0)p="utf8",l=this.length,o=0;else if(l===void 0&&typeof o=="string")p=o,l=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var m=this.length-o;if((l===void 0||l>m)&&(l=m),n.length>0&&(l<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var b=!1;;)switch(p){case"hex":return Gr(this,n,o,l);case"utf8":case"utf-8":return Hr(this,n,o,l);case"ascii":case"latin1":case"binary":return zr(this,n,o,l);case"base64":return Wr(this,n,o,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vr(this,n,o,l);default:if(b)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),b=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Jr(c,n,o){return n===0&&o===c.length?e.fromByteArray(c):e.fromByteArray(c.slice(n,o))}function Et(c,n,o){o=Math.min(c.length,o);for(var l=[],p=n;p<o;){var m=c[p],b=null,S=m>239?4:m>223?3:m>191?2:1;if(p+S<=o){var U,T,D,O;switch(S){case 1:m<128&&(b=m);break;case 2:U=c[p+1],(U&192)===128&&(O=(m&31)<<6|U&63,O>127&&(b=O));break;case 3:U=c[p+1],T=c[p+2],(U&192)===128&&(T&192)===128&&(O=(m&15)<<12|(U&63)<<6|T&63,O>2047&&(O<55296||O>57343)&&(b=O));break;case 4:U=c[p+1],T=c[p+2],D=c[p+3],(U&192)===128&&(T&192)===128&&(D&192)===128&&(O=(m&15)<<18|(U&63)<<12|(T&63)<<6|D&63,O>65535&&O<1114112&&(b=O))}}b===null?(b=65533,S=1):b>65535&&(b-=65536,l.push(b>>>10&1023|55296),b=56320|b&1023),l.push(b),p+=S}return Yr(l)}var xt=4096;function Yr(c){var n=c.length;if(n<=xt)return String.fromCharCode.apply(String,c);for(var o="",l=0;l<n;)o+=String.fromCharCode.apply(String,c.slice(l,l+=xt));return o}function Xr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]&127);return l}function Kr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]);return l}function Zr(c,n,o){var l=c.length;(!n||n<0)&&(n=0),(!o||o<0||o>l)&&(o=l);for(var p="",m=n;m<o;++m)p+=on[c[m]];return p}function Qr(c,n,o){for(var l=c.slice(n,o),p="",m=0;m<l.length-1;m+=2)p+=String.fromCharCode(l[m]+l[m+1]*256);return p}s.prototype.slice=function(n,o){var l=this.length;n=~~n,o=o===void 0?l:~~o,n<0?(n+=l,n<0&&(n=0)):n>l&&(n=l),o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),o<n&&(o=n);var p=this.subarray(n,o);return Object.setPrototypeOf(p,s.prototype),p};function k(c,n,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+n>o)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return p},s.prototype.readUintBE=s.prototype.readUIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n+--o],m=1;o>0&&(m*=256);)p+=this[n+--o]*m;return p},s.prototype.readUint8=s.prototype.readUInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]|this[n+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]<<8|this[n+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},s.prototype.readIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return m*=128,p>=m&&(p-=Math.pow(2,8*o)),p},s.prototype.readIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=o,m=1,b=this[n+--p];p>0&&(m*=256);)b+=this[n+--p]*m;return m*=128,b>=m&&(b-=Math.pow(2,8*o)),b},s.prototype.readInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},s.prototype.readInt16LE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n]|this[n+1]<<8;return l&32768?l|4294901760:l},s.prototype.readInt16BE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n+1]|this[n]<<8;return l&32768?l|4294901760:l},s.prototype.readInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},s.prototype.readInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},s.prototype.readFloatLE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!0,23,4)},s.prototype.readFloatBE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!1,23,4)},s.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!0,52,8)},s.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!1,52,8)};function N(c,n,o,l,p,m){if(!s.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>p||n<m)throw new RangeError('"value" argument is out of bounds');if(o+l>c.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=1,S=0;for(this[o]=n&255;++S<l&&(b*=256);)this[o+S]=n/b&255;return o+l},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=l-1,S=1;for(this[o+b]=n&255;--b>=0&&(S*=256);)this[o+b]=n/S&255;return o+l},s.prototype.writeUint8=s.prototype.writeUInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,255,0),this[o]=n&255,o+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},s.prototype.writeIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=0,S=1,U=0;for(this[o]=n&255;++b<l&&(S*=256);)n<0&&U===0&&this[o+b-1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=l-1,S=1,U=0;for(this[o+b]=n&255;--b>=0&&(S*=256);)n<0&&U===0&&this[o+b+1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},s.prototype.writeInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},s.prototype.writeInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function At(c,n,o,l,p,m){if(o+l>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Bt(c,n,o,l,p){return n=+n,o=o>>>0,p||At(c,n,o,4),t.write(c,n,o,l,23,4),o+4}s.prototype.writeFloatLE=function(n,o,l){return Bt(this,n,o,!0,l)},s.prototype.writeFloatBE=function(n,o,l){return Bt(this,n,o,!1,l)};function St(c,n,o,l,p){return n=+n,o=o>>>0,p||At(c,n,o,8),t.write(c,n,o,l,52,8),o+8}s.prototype.writeDoubleLE=function(n,o,l){return St(this,n,o,!0,l)},s.prototype.writeDoubleBE=function(n,o,l){return St(this,n,o,!1,l)},s.prototype.copy=function(n,o,l,p){if(!s.isBuffer(n))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),o>=n.length&&(o=n.length),o||(o=0),p>0&&p<l&&(p=l),p===l||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),n.length-o<p-l&&(p=n.length-o+l);var m=p-l;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,l,p):Uint8Array.prototype.set.call(n,this.subarray(l,p),o),m},s.prototype.fill=function(n,o,l,p){if(typeof n=="string"){if(typeof o=="string"?(p=o,o=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(n.length===1){var m=n.charCodeAt(0);(p==="utf8"&&m<128||p==="latin1")&&(n=m)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<l)throw new RangeError("Out of range index");if(l<=o)return this;o=o>>>0,l=l===void 0?this.length:l>>>0,n||(n=0);var b;if(typeof n=="number")for(b=o;b<l;++b)this[b]=n;else{var S=s.isBuffer(n)?n:s.from(n,p),U=S.length;if(U===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(b=0;b<l-o;++b)this[b+o]=S[b%U]}return this};var en=/[^+/0-9A-Za-z-_]/g;function tn(c){if(c=c.split("=")[0],c=c.trim().replace(en,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Te(c,n){n=n||1/0;for(var o,l=c.length,p=null,m=[],b=0;b<l;++b){if(o=c.charCodeAt(b),o>55295&&o<57344){if(!p){if(o>56319){(n-=3)>-1&&m.push(239,191,189);continue}else if(b+1===l){(n-=3)>-1&&m.push(239,191,189);continue}p=o;continue}if(o<56320){(n-=3)>-1&&m.push(239,191,189),p=o;continue}o=(p-55296<<10|o-56320)+65536}else p&&(n-=3)>-1&&m.push(239,191,189);if(p=null,o<128){if((n-=1)<0)break;m.push(o)}else if(o<2048){if((n-=2)<0)break;m.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;m.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;m.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return m}function rn(c){for(var n=[],o=0;o<c.length;++o)n.push(c.charCodeAt(o)&255);return n}function nn(c,n){for(var o,l,p,m=[],b=0;b<c.length&&!((n-=2)<0);++b)o=c.charCodeAt(b),l=o>>8,p=o%256,m.push(p),m.push(l);return m}function Ft(c){return e.toByteArray(tn(c))}function be(c,n,o,l){for(var p=0;p<l&&!(p+o>=n.length||p>=c.length);++p)n[p+o]=c[p];return p}function G(c,n){return c instanceof n||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===n.name}function Oe(c){return c!==c}var on=function(){for(var c="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var l=o*16,p=0;p<16;++p)n[l+p]=c[o]+c[p];return n}()})(pt);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(r,e){var t=pt,i=t.Buffer;function a(u,s){for(var h in u)s[h]=u[h]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(a(t,e),e.Buffer=f);function f(u,s,h){return i(u,s,h)}f.prototype=Object.create(i.prototype),a(i,f),f.from=function(u,s,h){if(typeof u=="number")throw new TypeError("Argument must not be a number");return i(u,s,h)},f.alloc=function(u,s,h){if(typeof u!="number")throw new TypeError("Argument must be a number");var d=i(u);return s!==void 0?typeof h=="string"?d.fill(s,h):d.fill(s):d.fill(0),d},f.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return i(u)},f.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(u)}})(ct,ct.exports);var dt=ct.exports,oi={}.toString,ai=Array.isArray||function(r){return oi.call(r)=="[object Array]"},pe=TypeError,vr=Object,si=Error,fi=EvalError,ci=RangeError,ui=ReferenceError,Er=SyntaxError,li=URIError,hi=Math.abs,pi=Math.floor,yi=Math.max,di=Math.min,gi=Math.pow,mi=Math.round,wi=Number.isNaN||function(e){return e!==e},bi=wi,vi=function(e){return bi(e)||e===0?e:e<0?-1:1},Ei=Object.getOwnPropertyDescriptor,Ee=Ei;if(Ee)try{Ee([],"length")}catch{Ee=null}var ye=Ee,xe=Object.defineProperty||!1;if(xe)try{xe({},"a",{value:1})}catch{xe=!1}var Ue=xe,je,Rt;function xr(){return Rt||(Rt=1,je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(var f in 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 u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0}),je}var Ce,jt;function xi(){if(jt)return Ce;jt=1;var r=typeof Symbol<"u"&&Symbol,e=xr();return Ce=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Ce}var De,Ct;function Ar(){return Ct||(Ct=1,De=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),De}var Ne,Dt;function Br(){if(Dt)return Ne;Dt=1;var r=vr;return Ne=r.getPrototypeOf||null,Ne}var Ai="Function.prototype.bind called on incompatible ",Bi=Object.prototype.toString,Si=Math.max,Fi="[object Function]",Nt=function(e,t){for(var i=[],a=0;a<e.length;a+=1)i[a]=e[a];for(var f=0;f<t.length;f+=1)i[f+e.length]=t[f];return i},Ii=function(e,t){for(var i=[],a=t,f=0;a<e.length;a+=1,f+=1)i[f]=e[a];return i},_i=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},Ui=function(e){var t=this;if(typeof t!="function"||Bi.apply(t)!==Fi)throw new TypeError(Ai+t);for(var i=Ii(arguments,1),a,f=function(){if(this instanceof a){var y=t.apply(this,Nt(i,arguments));return Object(y)===y?y:this}return t.apply(e,Nt(i,arguments))},u=Si(0,t.length-i.length),s=[],h=0;h<u;h++)s[h]="$"+h;if(a=Function("binder","return function ("+_i(s,",")+"){ return binder.apply(this,arguments); }")(f),t.prototype){var d=function(){};d.prototype=t.prototype,a.prototype=new d,d.prototype=null}return a},Pi=Ui,de=Function.prototype.bind||Pi,gt=Function.prototype.call,Me,Mt;function mt(){return Mt||(Mt=1,Me=Function.prototype.apply),Me}var $i=typeof Reflect<"u"&&Reflect&&Reflect.apply,Ti=de,Oi=mt(),ki=gt,Ri=$i,Sr=Ri||Ti.call(ki,Oi),ji=de,Ci=pe,Di=gt,Ni=Sr,wt=function(e){if(e.length<1||typeof e[0]!="function")throw new Ci("a function is required");return Ni(ji,Di,e)},Le,Lt;function Mi(){if(Lt)return Le;Lt=1;var r=wt,e=ye,t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var i=!!t&&e&&e(Object.prototype,"__proto__"),a=Object,f=a.getPrototypeOf;return Le=i&&typeof i.get=="function"?r([i.get]):typeof f=="function"?function(s){return f(s==null?s:a(s))}:!1,Le}var qe,qt;function Fr(){if(qt)return qe;qt=1;var r=Ar(),e=Br(),t=Mi();return qe=r?function(a){return r(a)}:e?function(a){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("getProto: not an object");return e(a)}:t?function(a){return t(a)}:null,qe}var Ge,Gt;function Li(){if(Gt)return Ge;Gt=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=de;return Ge=t.call(r,e),Ge}var A,qi=vr,Gi=si,Hi=fi,zi=ci,Wi=ui,re=Er,ee=pe,Vi=li,Ji=hi,Yi=pi,Xi=yi,Ki=di,Zi=gi,Qi=mi,eo=vi,Ir=Function,He=function(r){try{return Ir('"use strict"; return ('+r+").constructor;")()}catch{}},fe=ye,to=Ue,ze=function(){throw new ee},ro=fe?function(){try{return arguments.callee,ze}catch{try{return fe(arguments,"callee").get}catch{return ze}}}():ze,Z=xi()(),R=Fr(),no=Br(),io=Ar(),_r=mt(),ge=gt,Q={},oo=typeof Uint8Array>"u"||!R?A:R(Uint8Array),Y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?A:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?A:ArrayBuffer,"%ArrayIteratorPrototype%":Z&&R?R([][Symbol.iterator]()):A,"%AsyncFromSyncIteratorPrototype%":A,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?A:Atomics,"%BigInt%":typeof BigInt>"u"?A:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?A:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?A:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?A:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Gi,"%eval%":eval,"%EvalError%":Hi,"%Float16Array%":typeof Float16Array>"u"?A:Float16Array,"%Float32Array%":typeof Float32Array>"u"?A:Float32Array,"%Float64Array%":typeof Float64Array>"u"?A:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?A:FinalizationRegistry,"%Function%":Ir,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?A:Int8Array,"%Int16Array%":typeof Int16Array>"u"?A:Int16Array,"%Int32Array%":typeof Int32Array>"u"?A:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z&&R?R(R([][Symbol.iterator]())):A,"%JSON%":typeof JSON=="object"?JSON:A,"%Map%":typeof Map>"u"?A:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Z||!R?A:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":qi,"%Object.getOwnPropertyDescriptor%":fe,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?A:Promise,"%Proxy%":typeof Proxy>"u"?A:Proxy,"%RangeError%":zi,"%ReferenceError%":Wi,"%Reflect%":typeof Reflect>"u"?A:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?A:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Z||!R?A:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?A:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z&&R?R(""[Symbol.iterator]()):A,"%Symbol%":Z?Symbol:A,"%SyntaxError%":re,"%ThrowTypeError%":ro,"%TypedArray%":oo,"%TypeError%":ee,"%Uint8Array%":typeof Uint8Array>"u"?A:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?A:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?A:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?A:Uint32Array,"%URIError%":Vi,"%WeakMap%":typeof WeakMap>"u"?A:WeakMap,"%WeakRef%":typeof WeakRef>"u"?A:WeakRef,"%WeakSet%":typeof WeakSet>"u"?A:WeakSet,"%Function.prototype.call%":ge,"%Function.prototype.apply%":_r,"%Object.defineProperty%":to,"%Object.getPrototypeOf%":no,"%Math.abs%":Ji,"%Math.floor%":Yi,"%Math.max%":Xi,"%Math.min%":Ki,"%Math.pow%":Zi,"%Math.round%":Qi,"%Math.sign%":eo,"%Reflect.getPrototypeOf%":io};if(R)try{null.error}catch(r){var ao=R(R(r));Y["%Error.prototype%"]=ao}var so=function r(e){var t;if(e==="%AsyncFunction%")t=He("async function () {}");else if(e==="%GeneratorFunction%")t=He("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=He("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&R&&(t=R(a.prototype))}return Y[e]=t,t},Ht={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},me=de,Be=Li(),fo=me.call(ge,Array.prototype.concat),co=me.call(_r,Array.prototype.splice),zt=me.call(ge,String.prototype.replace),Se=me.call(ge,String.prototype.slice),uo=me.call(ge,RegExp.prototype.exec),lo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ho=/\\(\\)?/g,po=function(e){var t=Se(e,0,1),i=Se(e,-1);if(t==="%"&&i!=="%")throw new re("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new re("invalid intrinsic syntax, expected opening `%`");var a=[];return zt(e,lo,function(f,u,s,h){a[a.length]=s?zt(h,ho,"$1"):u||f}),a},yo=function(e,t){var i=e,a;if(Be(Ht,i)&&(a=Ht[i],i="%"+a[0]+"%"),Be(Y,i)){var f=Y[i];if(f===Q&&(f=so(i)),typeof f>"u"&&!t)throw new ee("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:f}}throw new re("intrinsic "+e+" does not exist!")},Ur=function(e,t){if(typeof e!="string"||e.length===0)throw new ee("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ee('"allowMissing" argument must be a boolean');if(uo(/^%?[^%]*%?$/,e)===null)throw new re("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=po(e),a=i.length>0?i[0]:"",f=yo("%"+a+"%",t),u=f.name,s=f.value,h=!1,d=f.alias;d&&(a=d[0],co(i,fo([0,1],d)));for(var y=1,g=!0;y<i.length;y+=1){var w=i[y],v=Se(w,0,1),_=Se(w,-1);if((v==='"'||v==="'"||v==="`"||_==='"'||_==="'"||_==="`")&&v!==_)throw new re("property names with quotes must have matching quotes");if((w==="constructor"||!g)&&(h=!0),a+="."+w,u="%"+a+"%",Be(Y,u))s=Y[u];else if(s!=null){if(!(w in s)){if(!t)throw new ee("base intrinsic for "+e+" exists, but the property is not available.");return}if(fe&&y+1>=i.length){var P=fe(s,w);g=!!P,g&&"get"in P&&!("originalValue"in P.get)?s=P.get:s=s[w]}else g=Be(s,w),s=s[w];g&&!h&&(Y[u]=s)}}return s},Pr=Ur,$r=wt,go=$r([Pr("%String.prototype.indexOf%")]),Tr=function(e,t){var i=Pr(e,!!t);return typeof i=="function"&&go(e,".prototype.")>-1?$r([i]):i},We,Wt;function mo(){if(Wt)return We;Wt=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,i;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw i}}),i={},e(function(){throw 42},null,t)}catch(I){I!==i&&(e=null)}else e=null;var a=/^\s*class\b/,f=function(E){try{var $=r.call(E);return a.test($)}catch{return!1}},u=function(E){try{return f(E)?!1:(r.call(E),!0)}catch{return!1}},s=Object.prototype.toString,h="[object Object]",d="[object Function]",y="[object GeneratorFunction]",g="[object HTMLAllCollection]",w="[object HTML document.all class]",v="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var $=s.call(E);return($===g||$===w||$===v||$===h)&&E("")==null}catch{}return!1})}return We=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,t)}catch($){if($!==i)return!1}return!f(E)&&u(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(_)return u(E);if(f(E))return!1;var $=s.call(E);return $!==d&&$!==y&&!/^\[object HTML/.test($)?!1:u(E)},We}var Ve,Vt;function wo(){if(Vt)return Ve;Vt=1;var r=mo(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,i=function(h,d,y){for(var g=0,w=h.length;g<w;g++)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))},a=function(h,d,y){for(var g=0,w=h.length;g<w;g++)y==null?d(h.charAt(g),g,h):d.call(y,h.charAt(g),g,h)},f=function(h,d,y){for(var g in h)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))};function u(s){return e.call(s)==="[object Array]"}return Ve=function(h,d,y){if(!r(d))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=y),u(h)?i(h,d,g):typeof h=="string"?a(h,d,g):f(h,d,g)},Ve}var Je,Jt;function bo(){return Jt||(Jt=1,Je=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Je}var Ye,Yt;function vo(){if(Yt)return Ye;Yt=1;var r=bo(),e=typeof globalThis>"u"?wr:globalThis;return Ye=function(){for(var i=[],a=0;a<r.length;a++)typeof e[r[a]]=="function"&&(i[i.length]=r[a]);return i},Ye}var Xe={exports:{}},Ke,Xt;function Eo(){if(Xt)return Ke;Xt=1;var r=Ue,e=Er,t=pe,i=ye;return Ke=function(f,u,s){if(!f||typeof f!="object"&&typeof f!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,w=!!i&&i(f,u);if(r)r(f,u,{configurable:y===null&&w?w.configurable:!y,enumerable:h===null&&w?w.enumerable:!h,value:s,writable:d===null&&w?w.writable:!d});else if(g||!h&&!d&&!y)f[u]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ke}var Ze,Kt;function xo(){if(Kt)return Ze;Kt=1;var r=Ue,e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Ze=e,Ze}var Qe,Zt;function Ao(){if(Zt)return Qe;Zt=1;var r=Ur,e=Eo(),t=xo()(),i=ye,a=pe,f=r("%Math.floor%");return Qe=function(s,h){if(typeof s!="function")throw new a("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||f(h)!==h)throw new a("`length` must be a positive 32-bit integer");var d=arguments.length>2&&!!arguments[2],y=!0,g=!0;if("length"in s&&i){var w=i(s,"length");w&&!w.configurable&&(y=!1),w&&!w.writable&&(g=!1)}return(y||g||!d)&&(t?e(s,"length",h,!0,!0):e(s,"length",h)),s},Qe}var et,Qt;function Bo(){if(Qt)return et;Qt=1;var r=de,e=mt(),t=Sr;return et=function(){return t(r,e,arguments)},et}var er;function So(){return er||(er=1,function(r){var e=Ao(),t=Ue,i=wt,a=Bo();r.exports=function(u){var s=i(arguments),h=u.length-(arguments.length-1);return e(s,1+(h>0?h:0),!0)},t?t(r.exports,"apply",{value:a}):r.exports.apply=a}(Xe)),Xe.exports}var tt,tr;function Fo(){if(tr)return tt;tr=1;var r=xr();return tt=function(){return r()&&!!Symbol.toStringTag},tt}var rt,rr;function Io(){if(rr)return rt;rr=1;var r=wo(),e=vo(),t=So(),i=Tr,a=ye,f=Fr(),u=i("Object.prototype.toString"),s=Fo()(),h=typeof globalThis>"u"?wr:globalThis,d=e(),y=i("String.prototype.slice"),g=i("Array.prototype.indexOf",!0)||function(B,x){for(var I=0;I<B.length;I+=1)if(B[I]===x)return I;return-1},w={__proto__:null};s&&a&&f?r(d,function(P){var B=new h[P];if(Symbol.toStringTag in B&&f){var x=f(B),I=a(x,Symbol.toStringTag);if(!I&&x){var E=f(x);I=a(E,Symbol.toStringTag)}w["$"+P]=t(I.get)}}):r(d,function(P){var B=new h[P],x=B.slice||B.set;x&&(w["$"+P]=t(x))});var v=function(B){var x=!1;return r(w,function(I,E){if(!x)try{"$"+I(B)===E&&(x=y(E,1))}catch{}}),x},_=function(B){var x=!1;return r(w,function(I,E){if(!x)try{I(B),x=y(E,1)}catch{}}),x};return rt=function(B){if(!B||typeof B!="object")return!1;if(!s){var x=y(u(B),8,-1);return g(d,x)>-1?x:x!=="Object"?!1:_(B)}return a?v(B):null},rt}var nt,nr;function _o(){if(nr)return nt;nr=1;var r=Io();return nt=function(t){return!!r(t)},nt}var Uo=pe,Po=Tr,$o=Po("TypedArray.prototype.buffer",!0),To=_o(),Oo=$o||function(e){if(!To(e))throw new Uo("Not a Typed Array");return e.buffer},q=dt.Buffer,ko=ai,Ro=Oo,jo=ArrayBuffer.isView||function(e){try{return Ro(e),!0}catch{return!1}},Co=typeof Uint8Array<"u",Or=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Do=Or&&(q.prototype instanceof Uint8Array||q.TYPED_ARRAY_SUPPORT),No=function(e,t){if(q.isBuffer(e))return e.constructor&&!("isBuffer"in e)?q.from(e):e;if(typeof e=="string")return q.from(e,t);if(Or&&jo(e)){if(e.byteLength===0)return q.alloc(0);if(Do){var i=q.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var a=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),f=q.from(a);if(f.length===e.byteLength)return f}if(Co&&e instanceof Uint8Array)return q.from(e);var u=ko(e);if(u)for(var s=0;s<e.length;s+=1){var h=e[s];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(u||q.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return q.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Mo=dt.Buffer,Lo=No;function Pe(r,e){this._block=Mo.alloc(r),this._finalSize=e,this._blockSize=r,this._len=0}Pe.prototype.update=function(r,e){r=Lo(r,e||"utf8");for(var t=this._block,i=this._blockSize,a=r.length,f=this._len,u=0;u<a;){for(var s=f%i,h=Math.min(a-u,i-s),d=0;d<h;d++)t[s+d]=r[u+d];f+=h,u+=h,f%i===0&&this._update(t)}return this._len+=a,this};Pe.prototype.digest=function(r){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var t=this._len*8;if(t<=4294967295)this._block.writeUInt32BE(t,this._blockSize-4);else{var i=(t&4294967295)>>>0,a=(t-i)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var f=this._hash();return r?f.toString(r):f};Pe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var qo=Pe,Go=Xn,kr=qo,Ho=dt.Buffer,zo=[1518500249,1859775393,-1894007588,-899497514],Wo=new Array(80);function we(){this.init(),this._w=Wo,kr.call(this,64,56)}Go(we,kr);we.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Vo(r){return r<<1|r>>>31}function Jo(r){return r<<5|r>>>27}function Yo(r){return r<<30|r>>>2}function Xo(r,e,t,i){return r===0?e&t|~e&i:r===2?e&t|e&i|t&i:e^t^i}we.prototype._update=function(r){for(var e=this._w,t=this._a|0,i=this._b|0,a=this._c|0,f=this._d|0,u=this._e|0,s=0;s<16;++s)e[s]=r.readInt32BE(s*4);for(;s<80;++s)e[s]=Vo(e[s-3]^e[s-8]^e[s-14]^e[s-16]);for(var h=0;h<80;++h){var d=~~(h/20),y=Jo(t)+Xo(d,i,a,f)+u+e[h]+zo[d]|0;u=f,f=a,a=Yo(i),i=t,t=y}this._a=t+this._a|0,this._b=i+this._b|0,this._c=a+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0};we.prototype._hash=function(){var r=Ho.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var Ko=we;const Zo=Yn(Ko);function Qo(r){let e="";for(const t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}let it=null;async function Fe(r){return it===null&&(it=await ta()),it?Rr(r):ea(r)}function ea(r){return new Zo().update(r).digest("hex")}async function Rr(r){const e=await crypto.subtle.digest("SHA-1",r);return Qo(e)}async function ta(){try{if(await Rr(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function ra(r){const e=[];let t=0,i=0;do{t=r.readUInt8();const a=t&127;e.push(a),i=t&128}while(i);return e.reduce((a,f)=>a+1<<7|f,-1)}function na(r,e){let t=e,i=4,a=null;do a=r.readUInt8(),t|=(a&127)<<i,i+=7;while(a&128);return t}class ne{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:t}){const i=new z(e);if(i.slice(4).toString("hex")!=="ff744f63")return;const f=i.readUInt32BE();if(f!==2)throw new F(`Unable to read version ${f} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new F("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);const u=i.readUInt32BE(),s=[];for(let y=0;y<u;y++){const g=i.slice(20).toString("hex");s[y]=g}i.seek(i.tell()+4*u);const h=new Map;for(let y=0;y<u;y++)h.set(s[y],i.readUInt32BE());const d=i.slice(20).toString("hex");return new ne({hashes:s,crcs:{},offsets:h,packfileSha:d,getExternalRefDelta:t})}static async fromPack({pack:e,getExternalRefDelta:t,onProgress:i}){const a={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},f={},u=e.slice(-20).toString("hex"),s=[],h={},d=new Map;let y=null,g=null;await Wn([e],async({data:B,type:x,reference:I,offset:E,num:$})=>{y===null&&(y=$);const C=Math.floor((y-$)*100/y);C!==g&&i&&await i({phase:"Receiving objects",loaded:y-$,total:y}),g=C,x=a[x],["commit","tree","blob","tag"].includes(x)?f[E]={type:x,offset:E}:x==="ofs-delta"?f[E]={type:x,offset:E}:x==="ref-delta"&&(f[E]={type:x,offset:E})});const w=Object.keys(f).map(Number);for(const[B,x]of w.entries()){const I=B+1===w.length?e.byteLength-20:w[B+1],E=f[x],$=pn.buf(e.slice(x,I))>>>0;E.end=I,E.crc=$}const v=new ne({pack:Promise.resolve(e),packfileSha:u,crcs:h,hashes:s,offsets:d,getExternalRefDelta:t});g=null;let _=0;const P=[0,0,0,0,0,0,0,0,0,0,0,0];for(let B in f){B=Number(B);const x=Math.floor(_*100/y);x!==g&&i&&await i({phase:"Resolving deltas",loaded:_,total:y}),_++,g=x;const I=f[B];if(!I.oid)try{v.readDepth=0,v.externalReadDepth=0;const{type:E,object:$}=await v.readSlice({start:B});P[v.readDepth]+=1;const C=await Fe(Hn.wrap({type:E,object:$}));I.oid=C,s.push(C),d.set(C,B),h[C]=I.crc}catch{continue}}return s.sort(),v}async toBuffer(){const e=[],t=(d,y)=>{e.push(Buffer.from(d,y))};t("ff744f63","hex"),t("00000002","hex");const i=new z(Buffer.alloc(256*4));for(let d=0;d<256;d++){let y=0;for(const g of this.hashes)parseInt(g.slice(0,2),16)<=d&&y++;i.writeUInt32BE(y)}e.push(i.buffer);for(const d of this.hashes)t(d,"hex");const a=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)a.writeUInt32BE(this.crcs[d]);e.push(a.buffer);const f=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)f.writeUInt32BE(this.offsets.get(d));e.push(f.buffer),t(this.packfileSha,"hex");const u=Buffer.concat(e),s=await Fe(u),h=Buffer.alloc(20);return h.write(s,"hex"),Buffer.concat([u,h])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new F(`Could not read object ${e} from packfile`)}const t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;const t={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new F("Tried to read from a GitPackIndex with no packfile loaded into memory");const i=(await this.pack).slice(e),a=new z(i),f=a.readUInt8(),u=f&112;let s=t[u];if(s===void 0)throw new F("Unrecognized type: 0b"+u.toString(2));const h=f&15;let d=h;f&128&&(d=na(a,h));let g=null,w=null;if(s==="ofs_delta"){const _=ra(a),P=e-_;({object:g,type:s}=await this.readSlice({start:P}))}if(s==="ref_delta"){const _=a.slice(20).toString("hex");({object:g,type:s}=await this.read({oid:_}))}const v=i.slice(a.tell());if(w=Buffer.from(await Jn(v)),w.byteLength!==d)throw new F(`Packfile told us object would have length ${d} but it had length ${w.byteLength}`);return g&&(w=Buffer.from(zn(w,g))),this.readDepth>3&&(this.offsetCache[e]={type:s,object:w}),{type:s,format:"content",object:w}}}class ce extends ie{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=ce.code,this.data={value:e}}}ce.code="InvalidOidError";class $e extends ie{constructor(e,t,i,a){super(`Object ${e} ${a?`at ${a}`:""}was anticipated to be a ${i} but it is a ${t}.`),this.code=this.name=$e.code,this.data={oid:e,actual:t,expected:i,filepath:a}}}$e.code="ObjectTypeError";function ia(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}const H=2**32;function ir(r,e,t,i){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=i.valueOf());const a=Math.floor(t/1e3),f=(t-a*1e3)*1e6;return[a,f]}function or(r){const[e,t]=ir(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[i,a]=ir(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%H,ctimeNanoseconds:t%H,mtimeSeconds:i%H,mtimeNanoseconds:a%H,dev:r.dev%H,ino:r.ino%H,mode:ia(r.mode%H),uid:r.uid%H,gid:r.gid%H,size:r.size>-1?r.size%H:0}}function oa(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095}}function aa(r){const e=r.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}class J{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return J.fromBuffer(e);if(e===null)return new J(null);throw new F("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new F("Index file is empty (.git/index)");const t=new J,i=new z(e),a=i.toString("utf8",4);if(a!=="DIRC")throw new F(`Invalid dircache magic file number: ${a}`);const f=await Fe(e.slice(0,-20)),u=e.slice(-20).toString("hex");if(u!==f)throw new F(`Invalid checksum in GitIndex buffer: expected ${u} but saw ${f}`);const s=i.readUInt32BE();if(s!==2)throw new F(`Unsupported dircache version: ${s}`);const h=i.readUInt32BE();let d=0;for(;!i.eof()&&d<h;){const y={};y.ctimeSeconds=i.readUInt32BE(),y.ctimeNanoseconds=i.readUInt32BE(),y.mtimeSeconds=i.readUInt32BE(),y.mtimeNanoseconds=i.readUInt32BE(),y.dev=i.readUInt32BE(),y.ino=i.readUInt32BE(),y.mode=i.readUInt32BE(),y.uid=i.readUInt32BE(),y.gid=i.readUInt32BE(),y.size=i.readUInt32BE(),y.oid=i.slice(20).toString("hex");const g=i.readUInt16BE();y.flags=oa(g);const w=e.indexOf(0,i.tell()+1)-i.tell();if(w<1)throw new F(`Got a path length of: ${w}`);if(y.path=i.toString("utf8",w),y.path.includes("..\\")||y.path.includes("../"))throw new he(y.path);let v=8-(i.tell()-12)%8;for(v===0&&(v=8);v--;){const _=i.readUInt8();if(_!==0)throw new F(`Expected 1-8 null characters but got '${_}' after ${y.path}`);if(i.eof())throw new F("Unexpected end of file")}y.stages=[],t._addEntry(y),d++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(gr)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(const e of this.entries)yield e}insert({filepath:e,stats:t,oid:i,stage:a=0}){t||(t={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),t=or(t);const f=Buffer.from(e),u={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:a,nameLength:f.length<4095?f.length:4095},stages:[]};this._addEntry(u),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(const t of this._entries.keys())t.startsWith(e+"/")&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
50
- `)}static async _entryToBuffer(e){const t=Buffer.from(e.path),i=Math.ceil((62+t.length+1)/8)*8,a=Buffer.alloc(i),f=new z(a),u=or(e);return f.writeUInt32BE(u.ctimeSeconds),f.writeUInt32BE(u.ctimeNanoseconds),f.writeUInt32BE(u.mtimeSeconds),f.writeUInt32BE(u.mtimeNanoseconds),f.writeUInt32BE(u.dev),f.writeUInt32BE(u.ino),f.writeUInt32BE(u.mode),f.writeUInt32BE(u.uid),f.writeUInt32BE(u.gid),f.writeUInt32BE(u.size),f.write(e.oid,20,"hex"),f.writeUInt16BE(aa(e)),f.write(e.path,t.length,"utf8"),a}async toObject(){const e=Buffer.alloc(12),t=new z(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(2),t.writeUInt32BE(this.entriesFlat.length);let i=[];for(const s of this.entries)if(i.push(J._entryToBuffer(s)),s.stages.length>1)for(const h of s.stages)h&&h!==s&&i.push(J._entryToBuffer(h));i=await Promise.all(i);const a=Buffer.concat(i),f=Buffer.concat([e,a]),u=await Fe(f);return Buffer.concat([f,Buffer.from(u,"hex")])}}async function jr(r,e){const t=pr(r);for(;;){const{value:i,done:a}=await t.next();if(i&&await e(i),a)break}t.return&&t.return()}async function ue(r){let e=0;const t=[];await jr(r,f=>{t.push(f),e+=f.byteLength});const i=new Uint8Array(e);let a=0;for(const f of t)i.set(f,a),a+=f.byteLength;return i}class ot{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){const t=this._waiting;this._waiting=null,t({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){const e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}}class sa{static demux(e){const t=j.streamReader(e),i=new ot,a=new ot,f=new ot,u=async function(){const s=await t();if(s===null)return u();if(s===!0){i.end(),f.end(),e.error?a.destroy(e.error):a.end();return}switch(s[0]){case 1:{a.write(s.slice(1));break}case 2:{f.write(s.slice(1));break}case 3:{const h=s.slice(1);f.write(h),i.end(),f.end(),a.destroy(new Error(h.toString("utf8")));return}default:i.write(s)}u()};return u(),{packetlines:i,packfile:a,progress:f}}}async function Cr(r){const{packetlines:e,packfile:t,progress:i}=sa.demux(r),a=[],f=[],u=[];let s=!1,h=!1;return new Promise((d,y)=>{jr(e,g=>{const w=g.toString("utf8").trim();if(w.startsWith("shallow")){const v=w.slice(-41).trim();v.length!==40&&y(new ce(v)),a.push(v)}else if(w.startsWith("unshallow")){const v=w.slice(-41).trim();v.length!==40&&y(new ce(v)),f.push(v)}else if(w.startsWith("ACK")){const[,v,_]=w.split(" ");u.push({oid:v,status:_}),_||(h=!0)}else w.startsWith("NAK")?(s=!0,h=!0):(h=!0,s=!0);h&&(r.error?y(r.error):d({shallows:a,unshallows:f,acks:u,nak:s,packfile:t,progress:i}))}).finally(()=>{h||(r.error?y(r.error):d({shallows:a,unshallows:f,acks:u,nak:s,packfile:t,progress:i}))})})}typeof globalThis.Buffer>"u"&&(globalThis.Buffer=pt.Buffer);async function fa(r,e,t,i){const a=await Mr(r,e),f=await ya(a.idx,e,t),u=t.map(w=>f[w].oid),s=u.length>0?await da(r,u):null,h={};if(await Promise.all(t.map(async w=>{s&&(h[w]=await Lr(s.idx,f[w].oid))})),!(i!=null&&i.withObjects))return{files:h};const d=[],y=await a.idx.toBuffer();if(d.push({name:`pack-${a.idx.packfileSha}`,pack:a.packfile,index:le(y),promisor:a.promisor}),s){const w=await s.idx.toBuffer();d.push({name:`pack-${s.idx.packfileSha}`,pack:s.packfile,index:le(w),promisor:s.promisor})}const g={};for(const w of t)g[w]=f[w].oid;return{files:h,packfiles:d,objects:[...await ar(a),...await ar(s)],fileOids:g}}const ca=/^[0-9a-f]{40}$/i;async function ua(r,e){const t=await Mr(r,e),i=await pa(t.idx,e);return i!=null&&i.object?Dr(i):[]}async function la(r,e){const t=await ha(r,e);if(t.resolvedOid)return t.resolvedOid;const i=await ut(r,t.refname);if(!i)throw new Error(`Git ref "${t.refname}" not found at ${r}`);return i}function Dr(r){return r.object.map(e=>{if(e.type==="blob")return{name:e.path,type:"file"};if(e.type==="tree"&&e.object)return{name:e.path,type:"folder",children:Dr(e)}}).filter(e=>!!(e!=null&&e.name))}async function Nr(r,e){const t=Buffer.from(await ue([j.encode(`command=ls-refs
49
+ */(function(r){var e=_e,t=pt,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=s,r.SlowBuffer=F,r.INSPECT_MAX_BYTES=50;var a=2147483647;r.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=f(),!s.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 f(){try{var c=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(c,n),c.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function u(c){if(c>a)throw new RangeError('The value "'+c+'" is invalid for option "size"');var n=new Uint8Array(c);return Object.setPrototypeOf(n,s.prototype),n}function s(c,n,o){if(typeof c=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(c)}return h(c,n,o)}s.poolSize=8192;function h(c,n,o){if(typeof c=="string")return w(c,n);if(ArrayBuffer.isView(c))return _(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(q(c,ArrayBuffer)||c&&q(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(q(c,SharedArrayBuffer)||c&&q(c.buffer,SharedArrayBuffer)))return P(c,n,o);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return s.from(l,n,o);var p=B(c);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return s.from(c[Symbol.toPrimitive]("string"),n,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c)}s.from=function(c,n,o){return h(c,n,o)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function d(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function y(c,n,o){return d(c),c<=0?u(c):n!==void 0?typeof o=="string"?u(c).fill(n,o):u(c).fill(n):u(c)}s.alloc=function(c,n,o){return y(c,n,o)};function g(c){return d(c),u(c<0?0:x(c)|0)}s.allocUnsafe=function(c){return g(c)},s.allocUnsafeSlow=function(c){return g(c)};function w(c,n){if((typeof n!="string"||n==="")&&(n="utf8"),!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o=E(c,n)|0,l=u(o),p=l.write(c,n);return p!==o&&(l=l.slice(0,p)),l}function v(c){for(var n=c.length<0?0:x(c.length)|0,o=u(n),l=0;l<n;l+=1)o[l]=c[l]&255;return o}function _(c){if(q(c,Uint8Array)){var n=new Uint8Array(c);return P(n.buffer,n.byteOffset,n.byteLength)}return v(c)}function P(c,n,o){if(n<0||c.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');var l;return n===void 0&&o===void 0?l=new Uint8Array(c):o===void 0?l=new Uint8Array(c,n):l=new Uint8Array(c,n,o),Object.setPrototypeOf(l,s.prototype),l}function B(c){if(s.isBuffer(c)){var n=x(c.length)|0,o=u(n);return o.length===0||c.copy(o,0,0,n),o}if(c.length!==void 0)return typeof c.length!="number"||Oe(c.length)?u(0):v(c);if(c.type==="Buffer"&&Array.isArray(c.data))return v(c.data)}function x(c){if(c>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return c|0}function F(c){return+c!=c&&(c=0),s.alloc(+c)}s.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==s.prototype},s.compare=function(n,o){if(q(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),q(o,Uint8Array)&&(o=s.from(o,o.offset,o.byteLength)),!s.isBuffer(n)||!s.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;for(var l=n.length,p=o.length,m=0,b=Math.min(l,p);m<b;++m)if(n[m]!==o[m]){l=n[m],p=o[m];break}return l<p?-1:p<l?1:0},s.isEncoding=function(n){switch(String(n).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}},s.concat=function(n,o){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return s.alloc(0);var l;if(o===void 0)for(o=0,l=0;l<n.length;++l)o+=n[l].length;var p=s.allocUnsafe(o),m=0;for(l=0;l<n.length;++l){var b=n[l];if(q(b,Uint8Array))m+b.length>p.length?s.from(b).copy(p,m):Uint8Array.prototype.set.call(p,b,m);else if(s.isBuffer(b))b.copy(p,m);else throw new TypeError('"list" argument must be an Array of Buffers');m+=b.length}return p};function E(c,n){if(s.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||q(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);var o=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&o===0)return 0;for(var p=!1;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return Te(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return St(c).length;default:if(p)return l?-1:Te(c).length;n=(""+n).toLowerCase(),p=!0}}s.byteLength=E;function $(c,n,o){var l=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(c||(c="utf8");;)switch(c){case"hex":return Xr(this,n,o);case"utf8":case"utf-8":return vt(this,n,o);case"ascii":return Jr(this,n,o);case"latin1":case"binary":return Yr(this,n,o);case"base64":return Wr(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kr(this,n,o);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}s.prototype._isBuffer=!0;function C(c,n,o){var l=c[n];c[n]=c[o],c[o]=l}s.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var o=0;o<n;o+=2)C(this,o,o+1);return this},s.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var o=0;o<n;o+=4)C(this,o,o+3),C(this,o+1,o+2);return this},s.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var o=0;o<n;o+=8)C(this,o,o+7),C(this,o+1,o+6),C(this,o+2,o+5),C(this,o+3,o+4);return this},s.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?vt(this,0,n):$.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(n){if(!s.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:s.compare(this,n)===0},s.prototype.inspect=function(){var n="",o=r.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(n,o,l,p,m){if(q(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(o===void 0&&(o=0),l===void 0&&(l=n?n.length:0),p===void 0&&(p=0),m===void 0&&(m=this.length),o<0||l>n.length||p<0||m>this.length)throw new RangeError("out of range index");if(p>=m&&o>=l)return 0;if(p>=m)return-1;if(o>=l)return 1;if(o>>>=0,l>>>=0,p>>>=0,m>>>=0,this===n)return 0;for(var b=m-p,S=l-o,U=Math.min(b,S),T=this.slice(p,m),D=n.slice(o,l),O=0;O<U;++O)if(T[O]!==D[O]){b=T[O],S=D[O];break}return b<S?-1:S<b?1:0};function wt(c,n,o,l,p){if(c.length===0)return-1;if(typeof o=="string"?(l=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Oe(o)&&(o=p?0:c.length-1),o<0&&(o=c.length+o),o>=c.length){if(p)return-1;o=c.length-1}else if(o<0)if(p)o=0;else return-1;if(typeof n=="string"&&(n=s.from(n,l)),s.isBuffer(n))return n.length===0?-1:bt(c,n,o,l,p);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(c,n,o):Uint8Array.prototype.lastIndexOf.call(c,n,o):bt(c,[n],o,l,p);throw new TypeError("val must be string, number or Buffer")}function bt(c,n,o,l,p){var m=1,b=c.length,S=n.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.length<2||n.length<2)return-1;m=2,b/=2,S/=2,o/=2}function U(It,Ft){return m===1?It[Ft]:It.readUInt16BE(Ft*m)}var T;if(p){var D=-1;for(T=o;T<b;T++)if(U(c,T)===U(n,D===-1?0:T-D)){if(D===-1&&(D=T),T-D+1===S)return D*m}else D!==-1&&(T-=T-D),D=-1}else for(o+S>b&&(o=b-S),T=o;T>=0;T--){for(var O=!0,ve=0;ve<S;ve++)if(U(c,T+ve)!==U(n,ve)){O=!1;break}if(O)return T}return-1}s.prototype.includes=function(n,o,l){return this.indexOf(n,o,l)!==-1},s.prototype.indexOf=function(n,o,l){return wt(this,n,o,l,!0)},s.prototype.lastIndexOf=function(n,o,l){return wt(this,n,o,l,!1)};function Lr(c,n,o,l){o=Number(o)||0;var p=c.length-o;l?(l=Number(l),l>p&&(l=p)):l=p;var m=n.length;l>m/2&&(l=m/2);for(var b=0;b<l;++b){var S=parseInt(n.substr(b*2,2),16);if(Oe(S))return b;c[o+b]=S}return b}function Gr(c,n,o,l){return be(Te(n,c.length-o),c,o,l)}function qr(c,n,o,l){return be(en(n),c,o,l)}function Hr(c,n,o,l){return be(St(n),c,o,l)}function zr(c,n,o,l){return be(tn(n,c.length-o),c,o,l)}s.prototype.write=function(n,o,l,p){if(o===void 0)p="utf8",l=this.length,o=0;else if(l===void 0&&typeof o=="string")p=o,l=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var m=this.length-o;if((l===void 0||l>m)&&(l=m),n.length>0&&(l<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var b=!1;;)switch(p){case"hex":return Lr(this,n,o,l);case"utf8":case"utf-8":return Gr(this,n,o,l);case"ascii":case"latin1":case"binary":return qr(this,n,o,l);case"base64":return Hr(this,n,o,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zr(this,n,o,l);default:if(b)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),b=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Wr(c,n,o){return n===0&&o===c.length?e.fromByteArray(c):e.fromByteArray(c.slice(n,o))}function vt(c,n,o){o=Math.min(c.length,o);for(var l=[],p=n;p<o;){var m=c[p],b=null,S=m>239?4:m>223?3:m>191?2:1;if(p+S<=o){var U,T,D,O;switch(S){case 1:m<128&&(b=m);break;case 2:U=c[p+1],(U&192)===128&&(O=(m&31)<<6|U&63,O>127&&(b=O));break;case 3:U=c[p+1],T=c[p+2],(U&192)===128&&(T&192)===128&&(O=(m&15)<<12|(U&63)<<6|T&63,O>2047&&(O<55296||O>57343)&&(b=O));break;case 4:U=c[p+1],T=c[p+2],D=c[p+3],(U&192)===128&&(T&192)===128&&(D&192)===128&&(O=(m&15)<<18|(U&63)<<12|(T&63)<<6|D&63,O>65535&&O<1114112&&(b=O))}}b===null?(b=65533,S=1):b>65535&&(b-=65536,l.push(b>>>10&1023|55296),b=56320|b&1023),l.push(b),p+=S}return Vr(l)}var Et=4096;function Vr(c){var n=c.length;if(n<=Et)return String.fromCharCode.apply(String,c);for(var o="",l=0;l<n;)o+=String.fromCharCode.apply(String,c.slice(l,l+=Et));return o}function Jr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]&127);return l}function Yr(c,n,o){var l="";o=Math.min(c.length,o);for(var p=n;p<o;++p)l+=String.fromCharCode(c[p]);return l}function Xr(c,n,o){var l=c.length;(!n||n<0)&&(n=0),(!o||o<0||o>l)&&(o=l);for(var p="",m=n;m<o;++m)p+=rn[c[m]];return p}function Kr(c,n,o){for(var l=c.slice(n,o),p="",m=0;m<l.length-1;m+=2)p+=String.fromCharCode(l[m]+l[m+1]*256);return p}s.prototype.slice=function(n,o){var l=this.length;n=~~n,o=o===void 0?l:~~o,n<0?(n+=l,n<0&&(n=0)):n>l&&(n=l),o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),o<n&&(o=n);var p=this.subarray(n,o);return Object.setPrototypeOf(p,s.prototype),p};function k(c,n,o){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+n>o)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return p},s.prototype.readUintBE=s.prototype.readUIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n+--o],m=1;o>0&&(m*=256);)p+=this[n+--o]*m;return p},s.prototype.readUint8=s.prototype.readUInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]|this[n+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||k(n,2,this.length),this[n]<<8|this[n+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},s.prototype.readIntLE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=this[n],m=1,b=0;++b<o&&(m*=256);)p+=this[n+b]*m;return m*=128,p>=m&&(p-=Math.pow(2,8*o)),p},s.prototype.readIntBE=function(n,o,l){n=n>>>0,o=o>>>0,l||k(n,o,this.length);for(var p=o,m=1,b=this[n+--p];p>0&&(m*=256);)b+=this[n+--p]*m;return m*=128,b>=m&&(b-=Math.pow(2,8*o)),b},s.prototype.readInt8=function(n,o){return n=n>>>0,o||k(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},s.prototype.readInt16LE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n]|this[n+1]<<8;return l&32768?l|4294901760:l},s.prototype.readInt16BE=function(n,o){n=n>>>0,o||k(n,2,this.length);var l=this[n+1]|this[n]<<8;return l&32768?l|4294901760:l},s.prototype.readInt32LE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},s.prototype.readInt32BE=function(n,o){return n=n>>>0,o||k(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},s.prototype.readFloatLE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!0,23,4)},s.prototype.readFloatBE=function(n,o){return n=n>>>0,o||k(n,4,this.length),t.read(this,n,!1,23,4)},s.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!0,52,8)},s.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||k(n,8,this.length),t.read(this,n,!1,52,8)};function N(c,n,o,l,p,m){if(!s.isBuffer(c))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>p||n<m)throw new RangeError('"value" argument is out of bounds');if(o+l>c.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=1,S=0;for(this[o]=n&255;++S<l&&(b*=256);)this[o+S]=n/b&255;return o+l},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,l=l>>>0,!p){var m=Math.pow(2,8*l)-1;N(this,n,o,l,m,0)}var b=l-1,S=1;for(this[o+b]=n&255;--b>=0&&(S*=256);)this[o+b]=n/S&255;return o+l},s.prototype.writeUint8=s.prototype.writeUInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,255,0),this[o]=n&255,o+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},s.prototype.writeIntLE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=0,S=1,U=0;for(this[o]=n&255;++b<l&&(S*=256);)n<0&&U===0&&this[o+b-1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeIntBE=function(n,o,l,p){if(n=+n,o=o>>>0,!p){var m=Math.pow(2,8*l-1);N(this,n,o,l,m-1,-m)}var b=l-1,S=1,U=0;for(this[o+b]=n&255;--b>=0&&(S*=256);)n<0&&U===0&&this[o+b+1]!==0&&(U=1),this[o+b]=(n/S>>0)-U&255;return o+l},s.prototype.writeInt8=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},s.prototype.writeInt16LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},s.prototype.writeInt16BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},s.prototype.writeInt32LE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},s.prototype.writeInt32BE=function(n,o,l){return n=+n,o=o>>>0,l||N(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function xt(c,n,o,l,p,m){if(o+l>c.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function At(c,n,o,l,p){return n=+n,o=o>>>0,p||xt(c,n,o,4),t.write(c,n,o,l,23,4),o+4}s.prototype.writeFloatLE=function(n,o,l){return At(this,n,o,!0,l)},s.prototype.writeFloatBE=function(n,o,l){return At(this,n,o,!1,l)};function Bt(c,n,o,l,p){return n=+n,o=o>>>0,p||xt(c,n,o,8),t.write(c,n,o,l,52,8),o+8}s.prototype.writeDoubleLE=function(n,o,l){return Bt(this,n,o,!0,l)},s.prototype.writeDoubleBE=function(n,o,l){return Bt(this,n,o,!1,l)},s.prototype.copy=function(n,o,l,p){if(!s.isBuffer(n))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),o>=n.length&&(o=n.length),o||(o=0),p>0&&p<l&&(p=l),p===l||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),n.length-o<p-l&&(p=n.length-o+l);var m=p-l;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,l,p):Uint8Array.prototype.set.call(n,this.subarray(l,p),o),m},s.prototype.fill=function(n,o,l,p){if(typeof n=="string"){if(typeof o=="string"?(p=o,o=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!s.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(n.length===1){var m=n.charCodeAt(0);(p==="utf8"&&m<128||p==="latin1")&&(n=m)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<l)throw new RangeError("Out of range index");if(l<=o)return this;o=o>>>0,l=l===void 0?this.length:l>>>0,n||(n=0);var b;if(typeof n=="number")for(b=o;b<l;++b)this[b]=n;else{var S=s.isBuffer(n)?n:s.from(n,p),U=S.length;if(U===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(b=0;b<l-o;++b)this[b+o]=S[b%U]}return this};var Zr=/[^+/0-9A-Za-z-_]/g;function Qr(c){if(c=c.split("=")[0],c=c.trim().replace(Zr,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function Te(c,n){n=n||1/0;for(var o,l=c.length,p=null,m=[],b=0;b<l;++b){if(o=c.charCodeAt(b),o>55295&&o<57344){if(!p){if(o>56319){(n-=3)>-1&&m.push(239,191,189);continue}else if(b+1===l){(n-=3)>-1&&m.push(239,191,189);continue}p=o;continue}if(o<56320){(n-=3)>-1&&m.push(239,191,189),p=o;continue}o=(p-55296<<10|o-56320)+65536}else p&&(n-=3)>-1&&m.push(239,191,189);if(p=null,o<128){if((n-=1)<0)break;m.push(o)}else if(o<2048){if((n-=2)<0)break;m.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;m.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;m.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return m}function en(c){for(var n=[],o=0;o<c.length;++o)n.push(c.charCodeAt(o)&255);return n}function tn(c,n){for(var o,l,p,m=[],b=0;b<c.length&&!((n-=2)<0);++b)o=c.charCodeAt(b),l=o>>8,p=o%256,m.push(p),m.push(l);return m}function St(c){return e.toByteArray(Qr(c))}function be(c,n,o,l){for(var p=0;p<l&&!(p+o>=n.length||p>=c.length);++p)n[p+o]=c[p];return p}function q(c,n){return c instanceof n||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===n.name}function Oe(c){return c!==c}var rn=function(){for(var c="0123456789abcdef",n=new Array(256),o=0;o<16;++o)for(var l=o*16,p=0;p<16;++p)n[l+p]=c[o]+c[p];return n}()})(ht);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(r,e){var t=ht,i=t.Buffer;function a(u,s){for(var h in u)s[h]=u[h]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?r.exports=t:(a(t,e),e.Buffer=f);function f(u,s,h){return i(u,s,h)}f.prototype=Object.create(i.prototype),a(i,f),f.from=function(u,s,h){if(typeof u=="number")throw new TypeError("Argument must not be a number");return i(u,s,h)},f.alloc=function(u,s,h){if(typeof u!="number")throw new TypeError("Argument must be a number");var d=i(u);return s!==void 0?typeof h=="string"?d.fill(s,h):d.fill(s):d.fill(0),d},f.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return i(u)},f.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(u)}})(ft,ft.exports);var yt=ft.exports,ni={}.toString,ii=Array.isArray||function(r){return ni.call(r)=="[object Array]"},pe=TypeError,wr=Object,oi=Error,ai=EvalError,si=RangeError,fi=ReferenceError,br=SyntaxError,ci=URIError,ui=Math.abs,li=Math.floor,hi=Math.max,pi=Math.min,yi=Math.pow,di=Math.round,gi=Number.isNaN||function(e){return e!==e},mi=gi,wi=function(e){return mi(e)||e===0?e:e<0?-1:1},bi=Object.getOwnPropertyDescriptor,Ee=bi;if(Ee)try{Ee([],"length")}catch{Ee=null}var ye=Ee,xe=Object.defineProperty||!1;if(xe)try{xe({},"a",{value:1})}catch{xe=!1}var Ue=xe,je,kt;function vr(){return kt||(kt=1,je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(var f in 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 u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0}),je}var Ce,Rt;function vi(){if(Rt)return Ce;Rt=1;var r=typeof Symbol<"u"&&Symbol,e=vr();return Ce=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Ce}var De,jt;function Er(){return jt||(jt=1,De=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),De}var Ne,Ct;function xr(){if(Ct)return Ne;Ct=1;var r=wr;return Ne=r.getPrototypeOf||null,Ne}var Ei="Function.prototype.bind called on incompatible ",xi=Object.prototype.toString,Ai=Math.max,Bi="[object Function]",Dt=function(e,t){for(var i=[],a=0;a<e.length;a+=1)i[a]=e[a];for(var f=0;f<t.length;f+=1)i[f+e.length]=t[f];return i},Si=function(e,t){for(var i=[],a=t,f=0;a<e.length;a+=1,f+=1)i[f]=e[a];return i},Ii=function(r,e){for(var t="",i=0;i<r.length;i+=1)t+=r[i],i+1<r.length&&(t+=e);return t},Fi=function(e){var t=this;if(typeof t!="function"||xi.apply(t)!==Bi)throw new TypeError(Ei+t);for(var i=Si(arguments,1),a,f=function(){if(this instanceof a){var y=t.apply(this,Dt(i,arguments));return Object(y)===y?y:this}return t.apply(e,Dt(i,arguments))},u=Ai(0,t.length-i.length),s=[],h=0;h<u;h++)s[h]="$"+h;if(a=Function("binder","return function ("+Ii(s,",")+"){ return binder.apply(this,arguments); }")(f),t.prototype){var d=function(){};d.prototype=t.prototype,a.prototype=new d,d.prototype=null}return a},_i=Fi,de=Function.prototype.bind||_i,dt=Function.prototype.call,gt=Function.prototype.apply,Ui=typeof Reflect<"u"&&Reflect&&Reflect.apply,Pi=de,$i=gt,Ti=dt,Oi=Ui,Ar=Oi||Pi.call(Ti,$i),ki=de,Ri=pe,ji=dt,Ci=Ar,mt=function(e){if(e.length<1||typeof e[0]!="function")throw new Ri("a function is required");return Ci(ki,ji,e)},Me,Nt;function Di(){if(Nt)return Me;Nt=1;var r=mt,e=ye,t;try{t=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var i=!!t&&e&&e(Object.prototype,"__proto__"),a=Object,f=a.getPrototypeOf;return Me=i&&typeof i.get=="function"?r([i.get]):typeof f=="function"?function(s){return f(s==null?s:a(s))}:!1,Me}var Le,Mt;function Br(){if(Mt)return Le;Mt=1;var r=Er(),e=xr(),t=Di();return Le=r?function(a){return r(a)}:e?function(a){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("getProto: not an object");return e(a)}:t?function(a){return t(a)}:null,Le}var Ge,Lt;function Ni(){if(Lt)return Ge;Lt=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=de;return Ge=t.call(r,e),Ge}var A,Mi=wr,Li=oi,Gi=ai,qi=si,Hi=fi,re=br,ee=pe,zi=ci,Wi=ui,Vi=li,Ji=hi,Yi=pi,Xi=yi,Ki=di,Zi=wi,Sr=Function,qe=function(r){try{return Sr('"use strict"; return ('+r+").constructor;")()}catch{}},fe=ye,Qi=Ue,He=function(){throw new ee},eo=fe?function(){try{return arguments.callee,He}catch{try{return fe(arguments,"callee").get}catch{return He}}}():He,Z=vi()(),R=Br(),to=xr(),ro=Er(),Ir=gt,ge=dt,Q={},no=typeof Uint8Array>"u"||!R?A:R(Uint8Array),Y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?A:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?A:ArrayBuffer,"%ArrayIteratorPrototype%":Z&&R?R([][Symbol.iterator]()):A,"%AsyncFromSyncIteratorPrototype%":A,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?A:Atomics,"%BigInt%":typeof BigInt>"u"?A:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?A:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?A:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?A:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Li,"%eval%":eval,"%EvalError%":Gi,"%Float16Array%":typeof Float16Array>"u"?A:Float16Array,"%Float32Array%":typeof Float32Array>"u"?A:Float32Array,"%Float64Array%":typeof Float64Array>"u"?A:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?A:FinalizationRegistry,"%Function%":Sr,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?A:Int8Array,"%Int16Array%":typeof Int16Array>"u"?A:Int16Array,"%Int32Array%":typeof Int32Array>"u"?A:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z&&R?R(R([][Symbol.iterator]())):A,"%JSON%":typeof JSON=="object"?JSON:A,"%Map%":typeof Map>"u"?A:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Z||!R?A:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Mi,"%Object.getOwnPropertyDescriptor%":fe,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?A:Promise,"%Proxy%":typeof Proxy>"u"?A:Proxy,"%RangeError%":qi,"%ReferenceError%":Hi,"%Reflect%":typeof Reflect>"u"?A:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?A:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Z||!R?A:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?A:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z&&R?R(""[Symbol.iterator]()):A,"%Symbol%":Z?Symbol:A,"%SyntaxError%":re,"%ThrowTypeError%":eo,"%TypedArray%":no,"%TypeError%":ee,"%Uint8Array%":typeof Uint8Array>"u"?A:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?A:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?A:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?A:Uint32Array,"%URIError%":zi,"%WeakMap%":typeof WeakMap>"u"?A:WeakMap,"%WeakRef%":typeof WeakRef>"u"?A:WeakRef,"%WeakSet%":typeof WeakSet>"u"?A:WeakSet,"%Function.prototype.call%":ge,"%Function.prototype.apply%":Ir,"%Object.defineProperty%":Qi,"%Object.getPrototypeOf%":to,"%Math.abs%":Wi,"%Math.floor%":Vi,"%Math.max%":Ji,"%Math.min%":Yi,"%Math.pow%":Xi,"%Math.round%":Ki,"%Math.sign%":Zi,"%Reflect.getPrototypeOf%":ro};if(R)try{null.error}catch(r){var io=R(R(r));Y["%Error.prototype%"]=io}var oo=function r(e){var t;if(e==="%AsyncFunction%")t=qe("async function () {}");else if(e==="%GeneratorFunction%")t=qe("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=qe("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&R&&(t=R(a.prototype))}return Y[e]=t,t},Gt={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},me=de,Be=Ni(),ao=me.call(ge,Array.prototype.concat),so=me.call(Ir,Array.prototype.splice),qt=me.call(ge,String.prototype.replace),Se=me.call(ge,String.prototype.slice),fo=me.call(ge,RegExp.prototype.exec),co=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,uo=/\\(\\)?/g,lo=function(e){var t=Se(e,0,1),i=Se(e,-1);if(t==="%"&&i!=="%")throw new re("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new re("invalid intrinsic syntax, expected opening `%`");var a=[];return qt(e,co,function(f,u,s,h){a[a.length]=s?qt(h,uo,"$1"):u||f}),a},ho=function(e,t){var i=e,a;if(Be(Gt,i)&&(a=Gt[i],i="%"+a[0]+"%"),Be(Y,i)){var f=Y[i];if(f===Q&&(f=oo(i)),typeof f>"u"&&!t)throw new ee("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:f}}throw new re("intrinsic "+e+" does not exist!")},Fr=function(e,t){if(typeof e!="string"||e.length===0)throw new ee("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ee('"allowMissing" argument must be a boolean');if(fo(/^%?[^%]*%?$/,e)===null)throw new re("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=lo(e),a=i.length>0?i[0]:"",f=ho("%"+a+"%",t),u=f.name,s=f.value,h=!1,d=f.alias;d&&(a=d[0],so(i,ao([0,1],d)));for(var y=1,g=!0;y<i.length;y+=1){var w=i[y],v=Se(w,0,1),_=Se(w,-1);if((v==='"'||v==="'"||v==="`"||_==='"'||_==="'"||_==="`")&&v!==_)throw new re("property names with quotes must have matching quotes");if((w==="constructor"||!g)&&(h=!0),a+="."+w,u="%"+a+"%",Be(Y,u))s=Y[u];else if(s!=null){if(!(w in s)){if(!t)throw new ee("base intrinsic for "+e+" exists, but the property is not available.");return}if(fe&&y+1>=i.length){var P=fe(s,w);g=!!P,g&&"get"in P&&!("originalValue"in P.get)?s=P.get:s=s[w]}else g=Be(s,w),s=s[w];g&&!h&&(Y[u]=s)}}return s},_r=Fr,Ur=mt,po=Ur([_r("%String.prototype.indexOf%")]),Pr=function(e,t){var i=_r(e,!!t);return typeof i=="function"&&po(e,".prototype.")>-1?Ur([i]):i},ze,Ht;function yo(){if(Ht)return ze;Ht=1;var r=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,i;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw i}}),i={},e(function(){throw 42},null,t)}catch(F){F!==i&&(e=null)}else e=null;var a=/^\s*class\b/,f=function(E){try{var $=r.call(E);return a.test($)}catch{return!1}},u=function(E){try{return f(E)?!1:(r.call(E),!0)}catch{return!1}},s=Object.prototype.toString,h="[object Object]",d="[object Function]",y="[object GeneratorFunction]",g="[object HTMLAllCollection]",w="[object HTML document.all class]",v="[object HTMLCollection]",_=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var x=document.all;s.call(x)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var $=s.call(E);return($===g||$===w||$===v||$===h)&&E("")==null}catch{}return!1})}return ze=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,t)}catch($){if($!==i)return!1}return!f(E)&&u(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(_)return u(E);if(f(E))return!1;var $=s.call(E);return $!==d&&$!==y&&!/^\[object HTML/.test($)?!1:u(E)},ze}var We,zt;function go(){if(zt)return We;zt=1;var r=yo(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,i=function(h,d,y){for(var g=0,w=h.length;g<w;g++)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))},a=function(h,d,y){for(var g=0,w=h.length;g<w;g++)y==null?d(h.charAt(g),g,h):d.call(y,h.charAt(g),g,h)},f=function(h,d,y){for(var g in h)t.call(h,g)&&(y==null?d(h[g],g,h):d.call(y,h[g],g,h))};function u(s){return e.call(s)==="[object Array]"}return We=function(h,d,y){if(!r(d))throw new TypeError("iterator must be a function");var g;arguments.length>=3&&(g=y),u(h)?i(h,d,g):typeof h=="string"?a(h,d,g):f(h,d,g)},We}var Ve,Wt;function mo(){return Wt||(Wt=1,Ve=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ve}var Je,Vt;function wo(){if(Vt)return Je;Vt=1;var r=mo(),e=typeof globalThis>"u"?gr:globalThis;return Je=function(){for(var i=[],a=0;a<r.length;a++)typeof e[r[a]]=="function"&&(i[i.length]=r[a]);return i},Je}var Ye={exports:{}},Xe,Jt;function bo(){if(Jt)return Xe;Jt=1;var r=Ue,e=br,t=pe,i=ye;return Xe=function(f,u,s){if(!f||typeof f!="object"&&typeof f!="function")throw new t("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,g=arguments.length>6?arguments[6]:!1,w=!!i&&i(f,u);if(r)r(f,u,{configurable:y===null&&w?w.configurable:!y,enumerable:h===null&&w?w.enumerable:!h,value:s,writable:d===null&&w?w.writable:!d});else if(g||!h&&!d&&!y)f[u]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Xe}var Ke,Yt;function vo(){if(Yt)return Ke;Yt=1;var r=Ue,e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Ke=e,Ke}var Ze,Xt;function Eo(){if(Xt)return Ze;Xt=1;var r=Fr,e=bo(),t=vo()(),i=ye,a=pe,f=r("%Math.floor%");return Ze=function(s,h){if(typeof s!="function")throw new a("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||f(h)!==h)throw new a("`length` must be a positive 32-bit integer");var d=arguments.length>2&&!!arguments[2],y=!0,g=!0;if("length"in s&&i){var w=i(s,"length");w&&!w.configurable&&(y=!1),w&&!w.writable&&(g=!1)}return(y||g||!d)&&(t?e(s,"length",h,!0,!0):e(s,"length",h)),s},Ze}var Qe,Kt;function xo(){if(Kt)return Qe;Kt=1;var r=de,e=gt,t=Ar;return Qe=function(){return t(r,e,arguments)},Qe}var Zt;function Ao(){return Zt||(Zt=1,function(r){var e=Eo(),t=Ue,i=mt,a=xo();r.exports=function(u){var s=i(arguments),h=u.length-(arguments.length-1);return e(s,1+(h>0?h:0),!0)},t?t(r.exports,"apply",{value:a}):r.exports.apply=a}(Ye)),Ye.exports}var et,Qt;function Bo(){if(Qt)return et;Qt=1;var r=vr();return et=function(){return r()&&!!Symbol.toStringTag},et}var tt,er;function So(){if(er)return tt;er=1;var r=go(),e=wo(),t=Ao(),i=Pr,a=ye,f=Br(),u=i("Object.prototype.toString"),s=Bo()(),h=typeof globalThis>"u"?gr:globalThis,d=e(),y=i("String.prototype.slice"),g=i("Array.prototype.indexOf",!0)||function(B,x){for(var F=0;F<B.length;F+=1)if(B[F]===x)return F;return-1},w={__proto__:null};s&&a&&f?r(d,function(P){var B=new h[P];if(Symbol.toStringTag in B&&f){var x=f(B),F=a(x,Symbol.toStringTag);if(!F&&x){var E=f(x);F=a(E,Symbol.toStringTag)}w["$"+P]=t(F.get)}}):r(d,function(P){var B=new h[P],x=B.slice||B.set;x&&(w["$"+P]=t(x))});var v=function(B){var x=!1;return r(w,function(F,E){if(!x)try{"$"+F(B)===E&&(x=y(E,1))}catch{}}),x},_=function(B){var x=!1;return r(w,function(F,E){if(!x)try{F(B),x=y(E,1)}catch{}}),x};return tt=function(B){if(!B||typeof B!="object")return!1;if(!s){var x=y(u(B),8,-1);return g(d,x)>-1?x:x!=="Object"?!1:_(B)}return a?v(B):null},tt}var rt,tr;function Io(){if(tr)return rt;tr=1;var r=So();return rt=function(t){return!!r(t)},rt}var Fo=pe,_o=Pr,Uo=_o("TypedArray.prototype.buffer",!0),Po=Io(),$o=Uo||function(e){if(!Po(e))throw new Fo("Not a Typed Array");return e.buffer},G=yt.Buffer,To=ii,Oo=$o,ko=ArrayBuffer.isView||function(e){try{return Oo(e),!0}catch{return!1}},Ro=typeof Uint8Array<"u",$r=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",jo=$r&&(G.prototype instanceof Uint8Array||G.TYPED_ARRAY_SUPPORT),Co=function(e,t){if(G.isBuffer(e))return e.constructor&&!("isBuffer"in e)?G.from(e):e;if(typeof e=="string")return G.from(e,t);if($r&&ko(e)){if(e.byteLength===0)return G.alloc(0);if(jo){var i=G.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var a=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),f=G.from(a);if(f.length===e.byteLength)return f}if(Ro&&e instanceof Uint8Array)return G.from(e);var u=To(e);if(u)for(var s=0;s<e.length;s+=1){var h=e[s];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(u||G.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return G.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Do=yt.Buffer,No=Co;function Pe(r,e){this._block=Do.alloc(r),this._finalSize=e,this._blockSize=r,this._len=0}Pe.prototype.update=function(r,e){r=No(r,e||"utf8");for(var t=this._block,i=this._blockSize,a=r.length,f=this._len,u=0;u<a;){for(var s=f%i,h=Math.min(a-u,i-s),d=0;d<h;d++)t[s+d]=r[u+d];f+=h,u+=h,f%i===0&&this._update(t)}return this._len+=a,this};Pe.prototype.digest=function(r){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var t=this._len*8;if(t<=4294967295)this._block.writeUInt32BE(t,this._blockSize-4);else{var i=(t&4294967295)>>>0,a=(t-i)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var f=this._hash();return r?f.toString(r):f};Pe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Mo=Pe,Lo=Jn,Tr=Mo,Go=yt.Buffer,qo=[1518500249,1859775393,-1894007588,-899497514],Ho=new Array(80);function we(){this.init(),this._w=Ho,Tr.call(this,64,56)}Lo(we,Tr);we.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zo(r){return r<<1|r>>>31}function Wo(r){return r<<5|r>>>27}function Vo(r){return r<<30|r>>>2}function Jo(r,e,t,i){return r===0?e&t|~e&i:r===2?e&t|e&i|t&i:e^t^i}we.prototype._update=function(r){for(var e=this._w,t=this._a|0,i=this._b|0,a=this._c|0,f=this._d|0,u=this._e|0,s=0;s<16;++s)e[s]=r.readInt32BE(s*4);for(;s<80;++s)e[s]=zo(e[s-3]^e[s-8]^e[s-14]^e[s-16]);for(var h=0;h<80;++h){var d=~~(h/20),y=Wo(t)+Jo(d,i,a,f)+u+e[h]+qo[d]|0;u=f,f=a,a=Vo(i),i=t,t=y}this._a=t+this._a|0,this._b=i+this._b|0,this._c=a+this._c|0,this._d=f+this._d|0,this._e=u+this._e|0};we.prototype._hash=function(){var r=Go.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var Yo=we;const Xo=Vn(Yo);function Ko(r){let e="";for(const t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}let nt=null;async function Ie(r){return nt===null&&(nt=await Qo()),nt?Or(r):Zo(r)}function Zo(r){return new Xo().update(r).digest("hex")}async function Or(r){const e=await crypto.subtle.digest("SHA-1",r);return Ko(e)}async function Qo(){try{if(await Or(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch{}return!1}function ea(r){const e=[];let t=0,i=0;do{t=r.readUInt8();const a=t&127;e.push(a),i=t&128}while(i);return e.reduce((a,f)=>a+1<<7|f,-1)}function ta(r,e){let t=e,i=4,a=null;do a=r.readUInt8(),t|=(a&127)<<i,i+=7;while(a&128);return t}class ne{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:t}){const i=new z(e);if(i.slice(4).toString("hex")!=="ff744f63")return;const f=i.readUInt32BE();if(f!==2)throw new I(`Unable to read version ${f} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new I("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);const u=i.readUInt32BE(),s=[];for(let y=0;y<u;y++){const g=i.slice(20).toString("hex");s[y]=g}i.seek(i.tell()+4*u);const h=new Map;for(let y=0;y<u;y++)h.set(s[y],i.readUInt32BE());const d=i.slice(20).toString("hex");return new ne({hashes:s,crcs:{},offsets:h,packfileSha:d,getExternalRefDelta:t})}static async fromPack({pack:e,getExternalRefDelta:t,onProgress:i}){const a={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},f={},u=e.slice(-20).toString("hex"),s=[],h={},d=new Map;let y=null,g=null;await Hn([e],async({data:B,type:x,reference:F,offset:E,num:$})=>{y===null&&(y=$);const C=Math.floor((y-$)*100/y);C!==g&&i&&await i({phase:"Receiving objects",loaded:y-$,total:y}),g=C,x=a[x],["commit","tree","blob","tag"].includes(x)?f[E]={type:x,offset:E}:x==="ofs-delta"?f[E]={type:x,offset:E}:x==="ref-delta"&&(f[E]={type:x,offset:E})});const w=Object.keys(f).map(Number);for(const[B,x]of w.entries()){const F=B+1===w.length?e.byteLength-20:w[B+1],E=f[x],$=ln.buf(e.slice(x,F))>>>0;E.end=F,E.crc=$}const v=new ne({pack:Promise.resolve(e),packfileSha:u,crcs:h,hashes:s,offsets:d,getExternalRefDelta:t});g=null;let _=0;const P=[0,0,0,0,0,0,0,0,0,0,0,0];for(let B in f){B=Number(B);const x=Math.floor(_*100/y);x!==g&&i&&await i({phase:"Resolving deltas",loaded:_,total:y}),_++,g=x;const F=f[B];if(!F.oid)try{v.readDepth=0,v.externalReadDepth=0;const{type:E,object:$}=await v.readSlice({start:B});P[v.readDepth]+=1;const C=await Ie(Gn.wrap({type:E,object:$}));F.oid=C,s.push(C),d.set(C,B),h[C]=F.crc}catch{continue}}return s.sort(),v}async toBuffer(){const e=[],t=(d,y)=>{e.push(Buffer.from(d,y))};t("ff744f63","hex"),t("00000002","hex");const i=new z(Buffer.alloc(256*4));for(let d=0;d<256;d++){let y=0;for(const g of this.hashes)parseInt(g.slice(0,2),16)<=d&&y++;i.writeUInt32BE(y)}e.push(i.buffer);for(const d of this.hashes)t(d,"hex");const a=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)a.writeUInt32BE(this.crcs[d]);e.push(a.buffer);const f=new z(Buffer.alloc(this.hashes.length*4));for(const d of this.hashes)f.writeUInt32BE(this.offsets.get(d));e.push(f.buffer),t(this.packfileSha,"hex");const u=Buffer.concat(e),s=await Ie(u),h=Buffer.alloc(20);return h.write(s,"hex"),Buffer.concat([u,h])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new I(`Could not read object ${e} from packfile`)}const t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;const t={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new I("Tried to read from a GitPackIndex with no packfile loaded into memory");const i=(await this.pack).slice(e),a=new z(i),f=a.readUInt8(),u=f&112;let s=t[u];if(s===void 0)throw new I("Unrecognized type: 0b"+u.toString(2));const h=f&15;let d=h;f&128&&(d=ta(a,h));let g=null,w=null;if(s==="ofs_delta"){const _=ea(a),P=e-_;({object:g,type:s}=await this.readSlice({start:P}))}if(s==="ref_delta"){const _=a.slice(20).toString("hex");({object:g,type:s}=await this.read({oid:_}))}const v=i.slice(a.tell());if(w=Buffer.from(await Wn(v)),w.byteLength!==d)throw new I(`Packfile told us object would have length ${d} but it had length ${w.byteLength}`);return g&&(w=Buffer.from(qn(w,g))),this.readDepth>3&&(this.offsetCache[e]={type:s,object:w}),{type:s,format:"content",object:w}}}class ce extends ie{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=ce.code,this.data={value:e}}}ce.code="InvalidOidError";class $e extends ie{constructor(e,t,i,a){super(`Object ${e} ${a?`at ${a}`:""}was anticipated to be a ${i} but it is a ${t}.`),this.code=this.name=$e.code,this.data={oid:e,actual:t,expected:i,filepath:a}}}$e.code="ObjectTypeError";function ra(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}const H=2**32;function rr(r,e,t,i){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=i.valueOf());const a=Math.floor(t/1e3),f=(t-a*1e3)*1e6;return[a,f]}function nr(r){const[e,t]=rr(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[i,a]=rr(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%H,ctimeNanoseconds:t%H,mtimeSeconds:i%H,mtimeNanoseconds:a%H,dev:r.dev%H,ino:r.ino%H,mode:ra(r.mode%H),uid:r.uid%H,gid:r.gid%H,size:r.size>-1?r.size%H:0}}function na(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095}}function ia(r){const e=r.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}class J{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return J.fromBuffer(e);if(e===null)return new J(null);throw new I("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new I("Index file is empty (.git/index)");const t=new J,i=new z(e),a=i.toString("utf8",4);if(a!=="DIRC")throw new I(`Invalid dircache magic file number: ${a}`);const f=await Ie(e.slice(0,-20)),u=e.slice(-20).toString("hex");if(u!==f)throw new I(`Invalid checksum in GitIndex buffer: expected ${u} but saw ${f}`);const s=i.readUInt32BE();if(s!==2)throw new I(`Unsupported dircache version: ${s}`);const h=i.readUInt32BE();let d=0;for(;!i.eof()&&d<h;){const y={};y.ctimeSeconds=i.readUInt32BE(),y.ctimeNanoseconds=i.readUInt32BE(),y.mtimeSeconds=i.readUInt32BE(),y.mtimeNanoseconds=i.readUInt32BE(),y.dev=i.readUInt32BE(),y.ino=i.readUInt32BE(),y.mode=i.readUInt32BE(),y.uid=i.readUInt32BE(),y.gid=i.readUInt32BE(),y.size=i.readUInt32BE(),y.oid=i.slice(20).toString("hex");const g=i.readUInt16BE();y.flags=na(g);const w=e.indexOf(0,i.tell()+1)-i.tell();if(w<1)throw new I(`Got a path length of: ${w}`);if(y.path=i.toString("utf8",w),y.path.includes("..\\")||y.path.includes("../"))throw new he(y.path);let v=8-(i.tell()-12)%8;for(v===0&&(v=8);v--;){const _=i.readUInt8();if(_!==0)throw new I(`Expected 1-8 null characters but got '${_}' after ${y.path}`);if(i.eof())throw new I("Unexpected end of file")}y.stages=[],t._addEntry(y),d++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(yr)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(const e of this.entries)yield e}insert({filepath:e,stats:t,oid:i,stage:a=0}){t||(t={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),t=nr(t);const f=Buffer.from(e),u={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:a,nameLength:f.length<4095?f.length:4095},stages:[]};this._addEntry(u),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(const t of this._entries.keys())t.startsWith(e+"/")&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
50
+ `)}static async _entryToBuffer(e){const t=Buffer.from(e.path),i=Math.ceil((62+t.length+1)/8)*8,a=Buffer.alloc(i),f=new z(a),u=nr(e);return f.writeUInt32BE(u.ctimeSeconds),f.writeUInt32BE(u.ctimeNanoseconds),f.writeUInt32BE(u.mtimeSeconds),f.writeUInt32BE(u.mtimeNanoseconds),f.writeUInt32BE(u.dev),f.writeUInt32BE(u.ino),f.writeUInt32BE(u.mode),f.writeUInt32BE(u.uid),f.writeUInt32BE(u.gid),f.writeUInt32BE(u.size),f.write(e.oid,20,"hex"),f.writeUInt16BE(ia(e)),f.write(e.path,t.length,"utf8"),a}async toObject(){const e=Buffer.alloc(12),t=new z(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(2),t.writeUInt32BE(this.entriesFlat.length);let i=[];for(const s of this.entries)if(i.push(J._entryToBuffer(s)),s.stages.length>1)for(const h of s.stages)h&&h!==s&&i.push(J._entryToBuffer(h));i=await Promise.all(i);const a=Buffer.concat(i),f=Buffer.concat([e,a]),u=await Ie(f);return Buffer.concat([f,Buffer.from(u,"hex")])}}async function kr(r,e){const t=lr(r);for(;;){const{value:i,done:a}=await t.next();if(i&&await e(i),a)break}t.return&&t.return()}async function ue(r){let e=0;const t=[];await kr(r,f=>{t.push(f),e+=f.byteLength});const i=new Uint8Array(e);let a=0;for(const f of t)i.set(f,a),a+=f.byteLength;return i}class it{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){const t=this._waiting;this._waiting=null,t({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){const e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}}class oa{static demux(e){const t=j.streamReader(e),i=new it,a=new it,f=new it,u=async function(){const s=await t();if(s===null)return u();if(s===!0){i.end(),f.end(),e.error?a.destroy(e.error):a.end();return}switch(s[0]){case 1:{a.write(s.slice(1));break}case 2:{f.write(s.slice(1));break}case 3:{const h=s.slice(1);f.write(h),i.end(),f.end(),a.destroy(new Error(h.toString("utf8")));return}default:i.write(s)}u()};return u(),{packetlines:i,packfile:a,progress:f}}}async function Rr(r){const{packetlines:e,packfile:t,progress:i}=oa.demux(r),a=[],f=[],u=[];let s=!1,h=!1;return new Promise((d,y)=>{kr(e,g=>{const w=g.toString("utf8").trim();if(w.startsWith("shallow")){const v=w.slice(-41).trim();v.length!==40&&y(new ce(v)),a.push(v)}else if(w.startsWith("unshallow")){const v=w.slice(-41).trim();v.length!==40&&y(new ce(v)),f.push(v)}else if(w.startsWith("ACK")){const[,v,_]=w.split(" ");u.push({oid:v,status:_}),_||(h=!0)}else w.startsWith("NAK")?(s=!0,h=!0):(h=!0,s=!0);h&&(r.error?y(r.error):d({shallows:a,unshallows:f,acks:u,nak:s,packfile:t,progress:i}))}).finally(()=>{h||(r.error?y(r.error):d({shallows:a,unshallows:f,acks:u,nak:s,packfile:t,progress:i}))})})}typeof globalThis.Buffer>"u"&&(globalThis.Buffer=ht.Buffer);async function aa(r,e,t,i){const a=await Dr(r,e),f=await ha(a.idx,e,t),u=t.map(w=>f[w].oid),s=u.length>0?await pa(r,u):null,h={};if(await Promise.all(t.map(async w=>{s&&(h[w]=await Nr(s.idx,f[w].oid))})),!(i!=null&&i.withObjects))return{files:h};const d=[],y=await a.idx.toBuffer();if(d.push({name:`pack-${a.idx.packfileSha}`,pack:a.packfile,index:le(y),promisor:a.promisor}),s){const w=await s.idx.toBuffer();d.push({name:`pack-${s.idx.packfileSha}`,pack:s.packfile,index:le(w),promisor:s.promisor})}const g={};for(const w of t)g[w]=f[w].oid;return{files:h,packfiles:d,objects:[...await ir(a),...await ir(s)],fileOids:g}}const sa=/^[0-9a-f]{40}$/i;async function fa(r,e){const t=await Dr(r,e),i=await la(t.idx,e);return i!=null&&i.object?jr(i):[]}async function ca(r,e){const t=await ua(r,e);if(t.resolvedOid)return t.resolvedOid;const i=await ct(r,t.refname);if(!i)throw new Error(`Git ref "${t.refname}" not found at ${r}`);return i}function jr(r){return r.object.map(e=>{if(e.type==="blob")return{name:e.path,type:"file"};if(e.type==="tree"&&e.object)return{name:e.path,type:"folder",children:jr(e)}}).filter(e=>!!(e!=null&&e.name))}async function Cr(r,e){const t=Buffer.from(await ue([j.encode(`command=ls-refs
51
51
  `),j.encode(`agent=git/2.37.3
52
52
  `),j.encode(`object-format=sha1
53
53
  `),j.delim(),j.encode(`peel
54
54
  `),j.encode(`ref-prefix ${e}
55
- `),j.flush()])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`,"Git-Protocol":"version=2"},body:t}),a={};for await(const f of ga(i)){const u=f.indexOf(" "),s=f.slice(0,u),d=f.slice(u+1,f.length-1).split(" ")[0];a[d]=s}return a}async function ha(r,e){switch(e.type??"infer"){case"commit":return{kind:"commit",refname:e.value,resolvedOid:e.value};case"branch":return{kind:"refname",refname:`refs/heads/${e.value.trim()}`};case"tag":return{kind:"refname",refname:`refs/tags/${e.value.trim()}`};case"refname":return{kind:"refname",refname:e.value.trim()};case"infer":{const i=e.value.trim();if(i===""||i==="HEAD")return{kind:"refname",refname:"HEAD"};if(i.startsWith("refs/"))return{kind:"refname",refname:i};if(ca.test(i))return{kind:"commit",refname:i,resolvedOid:i};const a=`refs/heads/${i}`,f=await ut(r,a);if(f)return{kind:"refname",refname:a,resolvedOid:f};const u=`refs/tags/${i}`,s=await ut(r,u);if(s)return{kind:"refname",refname:u,resolvedOid:s};throw new Error(`Git ref "${e.value}" not found at ${r}`)}default:throw new Error(`Invalid ref type: ${e.type}`)}}async function ut(r,e){const t=await Nr(r,e),i=[e,`${e}^{}`];for(const a of i){const f=a.trim();if(f in t)return t[f]}return null}async function Mr(r,e){const t=Buffer.from(await ue([j.encode(`want ${e} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3 filter
55
+ `),j.flush()])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`,"Git-Protocol":"version=2"},body:t}),a={};for await(const f of ya(i)){const u=f.indexOf(" "),s=f.slice(0,u),d=f.slice(u+1,f.length-1).split(" ")[0];a[d]=s}return a}async function ua(r,e){switch(e.type??"infer"){case"commit":return{kind:"commit",refname:e.value,resolvedOid:e.value};case"branch":return{kind:"refname",refname:`refs/heads/${e.value.trim()}`};case"tag":return{kind:"refname",refname:`refs/tags/${e.value.trim()}`};case"refname":return{kind:"refname",refname:e.value.trim()};case"infer":{const i=e.value.trim();if(i===""||i==="HEAD")return{kind:"refname",refname:"HEAD"};if(i.startsWith("refs/"))return{kind:"refname",refname:i};if(sa.test(i))return{kind:"commit",refname:i,resolvedOid:i};const a=`refs/heads/${i}`,f=await ct(r,a);if(f)return{kind:"refname",refname:a,resolvedOid:f};const u=`refs/tags/${i}`,s=await ct(r,u);if(s)return{kind:"refname",refname:u,resolvedOid:s};throw new Error(`Git ref "${e.value}" not found at ${r}`)}default:throw new Error(`Invalid ref type: ${e.type}`)}}async function ct(r,e){const t=await Cr(r,e),i=[e,`${e}^{}`];for(const a of i){const f=a.trim();if(f in t)return t[f]}return null}async function Dr(r,e){const t=Buffer.from(await ue([j.encode(`want ${e} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3 filter
56
56
  `),j.encode(`filter blob:none
57
57
  `),j.encode(`shallow ${e}
58
58
  `),j.encode(`deepen 1
59
59
  `),j.flush(),j.encode(`done
60
60
  `),j.encode(`done
61
- `)])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`},body:t}),a=qr(i.body),f=await Cr(a),u=Buffer.from(await ue(f.packfile)),s=await ne.fromPack({pack:u}),h=s.read;return s.read=async function({oid:d,...y}){const g=await h.call(this,{oid:d,...y});return g.oid=d,g},{idx:s,packfile:le(u),promisor:!0}}async function pa(r,e){const t=await r.read({oid:e});X(t);const i=await r.read({oid:t.object.tree}),a=[i];for(;a.length>0;){const f=a.pop(),u=await r.read({oid:f.oid});if(X(u),f.object=u.object,u.type==="tree")for(const s of u.object)s.type==="tree"&&a.push(s)}return i}async function ar(r){if(!r)return[];const e=[],t=new Set;for(const i of r.idx.hashes??[]){if(t.has(i))continue;const a=r.idx.offsets.get(i);if(a===void 0)continue;const{type:f,object:u}=await r.idx.readSlice({start:a});f==="ofs_delta"||f==="ref_delta"||u&&(t.add(i),e.push({oid:i,type:f,body:le(u)}))}return e}async function ya(r,e,t){const i=await r.read({oid:e});X(i);const a=await r.read({oid:i.object.tree});X(a);const f={};for(const u of t){let s=a;const h=u.split("/");for(const d of h){if(s.type!=="tree")throw new Error(`Path not found in the repo: ${u}`);let y=!1;for(const g of s.object)if(g.path===d){try{s=await r.read({oid:g.oid}),X(s)}catch{s=g}y=!0;break}if(!y)throw new Error(`Path not found in the repo: ${u}`)}f[u]=s}return f}async function da(r,e){const t=Buffer.from(await ue([...e.map(h=>j.encode(`want ${h} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3
61
+ `)])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`},body:t}),a=Mr(i.body),f=await Rr(a),u=Buffer.from(await ue(f.packfile)),s=await ne.fromPack({pack:u}),h=s.read;return s.read=async function({oid:d,...y}){const g=await h.call(this,{oid:d,...y});return g.oid=d,g},{idx:s,packfile:le(u),promisor:!0}}async function la(r,e){const t=await r.read({oid:e});X(t);const i=await r.read({oid:t.object.tree}),a=[i];for(;a.length>0;){const f=a.pop(),u=await r.read({oid:f.oid});if(X(u),f.object=u.object,u.type==="tree")for(const s of u.object)s.type==="tree"&&a.push(s)}return i}async function ir(r){if(!r)return[];const e=[],t=new Set;for(const i of r.idx.hashes??[]){if(t.has(i))continue;const a=r.idx.offsets.get(i);if(a===void 0)continue;const{type:f,object:u}=await r.idx.readSlice({start:a});f==="ofs_delta"||f==="ref_delta"||u&&(t.add(i),e.push({oid:i,type:f,body:le(u)}))}return e}async function ha(r,e,t){const i=await r.read({oid:e});X(i);const a=await r.read({oid:i.object.tree});X(a);const f={};for(const u of t){let s=a;const h=u.split("/");for(const d of h){if(s.type!=="tree")throw new Error(`Path not found in the repo: ${u}`);let y=!1;for(const g of s.object)if(g.path===d){try{s=await r.read({oid:g.oid}),X(s)}catch{s=g}y=!0;break}if(!y)throw new Error(`Path not found in the repo: ${u}`)}f[u]=s}return f}async function pa(r,e){const t=Buffer.from(await ue([...e.map(h=>j.encode(`want ${h} multi_ack_detailed no-done side-band-64k thin-pack ofs-delta agent=git/2.37.3
62
62
  `)),j.flush(),j.encode(`done
63
- `)])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`},body:t}),a=qr(i.body),f=await Cr(a),u=Buffer.from(await ue(f.packfile));return u.byteLength===0?{idx:await ne.fromPack({pack:u}),packfile:new Uint8Array,promisor:!1}:{idx:await ne.fromPack({pack:u}),packfile:le(u),promisor:!1}}async function Lr(r,e){const t=await r.read({oid:e});if(X(t),t.type==="blob")return t.object;const i={};for(const{path:a,oid:f,type:u}of t.object)if(u==="blob"){const s=await r.read({oid:f});X(s),i[a]=s.object}else u==="tree"&&(i[a]=await Lr(r,f));return i}function X(r){if(r.object instanceof Buffer)switch(r.type){case"commit":r.object=M.from(r.object).parse();break;case"tree":r.object=ht.from(r.object).entries();break;case"blob":r.object=new Uint8Array(r.object),r.format="content";break;case"tag":r.object=ae.from(r.object).parse();break;default:throw new $e(r.oid,r.type,"blob|commit|tag|tree")}}async function*ga(r){const e=await r.text();let t=0;for(;t<=e.length;){const i=parseInt(e.substring(t,t+4),16);if(i===0)break;yield e.substring(t+4,t+i),t+=i}}function qr(r){if(r[Symbol.asyncIterator])return r;const e=r.getReader();return{next(){return e.read()},return(){return e.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}function le(r){return r instanceof Uint8Array,Uint8Array.from(r)}const ma=lt.deflate,wa=/^[0-9a-f]{40}$/i;async function ba(r){const e={},t=new TextEncoder;return await Promise.all(r.map(async({oid:i,type:a,body:f})=>{if(!i||f.length===0)return;const u=t.encode(`${a} ${f.length}\0`),s=new Uint8Array(u.length+f.length);s.set(u,0),s.set(f,u.length);const h=await ma(s),d=i.slice(0,2),y=i.slice(2);e[`.git/objects/${d}/${y}`]=h})),e}function va(r,e,t){const i=(r==null?void 0:r.trim())??"";let a=null;switch(e){case"branch":i&&(a=`refs/heads/${i}`);break;case"refname":a=i||null;break;case"tag":i.startsWith("refs/")?a=i:i&&(a=`refs/tags/${i}`);break;case"commit":a=null;break;default:i.startsWith("refs/")?a=i:wa.test(i)?a=null:i&&i!=="HEAD"&&(a=`refs/heads/${i}`);break}const f=a?`ref: ${a}
63
+ `)])),i=await fetch(r+"/git-upload-pack",{method:"POST",headers:{Accept:"application/x-git-upload-pack-advertisement","content-type":"application/x-git-upload-pack-request","Content-Length":`${t.length}`},body:t}),a=Mr(i.body),f=await Rr(a),u=Buffer.from(await ue(f.packfile));return u.byteLength===0?{idx:await ne.fromPack({pack:u}),packfile:new Uint8Array,promisor:!1}:{idx:await ne.fromPack({pack:u}),packfile:le(u),promisor:!1}}async function Nr(r,e){const t=await r.read({oid:e});if(X(t),t.type==="blob")return t.object;const i={};for(const{path:a,oid:f,type:u}of t.object)if(u==="blob"){const s=await r.read({oid:f});X(s),i[a]=s.object}else u==="tree"&&(i[a]=await Nr(r,f));return i}function X(r){if(r.object instanceof Buffer)switch(r.type){case"commit":r.object=M.from(r.object).parse();break;case"tree":r.object=lt.from(r.object).entries();break;case"blob":r.object=new Uint8Array(r.object),r.format="content";break;case"tag":r.object=ae.from(r.object).parse();break;default:throw new $e(r.oid,r.type,"blob|commit|tag|tree")}}async function*ya(r){const e=await r.text();let t=0;for(;t<=e.length;){const i=parseInt(e.substring(t,t+4),16);if(i===0)break;yield e.substring(t+4,t+i),t+=i}}function Mr(r){if(r[Symbol.asyncIterator])return r;const e=r.getReader();return{next(){return e.read()},return(){return e.releaseLock(),{}},[Symbol.asyncIterator](){return this}}}function le(r){return r instanceof Uint8Array,Uint8Array.from(r)}const da=ut.deflate,ga=/^[0-9a-f]{40}$/i;async function ma(r){const e={},t=new TextEncoder;return await Promise.all(r.map(async({oid:i,type:a,body:f})=>{if(!i||f.length===0)return;const u=t.encode(`${a} ${f.length}\0`),s=new Uint8Array(u.length+f.length);s.set(u,0),s.set(f,u.length);const h=await da(s),d=i.slice(0,2),y=i.slice(2);e[`.git/objects/${d}/${y}`]=h})),e}function wa(r,e,t){const i=(r==null?void 0:r.trim())??"";let a=null;switch(e){case"branch":i&&(a=`refs/heads/${i}`);break;case"refname":a=i||null;break;case"tag":i.startsWith("refs/")?a=i:i&&(a=`refs/tags/${i}`);break;case"commit":a=null;break;default:i.startsWith("refs/")?a=i:ga.test(i)?a=null:i&&i!=="HEAD"&&(a=`refs/heads/${i}`);break}const f=a?`ref: ${a}
64
64
  `:`${t}
65
- `,u=a&&a.startsWith("refs/heads/")?a:void 0,s=u==null?void 0:u.slice(11),h=a&&a.startsWith("refs/tags/")?a:void 0,d=h==null?void 0:h.slice(10);return{headContent:f,branchName:s,branchRef:u,tagName:d}}function Ea(r,{branchName:e,partialCloneFilter:t}){const a=["[core]",` repositoryformatversion = ${t?1:0}`," filemode = true"," bare = false"," logallrefupdates = true"," ignorecase = true"," precomposeunicode = true",'[remote "origin"]',` url = ${r}`," fetch = +refs/heads/*:refs/remotes/origin/*"," fetch = +refs/tags/*:refs/tags/*"];return t&&(a.push(" promisor = true"),a.push(` partialclonefilter = ${t}`),a.push("[extensions]"),a.push(" partialclone = origin")),e&&a.push(`[branch "${e}"]`," remote = origin",` merge = refs/heads/${e}`),a.join(`
65
+ `,u=a&&a.startsWith("refs/heads/")?a:void 0,s=u==null?void 0:u.slice(11),h=a&&a.startsWith("refs/tags/")?a:void 0,d=h==null?void 0:h.slice(10);return{headContent:f,branchName:s,branchRef:u,tagName:d}}function ba(r,{branchName:e,partialCloneFilter:t}){const a=["[core]",` repositoryformatversion = ${t?1:0}`," filemode = true"," bare = false"," logallrefupdates = true"," ignorecase = true"," precomposeunicode = true",'[remote "origin"]',` url = ${r}`," fetch = +refs/heads/*:refs/remotes/origin/*"," fetch = +refs/tags/*:refs/tags/*"];return t&&(a.push(" promisor = true"),a.push(` partialclonefilter = ${t}`),a.push("[extensions]"),a.push(" partialclone = origin")),e&&a.push(`[branch "${e}"]`," remote = origin",` merge = refs/heads/${e}`),a.join(`
66
66
  `)+`
67
- `}async function xa({repoUrl:r,commitHash:e,ref:t,refType:i,objects:a,fileOids:f,pathPrefix:u}){const s={},h=va(t,i,e);s[".git/HEAD"]=h.headContent,s[".git/config"]=Ea(r,{branchName:h.branchName}),s[".git/description"]=`WordPress Playground clone
67
+ `}async function va({repoUrl:r,commitHash:e,ref:t,refType:i,objects:a,fileOids:f,pathPrefix:u}){const s={},h=wa(t,i,e);s[".git/HEAD"]=h.headContent,s[".git/config"]=ba(r,{branchName:h.branchName}),s[".git/description"]=`WordPress Playground clone
68
68
  `,s[".git/shallow"]=`${e}
69
69
  `,s[".git/refs/heads/.gitkeep"]="",s[".git/refs/tags/.gitkeep"]="",s[".git/refs/remotes/.gitkeep"]="",h.branchRef&&h.branchName&&(s[".git/logs/HEAD"]=`ref: ${h.branchRef}
70
70
  `,s[`.git/${h.branchRef}`]=`${e}
71
71
  `,s[`.git/refs/remotes/origin/${h.branchName}`]=`${e}
72
72
  `,s[".git/refs/remotes/origin/HEAD"]=`ref: refs/remotes/origin/${h.branchName}
73
73
  `),h.tagName&&(s[`.git/refs/tags/${h.tagName}`]=`${e}
74
- `),Object.assign(s,await ba(a));const d=new J;for(const[g,w]of Object.entries(f)){const v=g.substring(u.length).replace(/^\/+/,"");d.insert({filepath:v,oid:w,stats:{ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:33188,uid:0,gid:0,size:0}})}const y=await d.toObject();return s[".git/index"]=Uint8Array.from(y),s}function Aa(r,e){e=te.normalizePath(e);const t=["",".","/"].includes(e);let i=r;if(t)e="";else{const u=e.split("/");for(const s of u){const h=i==null?void 0:i.find(d=>d.name===s);if((h==null?void 0:h.type)==="folder")i=h.children;else return h?[h.name]:[]}}const a=[],f=[{tree:i,path:e}];for(;f.length>0;){const{tree:u,path:s}=f.pop();for(const h of u){const d=`${s}${s?"/":""}${h.name}`;h.type==="folder"?f.push({tree:h.children,path:d}):a.push(d)}}return a}function Ba(r,e){return r.startsWith(e)?r.substring(e.length):r}class Sa{constructor(e){this.fileTree=e}async read(e){let t=this.getEntryAtPath(e);if(typeof t=="string")t=new TextEncoder().encode(t);else if(!(t instanceof Uint8Array))throw new Error(`Unsupported content type: ${typeof t}`);const i=new ReadableStream({start(a){a.enqueue(t),a.close()}});return new se.StreamedFile(i,e,{filesize:t.byteLength})}getEntryAtPath(e){let t=e.replace(/^\//,""),i=this.fileTree;for(;t;){if(i[t])return i[t];const a=t.split("/"),f=a.shift();if(!f||!i[f])break;i=i[f],t=a.join("/")}throw new Error(`File not found at ${e}`)}}class Ie{constructor(e){this.entries=new Map,this.zipReader=e}static fromStream(e){const t=new oe.ZipReader(new oe.BlobReader(new se.StreamedFile(e,"archive.zip")));return new Ie(t)}static fromArrayBuffer(e){const t=new oe.ZipReader(new oe.BlobReader(new Blob([e])));return new Ie(t)}async read(e){const t=await this.getEntry(e),i=await t.getData(new oe.BlobWriter);return new se.StreamedFile(i.stream(),e,{filesize:t.uncompressedSize})}async getEntry(e){const i=(await this.getEntries()).get(e.replace(/^\//,""));if(!i)throw new Error(`File ${e} not found in the zip.`);return i}async getEntries(){if(this.entries.size===0){const e=await this.zipReader.getEntries();for(const t of e)this.entries.set(t.filename,t)}return this.entries}}class Fa{constructor(e){if(!e.length)throw new Error("OverlayFilesystem requires at least one filesystem");this.filesystems=e}async read(e){const t=[];for(const a of this.filesystems)try{return await a.read(e)}catch(f){t.push(f instanceof Error?f:new Error(String(f)))}const i=t.map(a=>a.message).join("; ");throw new Error(`Failed to read ${e} from any filesystem: ${i}`,{cause:t})}}class Ia{constructor(e){if(this.baseUrl="",this.options=e,this.isDataUrl=e.baseUrl.startsWith("data:"),this.isDataUrl)return;const t=new URL("./",e.baseUrl);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Unsupported protocol: "+t.protocol+". Only HTTP and HTTPS are supported.");this.baseUrl=t.origin+t.pathname}async read(e){if(this.isDataUrl)throw new Error("FetchFilesystem cannot fetch files from data URLs");e=te.normalizePath(e);const t=e.replace(/^\//,""),i=new URL(t,this.baseUrl).toString();if(!i.startsWith(this.baseUrl))throw new Error(`Refused to read a file outside of the base URL: ${i}`);const a=this.options.corsProxy?`${this.options.corsProxy}${encodeURIComponent(i)}`:i,f=await fetch(a);if(!f.ok)throw new Error(`Failed to fetch file at ${e}: ${f.statusText}`);const u=f.headers.get("content-length")?parseInt(f.headers.get("content-length"),10):void 0;return new se.StreamedFile(f.body,e,{filesize:u})}}class _a{constructor(e){this.root=e}async ensureNodeModules(){if(!this.fs||!this.path){try{this.fs=await import("fs"),this.path=await import("path")}catch{this.fs=require("fs"),this.path=require("path")}this.root=this.path.resolve(this.root)+this.path.sep}}async read(e){if(await this.ensureNodeModules(),e=this.path.resolve(this.root,this.path.normalize(e.replace(/^\//,""))),!e.startsWith(this.root))throw new Error(`Refused to read a file outside of the root directory: ${e}`);return new Promise((t,i)=>{const a=this.path.resolve(e),f=this.fs.createReadStream(a);f.on("error",u=>{i(new Error(`Failed to read file at ${e}: ${u.message}`))}),this.fs.stat(a,(u,s)=>{u?i(new Error(`Failed to read file at ${e}: ${u.message}`)):t(new se.StreamedFile(Ua(f),e,{filesize:s.size}))})})}}function Ua(r){return new ReadableStream({start(t){r.on("data",i=>t.enqueue(i)),r.on("end",()=>t.close())}})}exports.FetchFilesystem=Ia;exports.InMemoryFilesystem=Sa;exports.NodeJsFilesystem=_a;exports.OverlayFilesystem=Fa;exports.ZipFilesystem=Ie;exports.changeset=In;exports.clearContentsFromMountDevice=Pn;exports.createClient=yn;exports.createCommit=An;exports.createDotGitDirectory=xa;exports.createOrUpdateBranch=En;exports.createTree=Bn;exports.createTreeNode=at;exports.createTreeNodes=fr;exports.deleteFile=ur;exports.directoryHandleFromMountDevice=lr;exports.directoryHandleToOpfsPath=Un;exports.filesListToObject=dn;exports.fork=xn;exports.getArtifact=bn;exports.getFilesFromDirectory=sr;exports.iterateFiles=Fn;exports.listDescendantFiles=Aa;exports.listGitFiles=ua;exports.listGitRefs=Nr;exports.mayPush=vn;exports.opfsPathToDirectoryHandle=hr;exports.removePathPrefix=Ba;exports.resolveCommitHash=la;exports.sparseCheckout=fa;
74
+ `),Object.assign(s,await ma(a));const d=new J;for(const[g,w]of Object.entries(f)){const v=g.substring(u.length).replace(/^\/+/,"");d.insert({filepath:v,oid:w,stats:{ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:33188,uid:0,gid:0,size:0}})}const y=await d.toObject();return s[".git/index"]=Uint8Array.from(y),s}function Ea(r,e){e=te.normalizePath(e);const t=["",".","/"].includes(e);let i=r;if(t)e="";else{const u=e.split("/");for(const s of u){const h=i==null?void 0:i.find(d=>d.name===s);if((h==null?void 0:h.type)==="folder")i=h.children;else return h?[h.name]:[]}}const a=[],f=[{tree:i,path:e}];for(;f.length>0;){const{tree:u,path:s}=f.pop();for(const h of u){const d=`${s}${s?"/":""}${h.name}`;h.type==="folder"?f.push({tree:h.children,path:d}):a.push(d)}}return a}function xa(r,e){return r.startsWith(e)?r.substring(e.length):r}class Aa{constructor(e){this.fileTree=e}async read(e){let t=this.getEntryAtPath(e);if(typeof t=="string")t=new TextEncoder().encode(t);else if(!(t instanceof Uint8Array))throw new Error(`Unsupported content type: ${typeof t}`);const i=new ReadableStream({start(a){a.enqueue(t),a.close()}});return new se.StreamedFile(i,e,{filesize:t.byteLength})}getEntryAtPath(e){let t=e.replace(/^\//,""),i=this.fileTree;for(;t;){if(i[t])return i[t];const a=t.split("/"),f=a.shift();if(!f||!i[f])break;i=i[f],t=a.join("/")}throw new Error(`File not found at ${e}`)}}class Fe{constructor(e){this.entries=new Map,this.zipReader=e}static fromStream(e){const t=new oe.ZipReader(new oe.BlobReader(new se.StreamedFile(e,"archive.zip")));return new Fe(t)}static fromArrayBuffer(e){const t=new oe.ZipReader(new oe.BlobReader(new Blob([e])));return new Fe(t)}async read(e){const t=await this.getEntry(e),i=await t.getData(new oe.BlobWriter);return new se.StreamedFile(i.stream(),e,{filesize:t.uncompressedSize})}async getEntry(e){const i=(await this.getEntries()).get(e.replace(/^\//,""));if(!i)throw new Error(`File ${e} not found in the zip.`);return i}async getEntries(){if(this.entries.size===0){const e=await this.zipReader.getEntries();for(const t of e)this.entries.set(t.filename,t)}return this.entries}}class Ba{constructor(e){if(!e.length)throw new Error("OverlayFilesystem requires at least one filesystem");this.filesystems=e}async read(e){const t=[];for(const a of this.filesystems)try{return await a.read(e)}catch(f){t.push(f instanceof Error?f:new Error(String(f)))}const i=t.map(a=>a.message).join("; ");throw new Error(`Failed to read ${e} from any filesystem: ${i}`,{cause:t})}}class Sa{constructor(e){if(this.baseUrl="",this.options=e,this.isDataUrl=e.baseUrl.startsWith("data:"),this.isDataUrl)return;const t=new URL("./",e.baseUrl);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("Unsupported protocol: "+t.protocol+". Only HTTP and HTTPS are supported.");this.baseUrl=t.origin+t.pathname}async read(e){if(this.isDataUrl)throw new Error("FetchFilesystem cannot fetch files from data URLs");e=te.normalizePath(e);const t=e.replace(/^\//,""),i=new URL(t,this.baseUrl).toString();if(!i.startsWith(this.baseUrl))throw new Error(`Refused to read a file outside of the base URL: ${i}`);const a=this.options.corsProxy?`${this.options.corsProxy}${encodeURIComponent(i)}`:i,f=await fetch(a);if(!f.ok)throw new Error(`Failed to fetch file at ${e}: ${f.statusText}`);const u=f.headers.get("content-length")?parseInt(f.headers.get("content-length"),10):void 0;return new se.StreamedFile(f.body,e,{filesize:u})}}class Ia{constructor(e){this.root=e}async ensureNodeModules(){if(!this.fs||!this.path){try{this.fs=await import("fs"),this.path=await import("path")}catch{this.fs=require("fs"),this.path=require("path")}this.root=this.path.resolve(this.root)+this.path.sep}}async read(e){if(await this.ensureNodeModules(),e=this.path.resolve(this.root,this.path.normalize(e.replace(/^\//,""))),!e.startsWith(this.root))throw new Error(`Refused to read a file outside of the root directory: ${e}`);return new Promise((t,i)=>{const a=this.path.resolve(e),f=this.fs.createReadStream(a);f.on("error",u=>{i(new Error(`Failed to read file at ${e}: ${u.message}`))}),this.fs.stat(a,(u,s)=>{u?i(new Error(`Failed to read file at ${e}: ${u.message}`)):t(new se.StreamedFile(Fa(f),e,{filesize:s.size}))})})}}function Fa(r){return new ReadableStream({start(t){r.on("data",i=>t.enqueue(i)),r.on("end",()=>t.close())}})}exports.FetchFilesystem=Sa;exports.InMemoryFilesystem=Aa;exports.NodeJsFilesystem=Ia;exports.OverlayFilesystem=Ba;exports.ZipFilesystem=Fe;exports.changeset=Sn;exports.clearContentsFromMountDevice=_n;exports.createClient=hn;exports.createCommit=En;exports.createDotGitDirectory=va;exports.createOrUpdateBranch=bn;exports.createTree=xn;exports.createTreeNode=ot;exports.createTreeNodes=ar;exports.deleteFile=fr;exports.directoryHandleFromMountDevice=cr;exports.directoryHandleToOpfsPath=Fn;exports.filesListToObject=pn;exports.fork=vn;exports.getArtifact=mn;exports.getFilesFromDirectory=or;exports.iterateFiles=Bn;exports.listDescendantFiles=Ea;exports.listGitFiles=fa;exports.listGitRefs=Cr;exports.mayPush=wn;exports.opfsPathToDirectoryHandle=ur;exports.removePathPrefix=xa;exports.resolveCommitHash=ca;exports.sparseCheckout=aa;
75
75
  //# sourceMappingURL=index.cjs.map