@wp-playground/storage 3.0.12 → 3.0.13

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