vbapm 0.6.3-alpha
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/LICENSE +21 -0
- package/README.md +246 -0
- package/lib/_commonjsHelpers-553b27b3.js +2 -0
- package/lib/_commonjsHelpers-553b27b3.js.map +1 -0
- package/lib/build-project-55e5df48.js +4 -0
- package/lib/build-project-55e5df48.js.map +1 -0
- package/lib/build-target-283e1e7d.js +10 -0
- package/lib/build-target-283e1e7d.js.map +1 -0
- package/lib/create-project-905598ca.js +11 -0
- package/lib/create-project-905598ca.js.map +1 -0
- package/lib/debug.js +2 -0
- package/lib/debug.js.map +1 -0
- package/lib/export-project-55168787.js +5 -0
- package/lib/export-project-55168787.js.map +1 -0
- package/lib/export-target-c9ddd2fa.js +5 -0
- package/lib/export-target-c9ddd2fa.js.map +1 -0
- package/lib/get-target-23b8cc04.js +12 -0
- package/lib/get-target-23b8cc04.js.map +1 -0
- package/lib/index-35cff1d5.js +38 -0
- package/lib/index-35cff1d5.js.map +1 -0
- package/lib/index-87f55e79.js +4 -0
- package/lib/index-87f55e79.js.map +1 -0
- package/lib/index-b49bd5b2.js +2 -0
- package/lib/index-b49bd5b2.js.map +1 -0
- package/lib/index-c97017db.js +2 -0
- package/lib/index-c97017db.js.map +1 -0
- package/lib/index-d9ba3ba0.js +6 -0
- package/lib/index-d9ba3ba0.js.map +1 -0
- package/lib/index-ffbba08f.js +3 -0
- package/lib/index-ffbba08f.js.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/inherits-713f4554.js +2 -0
- package/lib/inherits-713f4554.js.map +1 -0
- package/lib/init-project-a62cb644.js +16 -0
- package/lib/init-project-a62cb644.js.map +1 -0
- package/lib/load-from-project-e6530a69.js +6 -0
- package/lib/load-from-project-e6530a69.js.map +1 -0
- package/lib/minimatch-3a1d1fa9.js +2 -0
- package/lib/minimatch-3a1d1fa9.js.map +1 -0
- package/lib/once-9eb67b4f.js +2 -0
- package/lib/once-9eb67b4f.js.map +1 -0
- package/lib/project-d43b4e0c.js +30 -0
- package/lib/project-d43b4e0c.js.map +1 -0
- package/lib/run-macro-f4aa7c14.js +2 -0
- package/lib/run-macro-f4aa7c14.js.map +1 -0
- package/lib/sat-solver-01d6409e.js +2 -0
- package/lib/sat-solver-01d6409e.js.map +1 -0
- package/lib/src/actions/build-project.d.ts +2 -0
- package/lib/src/actions/create-project.d.ts +8 -0
- package/lib/src/actions/export-project.d.ts +6 -0
- package/lib/src/actions/increment-version.d.ts +5 -0
- package/lib/src/actions/init-project.d.ts +9 -0
- package/lib/src/actions/run-macro.d.ts +8 -0
- package/lib/src/actions/test-project.d.ts +5 -0
- package/lib/src/addin.d.ts +36 -0
- package/lib/src/bin/vba-blocks-build.d.ts +2 -0
- package/lib/src/bin/vba-blocks-export.d.ts +2 -0
- package/lib/src/bin/vba-blocks-init.d.ts +2 -0
- package/lib/src/bin/vba-blocks-new.d.ts +2 -0
- package/lib/src/bin/vba-blocks-run.d.ts +2 -0
- package/lib/src/bin/vba-blocks-test.d.ts +2 -0
- package/lib/src/bin/vba-blocks-version.d.ts +2 -0
- package/lib/src/bin/vba-blocks.d.ts +2 -0
- package/lib/src/build/apply-changeset.d.ts +3 -0
- package/lib/src/build/build-graph.d.ts +18 -0
- package/lib/src/build/changeset.d.ts +14 -0
- package/lib/src/build/compare-build-graphs.d.ts +3 -0
- package/lib/src/build/component.d.ts +25 -0
- package/lib/src/build/index.d.ts +7 -0
- package/lib/src/build/load-from-export.d.ts +2 -0
- package/lib/src/build/load-from-project.d.ts +5 -0
- package/lib/src/build/stage-build-graph.d.ts +2 -0
- package/lib/src/build/transform-build-graph.d.ts +3 -0
- package/lib/src/build/transforms/editor-config.d.ts +3 -0
- package/lib/src/cache.d.ts +9 -0
- package/lib/src/config.d.ts +29 -0
- package/lib/src/debug.d.ts +2 -0
- package/lib/src/env.d.ts +21 -0
- package/lib/src/errors.d.ts +56 -0
- package/lib/src/index.d.ts +16 -0
- package/lib/src/installer.d.ts +3 -0
- package/lib/src/lockfile/index.d.ts +23 -0
- package/lib/src/lockfile/is-lockfile-valid.d.ts +10 -0
- package/lib/src/lockfile/lockfile.d.ts +26 -0
- package/lib/src/manifest/dependency.d.ts +25 -0
- package/lib/src/manifest/index.d.ts +34 -0
- package/lib/src/manifest/reference.d.ts +12 -0
- package/lib/src/manifest/source.d.ts +8 -0
- package/lib/src/manifest/target.d.ts +10 -0
- package/lib/src/manifest/version.d.ts +3 -0
- package/lib/src/messages.d.ts +22 -0
- package/lib/src/professional/sources/git-source.d.ts +7 -0
- package/lib/src/professional/workspace.d.ts +10 -0
- package/lib/src/project.d.ts +48 -0
- package/lib/src/reporter.d.ts +12 -0
- package/lib/src/resolve/dependency-graph.d.ts +4 -0
- package/lib/src/resolve/index.d.ts +6 -0
- package/lib/src/resolve/latest-solver.d.ts +8 -0
- package/lib/src/resolve/resolver.d.ts +23 -0
- package/lib/src/resolve/sat-solver.d.ts +7 -0
- package/lib/src/sources/index.d.ts +16 -0
- package/lib/src/sources/path-source.d.ts +7 -0
- package/lib/src/sources/registration.d.ts +17 -0
- package/lib/src/sources/registry-source.d.ts +32 -0
- package/lib/src/sources/source.d.ts +6 -0
- package/lib/src/targets/add-target.d.ts +8 -0
- package/lib/src/targets/build-target.d.ts +41 -0
- package/lib/src/targets/export-target.d.ts +15 -0
- package/lib/src/targets/get-target.d.ts +7 -0
- package/lib/src/targets/index.d.ts +3 -0
- package/lib/src/targets/project-info.d.ts +7 -0
- package/lib/src/targets/transform-target.d.ts +3 -0
- package/lib/src/targets/transforms/core-xml.d.ts +2 -0
- package/lib/src/targets/transforms/workbook-xml.d.ts +2 -0
- package/lib/src/utils/async-map.d.ts +4 -0
- package/lib/src/utils/download.d.ts +1 -0
- package/lib/src/utils/fs.d.ts +23 -0
- package/lib/src/utils/get-staging.d.ts +1 -0
- package/lib/src/utils/git.d.ts +4 -0
- package/lib/src/utils/github.d.ts +9 -0
- package/lib/src/utils/has.d.ts +1 -0
- package/lib/src/utils/hash.d.ts +8 -0
- package/lib/src/utils/interop.d.ts +1 -0
- package/lib/src/utils/is.d.ts +5 -0
- package/lib/src/utils/noop.d.ts +1 -0
- package/lib/src/utils/observable.d.ts +15 -0
- package/lib/src/utils/parallel.d.ts +6 -0
- package/lib/src/utils/path.d.ts +7 -0
- package/lib/src/utils/pipe.d.ts +5 -0
- package/lib/src/utils/run.d.ts +17 -0
- package/lib/src/utils/stdout-file.d.ts +3 -0
- package/lib/src/utils/text.d.ts +4 -0
- package/lib/src/utils/toml.d.ts +4 -0
- package/lib/src/utils/unique.d.ts +1 -0
- package/lib/src/utils/without.d.ts +1 -0
- package/lib/src/utils/xml.d.ts +10 -0
- package/lib/src/utils/zip.d.ts +17 -0
- package/lib/test-project-d4f237d1.js +2 -0
- package/lib/test-project-d4f237d1.js.map +1 -0
- package/lib/text-ba532b40.js +10 -0
- package/lib/text-ba532b40.js.map +1 -0
- package/lib/tmp-bc08ebcf.js +10 -0
- package/lib/tmp-bc08ebcf.js.map +1 -0
- package/lib/toml-patch.es-6bd2145d.js +4 -0
- package/lib/toml-patch.es-6bd2145d.js.map +1 -0
- package/lib/vba-blocks-build-a717fcdb.js +10 -0
- package/lib/vba-blocks-build-a717fcdb.js.map +1 -0
- package/lib/vba-blocks-export-7e2c75cc.js +8 -0
- package/lib/vba-blocks-export-7e2c75cc.js.map +1 -0
- package/lib/vba-blocks-init-54531020.js +17 -0
- package/lib/vba-blocks-init-54531020.js.map +1 -0
- package/lib/vba-blocks-new-3210d92c.js +18 -0
- package/lib/vba-blocks-new-3210d92c.js.map +1 -0
- package/lib/vba-blocks-run-ab9d4ad4.js +11 -0
- package/lib/vba-blocks-run-ab9d4ad4.js.map +1 -0
- package/lib/vba-blocks-test-da5dba90.js +16 -0
- package/lib/vba-blocks-test-da5dba90.js.map +1 -0
- package/lib/vba-blocks-version-e1b3c35a.js +9 -0
- package/lib/vba-blocks-version-e1b3c35a.js.map +1 -0
- package/lib/vba-blocks.js +43 -0
- package/lib/vba-blocks.js.map +1 -0
- package/lib/workbook-xml-69fff4ae.js +3 -0
- package/lib/workbook-xml-69fff4ae.js.map +1 -0
- package/package.json +116 -0
- package/run-scripts/run.applescript +78 -0
- package/run-scripts/run.ps1 +211 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("./inherits-713f4554.js"),e=require("./index-87f55e79.js"),i=require("./_commonjsHelpers-553b27b3.js");require("util"),require("buffer");var r=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if("undefined"==typeof process||void 0===process.domain)throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||r.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||r.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||r.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=r.DEFAULT_MAX_PENDING};r.DEFAULT_TIMEOUT=0,r.DEFAULT_MAX_OCCUPATION_TIME=0,r.DEFAULT_MAX_EXECUTION_TIME=0,r.DEFAULT_MAX_PENDING=1e3,r.prototype.acquire=function(t,e,i,r){if(Array.isArray(t))return this._acquireBatch(t,e,i,r);if("function"!=typeof e)throw new Error("You must pass a function to execute");var a=null,n=null,s=null;"function"!=typeof i&&(r=i,i=null,s=new this.Promise((function(t,e){a=t,n=e}))),r=r||{};var o=!1,c=null,f=null,d=null,h=this,l=function(e,r,c){f&&(clearTimeout(f),f=null),d&&(clearTimeout(d),d=null),e&&(h.queues[t]&&0===h.queues[t].length&&delete h.queues[t],h.domainReentrant&&delete h.domains[t]),o||(s?r?n(r):a(c):"function"==typeof i&&i(r,c),o=!0),e&&h.queues[t]&&h.queues[t].length>0&&h.queues[t].shift()()},u=function(i){if(o)return l(i);c&&(clearTimeout(c),c=null),h.domainReentrant&&i&&(h.domains[t]=process.domain);var a=r.maxExecutionTime||h.maxExecutionTime;if(a&&(d=setTimeout((function(){h.queues[t]&&l(i,new Error("Maximum execution time is exceeded "+t))}),a)),1===e.length){var n=!1;try{e((function(t,e){n||(n=!0,l(i,t,e))}))}catch(t){n||(n=!0,l(i,t))}}else h._promiseTry((function(){return e()})).then((function(t){l(i,void 0,t)}),(function(t){l(i,t)}))};h.domainReentrant&&process.domain&&(u=process.domain.bind(u));var g=r.maxPending||h.maxPending;if(h.queues[t])if(h.domainReentrant&&process.domain&&process.domain===h.domains[t])u(!1);else if(h.queues[t].length>=g)l(!1,new Error("Too many pending tasks in queue "+t));else{var w=function(){u(!0)};r.skipQueue?h.queues[t].unshift(w):h.queues[t].push(w);var p=r.timeout||h.timeout;p&&(c=setTimeout((function(){c=null,l(!1,new Error("async-lock timed out in queue "+t))}),p))}else h.queues[t]=[],u(!0);var m=r.maxOccupationTime||h.maxOccupationTime;return m&&(f=setTimeout((function(){h.queues[t]&&l(!1,new Error("Maximum occupation time is exceeded in queue "+t))}),m)),s||void 0},r.prototype._acquireBatch=function(t,e,i,r){"function"!=typeof i&&(r=i,i=null);var a=this,n=t.reduceRight((function(t,e){return function(t,e){return function(i){a.acquire(t,e,i,r)}}(e,t)}),e);if("function"!=typeof i)return new this.Promise((function(t,e){1===n.length?n((function(i,r){i?e(i):t(r)})):t(n())}));n(i)},r.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},r.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(t){return this.Promise.reject(t)}};var a=r,n=e.safeBuffer.Buffer;function s(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}s.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var i=this._block,r=this._blockSize,a=t.length,s=this._len,o=0;o<a;){for(var c=s%r,f=Math.min(a-o,r-c),d=0;d<f;d++)i[c+d]=t[o+d];o+=f,(s+=f)%r==0&&this._update(i)}return this._len+=a,this},s.prototype.digest=function(t){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 i=8*this._len;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var r=(4294967295&i)>>>0,a=(i-r)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var n=this._hash();return t?n.toString(t):n},s.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var o=s,c=e.safeBuffer.Buffer,f=[1518500249,1859775393,-1894007588,-899497514],d=new Array(80);function h(){this.init(),this._w=d,o.call(this,64,56)}function l(t){return t<<1|t>>>31}function u(t){return t<<5|t>>>27}function g(t){return t<<30|t>>>2}function w(t,e,i,r){return 0===t?e&i|~e&r:2===t?e&i|e&r|i&r:e^i^r}t.inherits(h,o),h.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},h.prototype._update=function(t){for(var e=this._w,i=0|this._a,r=0|this._b,a=0|this._c,n=0|this._d,s=0|this._e,o=0;o<16;++o)e[o]=t.readInt32BE(4*o);for(;o<80;++o)e[o]=l(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var c=0;c<80;++c){var d=~~(c/20),h=u(i)+w(d,r,a,n)+s+e[c]+f[d]|0;s=n,n=a,a=g(r),r=i,i=h}this._a=i+this._a|0,this._b=r+this._b|0,this._c=a+this._c|0,this._d=n+this._d|0,this._e=s+this._e|0},h.prototype._hash=function(){var t=c.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var p=h;function m(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function y(t,e){for(var i,r="",a=0,n=-1,s=0,o=0;o<=t.length;++o){if(o<t.length)i=t.charCodeAt(o);else{if(47===i)break;i=47}if(47===i){if(n===o-1||1===s);else if(n!==o-1&&2===s){if(r.length<2||2!==a||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var c=r.lastIndexOf("/");if(c!==r.length-1){-1===c?(r="",a=0):a=(r=r.slice(0,c)).length-1-r.lastIndexOf("/"),n=o,s=0;continue}}else if(2===r.length||1===r.length){r="",a=0,n=o,s=0;continue}e&&(r.length>0?r+="/..":r="..",a=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),a=o-n-1;n=o,s=0}else 46===i&&-1!==s?++s:s=-1}return r}var _={resolve:function(){for(var t,e="",i=!1,r=arguments.length-1;r>=-1&&!i;r--){var a;r>=0?a=arguments[r]:(void 0===t&&(t=process.cwd()),a=t),m(a),0!==a.length&&(e=a+"/"+e,i=47===a.charCodeAt(0))}return e=y(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(m(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return 0!==(t=y(t,!e)).length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return m(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var i=arguments[e];m(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":_.normalize(t)},relative:function(t,e){if(m(t),m(e),t===e)return"";if((t=_.resolve(t))===(e=_.resolve(e)))return"";for(var i=1;i<t.length&&47===t.charCodeAt(i);++i);for(var r=t.length,a=r-i,n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var s=e.length-n,o=a<s?a:s,c=-1,f=0;f<=o;++f){if(f===o){if(s>o){if(47===e.charCodeAt(n+f))return e.slice(n+f+1);if(0===f)return e.slice(n+f)}else a>o&&(47===t.charCodeAt(i+f)?c=f:0===f&&(c=0));break}var d=t.charCodeAt(i+f);if(d!==e.charCodeAt(n+f))break;47===d&&(c=f)}var h="";for(f=i+c+1;f<=r;++f)f!==r&&47!==t.charCodeAt(f)||(0===h.length?h+="..":h+="/..");return h.length>0?h+e.slice(n+c):(n+=c,47===e.charCodeAt(n)&&++n,e.slice(n))},_makeLong:function(t){return t},dirname:function(t){if(m(t),0===t.length)return".";for(var e=t.charCodeAt(0),i=47===e,r=-1,a=!0,n=t.length-1;n>=1;--n)if(47===(e=t.charCodeAt(n))){if(!a){r=n;break}}else a=!1;return-1===r?i?"/":".":i&&1===r?"//":t.slice(0,r)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');m(t);var i,r=0,a=-1,n=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,o=-1;for(i=t.length-1;i>=0;--i){var c=t.charCodeAt(i);if(47===c){if(!n){r=i+1;break}}else-1===o&&(n=!1,o=i+1),s>=0&&(c===e.charCodeAt(s)?-1==--s&&(a=i):(s=-1,a=o))}return r===a?a=o:-1===a&&(a=t.length),t.slice(r,a)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!n){r=i+1;break}}else-1===a&&(n=!1,a=i+1);return-1===a?"":t.slice(r,a)},extname:function(t){m(t);for(var e=-1,i=0,r=-1,a=!0,n=0,s=t.length-1;s>=0;--s){var o=t.charCodeAt(s);if(47!==o)-1===r&&(a=!1,r=s+1),46===o?-1===e?e=s:1!==n&&(n=1):-1!==e&&(n=-1);else if(!a){i=s+1;break}}return-1===e||-1===r||0===n||1===n&&e===r-1&&e===i+1?"":t.slice(e,r)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var i=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+r:i+t+r:r}("/",t)},parse:function(t){m(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var i,r=t.charCodeAt(0),a=47===r;a?(e.root="/",i=1):i=0;for(var n=-1,s=0,o=-1,c=!0,f=t.length-1,d=0;f>=i;--f)if(47!==(r=t.charCodeAt(f)))-1===o&&(c=!1,o=f+1),46===r?-1===n?n=f:1!==d&&(d=1):-1!==n&&(d=-1);else if(!c){s=f+1;break}return-1===n||-1===o||0===d||1===d&&n===o-1&&n===s+1?-1!==o&&(e.base=e.name=0===s&&a?t.slice(1,o):t.slice(s,o)):(0===s&&a?(e.name=t.slice(1,n),e.base=t.slice(1,o)):(e.name=t.slice(s,n),e.base=t.slice(s,o)),e.ext=t.slice(n,o)),s>0?e.dir=t.slice(0,s-1):a&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};_.posix=_;var b=_,v=i.createCommonjsModule((function(t,e){!function(t){"undefined"==typeof DO_NOT_EXPORT_CRC?t(e):t({})}((function(t){t.version="1.2.0";var e=function(){for(var t=0,e=new Array(256),i=0;256!=i;++i)t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=i)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1,e[i]=t;return"undefined"!=typeof Int32Array?new Int32Array(e):e}();t.table=e,t.bstr=function(t,i){for(var r=~i,a=t.length-1,n=0;n<a;)r=(r=r>>>8^e[255&(r^t.charCodeAt(n++))])>>>8^e[255&(r^t.charCodeAt(n++))];return n===a&&(r=r>>>8^e[255&(r^t.charCodeAt(n))]),~r},t.buf=function(t,i){if(t.length>1e4)return function(t,i){for(var r=~i,a=t.length-7,n=0;n<a;)r=(r=(r=(r=(r=(r=(r=(r=r>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])];for(;n<a+7;)r=r>>>8^e[255&(r^t[n++])];return~r}(t,i);for(var r=~i,a=t.length-3,n=0;n<a;)r=(r=(r=(r=r>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])])>>>8^e[255&(r^t[n++])];for(;n<a+3;)r=r>>>8^e[255&(r^t[n++])];return~r},t.str=function(t,i){for(var r,a,n=~i,s=0,o=t.length;s<o;)(r=t.charCodeAt(s++))<128?n=n>>>8^e[255&(n^r)]:r<2048?n=(n=n>>>8^e[255&(n^(192|r>>6&31))])>>>8^e[255&(n^(128|63&r))]:r>=55296&&r<57344?(r=64+(1023&r),a=1023&t.charCodeAt(s++),n=(n=(n=(n=n>>>8^e[255&(n^(240|r>>8&7))])>>>8^e[255&(n^(128|r>>2&63))])>>>8^e[255&(n^(128|a>>6&15|(3&r)<<4))])>>>8^e[255&(n^(128|63&a))]):n=(n=(n=n>>>8^e[255&(n^(224|r>>12&15))])>>>8^e[255&(n^(128|r>>6&63))])>>>8^e[255&(n^(128|63&r))];return~n}}))})),x=i.createCommonjsModule((function(t,e){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var a in i)r(i,a)&&(t[a]=i[a])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var a={arraySet:function(t,e,i,r,a){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),a);else for(var n=0;n<r;n++)t[a+n]=e[i+n]},flattenChunks:function(t){var e,i,r,a,n,s;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(s=new Uint8Array(r),a=0,e=0,i=t.length;e<i;e++)n=t[e],s.set(n,a),a+=n.length;return s}},n={arraySet:function(t,e,i,r,a){for(var n=0;n<r;n++)t[a+n]=e[i+n]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,a)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(i)}));function k(t){for(var e=t.length;--e>=0;)t[e]=0}var E=256,S=286,$=30,j=15,A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],B=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(576);k(O);var C=new Array(60);k(C);var I=new Array(512);k(I);var z=new Array(256);k(z);var T=new Array(29);k(T);var D,N,U,M=new Array($);function F(t,e,i,r,a){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=a,this.has_stree=t&&t.length}function H(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function q(t){return t<256?I[t]:I[256+(t>>>7)]}function L(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function W(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,L(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)}function G(t,e,i){W(t,i[2*e],i[2*e+1])}function Z(t,e){var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1}function K(t,e,i){var r,a,n=new Array(16),s=0;for(r=1;r<=j;r++)n[r]=s=s+i[r-1]<<1;for(a=0;a<=e;a++){var o=t[2*a+1];0!==o&&(t[2*a]=Z(n[o]++,o))}}function V(t){var e;for(e=0;e<S;e++)t.dyn_ltree[2*e]=0;for(e=0;e<$;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function X(t){t.bi_valid>8?L(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function Y(t,e,i,r){var a=2*e,n=2*i;return t[a]<t[n]||t[a]===t[n]&&r[e]<=r[i]}function J(t,e,i){for(var r=t.heap[i],a=i<<1;a<=t.heap_len&&(a<t.heap_len&&Y(e,t.heap[a+1],t.heap[a],t.depth)&&a++,!Y(e,r,t.heap[a],t.depth));)t.heap[i]=t.heap[a],i=a,a<<=1;t.heap[i]=r}function Q(t,e,i){var r,a,n,s,o=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],a=t.pending_buf[t.l_buf+o],o++,0===r?G(t,a,e):(G(t,(n=z[a])+E+1,e),0!==(s=A[n])&&W(t,a-=T[n],s),G(t,n=q(--r),i),0!==(s=B[n])&&W(t,r-=M[n],s))}while(o<t.last_lit);G(t,256,e)}function tt(t,e){var i,r,a,n=e.dyn_tree,s=e.stat_desc.static_tree,o=e.stat_desc.has_stree,c=e.stat_desc.elems,f=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<c;i++)0!==n[2*i]?(t.heap[++t.heap_len]=f=i,t.depth[i]=0):n[2*i+1]=0;for(;t.heap_len<2;)n[2*(a=t.heap[++t.heap_len]=f<2?++f:0)]=1,t.depth[a]=0,t.opt_len--,o&&(t.static_len-=s[2*a+1]);for(e.max_code=f,i=t.heap_len>>1;i>=1;i--)J(t,n,i);a=c;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],J(t,n,1),r=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=r,n[2*a]=n[2*i]+n[2*r],t.depth[a]=(t.depth[i]>=t.depth[r]?t.depth[i]:t.depth[r])+1,n[2*i+1]=n[2*r+1]=a,t.heap[1]=a++,J(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,r,a,n,s,o,c=e.dyn_tree,f=e.max_code,d=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,u=e.stat_desc.extra_base,g=e.stat_desc.max_length,w=0;for(n=0;n<=j;n++)t.bl_count[n]=0;for(c[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)(n=c[2*c[2*(r=t.heap[i])+1]+1]+1)>g&&(n=g,w++),c[2*r+1]=n,r>f||(t.bl_count[n]++,s=0,r>=u&&(s=l[r-u]),o=c[2*r],t.opt_len+=o*(n+s),h&&(t.static_len+=o*(d[2*r+1]+s)));if(0!==w){do{for(n=g-1;0===t.bl_count[n];)n--;t.bl_count[n]--,t.bl_count[n+1]+=2,t.bl_count[g]--,w-=2}while(w>0);for(n=g;0!==n;n--)for(r=t.bl_count[n];0!==r;)(a=t.heap[--i])>f||(c[2*a+1]!==n&&(t.opt_len+=(n-c[2*a+1])*c[2*a],c[2*a+1]=n),r--)}}(t,e),K(n,f,t.bl_count)}function et(t,e,i){var r,a,n=-1,s=e[1],o=0,c=7,f=4;for(0===s&&(c=138,f=3),e[2*(i+1)+1]=65535,r=0;r<=i;r++)a=s,s=e[2*(r+1)+1],++o<c&&a===s||(o<f?t.bl_tree[2*a]+=o:0!==a?(a!==n&&t.bl_tree[2*a]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,n=a,0===s?(c=138,f=3):a===s?(c=6,f=3):(c=7,f=4))}function it(t,e,i){var r,a,n=-1,s=e[1],o=0,c=7,f=4;for(0===s&&(c=138,f=3),r=0;r<=i;r++)if(a=s,s=e[2*(r+1)+1],!(++o<c&&a===s)){if(o<f)do{G(t,a,t.bl_tree)}while(0!=--o);else 0!==a?(a!==n&&(G(t,a,t.bl_tree),o--),G(t,16,t.bl_tree),W(t,o-3,2)):o<=10?(G(t,17,t.bl_tree),W(t,o-3,3)):(G(t,18,t.bl_tree),W(t,o-11,7));o=0,n=a,0===s?(c=138,f=3):a===s?(c=6,f=3):(c=7,f=4)}}k(M);var rt=!1;function at(t,e,i,r){W(t,0+(r?1:0),3),function(t,e,i,r){X(t),r&&(L(t,i),L(t,~i)),x.arraySet(t.pending_buf,t.window,e,i,t.pending),t.pending+=i}(t,e,i,!0)}var nt=function(t,e,i,r){var a,n,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<E;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),tt(t,t.l_desc),tt(t,t.d_desc),s=function(t){var e;for(et(t,t.dyn_ltree,t.l_desc.max_code),et(t,t.dyn_dtree,t.d_desc.max_code),tt(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*P[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),a=t.opt_len+3+7>>>3,(n=t.static_len+3+7>>>3)<=a&&(a=n)):a=n=i+5,i+4<=a&&-1!==e?at(t,e,i,r):4===t.strategy||n===a?(W(t,2+(r?1:0),3),Q(t,O,C)):(W(t,4+(r?1:0),3),function(t,e,i,r){var a;for(W(t,e-257,5),W(t,i-1,5),W(t,r-4,4),a=0;a<r;a++)W(t,t.bl_tree[2*P[a]+1],3);it(t,t.dyn_ltree,e-1),it(t,t.dyn_dtree,i-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Q(t,t.dyn_ltree,t.dyn_dtree)),V(t),r&&X(t)},st={_tr_init:function(t){rt||(!function(){var t,e,i,r,a,n=new Array(16);for(i=0,r=0;r<28;r++)for(T[r]=i,t=0;t<1<<A[r];t++)z[i++]=r;for(z[i-1]=r,a=0,r=0;r<16;r++)for(M[r]=a,t=0;t<1<<B[r];t++)I[a++]=r;for(a>>=7;r<$;r++)for(M[r]=a<<7,t=0;t<1<<B[r]-7;t++)I[256+a++]=r;for(e=0;e<=j;e++)n[e]=0;for(t=0;t<=143;)O[2*t+1]=8,t++,n[8]++;for(;t<=255;)O[2*t+1]=9,t++,n[9]++;for(;t<=279;)O[2*t+1]=7,t++,n[7]++;for(;t<=287;)O[2*t+1]=8,t++,n[8]++;for(K(O,287,n),t=0;t<$;t++)C[2*t+1]=5,C[2*t]=Z(t,5);D=new F(O,A,257,S,j),N=new F(C,B,0,$,j),U=new F(new Array(0),R,0,19,7)}(),rt=!0),t.l_desc=new H(t.dyn_ltree,D),t.d_desc=new H(t.dyn_dtree,N),t.bl_desc=new H(t.bl_tree,U),t.bi_buf=0,t.bi_valid=0,V(t)},_tr_stored_block:at,_tr_flush_block:nt,_tr_tally:function(t,e,i){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(z[i]+E+1)]++,t.dyn_dtree[2*q(e)]++),t.last_lit===t.lit_bufsize-1},_tr_align:function(t){W(t,2,3),G(t,256,O),function(t){16===t.bi_valid?(L(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}};var ot=function(t,e,i,r){for(var a=65535&t,n=t>>>16&65535,s=0;0!==i;){i-=s=i>2e3?2e3:i;do{n=n+(a=a+e[r++]|0)|0}while(--s);a%=65521,n%=65521}return a|n<<16};var ct=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();var ft,dt=function(t,e,i,r){var a=ct,n=r+i;t^=-1;for(var s=r;s<n;s++)t=t>>>8^a[255&(t^e[s])];return~t},ht={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},lt=-2,ut=258,gt=262,wt=103,pt=113,mt=666;function yt(t,e){return t.msg=ht[e],e}function _t(t){return(t<<1)-(t>4?9:0)}function bt(t){for(var e=t.length;--e>=0;)t[e]=0}function vt(t){var e=t.state,i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(x.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function xt(t,e){st._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vt(t.strm)}function kt(t,e){t.pending_buf[t.pending++]=e}function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function St(t,e){var i,r,a=t.max_chain_length,n=t.strstart,s=t.prev_length,o=t.nice_match,c=t.strstart>t.w_size-gt?t.strstart-(t.w_size-gt):0,f=t.window,d=t.w_mask,h=t.prev,l=t.strstart+ut,u=f[n+s-1],g=f[n+s];t.prev_length>=t.good_match&&(a>>=2),o>t.lookahead&&(o=t.lookahead);do{if(f[(i=e)+s]===g&&f[i+s-1]===u&&f[i]===f[n]&&f[++i]===f[n+1]){n+=2,i++;do{}while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&n<l);if(r=ut-(l-n),n=l-ut,r>s){if(t.match_start=e,s=r,r>=o)break;u=f[n+s-1],g=f[n+s]}}}while((e=h[e&d])>c&&0!=--a);return s<=t.lookahead?s:t.lookahead}function $t(t){var e,i,r,a,n,s,o,c,f,d,h=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=h+(h-gt)){x.arraySet(t.window,t.window,h,h,0),t.match_start-=h,t.strstart-=h,t.block_start-=h,e=i=t.hash_size;do{r=t.head[--e],t.head[e]=r>=h?r-h:0}while(--i);e=i=h;do{r=t.prev[--e],t.prev[e]=r>=h?r-h:0}while(--i);a+=h}if(0===t.strm.avail_in)break;if(s=t.strm,o=t.window,c=t.strstart+t.lookahead,f=a,d=void 0,(d=s.avail_in)>f&&(d=f),i=0===d?0:(s.avail_in-=d,x.arraySet(o,s.input,s.next_in,d,c),1===s.state.wrap?s.adler=ot(s.adler,o,d,c):2===s.state.wrap&&(s.adler=dt(s.adler,o,d,c)),s.next_in+=d,s.total_in+=d,d),t.lookahead+=i,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[n+3-1])&t.hash_mask,t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<gt&&0!==t.strm.avail_in)}function jt(t,e){for(var i,r;;){if(t.lookahead<gt){if($t(t),t.lookahead<gt&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-gt&&(t.match_length=St(t,i)),t.match_length>=3)if(r=st._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=st._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(xt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(xt(t,!1),0===t.strm.avail_out)?1:2}function At(t,e){for(var i,r,a;;){if(t.lookahead<gt){if($t(t),t.lookahead<gt&&0===e)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-gt&&(t.match_length=St(t,i),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){a=t.strstart+t.lookahead-3,r=st._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=a&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(xt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=st._tr_tally(t,0,t.window[t.strstart-1]))&&xt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=st._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(xt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(xt(t,!1),0===t.strm.avail_out)?1:2}function Bt(t,e,i,r,a){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=r,this.func=a}function Rt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new x.Buf16(1146),this.dyn_dtree=new x.Buf16(122),this.bl_tree=new x.Buf16(78),bt(this.dyn_ltree),bt(this.dyn_dtree),bt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new x.Buf16(16),this.heap=new x.Buf16(573),bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new x.Buf16(573),bt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Pt(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:pt,t.adler=2===e.wrap?0:1,e.last_flush=0,st._tr_init(e),0):yt(t,lt)}function Ot(t){var e,i=Pt(t);return 0===i&&((e=t.state).window_size=2*e.w_size,bt(e.head),e.max_lazy_match=ft[e.level].max_lazy,e.good_match=ft[e.level].good_length,e.nice_match=ft[e.level].nice_length,e.max_chain_length=ft[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i}function Ct(t,e,i,r,a,n){if(!t)return lt;var s=1;if(-1===e&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),a<1||a>9||8!==i||r<8||r>15||e<0||e>9||n<0||n>4)return yt(t,lt);8===r&&(r=9);var o=new Rt;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new x.Buf8(2*o.w_size),o.head=new x.Buf16(o.hash_size),o.prev=new x.Buf16(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new x.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=n,o.method=i,Ot(t)}ft=[new Bt(0,0,0,0,(function(t,e){var i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if($t(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+i;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,xt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-gt&&(xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(xt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(xt(t,!1),t.strm.avail_out),1)})),new Bt(4,4,8,4,jt),new Bt(4,5,16,8,jt),new Bt(4,6,32,32,jt),new Bt(4,4,16,16,At),new Bt(8,16,32,32,At),new Bt(8,16,128,128,At),new Bt(8,32,128,256,At),new Bt(32,128,258,1024,At),new Bt(32,258,258,4096,At)];var It=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==wt&&e!==pt&&e!==mt?yt(t,lt):(t.state=null,e===pt?yt(t,-3):0):lt},zt={deflateInit:function(t,e){return Ct(t,e,8,15,8,0)},deflateInit2:Ct,deflateReset:Ot,deflateResetKeep:Pt,deflateSetHeader:function(t,e){return t&&t.state?2!==t.state.wrap?lt:(t.state.gzhead=e,0):lt},deflate:function(t,e){var i,r,a,n;if(!t||!t.state||e>5||e<0)return t?yt(t,lt):lt;if(r=t.state,!t.output||!t.input&&0!==t.avail_in||r.status===mt&&4!==e)return yt(t,0===t.avail_out?-5:lt);if(r.strm=t,i=r.last_flush,r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,kt(r,31),kt(r,139),kt(r,8),r.gzhead?(kt(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),kt(r,255&r.gzhead.time),kt(r,r.gzhead.time>>8&255),kt(r,r.gzhead.time>>16&255),kt(r,r.gzhead.time>>24&255),kt(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),kt(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(kt(r,255&r.gzhead.extra.length),kt(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=dt(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(kt(r,0),kt(r,0),kt(r,0),kt(r,0),kt(r,0),kt(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),kt(r,3),r.status=pt);else{var s=8+(r.w_bits-8<<4)<<8;s|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(s|=32),s+=31-s%31,r.status=pt,Et(r,s),0!==r.strstart&&(Et(r,t.adler>>>16),Et(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),vt(t),a=r.pending,r.pending!==r.pending_buf_size));)kt(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),vt(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,kt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),vt(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,kt(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=dt(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=wt)}else r.status=wt;if(r.status===wt&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&vt(t),r.pending+2<=r.pending_buf_size&&(kt(r,255&t.adler),kt(r,t.adler>>8&255),t.adler=0,r.status=pt)):r.status=pt),0!==r.pending){if(vt(t),0===t.avail_out)return r.last_flush=-1,0}else if(0===t.avail_in&&_t(e)<=_t(i)&&4!==e)return yt(t,-5);if(r.status===mt&&0!==t.avail_in)return yt(t,-5);if(0!==t.avail_in||0!==r.lookahead||0!==e&&r.status!==mt){var o=2===r.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&($t(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,i=st._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(xt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(xt(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var i,r,a,n,s=t.window;;){if(t.lookahead<=ut){if($t(t),t.lookahead<=ut&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=s[a=t.strstart-1])===s[++a]&&r===s[++a]&&r===s[++a]){n=t.strstart+ut;do{}while(r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&a<n);t.match_length=ut-(n-a),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=st._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=st._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(xt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(xt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(xt(t,!1),0===t.strm.avail_out)?1:2}(r,e):ft[r.level].func(r,e);if(3!==o&&4!==o||(r.status=mt),1===o||3===o)return 0===t.avail_out&&(r.last_flush=-1),0;if(2===o&&(1===e?st._tr_align(r):5!==e&&(st._tr_stored_block(r,0,0,!1),3===e&&(bt(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),vt(t),0===t.avail_out))return r.last_flush=-1,0}return 4!==e?0:r.wrap<=0?1:(2===r.wrap?(kt(r,255&t.adler),kt(r,t.adler>>8&255),kt(r,t.adler>>16&255),kt(r,t.adler>>24&255),kt(r,255&t.total_in),kt(r,t.total_in>>8&255),kt(r,t.total_in>>16&255),kt(r,t.total_in>>24&255)):(Et(r,t.adler>>>16),Et(r,65535&t.adler)),vt(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},deflateEnd:It,deflateSetDictionary:function(t,e){var i,r,a,n,s,o,c,f,d=e.length;if(!t||!t.state)return lt;if(2===(n=(i=t.state).wrap)||1===n&&42!==i.status||i.lookahead)return lt;for(1===n&&(t.adler=ot(t.adler,e,d,0)),i.wrap=0,d>=i.w_size&&(0===n&&(bt(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new x.Buf8(i.w_size),x.arraySet(f,e,d-i.w_size,i.w_size,0),e=f,d=i.w_size),s=t.avail_in,o=t.next_in,c=t.input,t.avail_in=d,t.next_in=0,t.input=e,$t(i);i.lookahead>=3;){r=i.strstart,a=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--a);i.strstart=r,i.lookahead=2,$t(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=o,t.input=c,t.avail_in=s,i.wrap=n,0},deflateInfo:"pako deflate (from Nodeca project)"},Tt=!0,Dt=!0;try{String.fromCharCode.apply(null,[0])}catch(t){Tt=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Dt=!1}for(var Nt=new x.Buf8(256),Ut=0;Ut<256;Ut++)Nt[Ut]=Ut>=252?6:Ut>=248?5:Ut>=240?4:Ut>=224?3:Ut>=192?2:1;Nt[254]=Nt[254]=1;function Mt(t,e){if(e<65534&&(t.subarray&&Dt||!t.subarray&&Tt))return String.fromCharCode.apply(null,x.shrinkBuf(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}var Ft=function(t){var e,i,r,a,n,s=t.length,o=0;for(a=0;a<s;a++)55296==(64512&(i=t.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=t.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new x.Buf8(o),n=0,a=0;n<o;a++)55296==(64512&(i=t.charCodeAt(a)))&&a+1<s&&56320==(64512&(r=t.charCodeAt(a+1)))&&(i=65536+(i-55296<<10)+(r-56320),a++),i<128?e[n++]=i:i<2048?(e[n++]=192|i>>>6,e[n++]=128|63&i):i<65536?(e[n++]=224|i>>>12,e[n++]=128|i>>>6&63,e[n++]=128|63&i):(e[n++]=240|i>>>18,e[n++]=128|i>>>12&63,e[n++]=128|i>>>6&63,e[n++]=128|63&i);return e},Ht=function(t){return Mt(t,t.length)},qt=function(t){for(var e=new x.Buf8(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e},Lt=function(t,e){var i,r,a,n,s=e||t.length,o=new Array(2*s);for(r=0,i=0;i<s;)if((a=t[i++])<128)o[r++]=a;else if((n=Nt[a])>4)o[r++]=65533,i+=n-1;else{for(a&=2===n?31:3===n?15:7;n>1&&i<s;)a=a<<6|63&t[i++],n--;n>1?o[r++]=65533:a<65536?o[r++]=a:(a-=65536,o[r++]=55296|a>>10&1023,o[r++]=56320|1023&a)}return Mt(o,r)},Wt=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+Nt[t[i]]>e?i:e};var Gt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Zt=Object.prototype.toString;function Kt(t){if(!(this instanceof Kt))return new Kt(t);this.options=x.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gt,this.strm.avail_out=0;var i=zt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==i)throw new Error(ht[i]);if(e.header&&zt.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(r="string"==typeof e.dictionary?Ft(e.dictionary):"[object ArrayBuffer]"===Zt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(i=zt.deflateSetDictionary(this.strm,r)))throw new Error(ht[i]);this._dict_set=!0}}function Vt(t,e){var i=new Kt(e);if(i.push(t,!0),i.err)throw i.msg||ht[i.err];return i.result}Kt.prototype.push=function(t,e){var i,r,a=this.strm,n=this.options.chunkSize;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?a.input=Ft(t):"[object ArrayBuffer]"===Zt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new x.Buf8(n),a.next_out=0,a.avail_out=n),1!==(i=zt.deflate(a,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(Ht(x.shrinkBuf(a.output,a.next_out))):this.onData(x.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==i);return 4===r?(i=zt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),a.avail_out=0,!0)},Kt.prototype.onData=function(t){this.chunks.push(t)},Kt.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=x.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Xt={Deflate:Kt,deflate:Vt,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Vt(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Vt(t,e)}},Yt=function(t,e){var i,r,a,n,s,o,c,f,d,h,l,u,g,w,p,m,y,_,b,v,x,k,E,S,$;i=t.state,r=t.next_in,S=t.input,a=r+(t.avail_in-5),n=t.next_out,$=t.output,s=n-(e-t.avail_out),o=n+(t.avail_out-257),c=i.dmax,f=i.wsize,d=i.whave,h=i.wnext,l=i.window,u=i.hold,g=i.bits,w=i.lencode,p=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{g<15&&(u+=S[r++]<<g,g+=8,u+=S[r++]<<g,g+=8),_=w[u&m];e:for(;;){if(u>>>=b=_>>>24,g-=b,0===(b=_>>>16&255))$[n++]=65535&_;else{if(!(16&b)){if(64&b){if(32&b){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=w[(65535&_)+(u&(1<<b)-1)];continue e}for(v=65535&_,(b&=15)&&(g<b&&(u+=S[r++]<<g,g+=8),v+=u&(1<<b)-1,u>>>=b,g-=b),g<15&&(u+=S[r++]<<g,g+=8,u+=S[r++]<<g,g+=8),_=p[u&y];;){if(u>>>=b=_>>>24,g-=b,16&(b=_>>>16&255)){if(x=65535&_,g<(b&=15)&&(u+=S[r++]<<g,(g+=8)<b&&(u+=S[r++]<<g,g+=8)),(x+=u&(1<<b)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(u>>>=b,g-=b,x>(b=n-s)){if((b=x-b)>d&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(k=0,E=l,0===h){if(k+=f-b,b<v){v-=b;do{$[n++]=l[k++]}while(--b);k=n-x,E=$}}else if(h<b){if(k+=f+h-b,(b-=h)<v){v-=b;do{$[n++]=l[k++]}while(--b);if(k=0,h<v){v-=b=h;do{$[n++]=l[k++]}while(--b);k=n-x,E=$}}}else if(k+=h-b,b<v){v-=b;do{$[n++]=l[k++]}while(--b);k=n-x,E=$}for(;v>2;)$[n++]=E[k++],$[n++]=E[k++],$[n++]=E[k++],v-=3;v&&($[n++]=E[k++],v>1&&($[n++]=E[k++]))}else{k=n-x;do{$[n++]=$[k++],$[n++]=$[k++],$[n++]=$[k++],v-=3}while(v>2);v&&($[n++]=$[k++],v>1&&($[n++]=$[k++]))}break}if(64&b){t.msg="invalid distance code",i.mode=30;break t}_=p[(65535&_)+(u&(1<<b)-1)]}}break}}while(r<a&&n<o);r-=v=g>>3,u&=(1<<(g-=v<<3))-1,t.next_in=r,t.next_out=n,t.avail_in=r<a?a-r+5:5-(r-a),t.avail_out=n<o?o-n+257:257-(n-o),i.hold=u,i.bits=g},Jt=15,Qt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],te=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],ee=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],ie=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],re=function(t,e,i,r,a,n,s,o){var c,f,d,h,l,u,g,w,p,m=o.bits,y=0,_=0,b=0,v=0,k=0,E=0,S=0,$=0,j=0,A=0,B=null,R=0,P=new x.Buf16(16),O=new x.Buf16(16),C=null,I=0;for(y=0;y<=Jt;y++)P[y]=0;for(_=0;_<r;_++)P[e[i+_]]++;for(k=m,v=Jt;v>=1&&0===P[v];v--);if(k>v&&(k=v),0===v)return a[n++]=20971520,a[n++]=20971520,o.bits=1,0;for(b=1;b<v&&0===P[b];b++);for(k<b&&(k=b),$=1,y=1;y<=Jt;y++)if($<<=1,($-=P[y])<0)return-1;if($>0&&(0===t||1!==v))return-1;for(O[1]=0,y=1;y<Jt;y++)O[y+1]=O[y]+P[y];for(_=0;_<r;_++)0!==e[i+_]&&(s[O[e[i+_]]++]=_);if(0===t?(B=C=s,u=19):1===t?(B=Qt,R-=257,C=te,I-=257,u=256):(B=ee,C=ie,u=-1),A=0,_=0,y=b,l=n,E=k,S=0,d=-1,h=(j=1<<k)-1,1===t&&j>852||2===t&&j>592)return 1;for(;;){g=y-S,s[_]<u?(w=0,p=s[_]):s[_]>u?(w=C[I+s[_]],p=B[R+s[_]]):(w=96,p=0),c=1<<y-S,b=f=1<<E;do{a[l+(A>>S)+(f-=c)]=g<<24|w<<16|p}while(0!==f);for(c=1<<y-1;A&c;)c>>=1;if(0!==c?(A&=c-1,A+=c):A=0,_++,0==--P[y]){if(y===v)break;y=e[i+s[_]]}if(y>k&&(A&h)!==d){for(0===S&&(S=k),l+=b,$=1<<(E=y-S);E+S<v&&!(($-=P[E+S])<=0);)E++,$<<=1;if(j+=1<<E,1===t&&j>852||2===t&&j>592)return 1;a[d=A&h]=k<<24|E<<16|l-n}}return 0!==A&&(a[l+A]=y-S<<24|64<<16),o.bits=k,0},ae=-2,ne=12,se=30;function oe(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function ce(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new x.Buf16(320),this.work=new x.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function fe(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new x.Buf32(852),e.distcode=e.distdyn=new x.Buf32(592),e.sane=1,e.back=-1,0):ae}function de(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,fe(t)):ae}function he(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?ae:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,de(t))):ae}function le(t,e){var i,r;return t?(r=new ce,t.state=r,r.window=null,0!==(i=he(t,e))&&(t.state=null),i):ae}var ue,ge,we=!0;function pe(t){if(we){var e;for(ue=new x.Buf32(512),ge=new x.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(re(1,t.lens,0,288,ue,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;re(2,t.lens,0,32,ge,0,t.work,{bits:5}),we=!1}t.lencode=ue,t.lenbits=9,t.distcode=ge,t.distbits=5}function me(t,e,i,r){var a,n=t.state;return null===n.window&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new x.Buf8(n.wsize)),r>=n.wsize?(x.arraySet(n.window,e,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):((a=n.wsize-n.wnext)>r&&(a=r),x.arraySet(n.window,e,i-r,a,n.wnext),(r-=a)?(x.arraySet(n.window,e,i-r,r,0),n.wnext=r,n.whave=n.wsize):(n.wnext+=a,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=a))),0}var ye={inflateReset:de,inflateReset2:he,inflateResetKeep:fe,inflateInit:function(t){return le(t,15)},inflateInit2:le,inflate:function(t,e){var i,r,a,n,s,o,c,f,d,h,l,u,g,w,p,m,y,_,b,v,k,E,S,$,j=0,A=new x.Buf8(4),B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return ae;(i=t.state).mode===ne&&(i.mode=13),s=t.next_out,a=t.output,c=t.avail_out,n=t.next_in,r=t.input,o=t.avail_in,f=i.hold,d=i.bits,h=o,l=c,E=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(2&i.wrap&&35615===f){i.check=0,A[0]=255&f,A[1]=f>>>8&255,i.check=dt(i.check,A,2,0),f=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&f)<<8)+(f>>8))%31){t.msg="incorrect header check",i.mode=se;break}if(8!=(15&f)){t.msg="unknown compression method",i.mode=se;break}if(d-=4,k=8+(15&(f>>>=4)),0===i.wbits)i.wbits=k;else if(k>i.wbits){t.msg="invalid window size",i.mode=se;break}i.dmax=1<<k,t.adler=i.check=1,i.mode=512&f?10:ne,f=0,d=0;break;case 2:for(;d<16;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(i.flags=f,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=se;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=se;break}i.head&&(i.head.text=f>>8&1),512&i.flags&&(A[0]=255&f,A[1]=f>>>8&255,i.check=dt(i.check,A,2,0)),f=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.head&&(i.head.time=f),512&i.flags&&(A[0]=255&f,A[1]=f>>>8&255,A[2]=f>>>16&255,A[3]=f>>>24&255,i.check=dt(i.check,A,4,0)),f=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.head&&(i.head.xflags=255&f,i.head.os=f>>8),512&i.flags&&(A[0]=255&f,A[1]=f>>>8&255,i.check=dt(i.check,A,2,0)),f=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.length=f,i.head&&(i.head.extra_len=f),512&i.flags&&(A[0]=255&f,A[1]=f>>>8&255,i.check=dt(i.check,A,2,0)),f=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((u=i.length)>o&&(u=o),u&&(i.head&&(k=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),x.arraySet(i.head.extra,r,n,u,k)),512&i.flags&&(i.check=dt(i.check,r,u,n)),o-=u,n+=u,i.length-=u),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===o)break t;u=0;do{k=r[n+u++],i.head&&k&&i.length<65536&&(i.head.name+=String.fromCharCode(k))}while(k&&u<o);if(512&i.flags&&(i.check=dt(i.check,r,u,n)),o-=u,n+=u,k)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===o)break t;u=0;do{k=r[n+u++],i.head&&k&&i.length<65536&&(i.head.comment+=String.fromCharCode(k))}while(k&&u<o);if(512&i.flags&&(i.check=dt(i.check,r,u,n)),o-=u,n+=u,k)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(f!==(65535&i.check)){t.msg="header crc mismatch",i.mode=se;break}f=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=ne;break;case 10:for(;d<32;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}t.adler=i.check=oe(f),f=0,d=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=s,t.avail_out=c,t.next_in=n,t.avail_in=o,i.hold=f,i.bits=d,2;t.adler=i.check=1,i.mode=ne;case ne:if(5===e||6===e)break t;case 13:if(i.last){f>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}switch(i.last=1&f,d-=1,3&(f>>>=1)){case 0:i.mode=14;break;case 1:if(pe(i),i.mode=20,6===e){f>>>=2,d-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=se}f>>>=2,d-=2;break;case 14:for(f>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if((65535&f)!=(f>>>16^65535)){t.msg="invalid stored block lengths",i.mode=se;break}if(i.length=65535&f,f=0,d=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(u=i.length){if(u>o&&(u=o),u>c&&(u=c),0===u)break t;x.arraySet(a,r,n,u,s),o-=u,n+=u,c-=u,s+=u,i.length-=u;break}i.mode=ne;break;case 17:for(;d<14;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(i.nlen=257+(31&f),f>>>=5,d-=5,i.ndist=1+(31&f),f>>>=5,d-=5,i.ncode=4+(15&f),f>>>=4,d-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=se;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.lens[B[i.have++]]=7&f,f>>>=3,d-=3}for(;i.have<19;)i.lens[B[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,S={bits:i.lenbits},E=re(0,i.lens,0,19,i.lencode,0,i.work,S),i.lenbits=S.bits,E){t.msg="invalid code lengths set",i.mode=se;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(j=i.lencode[f&(1<<i.lenbits)-1])>>>16&255,y=65535&j,!((p=j>>>24)<=d);){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(y<16)f>>>=p,d-=p,i.lens[i.have++]=y;else{if(16===y){for($=p+2;d<$;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(f>>>=p,d-=p,0===i.have){t.msg="invalid bit length repeat",i.mode=se;break}k=i.lens[i.have-1],u=3+(3&f),f>>>=2,d-=2}else if(17===y){for($=p+3;d<$;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}d-=p,k=0,u=3+(7&(f>>>=p)),f>>>=3,d-=3}else{for($=p+7;d<$;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}d-=p,k=0,u=11+(127&(f>>>=p)),f>>>=7,d-=7}if(i.have+u>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=se;break}for(;u--;)i.lens[i.have++]=k}}if(i.mode===se)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=se;break}if(i.lenbits=9,S={bits:i.lenbits},E=re(1,i.lens,0,i.nlen,i.lencode,0,i.work,S),i.lenbits=S.bits,E){t.msg="invalid literal/lengths set",i.mode=se;break}if(i.distbits=6,i.distcode=i.distdyn,S={bits:i.distbits},E=re(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,S),i.distbits=S.bits,E){t.msg="invalid distances set",i.mode=se;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(o>=6&&c>=258){t.next_out=s,t.avail_out=c,t.next_in=n,t.avail_in=o,i.hold=f,i.bits=d,Yt(t,l),s=t.next_out,a=t.output,c=t.avail_out,n=t.next_in,r=t.input,o=t.avail_in,f=i.hold,d=i.bits,i.mode===ne&&(i.back=-1);break}for(i.back=0;m=(j=i.lencode[f&(1<<i.lenbits)-1])>>>16&255,y=65535&j,!((p=j>>>24)<=d);){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(m&&!(240&m)){for(_=p,b=m,v=y;m=(j=i.lencode[v+((f&(1<<_+b)-1)>>_)])>>>16&255,y=65535&j,!(_+(p=j>>>24)<=d);){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}f>>>=_,d-=_,i.back+=_}if(f>>>=p,d-=p,i.back+=p,i.length=y,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=ne;break}if(64&m){t.msg="invalid literal/length code",i.mode=se;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for($=i.extra;d<$;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.length+=f&(1<<i.extra)-1,f>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(j=i.distcode[f&(1<<i.distbits)-1])>>>16&255,y=65535&j,!((p=j>>>24)<=d);){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(!(240&m)){for(_=p,b=m,v=y;m=(j=i.distcode[v+((f&(1<<_+b)-1)>>_)])>>>16&255,y=65535&j,!(_+(p=j>>>24)<=d);){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}f>>>=_,d-=_,i.back+=_}if(f>>>=p,d-=p,i.back+=p,64&m){t.msg="invalid distance code",i.mode=se;break}i.offset=y,i.extra=15&m,i.mode=24;case 24:if(i.extra){for($=i.extra;d<$;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}i.offset+=f&(1<<i.extra)-1,f>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=se;break}i.mode=25;case 25:if(0===c)break t;if(u=l-c,i.offset>u){if((u=i.offset-u)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=se;break}u>i.wnext?(u-=i.wnext,g=i.wsize-u):g=i.wnext-u,u>i.length&&(u=i.length),w=i.window}else w=a,g=s-i.offset,u=i.length;u>c&&(u=c),c-=u,i.length-=u;do{a[s++]=w[g++]}while(--u);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;a[s++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===o)break t;o--,f|=r[n++]<<d,d+=8}if(l-=c,t.total_out+=l,i.total+=l,l&&(t.adler=i.check=i.flags?dt(i.check,a,l,s-l):ot(i.check,a,l,s-l)),l=c,(i.flags?f:oe(f))!==i.check){t.msg="incorrect data check",i.mode=se;break}f=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===o)break t;o--,f+=r[n++]<<d,d+=8}if(f!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=se;break}f=0,d=0}i.mode=29;case 29:E=1;break t;case se:E=-3;break t;case 31:return-4;default:return ae}return t.next_out=s,t.avail_out=c,t.next_in=n,t.avail_in=o,i.hold=f,i.bits=d,(i.wsize||l!==t.avail_out&&i.mode<se&&(i.mode<27||4!==e))&&me(t,t.output,t.next_out,l-t.avail_out),h-=t.avail_in,l-=t.avail_out,t.total_in+=h,t.total_out+=l,i.total+=l,i.wrap&&l&&(t.adler=i.check=i.flags?dt(i.check,a,l,t.next_out-l):ot(i.check,a,l,t.next_out-l)),t.data_type=i.bits+(i.last?64:0)+(i.mode===ne?128:0)+(20===i.mode||15===i.mode?256:0),(0===h&&0===l||4===e)&&0===E&&(E=-5),E},inflateEnd:function(t){if(!t||!t.state)return ae;var e=t.state;return e.window&&(e.window=null),t.state=null,0},inflateGetHeader:function(t,e){var i;return t&&t.state&&2&(i=t.state).wrap?(i.head=e,e.done=!1,0):ae},inflateSetDictionary:function(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?ae:11===i.mode&&ot(1,e,r,0)!==i.check?-3:me(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):ae},inflateInfo:"pako inflate (from Nodeca project)"},_e={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var be=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},ve=Object.prototype.toString;function xe(t){if(!(this instanceof xe))return new xe(t);this.options=x.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Gt,this.strm.avail_out=0;var i=ye.inflateInit2(this.strm,e.windowBits);if(i!==_e.Z_OK)throw new Error(ht[i]);if(this.header=new be,ye.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Ft(e.dictionary):"[object ArrayBuffer]"===ve.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=ye.inflateSetDictionary(this.strm,e.dictionary))!==_e.Z_OK))throw new Error(ht[i])}function ke(t,e){var i=new xe(e);if(i.push(t,!0),i.err)throw i.msg||ht[i.err];return i.result}xe.prototype.push=function(t,e){var i,r,a,n,s,o=this.strm,c=this.options.chunkSize,f=this.options.dictionary,d=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?_e.Z_FINISH:_e.Z_NO_FLUSH,"string"==typeof t?o.input=qt(t):"[object ArrayBuffer]"===ve.call(t)?o.input=new Uint8Array(t):o.input=t,o.next_in=0,o.avail_in=o.input.length;do{if(0===o.avail_out&&(o.output=new x.Buf8(c),o.next_out=0,o.avail_out=c),(i=ye.inflate(o,_e.Z_NO_FLUSH))===_e.Z_NEED_DICT&&f&&(i=ye.inflateSetDictionary(this.strm,f)),i===_e.Z_BUF_ERROR&&!0===d&&(i=_e.Z_OK,d=!1),i!==_e.Z_STREAM_END&&i!==_e.Z_OK)return this.onEnd(i),this.ended=!0,!1;o.next_out&&(0!==o.avail_out&&i!==_e.Z_STREAM_END&&(0!==o.avail_in||r!==_e.Z_FINISH&&r!==_e.Z_SYNC_FLUSH)||("string"===this.options.to?(a=Wt(o.output,o.next_out),n=o.next_out-a,s=Lt(o.output,a),o.next_out=n,o.avail_out=c-n,n&&x.arraySet(o.output,o.output,a,n,0),this.onData(s)):this.onData(x.shrinkBuf(o.output,o.next_out)))),0===o.avail_in&&0===o.avail_out&&(d=!0)}while((o.avail_in>0||0===o.avail_out)&&i!==_e.Z_STREAM_END);return i===_e.Z_STREAM_END&&(r=_e.Z_FINISH),r===_e.Z_FINISH?(i=ye.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===_e.Z_OK):r!==_e.Z_SYNC_FLUSH||(this.onEnd(_e.Z_OK),o.avail_out=0,!0)},xe.prototype.onData=function(t){this.chunks.push(t)},xe.prototype.onEnd=function(t){t===_e.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=x.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ee={Inflate:xe,inflate:ke,inflateRaw:function(t,e){return(e=e||{}).raw=!0,ke(t,e)},ungzip:ke},Se={};(0,x.assign)(Se,Xt,Ee,_e);var $e=Se;const je=(t,e)=>function(...i){return new(0,e.promiseModule)(((r,a)=>{e.multiArgs?i.push(((...t)=>{e.errorFirst?t[0]?a(t):(t.shift(),r(t)):r(t)})):e.errorFirst?i.push(((t,e)=>{t?a(t):r(e)})):i.push(r),t.apply(this,i)}))};var Ae=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const i=typeof t;if(null===t||"object"!==i&&"function"!==i)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===t?"null":i}\``);const r=t=>{const i=e=>"string"==typeof e?t===e:e.test(t);return e.include?e.include.some(i):!e.exclude.some(i)};let a;a="function"===i?function(...i){return e.excludeMain?t(...i):je(t,e).apply(this,i)}:Object.create(Object.getPrototypeOf(t));for(const i in t){const n=t[i];a[i]="function"==typeof n&&r(i)?je(n,e):n}return a};function Be(t){return Array.isArray(t)?t:[t]}const Re=/^\s+$/,Pe=/^\\!/,Oe=/^\\#/,Ce=/\r?\n/g,Ie=/^\.*\/|^\.+$/,ze="undefined"!=typeof Symbol?Symbol.for("node-ignore"):"node-ignore",Te=/([0-z])-([0-z])/g,De=[[/\\?\s+$/,t=>0===t.indexOf("\\")?" ":""],[/\\\s/g,()=>" "],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,i)=>e+6<i.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)\\\*(?=.+)/g,(t,e)=>`${e}[^\\/]*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,i,r,a)=>"\\"===e?`\\[${i}${(t=>{const{length:e}=t;return t.slice(0,e-e%2)})(r)}${a}`:"]"===a&&r.length%2==0?`[${(t=>t.replace(Te,((t,e,i)=>e.charCodeAt(0)<=i.charCodeAt(0)?t:"")))(i)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Ne=Object.create(null),Ue=t=>"string"==typeof t;class Me{constructor(t,e,i,r){this.origin=t,this.pattern=e,this.negative=i,this.regex=r}}const Fe=(t,e)=>{const i=t;let r=!1;0===t.indexOf("!")&&(r=!0,t=t.substr(1));const a=((t,e,i)=>{const r=Ne[t];if(r)return r;const a=De.reduce(((e,i)=>e.replace(i[0],i[1].bind(t))),t);return Ne[t]=i?new RegExp(a,"i"):new RegExp(a)})(t=t.replace(Pe,"!").replace(Oe,"#"),0,e);return new Me(i,t,r,a)},He=(t,e)=>{throw new e(t)},qe=(t,e,i)=>{if(!Ue(t))return i(`path must be a string, but got \`${e}\``,TypeError);if(!t)return i("path must not be empty",TypeError);if(qe.isNotRelative(t)){return i(`path should be a ${"`path.relative()`d"} string, but got "${e}"`,RangeError)}return!0},Le=t=>Ie.test(t);qe.isNotRelative=Le,qe.convert=t=>t;class We{constructor({ignorecase:t=!0}={}){var e,i,r;this._rules=[],this._ignorecase=t,e=this,i=ze,r=!0,Object.defineProperty(e,i,{value:r}),this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[ze])return this._rules=this._rules.concat(t._rules),void(this._added=!0);if((t=>t&&Ue(t)&&!Re.test(t)&&0!==t.indexOf("#"))(t)){const e=Fe(t,this._ignorecase);this._added=!0,this._rules.push(e)}}add(t){return this._added=!1,Be(Ue(t)?(t=>t.split(Ce))(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,e){let i=!1,r=!1;return this._rules.forEach((a=>{const{negative:n}=a;if(r===n&&i!==r||n&&!i&&!r&&!e)return;a.regex.test(t)&&(i=!n,r=n)})),{ignored:i,unignored:r}}_test(t,e,i,r){const a=t&&qe.convert(t);return qe(a,t,He),this._t(a,e,i,r)}_t(t,e,i,r){if(t in e)return e[t];if(r||(r=t.split("/")),r.pop(),!r.length)return e[t]=this._testOne(t,i);const a=this._t(r.join("/")+"/",e,i,r);return e[t]=a.ignored?a:this._testOne(t,i)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return Be(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}}const Ge=t=>new We(t),Ze=()=>!1;Ge.isPathValid=t=>qe(t&&qe.convert(t),t,Ze),Ge.default=Ge;var Ke=Ge;if("undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const t=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");qe.convert=t;const e=/^[a-z]:\//i;qe.isNotRelative=t=>e.test(t)||Le(t)}function Ve(t,e,i){return e=e instanceof RegExp?e:new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),t.replace(e,i)}var Xe={clean:function(t){if("string"!=typeof t)throw new Error("Expected a string, received: "+t);return t=Ve(t,"./","/"),t=Ve(t,"..","."),t=Ve(t," ","-"),t=Ve(t,/^[~^:?*\\\-]/g,""),t=Ve(t,/[~^:?*\\]/g,"-"),t=Ve(t,/[~^:?*\\\-]$/g,""),t=Ve(t,"@{","-"),t=Ve(t,/\.$/g,""),t=Ve(t,/\/$/g,""),t=Ve(t,/\.lock$/g,"")}},Ye=function(t,e){var i,r,a=t,n=e,s=a.length,o=n.length,c=!1,f=null,d=s+1,h=[],l=[],u=[],g="",w=function(t,e,i){return{x:t,y:e,k:i}},p=function(t,e){return{elem:t,t:e}},m=function(t,e,i){var r,c,f;for(r=e>i?h[t-1+d]:h[t+1+d],c=(f=Math.max(e,i))-t;c<s&&f<o&&a[c]===n[f];)++c,++f;return h[t+d]=l.length,l[l.length]=new w(c,f,r),f};return s>=o&&(i=a,r=s,a=n,n=i,s=o,o=r,c=!0,d=s+1),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return f},getlcs:function(){return g},getses:function(){return u},compose:function(){var t,e,i,r,y,_,b,v;for(t=o-s,e=s+o+3,i={},b=0;b<e;++b)i[b]=-1,h[b]=-1;r=-1;do{for(v=-++r;v<=t-1;++v)i[v+d]=m(v,i[v-1+d]+1,i[v+1+d]);for(v=t+r;v>=t+1;--v)i[v+d]=m(v,i[v-1+d]+1,i[v+1+d]);i[t+d]=m(t,i[t-1+d]+1,i[t+1+d])}while(i[t+d]!==o);for(f=t+2*r,y=h[t+d],_=[];-1!==y;)_[_.length]=new w(l[y].x,l[y].y,null),y=l[y].k;!function(t){var e,i,r;for(e=i=0,r=t.length-1;r>=0;--r)for(;e<t[r].x||i<t[r].y;)t[r].y-t[r].x>i-e?(u[u.length]=new p(n[i],c?-1:1),++i):t[r].y-t[r].x<i-e?(u[u.length]=new p(a[e],c?1:-1),++e):(u[u.length]=new p(a[e],0),g+=a[e],++e,++i)}(_)}}};function Je(t,e){for(var i=[],r=t.length,a=e.length,n=function(t,e){var i=new Ye(t,e);i.compose();for(var r,a,n=i.getses(),s=t.length-1,o=e.length-1,c=n.length-1;c>=0;--c)n[c].t===i.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):a=r={file1index:s,file2index:o,chain:null},s--,o--):n[c].t===i.SES_DELETE?s--:n[c].t===i.SES_ADD&&o--;var f={file1index:-1,file2index:-1,chain:null};return a?(a.chain=f,r):f}(t,e);null!==n;n=n.chain){var s=r-n.file1index-1,o=a-n.file2index-1;r=n.file1index,a=n.file2index,(s||o)&&i.push({file1:[r+1,s],file2:[a+1,o]})}return i.reverse(),i}var Qe=function(t,e,i){var r=[],a=[t,e,i],n=function(t,e,i){var r,a=Je(e,t),n=Je(e,i),s=[];function o(t,e){s.push([t.file1[0],e,t.file1[1],t.file2[0],t.file2[1]])}for(r=0;r<a.length;r++)o(a[r],0);for(r=0;r<n.length;r++)o(n[r],2);s.sort((function(t,e){return t[0]-e[0]}));var c=[],f=0;function d(t){t>f&&(c.push([1,f,t-f]),f=t)}for(var h=0;h<s.length;h++){for(var l=h,u=s[h],g=u[0],w=g+u[2];h<s.length-1;){var p=s[h+1],m=p[0];if(m>w)break;w=Math.max(w,m+p[2]),h++}if(d(g),l==h)u[4]>0&&c.push([u[1],u[3],u[4]]);else{var y={0:[t.length,-1,e.length,-1],2:[i.length,-1,e.length,-1]};for(r=l;r<=h;r++){var _=y[(u=s[r])[1]],b=u[0],v=b+u[2],x=u[3],k=x+u[4];_[0]=Math.min(x,_[0]),_[1]=Math.max(k,_[1]),_[2]=Math.min(b,_[2]),_[3]=Math.max(v,_[3])}var E=y[0][0]+(g-y[0][2]),S=y[0][1]+(w-y[0][3]),$=y[2][0]+(g-y[2][2]),j=y[2][1]+(w-y[2][3]);c.push([-1,E,S-E,g,w-g,$,j-$])}f=w}return d(e.length),c}(t,e,i),s=[];function o(){s.length&&r.push({ok:s}),s=[]}function c(t){for(var e=0;e<t.length;e++)s.push(t[e])}function f(e){if(e[2]!=e[6])return!0;for(var r=e[1],a=e[5],n=0;n<e[2];n++)if(t[n+r]!=i[n+a])return!0;return!1}for(var d=0;d<n.length;d++){var h=n[d],l=h[0];-1==l?f(h)?(o(),r.push({conflict:{a:t.slice(h[1],h[1]+h[2]),aIndex:h[1],o:e.slice(h[3],h[3]+h[4]),oIndex:h[3],b:i.slice(h[5],h[5]+h[6]),bIndex:h[5]}})):c(a[0].slice(h[1],h[1]+h[2])):c(a[l].slice(h[1],h[1]+h[2]))}return o(),r};class ti 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 ti(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 ei extends ti{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=ei.code,this.data={filepaths:t}}}ei.code="UnmergedPathsError";class ii extends ti{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=ii.code,this.data={message:t}}}ii.code="InternalError";class ri extends ti{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=ri.code,this.data={filepath:t}}}ri.code="UnsafeFilepathError";class ai{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 i=this.buffer.toString(t,this._start,this._start+e);return this._start+=e,i}write(t,e,i){const r=this.buffer.write(t,this._start,e,i);return this._start+=e,r}copy(t,e,i){const r=t.copy(this.buffer,this._start,e,i);return this._start+=r,r}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 ni(t,e){return-(t<e)||+(t>e)}function si(t,e){return ni(t.path,e.path)}function oi(t){let e=t>0?t>>12:0;4!==e&&8!==e&&10!==e&&14!==e&&(e=8);let i=511&t;return i=73&i?493:420,8!==e&&(i=0),(e<<12)+i}const ci=2**32;function fi(t,e,i,r){if(void 0!==t&&void 0!==e)return[t,e];void 0===i&&(i=r.valueOf());const a=Math.floor(i/1e3);return[a,1e6*(i-1e3*a)]}function di(t){const[e,i]=fi(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,a]=fi(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%ci,ctimeNanoseconds:i%ci,mtimeSeconds:r%ci,mtimeNanoseconds:a%ci,dev:t.dev%ci,ino:t.ino%ci,mode:oi(t.mode%ci),uid:t.uid%ci,gid:t.gid%ci,size:t.size>-1?t.size%ci:0}}let hi=null;async function li(t){return null===hi&&(hi=await async function(){try{if("da39a3ee5e6b4b0d3255bfef95601890afd80709"===await ui(new Uint8Array([])))return!0}catch(t){}return!1}()),hi?ui(t):function(t){return(new p).update(t).digest("hex")}(t)}async function ui(t){return function(t){let e="";for(const i of new Uint8Array(t))i<16&&(e+="0"),e+=i.toString(16);return e}(await crypto.subtle.digest("SHA-1",t))}class gi{constructor(t,e){this._dirty=!1,this._unmergedPaths=e||new Set,this._entries=t||new Map}_addEntry(t){if(0===t.flags.stage)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let e=this._entries.get(t.path);e||(this._entries.set(t.path,t),e=t),e.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return gi.fromBuffer(t);if(null===t)return new gi(null);throw new ii("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(0===t.length)throw new ii("Index file is empty (.git/index)");const e=new gi,i=new ai(t),r=i.toString("utf8",4);if("DIRC"!==r)throw new ii(`Invalid dircache magic file number: ${r}`);const a=await li(t.slice(0,-20)),n=t.slice(-20).toString("hex");if(n!==a)throw new ii(`Invalid checksum in GitIndex buffer: expected ${n} but saw ${a}`);const s=i.readUInt32BE();if(2!==s)throw new ii(`Unsupported dircache version: ${s}`);const o=i.readUInt32BE();let c=0;for(;!i.eof()&&c<o;){const r={};r.ctimeSeconds=i.readUInt32BE(),r.ctimeNanoseconds=i.readUInt32BE(),r.mtimeSeconds=i.readUInt32BE(),r.mtimeNanoseconds=i.readUInt32BE(),r.dev=i.readUInt32BE(),r.ino=i.readUInt32BE(),r.mode=i.readUInt32BE(),r.uid=i.readUInt32BE(),r.gid=i.readUInt32BE(),r.size=i.readUInt32BE(),r.oid=i.slice(20).toString("hex");const a=i.readUInt16BE();r.flags=(f=a,{assumeValid:Boolean(32768&f),extended:Boolean(16384&f),stage:(12288&f)>>12,nameLength:4095&f});const n=t.indexOf(0,i.tell()+1)-i.tell();if(n<1)throw new ii(`Got a path length of: ${n}`);if(r.path=i.toString("utf8",n),r.path.includes("..\\")||r.path.includes("../"))throw new ri(r.path);let s=8-(i.tell()-12)%8;for(0===s&&(s=8);s--;){const t=i.readUInt8();if(0!==t)throw new ii(`Expected 1-8 null characters but got '${t}' after ${r.path}`);if(i.eof())throw new ii("Unexpected end of file")}r.stages=[],e._addEntry(r),c++}var f;return e}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(si)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap((t=>t.stages.length>1?t.stages.filter((t=>t)):t))}*[Symbol.iterator](){for(const t of this.entries)yield t}insert({filepath:t,stats:e,oid:i,stage:r=0}){e||(e={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),e=di(e);const a=Buffer.from(t),n={ctimeSeconds:e.ctimeSeconds,ctimeNanoseconds:e.ctimeNanoseconds,mtimeSeconds:e.mtimeSeconds,mtimeNanoseconds:e.mtimeNanoseconds,dev:e.dev,ino:e.ino,mode:e.mode||33188,uid:e.uid,gid:e.gid,size:e.size,path:t,oid:i,flags:{assumeValid:!1,extended:!1,stage:r,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(n),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(const e of this._entries.keys())e.startsWith(t+"/")&&this._entries.delete(e);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map((t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`)).join("\n")}static async _entryToBuffer(t){const e=Buffer.from(t.path),i=8*Math.ceil((62+e.length+1)/8),r=Buffer.alloc(i),a=new ai(r),n=di(t);return a.writeUInt32BE(n.ctimeSeconds),a.writeUInt32BE(n.ctimeNanoseconds),a.writeUInt32BE(n.mtimeSeconds),a.writeUInt32BE(n.mtimeNanoseconds),a.writeUInt32BE(n.dev),a.writeUInt32BE(n.ino),a.writeUInt32BE(n.mode),a.writeUInt32BE(n.uid),a.writeUInt32BE(n.gid),a.writeUInt32BE(n.size),a.write(t.oid,20,"hex"),a.writeUInt16BE(function(t){const e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((3&e.stage)<<12)+(4095&e.nameLength)}(t)),a.write(t.path,e.length,"utf8"),r}async toObject(){const t=Buffer.alloc(12),e=new ai(t);e.write("DIRC",4,"utf8"),e.writeUInt32BE(2),e.writeUInt32BE(this.entriesFlat.length);let i=[];for(const t of this.entries)if(i.push(gi._entryToBuffer(t)),t.stages.length>1)for(const e of t.stages)e&&e!==t&&i.push(gi._entryToBuffer(e));i=await Promise.all(i);const r=Buffer.concat(i),a=Buffer.concat([t,r]),n=await li(a);return Buffer.concat([a,Buffer.from(n,"hex")])}}function wi(t,e,i=!0,r=!0){const a=di(t),n=di(e);return i&&a.mode!==n.mode||a.mtimeSeconds!==n.mtimeSeconds||a.ctimeSeconds!==n.ctimeSeconds||a.uid!==n.uid||a.gid!==n.gid||r&&a.ino!==n.ino||a.size!==n.size}let pi=null;const mi=Symbol("IndexCache");class yi{static async acquire({fs:t,gitdir:e,cache:i,allowUnmerged:r=!0},n){i[mi]||(i[mi]={map:new Map,stats:new Map});const s=`${e}/index`;let o;null===pi&&(pi=new a({maxPending:1/0}));let c=[];return await pi.acquire(s,(async()=>{const e=i[mi];await async function(t,e,i){const r=i.stats.get(e);if(void 0===r)return!0;if(null===r)return!1;const a=await t.lstat(e);return null!==a&&wi(r,a)}(t,s,e)&&await async function(t,e,i){const[r,a]=await Promise.all([t.lstat(e),t.read(e)]),n=await gi.from(a);i.map.set(e,n),i.stats.set(e,r)}(t,s,e);const a=e.map.get(s);if(c=a.unmergedPaths,c.length&&!r)throw new ei(c);if(o=await n(a),a._dirty){const i=await a.toObject();await t.write(s,i),e.stats.set(s,await t.lstat(s)),a._dirty=!1}})),o}}function _i(t){const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function bi(t){const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return-1===e?".":0===e?"/":t.slice(0,e)}function vi(t){const e=new Map,i=function(t){if(!e.has(t)){const r={type:"tree",fullpath:t,basename:_i(t),metadata:{},children:[]};e.set(t,r),r.parent=i(bi(t)),r.parent&&r.parent!==r&&r.parent.children.push(r)}return e.get(t)},r=function(t,r){if(!e.has(t)){const a={type:"blob",fullpath:t,basename:_i(t),metadata:r,parent:i(bi(t)),children:[]};a.parent&&a.parent.children.push(a),e.set(t,a)}return e.get(t)};i(".");for(const e of t)r(e.path,e);return e}class xi{constructor({fs:t,gitdir:e,cache:i}){this.treePromise=yi.acquire({fs:t,gitdir:e,cache:i},(async function(t){return vi(t.entries)}));const r=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return r.type(this)}async mode(){return r.mode(this)}async stat(){return r.stat(this)}async content(){return r.content(this)}async oid(){return r.oid(this)}}}async readdir(t){const e=t._fullpath,i=(await this.treePromise).get(e);if(!i)return null;if("blob"===i.type)return null;if("tree"!==i.type)throw new Error(`ENOTDIR: not a directory, scandir '${e}'`);const r=i.children.map((t=>t.fullpath));return r.sort(ni),r}async type(t){return!1===t._type&&await t.stat(),t._type}async mode(t){return!1===t._mode&&await t.stat(),t._mode}async stat(t){if(!1===t._stat){const e=(await this.treePromise).get(t._fullpath);if(!e)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);const i="tree"===e.type?{}:di(e.metadata);t._type="tree"===e.type?"tree":function(t){switch(t){case 16384:return"tree";case 33188:case 33261:case 40960:return"blob";case 57344:return"commit"}throw new ii(`Unexpected GitTree entry mode: ${t.toString(8)}`)}(i.mode),t._mode=i.mode,"tree"===e.type?t._stat=void 0:t._stat=i}return t._stat}async content(t){}async oid(t){if(!1===t._oid){const e=(await this.treePromise).get(t._fullpath);t._oid=e.metadata.oid}return t._oid}}const ki=Symbol("GitWalkSymbol");function Ei(){const t=Object.create(null);return Object.defineProperty(t,ki,{value:function({fs:t,gitdir:e,cache:i}){return new xi({fs:t,gitdir:e,cache:i})}}),Object.freeze(t),t}class Si extends ti{constructor(t){super(`Could not find ${t}.`),this.code=this.name=Si.code,this.data={what:t}}}Si.code="NotFoundError";class $i extends ti{constructor(t,e,i,r){super(`Object ${t} ${r?`at ${r}`:""}was anticipated to be a ${i} but it is a ${e}.`),this.code=this.name=$i.code,this.data={oid:t,actual:e,expected:i,filepath:r}}}$i.code="ObjectTypeError";class ji extends ti{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=ji.code,this.data={value:t}}}ji.code="InvalidOidError";class Ai extends ti{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:\n[remote "${t}"]\n\tfetch = +refs/heads/*:refs/remotes/origin/*\n`),this.code=this.name=Ai.code,this.data={remote:t}}}Ai.code="NoRefspecError";class Bi{constructor(t){if(this.refs=new Map,this.parsedConfig=[],t){let e=null;this.parsedConfig=t.trim().split("\n").map((t=>{if(/^\s*#/.test(t))return{line:t,comment:!0};const i=t.indexOf(" ");if(t.startsWith("^")){const i=t.slice(1);return this.refs.set(e+"^{}",i),{line:t,ref:e,peeled:i}}{const r=t.slice(0,i);return e=t.slice(i+1),this.refs.set(e,r),{line:t,ref:e,oid:r}}}))}return this}static from(t){return new Bi(t)}delete(t){this.parsedConfig=this.parsedConfig.filter((e=>e.ref!==t)),this.refs.delete(t)}toString(){return this.parsedConfig.map((({line:t})=>t)).join("\n")+"\n"}}class Ri{constructor({remotePath:t,localPath:e,force:i,matchPrefix:r}){Object.assign(this,{remotePath:t,localPath:e,force:i,matchPrefix:r})}static from(t){const[e,i,r,a,n]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),s="+"===e,o="*"===r;if(o!==("*"===n))throw new ii("Invalid refspec");return new Ri({remotePath:i,localPath:a,force:s,matchPrefix:o})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}}class Pi{constructor(t=[]){this.rules=t}static from(t){const e=[];for(const i of t)e.push(Ri.from(i));return new Pi(e)}add(t){const e=Ri.from(t);this.rules.push(e)}translate(t){const e=[];for(const i of this.rules)for(const r of t){const t=i.translate(r);t&&e.push([r,t])}return e}translateOne(t){let e=null;for(const i of this.rules){const r=i.translate(t);r&&(e=r)}return e}localNamespaces(){return this.rules.filter((t=>t.matchPrefix)).map((t=>t.localPath.replace(/\/$/,"")))}}function Oi(t,e){const i=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),a=-(i<r)||+(i>r);return 0===a?t.endsWith("^{}")?1:-1:a}const Ci=t=>{if("boolean"==typeof t)return t;if("true"===(t=t.trim().toLowerCase())||"yes"===t||"on"===t)return!0;if("false"===t||"no"===t||"off"===t)return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},Ii={core:{filemode:Ci,bare:Ci,logallrefupdates:Ci,symlinks:Ci,ignorecase:Ci,bigFileThreshold:t=>{if("number"==typeof t)return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1048576),t.endsWith("g")&&(e*=1073741824),e}}},zi=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,Ti=/^[A-Za-z0-9-.]+$/,Di=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,Ni=/^[A-Za-z][A-Za-z-]*$/,Ui=/^(.*?)( *[#;].*)$/,Mi=t=>{const e=Ui.exec(t);if(null==e)return t;const[i,r]=e.slice(1);return Fi(i)&&Fi(r)?`${i}${r}`:i},Fi=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!=0,Hi=t=>t.split("").reduce(((t,e,i,r)=>{const a='"'===e&&"\\"!==r[i-1],n="\\"===e&&'"'===r[i+1];return a||n?t:t+e}),""),qi=t=>null!=t?t.toLowerCase():null,Li=(t,e,i)=>[qi(t),e,qi(i)].filter((t=>null!=t)).join("."),Wi=t=>{const e=t.split("."),i=e.shift(),r=e.pop(),a=e.length?e.join("."):void 0;return{section:i,subsection:a,name:r,path:Li(i,a,r),sectionPath:Li(i,a,null),isSection:!!i}};class Gi{constructor(t){let e=null,i=null;this.parsedConfig=t?t.split("\n").map((t=>{let r=null,a=null;const n=t.trim(),s=(t=>{const e=zi.exec(t);if(null!=e){const[t,i]=e.slice(1);return[t,i]}return null})(n),o=null!=s;if(o)[e,i]=s;else{const t=(t=>{const e=Di.exec(t);if(null!=e){const[t,i="true"]=e.slice(1),r=Mi(i);return[t,Hi(r)]}return null})(n);null!=t&&([r,a]=t)}const c=Li(e,i,r);return{line:t,isSection:o,section:e,subsection:i,name:r,value:a,path:c}})):[]}static from(t){return new Gi(t)}async get(t,e=!1){const i=Wi(t).path,r=this.parsedConfig.filter((t=>t.path===i)).map((({section:t,name:e,value:i})=>{const r=Ii[t]&&Ii[t][e];return r?r(i):i}));return e?r:r.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter((e=>e.isSection&&e.section===t)).map((t=>t.subsection))}async deleteSection(t,e){this.parsedConfig=this.parsedConfig.filter((i=>!(i.section===t&&i.subsection===e)))}async append(t,e){return this.set(t,e,!0)}async set(t,e,i=!1){const{section:r,subsection:a,name:n,path:s,sectionPath:o,isSection:c}=Wi(t),f=(d=this.parsedConfig,h=t=>t.path===s,d.reduce(((t,e,i)=>h(e)?i:t),-1));var d,h;if(null==e)-1!==f&&this.parsedConfig.splice(f,1);else if(-1!==f){const t=this.parsedConfig[f],r=Object.assign({},t,{name:n,value:e,modified:!0});i?this.parsedConfig.splice(f+1,0,r):this.parsedConfig[f]=r}else{const t=this.parsedConfig.findIndex((t=>t.path===o)),i={section:r,subsection:a,name:n,value:e,modified:!0,path:s};if(Ti.test(r)&&Ni.test(n))if(t>=0)this.parsedConfig.splice(t+1,0,i);else{const t={isSection:c,section:r,subsection:a,modified:!0,path:o};this.parsedConfig.push(t,i)}}}toString(){return this.parsedConfig.map((({line:t,section:e,subsection:i,name:r,value:a,modified:n=!1})=>n?null!=r&&null!=a?"string"==typeof a&&/[#;]/.test(a)?`\t${r} = "${a}"`:`\t${r} = ${a}`:null!=i?`[${e} "${i}"]`:`[${e}]`:t)).join("\n")}}class Zi{static async get({fs:t,gitdir:e}){const i=await t.read(`${e}/config`,{encoding:"utf8"});return Gi.from(i)}static async save({fs:t,gitdir:e,config:i}){await t.write(`${e}/config`,i.toString(),{encoding:"utf8"})}}const Ki=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],Vi=["config","description","index","shallow","commondir"];let Xi;async function Yi(t,e){return void 0===Xi&&(Xi=new a),Xi.acquire(t,e)}class Ji{static async updateRemoteRefs({fs:t,gitdir:e,remote:i,refs:r,symrefs:a,tags:n,refspecs:s,prune:o=!1,pruneTags:c=!1}){for(const t of r.values())if(!t.match(/[0-9a-f]{40}/))throw new ji(t);const f=await Zi.get({fs:t,gitdir:e});if(!s){if(0===(s=await f.getall(`remote.${i}.fetch`)).length)throw new Ai(i);s.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}const d=Pi.from(s),h=new Map;if(c){const i=await Ji.listRefs({fs:t,gitdir:e,filepath:"refs/tags"});await Ji.deleteRefs({fs:t,gitdir:e,refs:i.map((t=>`refs/tags/${t}`))})}if(n)for(const i of r.keys())if(i.startsWith("refs/tags")&&!i.endsWith("^{}")&&!await Ji.exists({fs:t,gitdir:e,ref:i})){const t=r.get(i);h.set(i,t)}const l=d.translate([...r.keys()]);for(const[t,e]of l){const i=r.get(t);h.set(e,i)}const u=d.translate([...a.keys()]);for(const[t,e]of u){const i=a.get(t),r=d.translateOne(i);r&&h.set(e,`ref: ${r}`)}const g=[];if(o){for(const i of d.localNamespaces()){const r=(await Ji.listRefs({fs:t,gitdir:e,filepath:i})).map((t=>`${i}/${t}`));for(const t of r)h.has(t)||g.push(t)}g.length>0&&await Ji.deleteRefs({fs:t,gitdir:e,refs:g})}for(const[i,r]of h)await Yi(i,(async()=>t.write(b.join(e,i),`${r.trim()}\n`,"utf8")));return{pruned:g}}static async writeRef({fs:t,gitdir:e,ref:i,value:r}){if(!r.match(/[0-9a-f]{40}/))throw new ji(r);await Yi(i,(async()=>t.write(b.join(e,i),`${r.trim()}\n`,"utf8")))}static async writeSymbolicRef({fs:t,gitdir:e,ref:i,value:r}){await Yi(i,(async()=>t.write(b.join(e,i),`ref: ${r.trim()}\n`,"utf8")))}static async deleteRef({fs:t,gitdir:e,ref:i}){return Ji.deleteRefs({fs:t,gitdir:e,refs:[i]})}static async deleteRefs({fs:t,gitdir:e,refs:i}){await Promise.all(i.map((i=>t.rm(b.join(e,i)))));let r=await Yi("packed-refs",(async()=>t.read(`${e}/packed-refs`,{encoding:"utf8"})));const a=Bi.from(r),n=a.refs.size;for(const t of i)a.refs.has(t)&&a.delete(t);a.refs.size<n&&(r=a.toString(),await Yi("packed-refs",(async()=>t.write(`${e}/packed-refs`,r,{encoding:"utf8"}))))}static async resolve({fs:t,gitdir:e,ref:i,depth:r}){if(void 0!==r&&-1===--r)return i;if(i.startsWith("ref: "))return i=i.slice(5),Ji.resolve({fs:t,gitdir:e,ref:i,depth:r});if(40===i.length&&/[0-9a-f]{40}/.test(i))return i;const a=await Ji.packedRefs({fs:t,gitdir:e}),n=Ki(i).filter((t=>!Vi.includes(t)));for(const i of n){const n=await Yi(i,(async()=>await t.read(`${e}/${i}`,{encoding:"utf8"})||a.get(i)));if(n)return Ji.resolve({fs:t,gitdir:e,ref:n.trim(),depth:r})}throw new Si(i)}static async exists({fs:t,gitdir:e,ref:i}){try{return await Ji.expand({fs:t,gitdir:e,ref:i}),!0}catch(t){return!1}}static async expand({fs:t,gitdir:e,ref:i}){if(40===i.length&&/[0-9a-f]{40}/.test(i))return i;const r=await Ji.packedRefs({fs:t,gitdir:e}),a=Ki(i);for(const i of a){if(await Yi(i,(async()=>t.exists(`${e}/${i}`))))return i;if(r.has(i))return i}throw new Si(i)}static async expandAgainstMap({ref:t,map:e}){const i=Ki(t);for(const t of i)if(await e.has(t))return t;throw new Si(t)}static resolveAgainstMap({ref:t,fullref:e=t,depth:i,map:r}){if(void 0!==i&&-1===--i)return{fullref:e,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),Ji.resolveAgainstMap({ref:t,fullref:e,depth:i,map:r});if(40===t.length&&/[0-9a-f]{40}/.test(t))return{fullref:e,oid:t};const a=Ki(t);for(const t of a){const e=r.get(t);if(e)return Ji.resolveAgainstMap({ref:e.trim(),fullref:t,depth:i,map:r})}throw new Si(t)}static async packedRefs({fs:t,gitdir:e}){const i=await Yi("packed-refs",(async()=>t.read(`${e}/packed-refs`,{encoding:"utf8"})));return Bi.from(i).refs}static async listRefs({fs:t,gitdir:e,filepath:i}){const r=Ji.packedRefs({fs:t,gitdir:e});let a=null;try{a=await t.readdirDeep(`${e}/${i}`),a=a.map((t=>t.replace(`${e}/${i}/`,"")))}catch(t){a=[]}for(let t of(await r).keys())t.startsWith(i)&&(t=t.replace(i+"/",""),a.includes(t)||a.push(t));return a.sort(Oi),a}static async listBranches({fs:t,gitdir:e,remote:i}){return i?Ji.listRefs({fs:t,gitdir:e,filepath:`refs/remotes/${i}`}):Ji.listRefs({fs:t,gitdir:e,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:e}){return(await Ji.listRefs({fs:t,gitdir:e,filepath:"refs/tags"})).filter((t=>!t.endsWith("^{}")))}}function Qi(t,e){return ni(tr(t),tr(e))}function tr(t){return"040000"===t.mode?t.path+"/":t.path}function er(t){switch(t){case"040000":return"tree";case"100644":case"100755":case"120000":return"blob";case"160000":return"commit"}throw new ii(`Unexpected GitTree entry mode: ${t}`)}function ir(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=function(t){if("number"==typeof t&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new ii(`Could not understand file mode: ${t}`)}(t.mode),t.type||(t.type=er(t.mode)),t}class rr{constructor(t){if(Buffer.isBuffer(t))this._entries=function(t){const e=[];let i=0;for(;i<t.length;){const r=t.indexOf(32,i);if(-1===r)throw new ii(`GitTree: Error parsing buffer at byte location ${i}: Could not find the next space character.`);const a=t.indexOf(0,i);if(-1===a)throw new ii(`GitTree: Error parsing buffer at byte location ${i}: Could not find the next null character.`);let n=t.slice(i,r).toString("utf8");"40000"===n&&(n="040000");const s=er(n),o=t.slice(r+1,a).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new ri(o);const c=t.slice(a+1,a+21).toString("hex");i=a+21,e.push({mode:n,path:o,oid:c,type:s})}return e}(t);else{if(!Array.isArray(t))throw new ii("invalid type passed to GitTree constructor");this._entries=t.map(ir)}this._entries.sort(si)}static from(t){return new rr(t)}render(){return this._entries.map((t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`)).join("\n")}toObject(){const t=[...this._entries];return t.sort(Qi),Buffer.concat(t.map((t=>{const e=Buffer.from(t.mode.replace(/^0/,"")),i=Buffer.from(" "),r=Buffer.from(t.path,"utf8"),a=Buffer.from([0]),n=Buffer.from(t.oid,"hex");return Buffer.concat([e,i,r,a,n])})))}entries(){return this._entries}*[Symbol.iterator](){for(const t of this._entries)yield t}}class ar{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),i=t.indexOf(0),r=t.slice(0,e).toString("utf8"),a=t.slice(e+1,i).toString("utf8"),n=t.length-(i+1);if(parseInt(a)!==n)throw new ii(`Length mismatch: expected ${a} bytes but got ${n} instead.`);return{type:r,object:Buffer.from(t.slice(i+1))}}}async function nr({fs:t,gitdir:e,oid:i}){const r=`objects/${i.slice(0,2)}/${i.slice(2)}`,a=await t.read(`${e}/${r}`);return a?{object:a,format:"deflated",source:r}:null}function sr(t){let e=0,i=0,r=null;do{r=t.readUInt8(),e|=(127&r)<<i,i+=7}while(128&r);return e}function or(t,e,i){let r=0,a=0;for(;i--;)1&e&&(r|=t.readUInt8()<<a),e>>=1,a+=8;return r}function cr(t,e){const i=t.readUInt8();if(128&i){const r=or(t,15&i,4);let a=or(t,(112&i)>>4,3);return 0===a&&(a=65536),e.slice(r,r+a)}return t.slice(i)}function fr(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:function(t){let e=[t];return{next:()=>Promise.resolve({done:0===e.length,value:e.pop()}),return:()=>(e=[],{}),[Symbol.asyncIterator](){return this}}}(t)}class dr{constructor(t){if("undefined"==typeof Buffer)throw new Error("Missing Buffer dependency");this.stream=fr(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>hr(e);){const t=await this._next();if(this._ended)break;e.push(t)}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 hr(t){return t.reduce(((t,e)=>t+e.length),0)}async function lr(t){let e=await t.byte();const i=e>>4&7;let r,a,n=15&e;if(128&e){let i=4;do{e=await t.byte(),n|=(127&e)<<i,i+=7}while(128&e)}if(6===i){let i=0;r=0;const n=[];do{e=await t.byte(),r|=(127&e)<<i,i+=7,n.push(e)}while(128&e);a=Buffer.from(n)}if(7===i){a=await t.read(20)}return{type:i,length:n,ofs:r,reference:a}}async function ur(t){return $e.inflate(t)}class gr{constructor(t){Object.assign(this,t),this.offsetCache={}}static async fromIdx({idx:t,getExternalRefDelta:e}){const i=new ai(t);if("ff744f63"!==i.slice(4).toString("hex"))return;const r=i.readUInt32BE();if(2!==r)throw new ii(`Unable to read version ${r} packfile IDX. (Only version 2 supported)`);if(t.byteLength>2147483648)throw new ii("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+1020);const a=i.readUInt32BE(),n=[];for(let t=0;t<a;t++){const e=i.slice(20).toString("hex");n[t]=e}i.seek(i.tell()+4*a);const s=new Map;for(let t=0;t<a;t++)s.set(n[t],i.readUInt32BE());const o=i.slice(20).toString("hex");return new gr({hashes:n,crcs:{},offsets:s,packfileSha:o,getExternalRefDelta:e})}static async fromPack({pack:t,getExternalRefDelta:e,onProgress:i}){const r={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},a={},n=t.slice(-20).toString("hex"),s=[],o={},c=new Map;let f=null,d=null;await async function(t,e){const i=new dr(t);let r=await i.read(4);if(r=r.toString("utf8"),"PACK"!==r)throw new ii(`Invalid PACK header '${r}'`);let a=await i.read(4);if(a=a.readUInt32BE(0),2!==a)throw new ii(`Invalid packfile version: ${a}`);let n=await i.read(4);if(n=n.readUInt32BE(0),!(n<1))for(;!i.eof()&&n--;){const t=i.tell(),{type:r,length:a,ofs:s,reference:o}=await lr(i),c=new $e.Inflate;for(;!c.result;){const f=await i.chunk();if(!f)break;if(c.push(f,!1),c.err)throw new ii(`Pako error: ${c.msg}`);if(c.result){if(c.result.length!==a)throw new ii("Inflated object size is different from that stated in packfile.");await i.undo(),await i.read(f.length-c.strm.avail_in);const d=i.tell();await e({data:c.result,type:r,num:n,offset:t,end:d,reference:o,ofs:s})}}}}([t],(async({data:t,type:e,reference:n,offset:s,num:o})=>{null===f&&(f=o);const c=Math.floor(100*(f-o)/f);c!==d&&i&&await i({phase:"Receiving objects",loaded:f-o,total:f}),d=c,(["commit","tree","blob","tag"].includes(e=r[e])||"ofs-delta"===e||"ref-delta"===e)&&(a[s]={type:e,offset:s})}));const h=Object.keys(a).map(Number);for(const[e,i]of h.entries()){const r=e+1===h.length?t.byteLength-20:h[e+1],n=a[i],s=v.buf(t.slice(i,r))>>>0;n.end=r,n.crc=s}const l=new gr({pack:Promise.resolve(t),packfileSha:n,crcs:o,hashes:s,offsets:c,getExternalRefDelta:e});d=null;let u=0;const g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let t in a){t=Number(t);const e=Math.floor(100*u/f);e!==d&&i&&await i({phase:"Resolving deltas",loaded:u,total:f}),u++,d=e;const r=a[t];if(!r.oid)try{l.readDepth=0,l.externalReadDepth=0;const{type:e,object:i}=await l.readSlice({start:t});g[l.readDepth]+=1;const a=await li(ar.wrap({type:e,object:i}));r.oid=a,s.push(a),c.set(a,t),o[a]=r.crc}catch(t){continue}}return s.sort(),l}async toBuffer(){const t=[],e=(e,i)=>{t.push(Buffer.from(e,i))};e("ff744f63","hex"),e("00000002","hex");const i=new ai(Buffer.alloc(1024));for(let t=0;t<256;t++){let e=0;for(const i of this.hashes)parseInt(i.slice(0,2),16)<=t&&e++;i.writeUInt32BE(e)}t.push(i.buffer);for(const t of this.hashes)e(t,"hex");const r=new ai(Buffer.alloc(4*this.hashes.length));for(const t of this.hashes)r.writeUInt32BE(this.crcs[t]);t.push(r.buffer);const a=new ai(Buffer.alloc(4*this.hashes.length));for(const t of this.hashes)a.writeUInt32BE(this.offsets.get(t));t.push(a.buffer),e(this.packfileSha,"hex");const n=Buffer.concat(t),s=await li(n),o=Buffer.alloc(20);return o.write(s,"hex"),Buffer.concat([n,o])}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 ii(`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++;if(!this.pack)throw new ii("Tried to read from a GitPackIndex with no packfile loaded into memory");const e=(await this.pack).slice(t),i=new ai(e),r=i.readUInt8(),a=112&r;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"}[a];if(void 0===n)throw new ii("Unrecognized type: 0b"+a.toString(2));const s=15&r;let o=s;128&r&&(o=function(t,e){let i=e,r=4,a=null;do{a=t.readUInt8(),i|=(127&a)<<r,r+=7}while(128&a);return i}(i,s));let c=null,f=null;if("ofs_delta"===n){const e=function(t){const e=[];let i=0,r=0;do{i=t.readUInt8();const a=127&i;e.push(a),r=128&i}while(r);return e.reduce(((t,e)=>t+1<<7|e),-1)}(i),r=t-e;({object:c,type:n}=await this.readSlice({start:r}))}if("ref_delta"===n){const t=i.slice(20).toString("hex");({object:c,type:n}=await this.read({oid:t}))}const d=e.slice(i.tell());if(f=Buffer.from(await ur(d)),f.byteLength!==o)throw new ii(`Packfile told us object would have length ${o} but it had length ${f.byteLength}`);return c&&(f=Buffer.from(function(t,e){const i=new ai(t),r=sr(i);if(r!==e.byteLength)throw new ii(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);const a=sr(i);let n;const s=cr(i,e);if(s.byteLength===a)n=s;else{n=Buffer.alloc(a);const t=new ai(n);for(t.copy(s);!i.eof();)t.copy(cr(i,e));const r=t.tell();if(a!==r)throw new ii(`applyDelta expected target buffer to be ${a} bytes but the resulting buffer was ${r} bytes`)}return n}(f,c))),this.readDepth>3&&(this.offsetCache[t]={type:n,object:f}),{type:n,format:"content",object:f}}}const wr=Symbol("PackfileCache");function pr({fs:t,cache:e,filename:i,getExternalRefDelta:r,emitter:a,emitterPrefix:n}){e[wr]||(e[wr]=new Map);let s=e[wr].get(i);return s||(s=async function({fs:t,filename:e,getExternalRefDelta:i,emitter:r,emitterPrefix:a}){const n=await t.read(e);return gr.fromIdx({idx:n,getExternalRefDelta:i})}({fs:t,filename:i,getExternalRefDelta:r,emitter:a,emitterPrefix:n}),e[wr].set(i,s)),s}async function mr({fs:t,cache:e,gitdir:i,oid:r,format:a="content"}){const n=r=>mr({fs:t,cache:e,gitdir:i,oid:r});let s;if("4b825dc642cb6eb9a060e54bf8d69288fbee4904"===r&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await nr({fs:t,gitdir:i,oid:r})),!s){if(s=await async function({fs:t,cache:e,gitdir:i,oid:r,format:a="content",getExternalRefDelta:n}){let s=await t.readdir(b.join(i,"objects/pack"));s=s.filter((t=>t.endsWith(".idx")));for(const a of s){const s=`${i}/objects/pack/${a}`,o=await pr({fs:t,cache:e,filename:s,getExternalRefDelta:n});if(o.error)throw new ii(o.error);if(o.offsets.has(r)){if(!o.pack){const e=s.replace(/idx$/,"pack");o.pack=t.read(e)}const e=await o.read({oid:r,getExternalRefDelta:n});return e.format="content",e.source=`objects/pack/${a.replace(/idx$/,"pack")}`,e}}return null}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:n}),!s)throw new Si(r);return s}if("deflated"===a)return s;if("deflated"===s.format&&(s.object=Buffer.from(await ur(s.object)),s.format="wrapped"),"wrapped"===a)return s;const o=await li(s.object);if(o!==r)throw new ii(`SHA check failed! Expected ${r}, computed ${o}`);const{object:c,type:f}=ar.unwrap(s.object);if(s.type=f,s.object=c,s.format="content","content"===a)return s;throw new ii(`invalid requested format "${a}"`)}class yr extends ti{constructor(t,e,i=!0){super(`Failed to create ${t} at ${e} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:""}`),this.code=this.name=yr.code,this.data={noun:t,where:e,canForce:i}}}yr.code="AlreadyExistsError";class _r extends ti{constructor(t,e,i){super(`Found multiple ${t} matching "${e}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=_r.code,this.data={nouns:t,short:e,matches:i}}}_r.code="AmbiguousError";class br extends ti{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(", ")}`),this.code=this.name=br.code,this.data={filepaths:t}}}br.code="CheckoutConflictError";class vr extends ti{constructor(t,e){super(`Failed to checkout "${t}" because commit ${e} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=vr.code,this.data={ref:t,oid:e}}}vr.code="CommitNotFetchedError";class xr extends ti{constructor(){super("Empty response from git server."),this.code=this.name=xr.code,this.data={}}}xr.code="EmptyServerResponseError";class kr extends ti{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=kr.code,this.data={}}}kr.code="FastForwardError";class Er extends ti{constructor(t,e){super(`One or more branches were not updated: ${t}`),this.code=this.name=Er.code,this.data={prettyDetails:t,result:e}}}Er.code="GitPushError";class Sr extends ti{constructor(t,e,i){super(`HTTP Error: ${t} ${e}`),this.code=this.name=Sr.code,this.data={statusCode:t,statusMessage:e,response:i}}}Sr.code="HttpError";class $r extends ti{constructor(t){let e="invalid filepath";"leading-slash"===t||"trailing-slash"===t?e='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':"directory"===t&&(e='"filepath" should not be a directory.'),super(e),this.code=this.name=$r.code,this.data={reason:t}}}$r.code="InvalidFilepathError";class jr extends ti{constructor(t,e){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${e}".)`),this.code=this.name=jr.code,this.data={ref:t,suggestion:e}}}jr.code="InvalidRefNameError";class Ar extends ti{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=Ar.code,this.data={depth:t}}}Ar.code="MaxDepthError";class Br extends ti{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=Br.code,this.data={}}}Br.code="MergeNotSupportedError";class Rr extends ti{constructor(t,e,i,r){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=Rr.code,this.data={filepaths:t,bothModified:e,deleteByUs:i,deleteByTheirs:r}}}Rr.code="MergeConflictError";class Pr extends ti{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=Pr.code,this.data={role:t}}}Pr.code="MissingNameError";class Or extends ti{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=Or.code,this.data={parameter:t}}}Or.code="MissingParameterError";class Cr extends ti{constructor(t){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=Cr.code,this.data={errors:t},this.errors=t}}Cr.code="MultipleGitError";class Ir extends ti{constructor(t,e){super(`Expected "${t}" but received "${e}".`),this.code=this.name=Ir.code,this.data={expected:t,actual:e}}}Ir.code="ParseError";class zr extends ti{constructor(t){let e="";"not-fast-forward"===t?e=" because it was not a simple fast-forward":"tag-exists"===t&&(e=" because tag already exists"),super(`Push rejected${e}. Use "force: true" to override.`),this.code=this.name=zr.code,this.data={reason:t}}}zr.code="PushRejectedError";class Tr extends ti{constructor(t,e){super(`Remote does not support the "${t}" so the "${e}" parameter cannot be used.`),this.code=this.name=Tr.code,this.data={capability:t,parameter:e}}}Tr.code="RemoteCapabilityError";class Dr extends ti{constructor(t,e){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=Dr.code,this.data={preview:t,response:e}}}Dr.code="SmartHttpError";class Nr extends ti{constructor(t,e,i){super(`Git remote "${t}" uses an unrecognized transport protocol: "${e}"`),this.code=this.name=Nr.code,this.data={url:t,transport:e,suggestion:i}}}Nr.code="UnknownTransportError";class Ur extends ti{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=Ur.code,this.data={url:t}}}Ur.code="UrlParseError";class Mr extends ti{constructor(){super("The operation was canceled."),this.code=this.name=Mr.code,this.data={}}}Mr.code="UserCanceledError";class Fr extends ti{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=Fr.code,this.data={filepath:t}}}Fr.code="IndexResetError";class Hr extends ti{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=Hr.code,this.data={ref:t}}}Hr.code="NoCommitError";var qr=Object.freeze({__proto__:null,AlreadyExistsError:yr,AmbiguousError:_r,CheckoutConflictError:br,CommitNotFetchedError:vr,EmptyServerResponseError:xr,FastForwardError:kr,GitPushError:Er,HttpError:Sr,InternalError:ii,InvalidFilepathError:$r,InvalidOidError:ji,InvalidRefNameError:jr,MaxDepthError:Ar,MergeNotSupportedError:Br,MergeConflictError:Rr,MissingNameError:Pr,MissingParameterError:Or,MultipleGitError:Cr,NoRefspecError:Ai,NotFoundError:Si,ObjectTypeError:$i,ParseError:Ir,PushRejectedError:zr,RemoteCapabilityError:Tr,SmartHttpError:Dr,UnknownTransportError:Nr,UnsafeFilepathError:ri,UrlParseError:Ur,UserCanceledError:Mr,UnmergedPathsError:ei,IndexResetError:Fr,NoCommitError:Hr});function Lr({name:t,email:e,timestamp:i,timezoneOffset:r}){return`${t} <${e}> ${i} ${r=function(t){const e=function(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}((i=t,0===i?i:-i));var i;t=Math.abs(t);const r=Math.floor(t/60);t-=60*r;let a=String(r),n=String(t);a.length<2&&(a="0"+a);n.length<2&&(n="0"+n);return(-1===e?"-":"+")+a+n}(r)}`}function Wr(t){return t=(t=(t=t.replace(/\r/g,"")).replace(/^\n+/,"")).replace(/\n+$/,"")+"\n"}function Gr(t){const[,e,i,r,a]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:i,timestamp:Number(r),timezoneOffset:Zr(a)}}function Zr(t){let[,e,i,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=("+"===e?1:-1)*(60*Number(i)+Number(r)),0===(a=r)?a:-a;var a}class Kr{constructor(t){if("string"==typeof t)this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else{if("object"!=typeof t)throw new ii("invalid type passed to GitAnnotatedTag constructor");this._tag=Kr.render(t)}}static from(t){return new Kr(t)}static render(t){return`object ${t.object}\ntype ${t.type}\ntag ${t.tag}\ntagger ${Lr(t.tagger)}\n\n${t.message}\n${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf("\n\n"))}message(){const t=this.withoutSignature();return t.slice(t.indexOf("\n\n")+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){const t=this.justHeaders().split("\n"),e=[];for(const i of t)" "===i[0]?e[e.length-1]+="\n"+i.slice(1):e.push(i);const i={};for(const t of e){const e=t.slice(0,t.indexOf(" ")),r=t.slice(t.indexOf(" ")+1);Array.isArray(i[e])?i[e].push(r):i[e]=r}return i.tagger&&(i.tagger=Gr(i.tagger)),i.committer&&(i.committer=Gr(i.committer)),i}withoutSignature(){const t=Wr(this._tag);return-1===t.indexOf("\n-----BEGIN PGP SIGNATURE-----")?t:t.slice(0,t.lastIndexOf("\n-----BEGIN PGP SIGNATURE-----"))}gpgsig(){if(-1===this._tag.indexOf("\n-----BEGIN PGP SIGNATURE-----"))return;return Wr(this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27))}payload(){return this.withoutSignature()+"\n"}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(t,e,i){const r=t.payload();let{signature:a}=await e({payload:r,secretKey:i});a=Wr(a);const n=r+a;return Kr.from(n)}}function Vr(t){return t.trim().split("\n").map((t=>" "+t)).join("\n")+"\n"}class Xr{constructor(t){if("string"==typeof t)this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString("utf8");else{if("object"!=typeof t)throw new ii("invalid type passed to GitCommit constructor");this._commit=Xr.render(t)}}static fromPayloadSignature({payload:t,signature:e}){const i=Xr.justHeaders(t),r=Xr.justMessage(t),a=Wr(i+"\ngpgsig"+Vr(e)+"\n"+r);return new Xr(a)}static from(t){return new Xr(t)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return Xr.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(t){return Wr(t.slice(t.indexOf("\n\n")+2))}static justHeaders(t){return t.slice(0,t.indexOf("\n\n"))}parseHeaders(){const t=Xr.justHeaders(this._commit).split("\n"),e=[];for(const i of t)" "===i[0]?e[e.length-1]+="\n"+i.slice(1):e.push(i);const i={parent:[]};for(const t of e){const e=t.slice(0,t.indexOf(" ")),r=t.slice(t.indexOf(" ")+1);Array.isArray(i[e])?i[e].push(r):i[e]=r}return i.author&&(i.author=Gr(i.author)),i.committer&&(i.committer=Gr(i.committer)),i}static renderHeaders(t){let e="";if(t.tree?e+=`tree ${t.tree}\n`:e+="tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n",t.parent){if(void 0===t.parent.length)throw new ii("commit 'parent' property should be an array");for(const i of t.parent)e+=`parent ${i}\n`}e+=`author ${Lr(t.author)}\n`;return e+=`committer ${Lr(t.committer||t.author)}\n`,t.gpgsig&&(e+="gpgsig"+Vr(t.gpgsig)),e}static render(t){return Xr.renderHeaders(t)+"\n"+Wr(t.message)}render(){return this._commit}withoutSignature(){const t=Wr(this._commit);if(-1===t.indexOf("\ngpgsig"))return t;return Wr(t.slice(0,t.indexOf("\ngpgsig"))+"\n"+t.slice(t.indexOf("-----END PGP SIGNATURE-----\n")+28))}isolateSignature(){const t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return t.split("\n").map((t=>t.replace(/^ /,""))).join("\n")}static async sign(t,e,i){const r=t.withoutSignature(),a=Xr.justMessage(t._commit);let{signature:n}=await e({payload:r,secretKey:i});n=Wr(n);const s=Xr.justHeaders(t._commit)+"\ngpgsig"+Vr(n)+"\n"+a;return Xr.from(s)}}async function Yr({fs:t,cache:e,gitdir:i,oid:r}){if("4b825dc642cb6eb9a060e54bf8d69288fbee4904"===r)return{tree:rr.from([]),oid:r};const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return Yr({fs:t,cache:e,gitdir:i,oid:r=Kr.from(n).parse().object});if("commit"===a)return Yr({fs:t,cache:e,gitdir:i,oid:r=Xr.from(n).parse().tree});if("tree"!==a)throw new $i(r,a,"tree");return{tree:rr.from(n),oid:r}}class Jr{constructor({fs:t,gitdir:e,ref:i,cache:r}){this.fs=t,this.cache=r,this.gitdir=e,this.mapPromise=(async()=>{const r=new Map;let a;try{a=await Ji.resolve({fs:t,gitdir:e,ref:i})}catch(t){t instanceof Si&&(a="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}const n=await Yr({fs:t,cache:this.cache,gitdir:e,oid:a});return n.type="tree",n.mode="40000",r.set(".",n),r})();const a=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){const e=t._fullpath,{fs:i,cache:r,gitdir:a}=this,n=await this.mapPromise,s=n.get(e);if(!s)throw new Error(`No obj for ${e}`);const o=s.oid;if(!o)throw new Error(`No oid for obj ${JSON.stringify(s)}`);if("tree"!==s.type)return null;const{type:c,object:f}=await mr({fs:i,cache:r,gitdir:a,oid:o});if(c!==s.type)throw new $i(o,c,s.type);const d=rr.from(f);for(const t of d)n.set(b.join(e,t.path),t);return d.entries().map((t=>b.join(e,t.path)))}async type(t){if(!1===t._type){const e=await this.mapPromise,{type:i}=e.get(t._fullpath);t._type=i}return t._type}async mode(t){if(!1===t._mode){const e=await this.mapPromise,{mode:i}=e.get(t._fullpath);t._mode=oi(parseInt(i,8))}return t._mode}async stat(t){}async content(t){if(!1===t._content){const e=await this.mapPromise,{fs:i,cache:r,gitdir:a}=this,n=e.get(t._fullpath).oid,{type:s,object:o}=await mr({fs:i,cache:r,gitdir:a,oid:n});t._content="blob"!==s?void 0:new Uint8Array(o)}return t._content}async oid(t){if(!1===t._oid){const e=(await this.mapPromise).get(t._fullpath);t._oid=e.oid}return t._oid}}function Qr({ref:t="HEAD"}={}){const e=Object.create(null);return Object.defineProperty(e,ki,{value:function({fs:e,gitdir:i,cache:r}){return new Jr({fs:e,gitdir:i,ref:t,cache:r})}}),Object.freeze(e),e}class ta{constructor({fs:t,dir:e,gitdir:i,cache:r}){this.fs=t,this.cache=r,this.dir=e,this.gitdir=i,this.config=null;const a=this;this.ConstructEntry=class{constructor(t){this._fullpath=t,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){const e=t._fullpath,{fs:i,dir:r}=this,a=await i.readdir(b.join(r,e));return null===a?null:a.map((t=>b.join(e,t)))}async type(t){return!1===t._type&&await t.stat(),t._type}async mode(t){return!1===t._mode&&await t.stat(),t._mode}async stat(t){if(!1===t._stat){const{fs:e,dir:i}=this;let r=await e.lstat(`${i}/${t._fullpath}`);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=r.isDirectory()?"tree":"blob";"blob"!==a||r.isFile()||r.isSymbolicLink()||(a="special"),t._type=a,r=di(r),t._mode=r.mode,-1===r.size&&t._actualSize&&(r.size=t._actualSize),t._stat=r}return t._stat}async content(t){if(!1===t._content){const{fs:e,dir:i,gitdir:r}=this;if("tree"===await t.type())t._content=void 0;else{const a=await this._getGitConfig(e,r),n=await a.get("core.autocrlf"),s=await e.read(`${i}/${t._fullpath}`,{autocrlf:n});t._actualSize=s.length,t._stat&&-1===t._stat.size&&(t._stat.size=t._actualSize),t._content=new Uint8Array(s)}}return t._content}async oid(t){if(!1===t._oid){const e=this,{fs:i,gitdir:r,cache:a}=this;let n;await yi.acquire({fs:i,gitdir:r,cache:a},(async function(a){const s=a.entriesMap.get(t._fullpath),o=await t.stat(),c=await e._getGitConfig(i,r),f=await c.get("core.filemode"),d="undefined"==typeof process||!("win32"===process.platform);if(!s||wi(o,s,f,d)){const e=await t.content();void 0===e?n=void 0:(n=await li(ar.wrap({type:"blob",object:e})),!s||n!==s.oid||f&&o.mode!==s.mode||!wi(o,s,f,d)||a.insert({filepath:t._fullpath,stats:o,oid:n}))}else n=s.oid})),t._oid=n}return t._oid}async _getGitConfig(t,e){return this.config||(this.config=await Zi.get({fs:t,gitdir:e})),this.config}}function ea(){const t=Object.create(null);return Object.defineProperty(t,ki,{value:function({fs:t,dir:e,gitdir:i,cache:r}){return new ta({fs:t,dir:e,gitdir:i,cache:r})}}),Object.freeze(t),t}const ia=void 0===Array.prototype.flat?t=>t.reduce(((t,e)=>t.concat(e)),[]):t=>t.flat();class ra{constructor(){this.value=null}consider(t){null!=t&&(null===this.value||t<this.value)&&(this.value=t)}reset(){this.value=null}}function*aa(t){const e=new ra;let i;const r=[],a=t.length;for(let i=0;i<a;i++)r[i]=t[i].next().value,void 0!==r[i]&&e.consider(r[i]);if(null!==e.value)for(;;){const n=[];i=e.value,e.reset();for(let s=0;s<a;s++)void 0!==r[s]&&r[s]===i?(n[s]=r[s],r[s]=t[s].next().value):n[s]=null,void 0!==r[s]&&e.consider(r[s]);if(yield n,null===e.value)return}}async function na({fs:t,cache:e,dir:i,gitdir:r,trees:a,map:n=async(t,e)=>e,reduce:s=async(t,e)=>{const i=ia(e);return void 0!==t&&i.unshift(t),i},iterate:o=(t,e)=>Promise.all([...e].map(t))}){const c=a.map((a=>a[ki]({fs:t,dir:i,gitdir:r,cache:e}))),f=new Array(c.length).fill("."),d=function(t,e){const i=e-t;return Array.from({length:i},((e,i)=>t+i))}(0,c.length),h=async t=>{const{entries:e,children:i}=await(async t=>{d.map((e=>{const i=t[e];t[e]=i&&new c[e].ConstructEntry(i)}));const e=(await Promise.all(d.map((e=>{const i=t[e];return i?c[e].readdir(i):[]})))).map((t=>(null===t?[]:t)[Symbol.iterator]()));return{entries:t,children:aa(e)}})(t),r=e.find((t=>t&&t._fullpath))._fullpath,a=await n(r,e);if(null!==a){let t=await o(h,i);return t=t.filter((t=>void 0!==t)),s(a,t)}};return h(f)}async function sa(t,e){const i=await t.readdir(e);null==i?await t.rm(e):i.length?await Promise.all(i.map((i=>{const r=b.join(e,i);return t.lstat(r).then((e=>{if(e)return e.isDirectory()?sa(t,r):t.rm(r)}))}))).then((()=>t.rmdir(e))):await t.rmdir(e)}function oa(t){return"function"==typeof t}function ca(t){return function(t){return t&&"object"==typeof t}(e=(t=>{try{return t.readFile().catch((t=>t))}catch(t){return t}})(t))&&oa(e.then)&&oa(e.catch);var e}const fa=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function da(t,e){if(ca(e))for(const i of fa)t[`_${i}`]=e[i].bind(e);else for(const i of fa)t[`_${i}`]=Ae(e[i].bind(e));ca(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=sa.bind(null,t):e.rm?t._rm=Ae(e.rm.bind(e)):e.rmdir.length>2?t._rm=Ae(e.rmdir.bind(e)):t._rm=sa.bind(null,t)}class ha{constructor(t){if(void 0!==t._original_unwrapped_fs)return t;const e=Object.getOwnPropertyDescriptor(t,"promises");e&&e.enumerable?da(this,t.promises):da(this,t),this._original_unwrapped_fs=t}async exists(t,e={}){try{return await this._stat(t),!0}catch(t){if("ENOENT"===t.code||"ENOTDIR"===t.code||(t.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',t),t}}async read(t,e={}){try{let i=await this._readFile(t,e);if("true"===e.autocrlf)try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,"\n"),i=(new TextEncoder).encode(i)}catch(t){}return"string"!=typeof i&&(i=Buffer.from(i)),i}catch(t){return null}}async write(t,e,i={}){try{return void await this._writeFile(t,e,i)}catch(r){await this.mkdir(bi(t)),await this._writeFile(t,e,i)}}async mkdir(t,e=!1){try{return void await this._mkdir(t)}catch(i){if(null===i)return;if("EEXIST"===i.code)return;if(e)throw i;if("ENOENT"===i.code){const e=bi(t);if("."===e||"/"===e||e===t)throw i;await this.mkdir(e),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(t){if("ENOENT"!==t.code)throw t}}async rmdir(t,e){try{e&&e.recursive?await this._rm(t,e):await this._rmdir(t)}catch(t){if("ENOENT"!==t.code)throw t}}async readdir(t){try{const e=await this._readdir(t);return e.sort(ni),e}catch(t){return"ENOTDIR"===t.code?null:[]}}async readdirDeep(t){const e=await this._readdir(t);return(await Promise.all(e.map((async e=>{const i=t+"/"+e;return(await this._stat(i)).isDirectory()?this.readdirDeep(i):i})))).reduce(((t,e)=>t.concat(e)),[])}async lstat(t){try{return await this._lstat(t)}catch(t){if("ENOENT"===t.code||(t.code||"").includes("ENS"))return null;throw t}}async readlink(t,e={encoding:"buffer"}){try{const i=await this._readlink(t,e);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(t){if("ENOENT"===t.code||(t.code||"").includes("ENS"))return null;throw t}}async writelink(t,e){return this._symlink(e.toString("utf8"),t)}}function la(t,e){if(void 0===e)throw new Or(t)}async function ua(t,e){return!(!t&&!e)&&(!(!t||e)||(!(t||!e)||("tree"!==await t.type()||"tree"!==await e.type())&&(await t.type()!==await e.type()||await t.mode()!==await e.mode()||await t.oid()!==await e.oid())))}async function ga({fs:t,dir:e,gitdir:i=b.join(e,".git"),commit:r="HEAD",cache:a={}}){try{la("fs",t),la("dir",e),la("gitdir",i);const n=new ha(t),s=[Qr({ref:r}),ea(),Ei()];let o=[];await yi.acquire({fs:n,gitdir:i,cache:a},(async function(t){o=t.unmergedPaths}));const c=await na({fs:n,cache:a,dir:e,gitdir:i,trees:s,map:async function(t,[e,i,r]){const a=!await ua(i,r),n=o.includes(t),s=!await ua(r,e);if(a||n)return e?{path:t,mode:await e.mode(),oid:await e.oid(),type:await e.type(),content:await e.content()}:void 0;if(s)return!1;throw new Fr(t)}});await yi.acquire({fs:n,gitdir:i,cache:a},(async function(t){for(const i of c)if(!1!==i)if(i){if("blob"===i.type){const r=(new TextDecoder).decode(i.content);await n.write(`${e}/${i.path}`,r,{mode:i.mode}),t.insert({filepath:i.path,oid:i.oid,stage:0})}}else await n.rmdir(`${e}/${i.path}`,{recursive:!0}),t.delete({filepath:i.path})}))}catch(t){throw t.caller="git.abortMerge",t}}class wa{static async isIgnored({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r}){if(".git"===_i(r))return!0;if("."===r)return!1;let a="";const n=b.join(i,"info","exclude");await t.exists(n)&&(a=await t.read(n,"utf8"));const s=[{gitignore:b.join(e,".gitignore"),filepath:r}],o=r.split("/").filter(Boolean);for(let t=1;t<o.length;t++){const i=o.slice(0,t).join("/"),r=o.slice(t).join("/");s.push({gitignore:b.join(e,i,".gitignore"),filepath:r})}let c=!1;for(const e of s){let i;try{i=await t.read(e.gitignore,"utf8")}catch(t){if("NOENT"===t.code)continue}const r=Ke().add(a);r.add(i);const n=bi(e.filepath);if("."!==n&&r.ignores(n))return!0;c=c?!r.test(e.filepath).unignored:r.test(e.filepath).ignored}return c}}let pa=null;async function ma(t){return null===pa&&(pa=function(){try{new CompressionStream("deflate").writable.close();return new Blob([]).stream().cancel(),!0}catch(t){return!1}}()),pa?async function(t){const e=new CompressionStream("deflate"),i=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(i).arrayBuffer())}(t):$e.deflate(t)}async function ya({fs:t,gitdir:e,type:i,object:r,format:a="content",oid:n,dryRun:s=!1}){return"deflated"!==a&&("wrapped"!==a&&(r=ar.wrap({type:i,object:r})),n=await li(r),r=Buffer.from(await ma(r))),s||await async function({fs:t,gitdir:e,object:i,format:r,oid:a}){if("deflated"!==r)throw new ii("GitObjectStoreLoose expects objects to write to be in deflated format");const n=`${e}/objects/${a.slice(0,2)}/${a.slice(2)}`;await t.exists(n)||await t.write(n,i)}({fs:t,gitdir:e,object:r,format:"deflated",oid:n}),n}function _a(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function ba({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r,cache:a={},force:n=!1,parallel:s=!0}){try{la("fs",t),la("dir",e),la("gitdir",i),la("filepath",r);const o=new ha(t);await yi.acquire({fs:o,gitdir:i,cache:a},(async t=>{const a=await Zi.get({fs:o,gitdir:i}),c=await a.get("core.autocrlf");return va({dir:e,gitdir:i,fs:o,filepath:r,index:t,force:n,parallel:s,autocrlf:c})}))}catch(t){throw t.caller="git.add",t}}async function va({dir:t,gitdir:e,fs:i,filepath:r,index:a,force:n,parallel:s,autocrlf:o}){const c=(r=Array.isArray(r)?r:[r]).map((async r=>{if(!n){if(await wa.isIgnored({fs:i,dir:t,gitdir:e,filepath:r}))return}const c=await i.lstat(b.join(t,r));if(!c)throw new Si(r);if(c.isDirectory()){const c=await i.readdir(b.join(t,r));if(s){const f=c.map((c=>va({dir:t,gitdir:e,fs:i,filepath:[b.join(r,c)],index:a,force:n,parallel:s,autocrlf:o})));await Promise.all(f)}else for(const f of c)await va({dir:t,gitdir:e,fs:i,filepath:[b.join(r,f)],index:a,force:n,parallel:s,autocrlf:o})}else{const n=c.isSymbolicLink()?await i.readlink(b.join(t,r)).then(_a):await i.read(b.join(t,r),{autocrlf:o});if(null===n)throw new Si(r);const s=await ya({fs:i,gitdir:e,type:"blob",object:n});a.insert({filepath:r,stats:c,oid:s})}})),f=await Promise.allSettled(c),d=f.filter((t=>"rejected"===t.status)).map((t=>t.reason));if(d.length>1)throw new Cr(d);if(1===d.length)throw d[0];return f.filter((t=>"fulfilled"===t.status&&t.value)).map((t=>t.value))}async function xa({fs:t,gitdir:e,path:i}){return(await Zi.get({fs:t,gitdir:e})).get(i)}function ka(t,...e){for(const i of e)if(i)for(const e of Object.keys(i)){const r=i[e];void 0!==r&&(t[e]=r)}return t}async function Ea({fs:t,gitdir:e,author:i,commit:r}){const a=Math.floor(Date.now()/1e3),n=ka({},{name:await xa({fs:t,gitdir:e,path:"user.name"}),email:await xa({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(1e3*a).getTimezoneOffset()},r?r.author:void 0,i);if(void 0!==n.name)return n}async function Sa({fs:t,gitdir:e,author:i,committer:r,commit:a}){const n=Math.floor(Date.now()/1e3),s=ka({},{name:await xa({fs:t,gitdir:e,path:"user.name"}),email:await xa({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(1e3*n).getTimezoneOffset()},a?a.committer:void 0,i,r);if(void 0!==s.name)return s}async function $a({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return $a({fs:t,cache:e,gitdir:i,oid:r=Kr.from(n).parse().object});if("commit"!==a)throw new $i(r,a,"commit");return{commit:Xr.from(n),oid:r}}async function ja({fs:t,cache:e,gitdir:i,oid:r}){const{commit:a,oid:n}=await $a({fs:t,cache:e,gitdir:i,oid:r});return{oid:n,commit:a.parse(),payload:a.withoutSignature()}}async function Aa({fs:t,cache:e,onSign:i,gitdir:r,message:a,author:n,committer:s,signingKey:o,amend:c=!1,dryRun:f=!1,noUpdateBranch:d=!1,ref:h,parent:l,tree:u}){let g,w,p=!1;h||(h=await Ji.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));try{g=await Ji.resolve({fs:t,gitdir:r,ref:h}),w=await ja({fs:t,gitdir:r,oid:g,cache:{}})}catch{p=!0}if(c&&p)throw new Hr(h);const m=c?await Ea({fs:t,gitdir:r,author:n,commit:w.commit}):await Ea({fs:t,gitdir:r,author:n});if(!m)throw new Pr("author");const y=c?await Sa({fs:t,gitdir:r,author:m,committer:s,commit:w.commit}):await Sa({fs:t,gitdir:r,author:m,committer:s});if(!y)throw new Pr("committer");return yi.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},(async function(e){const n=vi(e.entries).get(".");if(u||(u=await Ba({fs:t,gitdir:r,inode:n,dryRun:f})),l=l?await Promise.all(l.map((e=>Ji.resolve({fs:t,gitdir:r,ref:e})))):c?w.commit.parent:g?[g]:[],!a){if(!c)throw new Or("message");a=w.commit.message}let s=Xr.from({tree:u,parent:l,author:m,committer:y,message:a});o&&(s=await Xr.sign(s,i,o));const p=await ya({fs:t,gitdir:r,type:"commit",object:s.toObject(),dryRun:f});return d||f||await Ji.writeRef({fs:t,gitdir:r,ref:h,value:p}),p}))}async function Ba({fs:t,gitdir:e,inode:i,dryRun:r}){const a=i.children;for(const i of a)"tree"===i.type&&(i.metadata.mode="040000",i.metadata.oid=await Ba({fs:t,gitdir:e,inode:i,dryRun:r}));const n=a.map((t=>({mode:t.metadata.mode,path:t.basename,oid:t.metadata.oid,type:t.type}))),s=rr.from(n);return await ya({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function Ra({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){if(a.startsWith("/"))throw new $r("leading-slash");if(a.endsWith("/"))throw new $r("trailing-slash");const n=r,s=await Yr({fs:t,cache:e,gitdir:i,oid:r}),o=s.tree;if(""===a)r=s.oid;else{const s=a.split("/");r=await Pa({fs:t,cache:e,gitdir:i,tree:o,pathArray:s,oid:n,filepath:a})}return r}async function Pa({fs:t,cache:e,gitdir:i,tree:r,pathArray:a,oid:n,filepath:s}){const o=a.shift();for(const c of r)if(c.path===o){if(0===a.length)return c.oid;{const{type:o,object:f}=await mr({fs:t,cache:e,gitdir:i,oid:c.oid});if("tree"!==o)throw new $i(n,o,"tree",s);return Pa({fs:t,cache:e,gitdir:i,tree:r=rr.from(f),pathArray:a,oid:n,filepath:s})}}throw new Si(`file or directory found at "${n}:${s}"`)}async function Oa({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){void 0!==a&&(r=await Ra({fs:t,cache:e,gitdir:i,oid:r,filepath:a}));const{tree:n,oid:s}=await Yr({fs:t,cache:e,gitdir:i,oid:r});return{oid:s,tree:n.entries()}}async function Ca({fs:t,gitdir:e,tree:i}){const r=rr.from(i).toObject();return await ya({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function Ia({fs:t,onSign:e,dir:i,gitdir:r=b.join(i,".git"),ref:a="refs/notes/commits",oid:n,note:s,force:o,author:c,committer:f,signingKey:d,cache:h={}}){try{la("fs",t),la("gitdir",r),la("oid",n),la("note",s),d&&la("onSign",e);const i=new ha(t),l=await Ea({fs:i,gitdir:r,author:c});if(!l)throw new Pr("author");const u=await Sa({fs:i,gitdir:r,author:l,committer:f});if(!u)throw new Pr("committer");return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a,oid:n,note:s,force:o,author:c,committer:f,signingKey:d}){let h;try{h=await Ji.resolve({gitdir:r,fs:t,ref:a})}catch(t){if(!(t instanceof Si))throw t}let l=(await Oa({fs:t,cache:e,gitdir:r,oid:h||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)l=l.filter((t=>t.path!==n));else for(const t of l)if(t.path===n)throw new yr("note",n);"string"==typeof s&&(s=Buffer.from(s,"utf8"));const u=await ya({fs:t,gitdir:r,type:"blob",object:s,format:"content"});l.push({mode:"100644",path:n,oid:u,type:"blob"});const g=await Ca({fs:t,gitdir:r,tree:l});return await Aa({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tree:g,parent:h&&[h],message:"Note added by 'isomorphic-git addNote'\n",author:c,committer:f,signingKey:d})}({fs:new ha(i),cache:h,onSign:e,gitdir:r,ref:a,oid:n,note:s,force:o,author:l,committer:u,signingKey:d})}catch(t){throw t.caller="git.addNote",t}}async function za({fs:t,gitdir:e,remote:i,url:r,force:a}){if(i!==Xe.clean(i))throw new jr(i,Xe.clean(i));const n=await Zi.get({fs:t,gitdir:e});if(!a){if((await n.getSubsections("remote")).includes(i)&&r!==await n.get(`remote.${i}.url`))throw new yr("remote",i)}await n.set(`remote.${i}.url`,r),await n.set(`remote.${i}.fetch`,`+refs/heads/*:refs/remotes/${i}/*`),await Zi.save({fs:t,gitdir:e,config:n})}async function Ta({fs:t,dir:e,gitdir:i=b.join(e,".git"),remote:r,url:a,force:n=!1}){try{return la("fs",t),la("gitdir",i),la("remote",r),la("url",a),await za({fs:new ha(t),gitdir:i,remote:r,url:a,force:n})}catch(t){throw t.caller="git.addRemote",t}}async function Da({fs:t,onSign:e,dir:i,gitdir:r=b.join(i,".git"),ref:a,tagger:n,message:s=a,gpgsig:o,object:c,signingKey:f,force:d=!1,cache:h={}}){try{la("fs",t),la("gitdir",r),la("ref",a),f&&la("onSign",e);const i=new ha(t),l=await Ea({fs:i,gitdir:r,author:n});if(!l)throw new Pr("tagger");return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tagger:n,message:s=a,gpgsig:o,object:c,signingKey:f,force:d=!1}){if(a=a.startsWith("refs/tags/")?a:`refs/tags/${a}`,!d&&await Ji.exists({fs:t,gitdir:r,ref:a}))throw new yr("tag",a);const h=await Ji.resolve({fs:t,gitdir:r,ref:c||"HEAD"}),{type:l}=await mr({fs:t,cache:e,gitdir:r,oid:h});let u=Kr.from({object:h,type:l,tag:a.replace("refs/tags/",""),tagger:n,message:s,gpgsig:o});f&&(u=await Kr.sign(u,i,f));const g=await ya({fs:t,gitdir:r,type:"tag",object:u.toObject()});await Ji.writeRef({fs:t,gitdir:r,ref:a,value:g})}({fs:i,cache:h,onSign:e,gitdir:r,ref:a,tagger:l,message:s,gpgsig:o,object:c,signingKey:f,force:d})}catch(t){throw t.caller="git.annotatedTag",t}}async function Na({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,object:a,checkout:n=!1,force:s=!1}){try{return la("fs",t),la("gitdir",i),la("ref",r),await async function({fs:t,gitdir:e,ref:i,object:r,checkout:a=!1,force:n=!1}){if(i!==Xe.clean(i))throw new jr(i,Xe.clean(i));const s=`refs/heads/${i}`;if(!n&&await Ji.exists({fs:t,gitdir:e,ref:s}))throw new yr("branch",i,!1);let o;try{o=await Ji.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(t){}o&&await Ji.writeRef({fs:t,gitdir:e,ref:s,value:o}),a&&await Ji.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}({fs:new ha(t),gitdir:i,ref:r,object:a,checkout:n,force:s})}catch(t){throw t.caller="git.branch",t}}const Ua=(t,e)=>"."===t||null==e||0===e.length||"."===e||(e.length>=t.length?e.startsWith(t):t.startsWith(e));async function Ma({fs:t,cache:e,onProgress:i,onPostCheckout:r,dir:a,gitdir:n,remote:s,ref:o,filepaths:c,noCheckout:f,noUpdateHead:d,dryRun:h,force:l,track:u=!0}){let g,w;if(r)try{g=await Ji.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(t){g="0000000000000000000000000000000000000000"}try{w=await Ji.resolve({fs:t,gitdir:n,ref:o})}catch(e){if("HEAD"===o)throw e;const i=`${s}/${o}`;if(w=await Ji.resolve({fs:t,gitdir:n,ref:i}),u){const e=await Zi.get({fs:t,gitdir:n});await e.set(`branch.${o}.remote`,s),await e.set(`branch.${o}.merge`,`refs/heads/${o}`),await Zi.save({fs:t,gitdir:n,config:e})}await Ji.writeRef({fs:t,gitdir:n,ref:`refs/heads/${o}`,value:w})}if(!f){let s;try{s=await async function({fs:t,cache:e,onProgress:i,dir:r,gitdir:a,ref:n,force:s,filepaths:o}){let c=0;return na({fs:t,cache:e,dir:r,gitdir:a,trees:[Qr({ref:n}),ea(),Ei()],map:async function(t,[e,r,a]){if("."===t)return;if(o&&!o.some((e=>Ua(t,e))))return null;i&&await i({phase:"Analyzing workdir",loaded:++c});switch([!!a,!!e,!!r].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(t)?["delete",t]:void 0;case"010":switch(await e.type()){case"tree":return["mkdir",t];case"blob":return["create",t,await e.oid(),await e.mode()];case"commit":return["mkdir-index",t,await e.oid(),await e.mode()];default:return["error",`new entry Unhandled type ${await e.type()}`]}case"011":switch(`${await e.type()}-${await r.type()}`){case"tree-tree":case"commit-tree":return;case"tree-blob":case"blob-tree":case"commit-blob":return["conflict",t];case"blob-blob":return await e.oid()!==await r.oid()?s?["update",t,await e.oid(),await e.mode(),await e.mode()!==await r.mode()]:["conflict",t]:await e.mode()!==await r.mode()?s?["update",t,await e.oid(),await e.mode(),!0]:["conflict",t]:["create-index",t,await e.oid(),await e.mode()];default:return["error",`new entry Unhandled type ${e.type}`]}case"100":return["delete-index",t];case"101":switch(await a.type()){case"tree":return["rmdir",t];case"blob":return await a.oid()!==await r.oid()?s?["delete",t]:["conflict",t]:["delete",t];case"commit":return["rmdir-index",t];default:return["error",`delete entry Unhandled type ${await a.type()}`]}case"110":case"111":switch(`${await a.type()}-${await e.type()}`){case"tree-tree":return;case"blob-blob":if(await a.oid()===await e.oid()&&await a.mode()===await e.mode()&&!s)return;if(r){if(await r.oid()!==await a.oid()&&await r.oid()!==await e.oid())return s?["update",t,await e.oid(),await e.mode(),await e.mode()!==await r.mode()]:["conflict",t]}else if(s)return["update",t,await e.oid(),await e.mode(),await e.mode()!==await a.mode()];return await e.mode()!==await a.mode()?["update",t,await e.oid(),await e.mode(),!0]:await e.oid()!==await a.oid()?["update",t,await e.oid(),await e.mode(),!1]:void 0;case"tree-blob":return["update-dir-to-blob",t,await e.oid()];case"blob-tree":return["update-blob-to-tree",t];case"commit-commit":return["mkdir-index",t,await e.oid(),await e.mode()];default:return["error",`update entry Unhandled type ${await a.type()}-${await e.type()}`]}}},reduce:async function(t,e){return e=ia(e),t?t&&"rmdir"===t[0]?(e.push(t),e):(e.unshift(t),e):e}})}({fs:t,cache:e,onProgress:i,dir:a,gitdir:n,ref:o,force:l,filepaths:c})}catch(t){throw t instanceof Si&&t.data.what===w?new vr(o,w):t}const f=s.filter((([t])=>"conflict"===t)).map((([t,e])=>e));if(f.length>0)throw new br(f);const d=s.filter((([t])=>"error"===t)).map((([t,e])=>e));if(d.length>0)throw new ii(d.join(", "));if(h)return void(r&&await r({previousHead:g,newHead:w,type:null!=c&&c.length>0?"file":"branch"}));let u=0;const p=s.length;await yi.acquire({fs:t,gitdir:n,cache:e},(async function(e){await Promise.all(s.filter((([t])=>"delete"===t||"delete-index"===t)).map((async function([r,n]){const s=`${a}/${n}`;"delete"===r&&await t.rm(s),e.delete({filepath:n}),i&&await i({phase:"Updating workdir",loaded:++u,total:p})})))})),await yi.acquire({fs:t,gitdir:n,cache:e},(async function(e){for(const[r,n]of s)if("rmdir"===r||"rmdir-index"===r){const s=`${a}/${n}`;try{"rmdir-index"===r&&e.delete({filepath:n}),await t.rmdir(s),i&&await i({phase:"Updating workdir",loaded:++u,total:p})}catch(t){if("ENOTEMPTY"!==t.code)throw t;console.log(`Did not delete ${n} because directory is not empty`)}}})),await Promise.all(s.filter((([t])=>"mkdir"===t||"mkdir-index"===t)).map((async function([e,r]){const n=`${a}/${r}`;await t.mkdir(n),i&&await i({phase:"Updating workdir",loaded:++u,total:p})}))),await yi.acquire({fs:t,gitdir:n,cache:e},(async function(r){await Promise.all(s.filter((([t])=>"create"===t||"create-index"===t||"update"===t||"mkdir-index"===t)).map((async function([s,o,c,f,d]){const h=`${a}/${o}`;try{if("create-index"!==s&&"mkdir-index"!==s){const{object:i}=await mr({fs:t,cache:e,gitdir:n,oid:c});if(d&&await t.rm(h),33188===f)await t.write(h,i);else if(33261===f)await t.write(h,i,{mode:511});else{if(40960!==f)throw new ii(`Invalid mode 0o${f.toString(8)} detected in blob ${c}`);await t.writelink(h,i)}}const a=await t.lstat(h);33261===f&&(a.mode=493),"mkdir-index"===s&&(a.mode=57344),r.insert({filepath:o,stats:a,oid:c}),i&&await i({phase:"Updating workdir",loaded:++u,total:p})}catch(t){console.log(t)}})))})),r&&await r({previousHead:g,newHead:w,type:null!=c&&c.length>0?"file":"branch"})}if(!d){const e=await Ji.expand({fs:t,gitdir:n,ref:o});e.startsWith("refs/heads")?await Ji.writeSymbolicRef({fs:t,gitdir:n,ref:"HEAD",value:e}):await Ji.writeRef({fs:t,gitdir:n,ref:"HEAD",value:w})}}async function Fa({fs:t,onProgress:e,onPostCheckout:i,dir:r,gitdir:a=b.join(r,".git"),remote:n="origin",ref:s,filepaths:o,noCheckout:c=!1,noUpdateHead:f=void 0===s,dryRun:d=!1,force:h=!1,track:l=!0,cache:u={}}){try{la("fs",t),la("dir",r),la("gitdir",a);const g=s||"HEAD";return await Ma({fs:new ha(t),cache:u,onProgress:e,onPostCheckout:i,dir:r,gitdir:a,remote:n,ref:g,filepaths:o,noCheckout:c,noUpdateHead:f,dryRun:d,force:h,track:l})}catch(t){throw t.caller="git.checkout",t}}const Ha=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function qa(t){const e=Ha.exec(t);return e?"remotes/"===e[1]&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function La({fs:t,gitdir:e,fullname:i=!1,test:r=!1}){const a=await Ji.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await Ji.resolve({fs:t,gitdir:e,ref:a})}catch(t){return}if(a.startsWith("refs/"))return i?a:qa(a)}function Wa({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function Ga(t,e){const i=fr(t);for(;;){const{value:t,done:r}=await i.next();if(t&&await e(t),r)break}i.return&&i.return()}async function Za(t){let e=0;const i=[];await Ga(t,(t=>{i.push(t),e+=t.byteLength}));const r=new Uint8Array(e);let a=0;for(const t of i)r.set(t,a),a+=t.byteLength;return r}function Ka(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(null==e)return{url:t,auth:{}};e=e[1];const[i,r]=e.split(":");return{url:t=t.replace(`${e}@`,""),auth:{username:i,password:r}}}function Va(t,e){const i=e.toString(16);return"0".repeat(t-i.length)+i}class Xa{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){"string"==typeof t&&(t=Buffer.from(t));const e=Va(4,t.length+4);return Buffer.concat([Buffer.from(e,"utf8"),t])}static streamReader(t){const e=new dr(t);return async function(){try{let t=await e.read(4);if(null==t)return!0;if(t=parseInt(t.toString("utf8"),16),0===t)return null;if(1===t)return null;const i=await e.read(t-4);return null==i||i}catch(e){return t.error=e,!0}}}}async function Ya(t){const e={};let i;for(;i=await t(),!0!==i;){if(null===i)continue;i=i.toString("utf8").replace(/\n$/,"");const t=i.indexOf("=");if(t>-1){const r=i.slice(0,t),a=i.slice(t+1);e[r]=a}else e[i]=!0}return{protocolVersion:2,capabilities2:e}}async function Ja(t,{service:e}){const i=new Set,r=new Map,a=new Map,n=Xa.streamReader(t);let s=await n();for(;null===s;)s=await n();if(!0===s)throw new xr;if(s.includes("version 2"))return Ya(n);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ir(`# service=${e}\\n`,s.toString("utf8"));let o=await n();for(;null===o;)o=await n();if(!0===o)return{capabilities:i,refs:r,symrefs:a};if(o=o.toString("utf8"),o.includes("version 2"))return Ya(n);const[c,f]=Qa(o,"\0","\\x00");if(f.split(" ").map((t=>i.add(t))),"0000000000000000000000000000000000000000 capabilities^{}"!==c){const[t,e]=Qa(c," "," ");for(r.set(e,t);;){const t=await n();if(!0===t)break;if(null!==t){const[e,i]=Qa(t.toString("utf8")," "," ");r.set(i,e)}}}for(const t of i)if(t.startsWith("symref=")){const e=t.match(/symref=([^:]+):(.*)/);3===e.length&&a.set(e[1],e[2])}return{protocolVersion:1,capabilities:i,refs:r,symrefs:a}}function Qa(t,e,i){const r=t.trim().split(e);if(2!==r.length)throw new Ir(`Two strings separated by '${i}'`,t.toString("utf8"));return r}const tn=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,en=(t,e)=>{(e.username||e.password)&&(t.Authorization=Wa(e)),e.headers&&Object.assign(t,e.headers)},rn=async t=>{try{const e=Buffer.from(await Za(t.body)),i=e.toString("utf8");return{preview:i.length<256?i:i.slice(0,256)+"...",response:i,data:e}}catch(t){return{}}};class an{static async capabilities(){return["discover","connect"]}static async discover({http:t,onProgress:e,onAuth:i,onAuthSuccess:r,onAuthFailure:a,corsProxy:n,service:s,url:o,headers:c,protocolVersion:f}){let{url:d,auth:h}=Ka(o);const l=n?tn(n,d):d;let u,g;(h.username||h.password)&&(c.Authorization=Wa(h)),2===f&&(c["Git-Protocol"]="version=2");let w=!1;do{if(u=await t.request({onProgress:e,method:"GET",url:`${l}/info/refs?service=${s}`,headers:c}),g=!1,401===u.statusCode||203===u.statusCode){const t=w?a:i;if(t){if(h=await t(d,{...h,headers:{...c}}),h&&h.cancel)throw new Mr;h&&(en(c,h),w=!0,g=!0)}}else 200===u.statusCode&&w&&r&&await r(d,h)}while(g);if(200!==u.statusCode){const{response:t}=await rn(u);throw new Sr(u.statusCode,u.statusMessage,t)}if(u.headers["content-type"]===`application/x-${s}-advertisement`){const t=await Ja(u.body,{service:s});return t.auth=h,t}{const{preview:t,response:e,data:i}=await rn(u);try{const t=await Ja([i],{service:s});return t.auth=h,t}catch(i){throw new Dr(t,e)}}}static async connect({http:t,onProgress:e,corsProxy:i,service:r,url:a,auth:n,body:s,headers:o}){const c=Ka(a);c&&(a=c.url),i&&(a=tn(i,a)),o["content-type"]=`application/x-${r}-request`,o.accept=`application/x-${r}-result`,en(o,n);const f=await t.request({onProgress:e,method:"POST",url:`${a}/${r}`,body:s,headers:o});if(200!==f.statusCode){const{response:t}=rn(f);throw new Sr(f.statusCode,f.statusMessage,t)}return f}}class nn{static getRemoteHelperFor({url:t}){const e=new Map;e.set("http",an),e.set("https",an);const i=function({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};const e=t.match(/(\w+)(:\/\/|::)(.*)/);return null!==e?"://"===e[2]?{transport:e[1],address:e[0]}:"::"===e[2]?{transport:e[1],address:e[3]}:void 0:void 0}({url:t});if(!i)throw new Ur(t);if(e.has(i.transport))return e.get(i.transport);throw new Nr(t,i.transport,"ssh"===i.transport?function(t){return(t=t.replace(/^git@([^:]+):/,"https://$1/")).replace(/^ssh:\/\//,"https://")}(t):void 0)}}let sn=null;class on{static async read({fs:t,gitdir:e}){null===sn&&(sn=new a);const i=b.join(e,"shallow"),r=new Set;return await sn.acquire(i,(async function(){const e=await t.read(i,{encoding:"utf8"});return null===e||""===e.trim()?r:void e.trim().split("\n").map((t=>r.add(t)))})),r}static async write({fs:t,gitdir:e,oids:i}){null===sn&&(sn=new a);const r=b.join(e,"shallow");if(i.size>0){const e=[...i].join("\n")+"\n";await sn.acquire(r,(async function(){await t.write(r,e,{encoding:"utf8"})}))}else await sn.acquire(r,(async function(){await t.rm(r)}))}}async function cn({fs:t,cache:e,gitdir:i,oid:r,format:a="content"}){const n=r=>mr({fs:t,cache:e,gitdir:i,oid:r});let s=await async function({fs:t,gitdir:e,oid:i}){const r=`objects/${i.slice(0,2)}/${i.slice(2)}`;return t.exists(`${e}/${r}`)}({fs:t,gitdir:i,oid:r});return s||(s=await async function({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:a}){let n=await t.readdir(b.join(i,"objects/pack"));n=n.filter((t=>t.endsWith(".idx")));for(const s of n){const n=`${i}/objects/pack/${s}`,o=await pr({fs:t,cache:e,filename:n,getExternalRefDelta:a});if(o.error)throw new ii(o.error);if(o.offsets.has(r))return!0}return!1}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:n})),s}function fn(t,e){const i=t.map((t=>t.split("=",1)[0]));return e.filter((t=>{const e=t.split("=",1)[0];return i.includes(e)}))}const dn="1.30.1",hn="git/isomorphic-git@1.30.1";class ln{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}))}}function un(t){const e=t.indexOf("\r"),i=t.indexOf("\n");return-1===e&&-1===i?-1:-1===e?i+1:-1===i?e+1:i===e+1?i+1:Math.min(e,i)+1}function gn(t){const e=new ln;let i="";return(async()=>{await Ga(t,(t=>{for(t=t.toString("utf8"),i+=t;;){const t=un(i);if(-1===t)break;e.write(i.slice(0,t)),i=i.slice(t)}})),i.length>0&&e.write(i),e.end()})(),e}class wn{static demux(t){const e=Xa.streamReader(t),i=new ln,r=new ln,a=new ln,n=async function(){const s=await e();if(null===s)return n();if(!0===s)return i.end(),a.end(),void(t.error?r.destroy(t.error):r.end());switch(s[0]){case 1:r.write(s.slice(1));break;case 2:a.write(s.slice(1));break;case 3:{const t=s.slice(1);return a.write(t),i.end(),a.end(),void r.destroy(new Error(t.toString("utf8")))}default:i.write(s)}n()};return n(),{packetlines:i,packfile:r,progress:a}}}async function pn({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:f,remoteRef:d,remote:h,url:l,corsProxy:u,depth:g=null,since:w=null,exclude:p=[],relative:m=!1,tags:y=!1,singleBranch:_=!1,headers:v={},prune:x=!1,pruneTags:k=!1}){const E=f||await La({fs:t,gitdir:c,test:!0}),S=await Zi.get({fs:t,gitdir:c}),$=h||E&&await S.get(`branch.${E}.remote`)||"origin",j=l||await S.get(`remote.${$}.url`);if(void 0===j)throw new Or("remote OR url");const A=d||E&&await S.get(`branch.${E}.merge`)||f||"HEAD";void 0===u&&(u=await S.get("http.corsProxy"));const B=nn.getRemoteHelperFor({url:j}),R=await B.discover({http:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,corsProxy:u,service:"git-upload-pack",url:j,headers:v,protocolVersion:1}),P=R.auth,O=R.refs;if(0===O.size)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(null!==g&&!R.capabilities.has("shallow"))throw new Tr("shallow","depth");if(null!==w&&!R.capabilities.has("deepen-since"))throw new Tr("deepen-since","since");if(p.length>0&&!R.capabilities.has("deepen-not"))throw new Tr("deepen-not","exclude");if(!0===m&&!R.capabilities.has("deepen-relative"))throw new Tr("deepen-relative","relative");const{oid:C,fullref:I}=Ji.resolveAgainstMap({ref:A,map:O});for(const t of O.keys())t===I||"HEAD"===t||t.startsWith("refs/heads/")||y&&t.startsWith("refs/tags/")||O.delete(t);const z=fn([...R.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${hn}`]);m&&z.push("deepen-relative");const T=_?[C]:O.values(),D=_?[E]:await Ji.listRefs({fs:t,gitdir:c,filepath:"refs"});let N=[];for(let i of D)try{i=await Ji.expand({fs:t,gitdir:c,ref:i});const r=await Ji.resolve({fs:t,gitdir:c,ref:i});await cn({fs:t,cache:e,gitdir:c,oid:r})&&N.push(r)}catch(t){}N=[...new Set(N)];const U=await on.read({fs:t,gitdir:c}),M=function({capabilities:t=[],wants:e=[],haves:i=[],shallows:r=[],depth:a=null,since:n=null,exclude:s=[]}){const o=[];e=[...new Set(e)];let c=` ${t.join(" ")}`;for(const t of e)o.push(Xa.encode(`want ${t}${c}\n`)),c="";for(const t of r)o.push(Xa.encode(`shallow ${t}\n`));null!==a&&o.push(Xa.encode(`deepen ${a}\n`)),null!==n&&o.push(Xa.encode(`deepen-since ${Math.floor(n.valueOf()/1e3)}\n`));for(const t of s)o.push(Xa.encode(`deepen-not ${t}\n`));o.push(Xa.flush());for(const t of i)o.push(Xa.encode(`have ${t}\n`));return o.push(Xa.encode("done\n")),o}({capabilities:z,wants:T,haves:N,shallows:R.capabilities.has("shallow")?[...U]:[],depth:g,since:w,exclude:p}),F=Buffer.from(await Za(M)),H=await B.connect({http:i,onProgress:r,corsProxy:u,service:"git-upload-pack",url:j,auth:P,body:[F],headers:v}),q=await async function(t){const{packetlines:e,packfile:i,progress:r}=wn.demux(t),a=[],n=[],s=[];let o=!1,c=!1;return new Promise(((f,d)=>{Ga(e,(e=>{const h=e.toString("utf8").trim();if(h.startsWith("shallow")){const t=h.slice(-41).trim();40!==t.length&&d(new ji(t)),a.push(t)}else if(h.startsWith("unshallow")){const t=h.slice(-41).trim();40!==t.length&&d(new ji(t)),n.push(t)}else if(h.startsWith("ACK")){const[,t,e]=h.split(" ");s.push({oid:t,status:e}),e||(c=!0)}else h.startsWith("NAK")?(o=!0,c=!0):(c=!0,o=!0);c&&(t.error?d(t.error):f({shallows:a,unshallows:n,acks:s,nak:o,packfile:i,progress:r}))})).finally((()=>{c||(t.error?d(t.error):f({shallows:a,unshallows:n,acks:s,nak:o,packfile:i,progress:r}))}))}))}(H.body);H.headers&&(q.headers=H.headers);for(const i of q.shallows)if(!U.has(i))try{const{object:r}=await mr({fs:t,cache:e,gitdir:c,oid:i}),a=new Xr(r),n=await Promise.all(a.headers().parent.map((i=>cn({fs:t,cache:e,gitdir:c,oid:i}))));0===n.length||n.every((t=>t))||U.add(i)}catch(t){U.add(i)}for(const t of q.unshallows)U.delete(t);if(await on.write({fs:t,gitdir:c,oids:U}),_){const e=new Map([[I,C]]),i=new Map;let r=10,a=I;for(;r--;){const t=R.symrefs.get(a);if(void 0===t)break;i.set(a,t),a=t}const n=O.get(a);n&&e.set(a,n);const{pruned:s}=await Ji.updateRemoteRefs({fs:t,gitdir:c,remote:$,refs:e,symrefs:i,tags:y,prune:x});x&&(q.pruned=s)}else{const{pruned:e}=await Ji.updateRemoteRefs({fs:t,gitdir:c,remote:$,refs:O,symrefs:R.symrefs,tags:y,prune:x,pruneTags:k});x&&(q.pruned=e)}if(q.HEAD=R.symrefs.get("HEAD"),void 0===q.HEAD){const{oid:t}=Ji.resolveAgainstMap({ref:"HEAD",map:O});for(const[e,i]of O.entries())if("HEAD"!==e&&i===t){q.HEAD=e;break}}const L=I.startsWith("refs/tags")?"tag":"branch";if(q.FETCH_HEAD={oid:C,description:`${L} '${qa(I)}' of ${j}`},r||a){Ga(gn(q.progress),(async t=>{if(a&&await a(t),r){const e=t.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);e&&await r({phase:e[1].trim(),loaded:parseInt(e[2],10),total:parseInt(e[3],10)})}}))}const W=Buffer.from(await Za(q.packfile));if(H.body.error)throw H.body.error;const G=W.slice(-20).toString("hex"),Z={defaultBranch:q.HEAD,fetchHead:q.FETCH_HEAD.oid,fetchHeadDescription:q.FETCH_HEAD.description};if(q.headers&&(Z.headers=q.headers),x&&(Z.pruned=q.pruned),""!==G&&"5041434b0000000200000000"!==W.slice(0,12).toString("hex")){Z.packfile=`objects/pack/pack-${G}.pack`;const i=b.join(c,Z.packfile);await t.write(i,W);const a=i=>mr({fs:t,cache:e,gitdir:c,oid:i}),n=await gr.fromPack({pack:W,getExternalRefDelta:a,onProgress:r});await t.write(i.replace(/\.pack$/,".idx"),await n.toBuffer())}return Z}async function mn({fs:t,bare:e=!1,dir:i,gitdir:r=(e?i:b.join(i,".git")),defaultBranch:a="master"}){if(await t.exists(r+"/config"))return;let n=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];n=n.map((t=>r+"/"+t));for(const e of n)await t.mkdir(e);await t.write(r+"/config",`[core]\n\trepositoryformatversion = 0\n\tfilemode = false\n\tbare = ${e}\n`+(e?"":"\tlogallrefupdates = true\n")+"\tsymlinks = false\n\tignorecase = true\n"),await t.write(r+"/HEAD",`ref: refs/heads/${a}\n`)}async function yn({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:f=b.join(c,".git"),url:d,corsProxy:h,ref:l,remote:u="origin",depth:g,since:w,exclude:p=[],relative:m=!1,singleBranch:y=!1,noCheckout:_=!1,noTags:v=!1,headers:x={},cache:k={}}){try{return la("fs",t),la("http",e),la("gitdir",f),_||la("dir",c),la("url",d),await async function({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:c,dir:f,gitdir:d,url:h,corsProxy:l,ref:u,remote:g,depth:w,since:p,exclude:m,relative:y,singleBranch:_,noCheckout:b,noTags:v,headers:x}){try{if(await mn({fs:t,gitdir:d}),await za({fs:t,gitdir:d,remote:g,url:h,force:!1}),l){const e=await Zi.get({fs:t,gitdir:d});await e.set("http.corsProxy",l),await Zi.save({fs:t,gitdir:d,config:e})}const{defaultBranch:k,fetchHead:E}=await pn({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:d,ref:u,remote:g,corsProxy:l,depth:w,since:p,exclude:m,relative:y,singleBranch:_,headers:x,tags:!v});if(null===E)return;u=(u=u||k).replace("refs/heads/",""),await Ma({fs:t,cache:e,onProgress:r,onPostCheckout:c,dir:f,gitdir:d,ref:u,remote:g,noCheckout:b})}catch(e){throw await t.rmdir(d,{recursive:!0,maxRetries:10}).catch((()=>{})),e}}({fs:new ha(t),cache:k,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:f,url:d,corsProxy:h,ref:l,remote:u,depth:g,since:w,exclude:p,relative:m,singleBranch:y,noCheckout:_,noTags:v,headers:x})}catch(t){throw t.caller="git.clone",t}}async function _n({fs:t,onSign:e,dir:i,gitdir:r=b.join(i,".git"),message:a,author:n,committer:s,signingKey:o,amend:c=!1,dryRun:f=!1,noUpdateBranch:d=!1,ref:h,parent:l,tree:u,cache:g={}}){try{la("fs",t),c||la("message",a),o&&la("onSign",e);const i=new ha(t);return await Aa({fs:i,cache:g,onSign:e,gitdir:r,message:a,author:n,committer:s,signingKey:o,amend:c,dryRun:f,noUpdateBranch:d,ref:h,parent:l,tree:u})}catch(t){throw t.caller="git.commit",t}}async function bn({fs:t,dir:e,gitdir:i=b.join(e,".git"),fullname:r=!1,test:a=!1}){try{return la("fs",t),la("gitdir",i),await La({fs:new ha(t),gitdir:i,fullname:r,test:a})}catch(t){throw t.caller="git.currentBranch",t}}async function vn({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r}){try{return la("fs",t),la("ref",r),await async function({fs:t,gitdir:e,ref:i}){if(i=i.startsWith("refs/heads/")?i:`refs/heads/${i}`,!await Ji.exists({fs:t,gitdir:e,ref:i}))throw new Si(i);const r=await Ji.expand({fs:t,gitdir:e,ref:i});if(r===await La({fs:t,gitdir:e,fullname:!0})){const i=await Ji.resolve({fs:t,gitdir:e,ref:r});await Ji.writeRef({fs:t,gitdir:e,ref:"HEAD",value:i})}await Ji.deleteRef({fs:t,gitdir:e,ref:r});const a=qa(i),n=await Zi.get({fs:t,gitdir:e});await n.deleteSection("branch",a),await Zi.save({fs:t,gitdir:e,config:n})}({fs:new ha(t),gitdir:i,ref:r})}catch(t){throw t.caller="git.deleteBranch",t}}async function xn({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r}){try{la("fs",t),la("ref",r),await Ji.deleteRef({fs:new ha(t),gitdir:i,ref:r})}catch(t){throw t.caller="git.deleteRef",t}}async function kn({fs:t,dir:e,gitdir:i=b.join(e,".git"),remote:r}){try{return la("fs",t),la("remote",r),await async function({fs:t,gitdir:e,remote:i}){const r=await Zi.get({fs:t,gitdir:e});await r.deleteSection("remote",i),await Zi.save({fs:t,gitdir:e,config:r})}({fs:new ha(t),gitdir:i,remote:r})}catch(t){throw t.caller="git.deleteRemote",t}}async function En({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r}){try{return la("fs",t),la("ref",r),await async function({fs:t,gitdir:e,ref:i}){i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,await Ji.deleteRef({fs:t,gitdir:e,ref:i})}({fs:new ha(t),gitdir:i,ref:r})}catch(t){throw t.caller="git.deleteTag",t}}async function Sn({fs:t,cache:e,gitdir:i,oid:r}){const a=await async function({fs:t,gitdir:e,oid:i}){const r=i.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map((t=>`${r}${t}`)).filter((t=>t.startsWith(i)))}({fs:t,gitdir:i,oid:r}),n=await async function({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:a}){const n=[];let s=await t.readdir(b.join(i,"objects/pack"));s=s.filter((t=>t.endsWith(".idx")));for(const o of s){const s=`${i}/objects/pack/${o}`,c=await pr({fs:t,cache:e,filename:s,getExternalRefDelta:a});if(c.error)throw new ii(c.error);for(const t of c.offsets.keys())t.startsWith(r)&&n.push(t)}return n}({fs:t,cache:e,gitdir:i,oid:r,getExternalRefDelta:r=>mr({fs:t,cache:e,gitdir:i,oid:r})});for(const t of n)-1===a.indexOf(t)&&a.push(t);if(1===a.length)return a[0];if(a.length>1)throw new _r("oids",r,a);throw new Si(`an object matching "${r}"`)}async function $n({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,cache:a={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),await Sn({fs:new ha(t),cache:a,gitdir:i,oid:r})}catch(t){throw t.caller="git.expandOid",t}}async function jn({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r}){try{return la("fs",t),la("gitdir",i),la("ref",r),await Ji.expand({fs:new ha(t),gitdir:i,ref:r})}catch(t){throw t.caller="git.expandRef",t}}async function An({fs:t,cache:e,gitdir:i,oids:r}){const a={},n=r.length;let s=r.map(((t,e)=>({index:e,oid:t})));for(;s.length;){const r=new Set;for(const{oid:t,index:e}of s)a[t]||(a[t]=new Set),a[t].add(e),a[t].size===n&&r.add(t);if(r.size>0)return[...r];const o=new Map;for(const{oid:r,index:n}of s)try{const{object:s}=await mr({fs:t,cache:e,gitdir:i,oid:r}),c=Xr.from(s),{parent:f}=c.parseHeaders();for(const t of f)a[t]&&a[t].has(n)||o.set(t+":"+n,{oid:t,index:n})}catch(t){}s=Array.from(o.values())}return[]}const Bn=/^.*(\r?\n|$)/gm;function Rn({branches:t,contents:e}){const i=t[1],r=t[2],a=e[0],n=e[1],s=e[2],o=n.match(Bn),c=a.match(Bn),f=s.match(Bn),d=Qe(o,c,f);let h="",l=!0;for(const t of d)t.ok&&(h+=t.ok.join("")),t.conflict&&(l=!1,h+=`${"<".repeat(7)} ${i}\n`,h+=t.conflict.a.join(""),h+=`${"=".repeat(7)}\n`,h+=t.conflict.b.join(""),h+=`${">".repeat(7)} ${r}\n`);return{cleanMerge:l,mergedText:h}}async function Pn({fs:t,cache:e,dir:i,gitdir:r=b.join(i,".git"),index:a,ourOid:n,baseOid:s,theirOid:o,ourName:c="ours",baseName:f="base",theirName:d="theirs",dryRun:h=!1,abortOnConflict:l=!0,mergeDriver:u}){const g=Qr({ref:n}),w=Qr({ref:s}),p=Qr({ref:o}),m=[],y=[],_=[],v=[],x=await na({fs:t,cache:e,dir:i,gitdir:r,trees:[g,w,p],map:async function(e,[i,n,s]){const o=_i(e);switch(`${await ua(i,n)}-${await ua(s,n)}`){case"false-false":return{mode:await n.mode(),path:o,oid:await n.oid(),type:await n.type()};case"false-true":return s?{mode:await s.mode(),path:o,oid:await s.oid(),type:await s.type()}:void 0;case"true-false":return i?{mode:await i.mode(),path:o,oid:await i.oid(),type:await i.type()}:void 0;case"true-true":if(i&&n&&s&&"blob"===await i.type()&&"blob"===await n.type()&&"blob"===await s.type())return async function({fs:t,gitdir:e,path:i,ours:r,base:a,theirs:n,ourName:s,theirName:o,baseName:c,dryRun:f,mergeDriver:d=Rn}){const h="blob",l=await a.mode()===await r.mode()?await n.mode():await r.mode();if(await r.oid()===await n.oid())return{cleanMerge:!0,mergeResult:{mode:l,path:i,oid:await r.oid(),type:h}};if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:l,path:i,oid:await n.oid(),type:h}};if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:l,path:i,oid:await r.oid(),type:h}};const u=Buffer.from(await r.content()).toString("utf8"),g=Buffer.from(await a.content()).toString("utf8"),w=Buffer.from(await n.content()).toString("utf8"),{mergedText:p,cleanMerge:m}=await d({branches:[c,s,o],contents:[g,u,w],path:i}),y=await ya({fs:t,gitdir:e,type:"blob",object:Buffer.from(p,"utf8"),dryRun:f});return{cleanMerge:m,mergeResult:{mode:l,path:i,oid:y,type:h}}}({fs:t,gitdir:r,path:o,ours:i,base:n,theirs:s,ourName:c,baseName:f,theirName:d,mergeDriver:u}).then((async t=>{if(t.cleanMerge)l||a.insert({filepath:e,oid:t.mergeResult.oid,stage:0});else if(m.push(e),y.push(e),!l){const t=await n.oid(),r=await i.oid(),o=await s.oid();a.delete({filepath:e}),a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:r,stage:2}),a.insert({filepath:e,oid:o,stage:3})}return t.mergeResult}));if(n&&!i&&s&&"blob"===await n.type()&&"blob"===await s.type()){if(m.push(e),_.push(e),!l){const t=await n.oid(),i=await s.oid();a.delete({filepath:e}),a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:i,stage:3})}return{mode:await s.mode(),oid:await s.oid(),type:"blob",path:o}}if(n&&i&&!s&&"blob"===await n.type()&&"blob"===await i.type()){if(m.push(e),v.push(e),!l){const t=await n.oid(),r=await i.oid();a.delete({filepath:e}),a.insert({filepath:e,oid:t,stage:1}),a.insert({filepath:e,oid:r,stage:2})}return{mode:await i.mode(),oid:await i.oid(),type:"blob",path:o}}if(n&&!i&&!s&&"blob"===await n.type())return;throw new Br}},reduce:0===m.length||i&&!l?async(e,i)=>{const a=i.filter(Boolean);if(e&&(!e||"tree"!==e.type||0!==a.length)){if(a.length>0){const i=new rr(a).toObject(),n=await ya({fs:t,gitdir:r,type:"tree",object:i,dryRun:h});e.oid=n}return e}}:void 0});return 0!==m.length?(i&&!l&&await na({fs:t,cache:e,dir:i,gitdir:r,trees:[Qr({ref:x.oid})],map:async function(e,[r]){const a=`${i}/${e}`;if("blob"===await r.type()){const e=await r.mode(),i=(new TextDecoder).decode(await r.content());await t.write(a,i,{mode:e})}return!0}}),new Rr(m,y,_,v)):x.oid}async function On({fs:t,cache:e,dir:i,gitdir:r,ours:a,theirs:n,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:f=!1,abortOnConflict:d=!0,message:h,author:l,committer:u,signingKey:g,onSign:w,mergeDriver:p}){void 0===a&&(a=await La({fs:t,gitdir:r,fullname:!0})),a=await Ji.expand({fs:t,gitdir:r,ref:a}),n=await Ji.expand({fs:t,gitdir:r,ref:n});const m=await Ji.resolve({fs:t,gitdir:r,ref:a}),y=await Ji.resolve({fs:t,gitdir:r,ref:n}),_=await An({fs:t,cache:e,gitdir:r,oids:[m,y]});if(1!==_.length)throw new Br;const b=_[0];if(b===y)return{oid:m,alreadyMerged:!0};if(s&&b===m)return c||f||await Ji.writeRef({fs:t,gitdir:r,ref:a,value:y}),{oid:y,fastForward:!0};{if(o)throw new kr;const s=await yi.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},(async s=>Pn({fs:t,cache:e,dir:i,gitdir:r,index:s,ourOid:m,theirOid:y,baseOid:b,ourName:qa(a),baseName:"base",theirName:qa(n),dryRun:c,abortOnConflict:d,mergeDriver:p})));if(s instanceof Rr)throw s;h||(h=`Merge branch '${qa(n)}' into ${qa(a)}`);return{oid:await Aa({fs:t,cache:e,gitdir:r,message:h,ref:a,tree:s,parent:[m,y],author:l,committer:u,signingKey:g,onSign:w,dryRun:c,noUpdateBranch:f}),tree:s,mergeCommit:!0}}}async function Cn({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,dir:c,gitdir:f,ref:d,url:h,remote:l,remoteRef:u,prune:g,pruneTags:w,fastForward:p,fastForwardOnly:m,corsProxy:y,singleBranch:_,headers:b,author:v,committer:x,signingKey:k}){try{if(!d){const e=await La({fs:t,gitdir:f});if(!e)throw new Or("ref");d=e}const{fetchHead:E,fetchHeadDescription:S}=await pn({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,gitdir:f,corsProxy:y,ref:d,url:h,remote:l,remoteRef:u,singleBranch:_,headers:b,prune:g,pruneTags:w});await On({fs:t,cache:e,gitdir:f,ours:d,theirs:E,fastForward:p,fastForwardOnly:m,message:`Merge ${S}`,author:v,committer:x,signingKey:k,dryRun:!1,noUpdateBranch:!1}),await Ma({fs:t,cache:e,onProgress:r,dir:c,gitdir:f,ref:d,remote:l,noCheckout:!1})}catch(t){throw t.caller="git.pull",t}}async function In({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=b.join(o,".git"),ref:f,url:d,remote:h,remoteRef:l,corsProxy:u,singleBranch:g,headers:w={},cache:p={}}){try{la("fs",t),la("http",e),la("gitdir",c);const m={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await Cn({fs:new ha(t),cache:p,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c,ref:f,url:d,remote:h,remoteRef:l,fastForwardOnly:!0,corsProxy:u,singleBranch:g,headers:w,author:m,committer:m})}catch(t){throw t.caller="git.fastForward",t}}async function zn({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=b.join(o,".git"),ref:f,remote:d,remoteRef:h,url:l,corsProxy:u,depth:g=null,since:w=null,exclude:p=[],relative:m=!1,tags:y=!1,singleBranch:_=!1,headers:v={},prune:x=!1,pruneTags:k=!1,cache:E={}}){try{return la("fs",t),la("http",e),la("gitdir",c),await pn({fs:new ha(t),cache:E,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,gitdir:c,ref:f,remote:d,remoteRef:h,url:l,corsProxy:u,depth:g,since:w,exclude:p,relative:m,tags:y,singleBranch:_,headers:v,prune:x,pruneTags:k})}catch(t){throw t.caller="git.fetch",t}}async function Tn({fs:t,dir:e,gitdir:i=b.join(e,".git"),oids:r,cache:a={}}){try{return la("fs",t),la("gitdir",i),la("oids",r),await An({fs:new ha(t),cache:a,gitdir:i,oids:r})}catch(t){throw t.caller="git.findMergeBase",t}}async function Dn({fs:t,filepath:e}){if(await t.exists(b.join(e,".git")))return e;{const i=bi(e);if(i===e)throw new Si(`git root for ${e}`);return Dn({fs:t,filepath:i})}}async function Nn({fs:t,filepath:e}){try{return la("fs",t),la("filepath",e),await Dn({fs:new ha(t),filepath:e})}catch(t){throw t.caller="git.findRoot",t}}async function Un({fs:t,dir:e,gitdir:i=b.join(e,".git"),path:r}){try{return la("fs",t),la("gitdir",i),la("path",r),await xa({fs:new ha(t),gitdir:i,path:r})}catch(t){throw t.caller="git.getConfig",t}}async function Mn({fs:t,dir:e,gitdir:i=b.join(e,".git"),path:r}){try{return la("fs",t),la("gitdir",i),la("path",r),await async function({fs:t,gitdir:e,path:i}){return(await Zi.get({fs:t,gitdir:e})).getall(i)}({fs:new ha(t),gitdir:i,path:r})}catch(t){throw t.caller="git.getConfigAll",t}}async function Fn({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1}){try{la("http",t),la("url",n);const c=nn.getRemoteHelperFor({url:n}),f=await c.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:1}),d={capabilities:[...f.capabilities]};for(const[t,e]of f.refs){const i=t.split("/"),r=i.pop();let a=d;for(const t of i)a[t]=a[t]||{},a=a[t];a[r]=e}for(const[t,e]of f.symrefs){const i=t.split("/"),r=i.pop();let a=d;for(const t of i)a[t]=a[t]||{},a=a[t];a[r]=e}return d}catch(t){throw t.caller="git.getRemoteInfo",t}}function Hn(t,e,i,r){const a=[];for(const[n,s]of t.refs){if(e&&!n.startsWith(e))continue;if(n.endsWith("^{}")){if(r){const t=n.replace("^{}",""),e=a[a.length-1],i=e.ref===t?e:a.find((e=>e.ref===t));if(void 0===i)throw new Error("I did not expect this to happen");i.peeled=s}continue}const o={ref:n,oid:s};i&&t.symrefs.has(n)&&(o.target=t.symrefs.get(n)),a.push(o)}return a}async function qn({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1,protocolVersion:c=2}){try{la("http",t),la("url",n);const f=nn.getRemoteHelperFor({url:n}),d=await f.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:c});if(2===d.protocolVersion)return{protocolVersion:d.protocolVersion,capabilities:d.capabilities2};const h={};for(const t of d.capabilities){const[e,i]=t.split("=");h[e]=i||!0}return{protocolVersion:1,capabilities:h,refs:Hn(d,void 0,!0,!0)}}catch(t){throw t.caller="git.getRemoteInfo2",t}}async function Ln({object:t}){try{la("object",t),t="string"==typeof t?Buffer.from(t,"utf8"):Buffer.from(t);const e="blob",{oid:i,object:r}=await async function({type:t,object:e,format:i="content",oid:r}){return"deflated"!==i&&("wrapped"!==i&&(e=ar.wrap({type:t,object:e})),r=await li(e)),{oid:r,object:e}}({type:"blob",format:"content",object:t});return{oid:i,type:e,object:new Uint8Array(r),format:"wrapped"}}catch(t){throw t.caller="git.hashBlob",t}}async function Wn({fs:t,onProgress:e,dir:i,gitdir:r=b.join(i,".git"),filepath:a,cache:n={}}){try{return la("fs",t),la("dir",i),la("gitdir",i),la("filepath",a),await async function({fs:t,cache:e,onProgress:i,dir:r,gitdir:a,filepath:n}){try{n=b.join(r,n);const s=await t.read(n),o=i=>mr({fs:t,cache:e,gitdir:a,oid:i}),c=await gr.fromPack({pack:s,getExternalRefDelta:o,onProgress:i});return await t.write(n.replace(/\.pack$/,".idx"),await c.toBuffer()),{oids:[...c.hashes]}}catch(t){throw t.caller="git.indexPack",t}}({fs:new ha(t),cache:n,onProgress:e,dir:i,gitdir:r,filepath:a})}catch(t){throw t.caller="git.indexPack",t}}async function Gn({fs:t,bare:e=!1,dir:i,gitdir:r=(e?i:b.join(i,".git")),defaultBranch:a="master"}){try{return la("fs",t),la("gitdir",r),e||la("dir",i),await mn({fs:new ha(t),bare:e,dir:i,gitdir:r,defaultBranch:a})}catch(t){throw t.caller="git.init",t}}async function Zn({fs:t,cache:e,gitdir:i,oid:r,ancestor:a,depth:n}){const s=await on.read({fs:t,gitdir:i});if(!r)throw new Or("oid");if(!a)throw new Or("ancestor");if(r===a)return!1;const o=[r],c=new Set;let f=0;for(;o.length;){if(f++===n)throw new Ar(n);const r=o.shift(),{type:d,object:h}=await mr({fs:t,cache:e,gitdir:i,oid:r});if("commit"!==d)throw new $i(r,d,"commit");const l=Xr.from(h).parse();for(const t of l.parent)if(t===a)return!0;if(!s.has(r))for(const t of l.parent)c.has(t)||(o.push(t),c.add(t))}return!1}async function Kn({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,ancestor:a,depth:n=-1,cache:s={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),la("ancestor",a),await Zn({fs:new ha(t),cache:s,gitdir:i,oid:r,ancestor:a,depth:n})}catch(t){throw t.caller="git.isDescendent",t}}async function Vn({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r}){try{return la("fs",t),la("dir",e),la("gitdir",i),la("filepath",r),wa.isIgnored({fs:new ha(t),dir:e,gitdir:i,filepath:r})}catch(t){throw t.caller="git.isIgnored",t}}async function Xn({fs:t,dir:e,gitdir:i=b.join(e,".git"),remote:r}){try{return la("fs",t),la("gitdir",i),Ji.listBranches({fs:new ha(t),gitdir:i,remote:r})}catch(t){throw t.caller="git.listBranches",t}}async function Yn({fs:t,gitdir:e,ref:i,cache:r}){if(i){const a=await Ji.resolve({gitdir:e,fs:t,ref:i}),n=[];return await Jn({fs:t,cache:r,gitdir:e,oid:a,filenames:n,prefix:""}),n}return yi.acquire({fs:t,gitdir:e,cache:r},(async function(t){return t.entries.map((t=>t.path))}))}async function Jn({fs:t,cache:e,gitdir:i,oid:r,filenames:a,prefix:n}){const{tree:s}=await Oa({fs:t,cache:e,gitdir:i,oid:r});for(const r of s)"tree"===r.type?await Jn({fs:t,cache:e,gitdir:i,oid:r.oid,filenames:a,prefix:b.join(n,r.path)}):a.push(b.join(n,r.path))}async function Qn({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,cache:a={}}){try{return la("fs",t),la("gitdir",i),await Yn({fs:new ha(t),cache:a,gitdir:i,ref:r})}catch(t){throw t.caller="git.listFiles",t}}async function ts({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r="refs/notes/commits",cache:a={}}){try{return la("fs",t),la("gitdir",i),la("ref",r),await async function({fs:t,cache:e,gitdir:i,ref:r}){let a;try{a=await Ji.resolve({gitdir:i,fs:t,ref:r})}catch(t){if(t instanceof Si)return[]}return(await Oa({fs:t,cache:e,gitdir:i,oid:a})).tree.map((t=>({target:t.path,note:t.oid})))}({fs:new ha(t),cache:a,gitdir:i,ref:r})}catch(t){throw t.caller="git.listNotes",t}}async function es({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r}){try{return la("fs",t),la("gitdir",i),Ji.listRefs({fs:new ha(t),gitdir:i,filepath:r})}catch(t){throw t.caller="git.listRefs",t}}async function is({fs:t,dir:e,gitdir:i=b.join(e,".git")}){try{return la("fs",t),la("gitdir",i),await async function({fs:t,gitdir:e}){const i=await Zi.get({fs:t,gitdir:e}),r=await i.getSubsections("remote");return Promise.all(r.map((async t=>({remote:t,url:await i.get(`remote.${t}.url`)}))))}({fs:new ha(t),gitdir:i})}catch(t){throw t.caller="git.listRemotes",t}}async function rs({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,url:n,headers:s={},forPush:o=!1,protocolVersion:c=2,prefix:f,symrefs:d,peelTags:h}){try{la("http",t),la("url",n);const l=await an.discover({http:t,onAuth:e,onAuthSuccess:i,onAuthFailure:r,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,headers:s,protocolVersion:c});if(1===l.protocolVersion)return Hn(l,f,d,h);const u=await async function({prefix:t,symrefs:e,peelTags:i}){const r=[];return r.push(Xa.encode("command=ls-refs\n")),r.push(Xa.encode(`agent=${hn}\n`)),(i||e||t)&&r.push(Xa.delim()),i&&r.push(Xa.encode("peel")),e&&r.push(Xa.encode("symrefs")),t&&r.push(Xa.encode(`ref-prefix ${t}`)),r.push(Xa.flush()),r}({prefix:f,symrefs:d,peelTags:h});return async function(t){const e=Xa.streamReader(t),i=[];let r;for(;r=await e(),!0!==r;){if(null===r)continue;r=r.toString("utf8").replace(/\n$/,"");const[t,e,...a]=r.split(" "),n={ref:e,oid:t};for(const t of a){const[e,i]=t.split(":");"symref-target"===e?n.target=i:"peeled"===e&&(n.peeled=i)}i.push(n)}return i}((await an.connect({http:t,auth:l.auth,headers:s,corsProxy:a,service:o?"git-receive-pack":"git-upload-pack",url:n,body:u})).body)}catch(t){throw t.caller="git.listServerRefs",t}}async function as({fs:t,dir:e,gitdir:i=b.join(e,".git")}){try{return la("fs",t),la("gitdir",i),Ji.listTags({fs:new ha(t),gitdir:i})}catch(t){throw t.caller="git.listTags",t}}function ns(t,e){return t.committer.timestamp-e.committer.timestamp}async function ss({fs:t,cache:e,gitdir:i,oid:r,fileId:a}){if("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"===a)return;const n=r;let s;const o=await Yr({fs:t,cache:e,gitdir:i,oid:r}),c=o.tree;return a===o.oid?s=o.path:(s=await os({fs:t,cache:e,gitdir:i,tree:c,fileId:a,oid:n}),Array.isArray(s)&&(0===s.length?s=void 0:1===s.length&&(s=s[0]))),s}async function os({fs:t,cache:e,gitdir:i,tree:r,fileId:a,oid:n,filepaths:s=[],parentPath:o=""}){const c=r.entries().map((function(r){let c;return r.oid===a?(c=b.join(o,r.path),s.push(c)):"tree"===r.type&&(c=mr({fs:t,cache:e,gitdir:i,oid:r.oid}).then((function({object:c}){return os({fs:t,cache:e,gitdir:i,tree:rr.from(c),fileId:a,oid:n,filepaths:s,parentPath:b.join(o,r.path)})}))),c}));return await Promise.all(c),s}async function cs({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r,ref:a="HEAD",depth:n,since:s,force:o,follow:c,cache:f={}}){try{return la("fs",t),la("gitdir",i),la("ref",a),await async function({fs:t,cache:e,gitdir:i,filepath:r,ref:a,depth:n,since:s,force:o,follow:c}){const f=void 0===s?void 0:Math.floor(s.valueOf()/1e3),d=[],h=await on.read({fs:t,gitdir:i}),l=await Ji.resolve({fs:t,gitdir:i,ref:a}),u=[await ja({fs:t,cache:e,gitdir:i,oid:l})];let g,w,p;function m(t){p&&r&&d.push(t)}for(;u.length>0;){const a=u.pop();if(void 0!==f&&a.commit.committer.timestamp<=f)break;if(r){let n;try{n=await Ra({fs:t,cache:e,gitdir:i,oid:a.commit.tree,filepath:r}),w&&g!==n&&d.push(w),g=n,w=a,p=!0}catch(n){if(!(n instanceof Si))throw n;{let s=c&&g;if(s&&(s=await ss({fs:t,cache:e,gitdir:i,oid:a.commit.tree,fileId:g}),s))if(Array.isArray(s)){if(w){const a=await ss({fs:t,cache:e,gitdir:i,oid:w.commit.tree,fileId:g});if(Array.isArray(a)){if(s=s.filter((t=>-1===a.indexOf(t))),1!==s.length){s=!1,w&&d.push(w);break}s=s[0],r=s,w&&d.push(w)}}}else r=s,w&&d.push(w);if(!s){if(p&&g&&(d.push(w),!o))break;if(!o&&!c)throw n}w=a,p=!1}}}else d.push(a);if(void 0!==n&&d.length===n){m(a);break}if(!h.has(a.oid))for(const r of a.commit.parent){const a=await ja({fs:t,cache:e,gitdir:i,oid:r});u.map((t=>t.oid)).includes(a.oid)||u.push(a)}0===u.length&&m(a),u.sort(((t,e)=>ns(t.commit,e.commit)))}return d}({fs:new ha(t),cache:f,gitdir:i,filepath:r,ref:a,depth:n,since:s,force:o,follow:c})}catch(t){throw t.caller="git.log",t}}async function fs({fs:t,onSign:e,dir:i,gitdir:r=b.join(i,".git"),ours:a,theirs:n,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:f=!1,abortOnConflict:d=!0,message:h,author:l,committer:u,signingKey:g,cache:w={},mergeDriver:p}){try{la("fs",t),g&&la("onSign",e);const m=new ha(t),y=await Ea({fs:m,gitdir:r,author:l});if(!(y||o&&s))throw new Pr("author");const _=await Sa({fs:m,gitdir:r,author:y,committer:u});if(!(_||o&&s))throw new Pr("committer");return await On({fs:m,cache:w,dir:i,gitdir:r,ours:a,theirs:n,fastForward:s,fastForwardOnly:o,dryRun:c,noUpdateBranch:f,abortOnConflict:d,message:h,author:y,committer:_,signingKey:g,onSign:e,mergeDriver:p})}catch(t){throw t.caller="git.merge",t}}const ds={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function hs({fs:t,cache:e,dir:i,gitdir:r=b.join(i,".git"),oids:a}){const n=new p,s=[];function o(t,e){const i=Buffer.from(t,e);s.push(i),n.update(i)}async function c({stype:t,object:e}){const i=ds[t];let r=e.length,a=r>15?128:0;const n=15&r;r>>>=4;let s=(a|i|n).toString(16);for(o(s,"hex");a;)a=r>127?128:0,s=a|127&r,o(Va(2,s),"hex"),r>>>=7;o(Buffer.from(await ma(e)))}o("PACK"),o("00000002","hex"),o(Va(8,a.length),"hex");for(const i of a){const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:r,oid:i});await c({write:o,object:n,stype:a})}const f=n.digest();return s.push(f),s}async function ls({fs:t,dir:e,gitdir:i=b.join(e,".git"),oids:r,write:a=!1,cache:n={}}){try{return la("fs",t),la("gitdir",i),la("oids",r),await async function({fs:t,cache:e,gitdir:i,oids:r,write:a}){const n=await hs({fs:t,cache:e,gitdir:i,oids:r}),s=Buffer.from(await Za(n)),o=`pack-${s.slice(-20).toString("hex")}.pack`;return a?(await t.write(b.join(i,`objects/pack/${o}`),s),{filename:o}):{filename:o,packfile:new Uint8Array(s)}}({fs:new ha(t),cache:n,gitdir:i,oids:r,write:a})}catch(t){throw t.caller="git.packObjects",t}}async function us({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c=b.join(o,".git"),ref:f,url:d,remote:h,remoteRef:l,prune:u=!1,pruneTags:g=!1,fastForward:w=!0,fastForwardOnly:p=!1,corsProxy:m,singleBranch:y,headers:_={},author:v,committer:x,signingKey:k,cache:E={}}){try{la("fs",t),la("gitdir",c);const b=new ha(t),S=await Ea({fs:b,gitdir:c,author:v});if(!S)throw new Pr("author");const $=await Sa({fs:b,gitdir:c,author:S,committer:x});if(!$)throw new Pr("committer");return await Cn({fs:b,cache:E,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,dir:o,gitdir:c,ref:f,url:d,remote:h,remoteRef:l,fastForward:w,fastForwardOnly:p,corsProxy:m,singleBranch:y,headers:_,author:S,committer:$,signingKey:k,prune:u,pruneTags:g})}catch(t){throw t.caller="git.pull",t}}async function gs({fs:t,cache:e,dir:i,gitdir:r=b.join(i,".git"),oids:a}){const n=new Set;async function s(i){if(n.has(i))return;n.add(i);const{type:a,object:o}=await mr({fs:t,cache:e,gitdir:r,oid:i});if("tag"===a){const t=Kr.from(o).headers().object;await s(t)}else if("commit"===a){const t=Xr.from(o).headers().tree;await s(t)}else if("tree"===a){const t=rr.from(o);for(const e of t)"blob"===e.type&&n.add(e.oid),"tree"===e.type&&await s(e.oid)}}for(const t of a)await s(t);return n}async function ws({fs:t,cache:e,http:i,onProgress:r,onMessage:a,onAuth:n,onAuthSuccess:s,onAuthFailure:o,onPrePush:c,gitdir:f,ref:d,remoteRef:h,remote:l,url:u,force:g=!1,delete:w=!1,corsProxy:p,headers:m={}}){const y=d||await La({fs:t,gitdir:f});if(void 0===y)throw new Or("ref");const _=await Zi.get({fs:t,gitdir:f});l=l||await _.get(`branch.${y}.pushRemote`)||await _.get("remote.pushDefault")||await _.get(`branch.${y}.remote`)||"origin";const v=u||await _.get(`remote.${l}.pushurl`)||await _.get(`remote.${l}.url`);if(void 0===v)throw new Or("remote OR url");const x=h||await _.get(`branch.${y}.merge`);if(void 0===v)throw new Or("remoteRef");void 0===p&&(p=await _.get("http.corsProxy"));const k=await Ji.expand({fs:t,gitdir:f,ref:y}),E=w?"0000000000000000000000000000000000000000":await Ji.resolve({fs:t,gitdir:f,ref:k}),S=nn.getRemoteHelperFor({url:v}),$=await S.discover({http:i,onAuth:n,onAuthSuccess:s,onAuthFailure:o,corsProxy:p,service:"git-receive-pack",url:v,headers:m,protocolVersion:1}),j=$.auth;let A;if(x)try{A=await Ji.expandAgainstMap({ref:x,map:$.refs})}catch(t){if(!(t instanceof Si))throw t;A=x.startsWith("refs/")?x:`refs/heads/${x}`}else A=k;const B=$.refs.get(A)||"0000000000000000000000000000000000000000";if(c){if(!await c({remote:l,url:v,localRef:{ref:w?"(delete)":k,oid:E},remoteRef:{ref:A,oid:B}}))throw new Mr}const R=!$.capabilities.has("no-thin");let P=new Set;if(!w){const i=[...$.refs.values()];let r=new Set;if("0000000000000000000000000000000000000000"!==B){const a=await An({fs:t,cache:e,gitdir:f,oids:[E,B]});for(const t of a)i.push(t);R&&(r=await gs({fs:t,cache:e,gitdir:f,oids:a}))}if(!i.includes(E)){const r=await async function({fs:t,cache:e,dir:i,gitdir:r=b.join(i,".git"),start:a,finish:n}){const s=await on.read({fs:t,gitdir:r}),o=new Set,c=new Set;for(const e of a)o.add(await Ji.resolve({fs:t,gitdir:r,ref:e}));for(const e of n)try{const i=await Ji.resolve({fs:t,gitdir:r,ref:e});c.add(i)}catch(t){}const f=new Set;async function d(i){f.add(i);const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:r,oid:i});if("tag"===a)return d(Kr.from(n).headers().object);if("commit"!==a)throw new $i(i,a,"commit");if(!s.has(i)){const t=Xr.from(n).headers().parent;for(i of t)c.has(i)||f.has(i)||await d(i)}}for(const t of o)await d(t);return f}({fs:t,cache:e,gitdir:f,start:[E],finish:i});P=await gs({fs:t,cache:e,gitdir:f,oids:r})}if(R){try{const i=await Ji.resolve({fs:t,gitdir:f,ref:`refs/remotes/${l}/HEAD`,depth:2}),{oid:a}=await Ji.resolveAgainstMap({ref:i.replace(`refs/remotes/${l}/`,""),fullref:i,map:$.refs}),n=[a];for(const i of await gs({fs:t,cache:e,gitdir:f,oids:n}))r.add(i)}catch(t){}for(const t of r)P.delete(t)}if(E===B&&(g=!0),!g){if(k.startsWith("refs/tags")&&"0000000000000000000000000000000000000000"!==B)throw new zr("tag-exists");if("0000000000000000000000000000000000000000"!==E&&"0000000000000000000000000000000000000000"!==B&&!await Zn({fs:t,cache:e,gitdir:f,oid:E,ancestor:B,depth:-1}))throw new zr("not-fast-forward")}}const O=fn([...$.capabilities],["report-status","side-band-64k",`agent=${hn}`]),C=await async function({capabilities:t=[],triplets:e=[]}){const i=[];let r=`\0 ${t.join(" ")}`;for(const t of e)i.push(Xa.encode(`${t.oldoid} ${t.oid} ${t.fullRef}${r}\n`)),r="";return i.push(Xa.flush()),i}({capabilities:O,triplets:[{oldoid:B,oid:E,fullRef:A}]}),I=w?[]:await hs({fs:t,cache:e,gitdir:f,oids:[...P]}),z=await S.connect({http:i,onProgress:r,corsProxy:p,service:"git-receive-pack",url:v,auth:j,headers:m,body:[...C,...I]}),{packfile:T,progress:D}=await wn.demux(z.body);if(a){Ga(gn(D),(async t=>{await a(t)}))}const N=await async function(t){const e={};let i="";const r=Xa.streamReader(t);let a=await r();for(;!0!==a;)null!==a&&(i+=a.toString("utf8")+"\n"),a=await r();const n=i.toString("utf8").split("\n");if(a=n.shift(),!a.startsWith("unpack "))throw new Ir('unpack ok" or "unpack [error message]',a);e.ok="unpack ok"===a,e.ok||(e.error=a.slice(7)),e.refs={};for(const t of n){if(""===t.trim())continue;const i=t.slice(0,2),r=t.slice(3);let a=r.indexOf(" ");-1===a&&(a=r.length);const n=r.slice(0,a),s=r.slice(a+1);e.refs[n]={ok:"ok"===i,error:s}}return e}(T);if(z.headers&&(N.headers=z.headers),l&&N.ok&&N.refs[A].ok&&!k.startsWith("refs/tags")){const e=`refs/remotes/${l}/${A.replace("refs/heads","")}`;w?await Ji.deleteRef({fs:t,gitdir:f,ref:e}):await Ji.writeRef({fs:t,gitdir:f,ref:e,value:E})}if(N.ok&&Object.values(N.refs).every((t=>t.ok)))return N;{const t=Object.entries(N.refs).filter((([t,e])=>!e.ok)).map((([t,e])=>`\n - ${t}: ${e.error}`)).join("");throw new Er(t,N)}}async function ps({fs:t,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPrePush:o,dir:c,gitdir:f=b.join(c,".git"),ref:d,remoteRef:h,remote:l="origin",url:u,force:g=!1,delete:w=!1,corsProxy:p,headers:m={},cache:y={}}){try{return la("fs",t),la("http",e),la("gitdir",f),await ws({fs:new ha(t),cache:y,http:e,onProgress:i,onMessage:r,onAuth:a,onAuthSuccess:n,onAuthFailure:s,onPrePush:o,gitdir:f,ref:d,remoteRef:h,remote:l,url:u,force:g,delete:w,corsProxy:p,headers:m})}catch(t){throw t.caller="git.push",t}}async function ms({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:i,oid:r});if("tag"===a)return ms({fs:t,cache:e,gitdir:i,oid:r=Kr.from(n).parse().object});if("blob"!==a)throw new $i(r,a,"blob");return{oid:r,blob:new Uint8Array(n)}}async function ys({fs:t,cache:e,gitdir:i,oid:r,filepath:a}){void 0!==a&&(r=await Ra({fs:t,cache:e,gitdir:i,oid:r,filepath:a}));return await ms({fs:t,cache:e,gitdir:i,oid:r})}async function _s({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,filepath:a,cache:n={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),await ys({fs:new ha(t),cache:n,gitdir:i,oid:r,filepath:a})}catch(t){throw t.caller="git.readBlob",t}}async function bs({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,cache:a={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),await ja({fs:new ha(t),cache:a,gitdir:i,oid:r})}catch(t){throw t.caller="git.readCommit",t}}async function vs({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r="refs/notes/commits",oid:a,cache:n={}}){try{return la("fs",t),la("gitdir",i),la("ref",r),la("oid",a),await async function({fs:t,cache:e,gitdir:i,ref:r="refs/notes/commits",oid:a}){const n=await Ji.resolve({gitdir:i,fs:t,ref:r}),{blob:s}=await ys({fs:t,cache:e,gitdir:i,oid:n,filepath:a});return s}({fs:new ha(t),cache:n,gitdir:i,ref:r,oid:a})}catch(t){throw t.caller="git.readNote",t}}async function xs({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,format:a="parsed",filepath:n,encoding:s,cache:o={}}){try{la("fs",t),la("gitdir",i),la("oid",r);const e=new ha(t);void 0!==n&&(r=await Ra({fs:e,cache:o,gitdir:i,oid:r,filepath:n}));const c="parsed"===a?"content":a,f=await mr({fs:e,cache:o,gitdir:i,oid:r,format:c});if(f.oid=r,"parsed"===a)switch(f.format="parsed",f.type){case"commit":f.object=Xr.from(f.object).parse();break;case"tree":f.object=rr.from(f.object).entries();break;case"blob":s?f.object=f.object.toString(s):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Kr.from(f.object).parse();break;default:throw new $i(f.oid,f.type,"blob|commit|tag|tree")}else"deflated"!==f.format&&"wrapped"!==f.format||(f.type=f.format);return f}catch(t){throw t.caller="git.readObject",t}}async function ks({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,cache:a={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),await async function({fs:t,cache:e,gitdir:i,oid:r}){const{type:a,object:n}=await mr({fs:t,cache:e,gitdir:i,oid:r,format:"content"});if("tag"!==a)throw new $i(r,a,"tag");const s=Kr.from(n);return{oid:r,tag:s.parse(),payload:s.payload()}}({fs:new ha(t),cache:a,gitdir:i,oid:r})}catch(t){throw t.caller="git.readTag",t}}async function Es({fs:t,dir:e,gitdir:i=b.join(e,".git"),oid:r,filepath:a,cache:n={}}){try{return la("fs",t),la("gitdir",i),la("oid",r),await Oa({fs:new ha(t),cache:n,gitdir:i,oid:r,filepath:a})}catch(t){throw t.caller="git.readTree",t}}async function Ss({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r,cache:a={}}){try{la("fs",t),la("gitdir",i),la("filepath",r),await yi.acquire({fs:new ha(t),gitdir:i,cache:a},(async function(t){t.delete({filepath:r})}))}catch(t){throw t.caller="git.remove",t}}async function $s({fs:t,onSign:e,dir:i,gitdir:r=b.join(i,".git"),ref:a="refs/notes/commits",oid:n,author:s,committer:o,signingKey:c,cache:f={}}){try{la("fs",t),la("gitdir",r),la("oid",n);const i=new ha(t),d=await Ea({fs:i,gitdir:r,author:s});if(!d)throw new Pr("author");const h=await Sa({fs:i,gitdir:r,author:d,committer:o});if(!h)throw new Pr("committer");return await async function({fs:t,cache:e,onSign:i,gitdir:r,ref:a="refs/notes/commits",oid:n,author:s,committer:o,signingKey:c}){let f;try{f=await Ji.resolve({gitdir:r,fs:t,ref:a})}catch(t){if(!(t instanceof Si))throw t}let d=(await Oa({fs:t,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;d=d.filter((t=>t.path!==n));const h=await Ca({fs:t,gitdir:r,tree:d});return await Aa({fs:t,cache:e,onSign:i,gitdir:r,ref:a,tree:h,parent:f&&[f],message:"Note removed by 'isomorphic-git removeNote'\n",author:s,committer:o,signingKey:c})}({fs:i,cache:f,onSign:e,gitdir:r,ref:a,oid:n,author:d,committer:h,signingKey:c})}catch(t){throw t.caller="git.removeNote",t}}async function js({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,oldref:a,checkout:n=!1}){try{return la("fs",t),la("gitdir",i),la("ref",r),la("oldref",a),await async function({fs:t,gitdir:e,oldref:i,ref:r,checkout:a=!1}){if(r!==Xe.clean(r))throw new jr(r,Xe.clean(r));if(i!==Xe.clean(i))throw new jr(i,Xe.clean(i));const n=`refs/heads/${i}`,s=`refs/heads/${r}`;if(await Ji.exists({fs:t,gitdir:e,ref:s}))throw new yr("branch",r,!1);const o=await Ji.resolve({fs:t,gitdir:e,ref:n,depth:1});await Ji.writeRef({fs:t,gitdir:e,ref:s,value:o}),await Ji.deleteRef({fs:t,gitdir:e,ref:n});const c=await La({fs:t,gitdir:e,fullname:!0});(a||c===n)&&await Ji.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}({fs:new ha(t),gitdir:i,ref:r,oldref:a,checkout:n})}catch(t){throw t.caller="git.renameBranch",t}}async function As({gitdir:t,type:e,object:i}){return li(ar.wrap({type:e,object:i}))}async function Bs({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r,ref:a,cache:n={}}){try{la("fs",t),la("gitdir",i),la("filepath",r);const s=new ha(t);let o,c;try{o=await Ji.resolve({fs:s,gitdir:i,ref:a||"HEAD"})}catch(t){if(a)throw t}if(o)try{o=await Ra({fs:s,cache:n,gitdir:i,oid:o,filepath:r})}catch(t){o=null}let f={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0};const d=e&&await s.read(b.join(e,r));d&&(c=await As({gitdir:i,type:"blob",object:d}),o===c&&(f=await s.lstat(b.join(e,r)))),await yi.acquire({fs:s,gitdir:i,cache:n},(async function(t){t.delete({filepath:r}),o&&t.insert({filepath:r,stats:f,oid:o})}))}catch(t){throw t.caller="git.reset",t}}async function Rs({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,depth:a}){try{la("fs",t),la("gitdir",i),la("ref",r);return await Ji.resolve({fs:new ha(t),gitdir:i,ref:r,depth:a})}catch(t){throw t.caller="git.resolveRef",t}}async function Ps({fs:t,dir:e,gitdir:i=b.join(e,".git"),path:r,value:a,append:n=!1}){try{la("fs",t),la("gitdir",i),la("path",r);const e=new ha(t),s=await Zi.get({fs:e,gitdir:i});n?await s.append(r,a):await s.set(r,a),await Zi.save({fs:e,gitdir:i,config:s})}catch(t){throw t.caller="git.setConfig",t}}async function Os({fs:t,gitdir:e,commit:i}){const r=Xr.from(i).toObject();return await ya({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}class Cs{static get timezoneOffsetForRefLogEntry(){const t=(new Date).getTimezoneOffset(),e=Math.abs(Math.floor(t/60)),i=Math.abs(t%60).toString().padStart(2,"0");return`${t>0?"-":"+"}${e.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(t,e,i){const r=t.name.replace(/\s/g,""),a=Math.floor(Date.now()/1e3),n=Cs.timezoneOffsetForRefLogEntry;return`0000000000000000000000000000000000000000 ${e} ${r} ${t.email} ${a} ${n}\t${i}\n`}static getStashReflogEntry(t,e=!1){return t.split("\n").filter((t=>t)).reverse().map(((t,i)=>e?`stash@{${i}}: ${t.split("\t")[1]}`:t))}}const Is={stage:Ei,workdir:ea};let zs;async function Ts(t,e){return void 0===zs&&(zs=new a),zs.acquire(t,e)}async function Ds({fs:t,dir:e,gitdir:i,entries:r}){return Promise.all(r.map((async function r(a){if("tree"===a.type){if(!a.oid){const e=await Promise.all(a.children.map(r));a.oid=await Ca({fs:t,gitdir:i,tree:e}),a.mode=16384}}else"blob"===a.type&&(a.oid=await async function(t,e,i,r,a=null){const n=b.join(i,r),s=await t.lstat(n);if(!s)throw new Si(n);if(s.isDirectory())throw new ii(`${n}: file expected, but found directory`);const o=a?await nr({fs:t,gitdir:e,oid:a}):void 0;let c=o?a:void 0;return o||await Ts({fs:t,gitdir:e,currentFilepath:n},(async()=>{const i=s.isSymbolicLink()?await t.readlink(n).then(_a):await t.read(n);if(null===i)throw new Si(n);c=await ya({fs:t,gitdir:e,type:"blob",object:i})})),c}(t,i,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a})))}async function Ns({fs:t,dir:e,gitdir:i,treePair:r}){const a="stage"===r[1],n=r.map((t=>"string"==typeof t?Is[t]():t)),s=[],o=await na({fs:t,cache:{},dir:e,gitdir:i,trees:n,map:async(r,[a,n])=>{if("."!==r&&!await wa.isIgnored({fs:t,dir:e,gitdir:i,filepath:r}))return n?((!a||await a.oid()!==await n.oid()&&void 0!==await n.oid())&&s.push([a,n]),{mode:await n.mode(),path:r,oid:await n.oid(),type:await n.type()}):void 0},reduce:async(t,e)=>(e=e.filter(Boolean),t?(t.children=e,t):e.length>0?e:void 0),iterate:async(i,r)=>{const n=[];for(const i of r){const[r,o]=i;a?o&&(await t.exists(`${e}/${o.toString()}`)?n.push(i):s.push([null,o])):r&&(o?n.push(i):s.push([r,null]))}return n.length?Promise.all(n.map(i)):[]}});if(0===s.length||0===o.length)return null;const c=(await Ds({fs:t,dir:e,gitdir:i,entries:o})).filter(Boolean).map((t=>({mode:t.mode,path:t.path,oid:t.oid,type:t.type})));return Ca({fs:t,gitdir:i,tree:c})}async function Us({fs:t,dir:e,gitdir:i,stashCommit:r,parentCommit:a,wasStaged:n}){const s=[],o=[],c=await na({fs:t,cache:{},dir:e,gitdir:i,trees:[Qr({ref:a}),Qr({ref:r})],map:async(r,[a,c])=>{if("."===r||await wa.isIgnored({fs:t,dir:e,gitdir:i,filepath:r}))return;const f=c?await c.type():await a.type();if("tree"!==f&&"blob"!==f)return;if(!c&&a){const t="tree"===f?"rmdir":"rm";return"tree"===f&&s.push(r),"blob"===f&&n&&o.push({filepath:r,oid:await a.oid()}),{method:t,filepath:r}}const d=await c.oid();return a&&await a.oid()===d?void 0:"tree"===f?{method:"mkdir",filepath:r}:(n&&o.push({filepath:r,oid:d,stats:await t.lstat(b.join(e,r))}),{method:"write",filepath:r,oid:d})}});await Ts({fs:t,gitdir:i,dirRemoved:s,ops:c},(async()=>{for(const r of c){const a=b.join(e,r.filepath);switch(r.method){case"rmdir":await t.rmdir(a);break;case"mkdir":await t.mkdir(a);break;case"rm":await t.rm(a);break;case"write":if(!s.some((t=>a.startsWith(t)))){const{object:e}=await mr({fs:t,cache:{},gitdir:i,oid:r.oid});await t.exists(a)&&await t.rm(a),await t.write(a,e)}}}})),await yi.acquire({fs:t,gitdir:i,cache:{}},(async t=>{o.forEach((({filepath:e,stats:i,oid:r})=>{t.insert({filepath:e,stats:i,oid:r})}))}))}class Ms{constructor({fs:t,dir:e,gitdir:i=b.join(e,".git")}){Object.assign(this,{fs:t,dir:e,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return b.join(this.gitdir,Ms.refStash)}get refLogsStashPath(){return b.join(this.gitdir,Ms.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ea({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Pr("author");return this._author}async getStashSHA(t,e){if(!await this.fs.exists(this.refStashPath))return null;return(e||await this.readStashReflogs({parsed:!1}))[t].split(" ")[1]}async writeStashCommit({message:t,tree:e,parent:i}){return Os({fs:this.fs,gitdir:this.gitdir,commit:{message:t,tree:e,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(t){const e=await this.readStashReflogs({parsed:!1});if(0!==t&&(t<0||t>e.length-1))throw new jr(`stash@${t}`,"number that is in range of [0, num of stash pushed]");const i=await this.getStashSHA(t,e);return i?ja({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(t){return Ji.writeRef({fs:this.fs,gitdir:this.gitdir,ref:Ms.refStash,value:t})}async writeStashReflogEntry({stashCommit:t,message:e}){const i=await this.getAuthor(),r=Cs.createStashReflogEntry(i,t,e),a=this.refLogsStashPath;await Ts({filepath:a,entry:r},(async()=>{const t=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,t+r,"utf8")}))}async readStashReflogs({parsed:t=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];const e=(await this.fs.read(this.refLogsStashPath)).toString();return Cs.getStashReflogEntry(e,t)}}async function Fs({fs:t,dir:e,gitdir:i,message:r=""}){const a=new Ms({fs:t,dir:e,gitdir:i});await a.getAuthor();const n=await La({fs:t,gitdir:i,fullname:!1}),s=await Ji.resolve({fs:t,gitdir:i,ref:"HEAD"}),o=(await bs({fs:t,dir:e,gitdir:i,oid:s})).commit.message,c=[s];let f=null,d=Qr({ref:"HEAD"});const h=await Ns({fs:t,dir:e,gitdir:i,treePair:[Qr({ref:"HEAD"}),"stage"]});if(h){const t=await a.writeStashCommit({message:`stash-Index: WIP on ${n} - ${(new Date).toISOString()}`,tree:h,parent:c});c.push(t),f=h,d=Ei()}const l=await Ns({fs:t,dir:e,gitdir:i,treePair:[d,"workdir"]});if(l){const t=await a.writeStashCommit({message:`stash-WorkDir: WIP on ${n} - ${(new Date).toISOString()}`,tree:l,parent:[c[c.length-1]]});c.push(t),f=l}if(!f||!h&&!l)throw new Si("changes, nothing to stash");const u=(r.trim()||`WIP on ${n}`)+`: ${s.substring(0,7)} ${o}`,g=await a.writeStashCommit({message:u,tree:f,parent:c});return await a.writeStashRef(g),await a.writeStashReflogEntry({stashCommit:g,message:u}),await Fa({fs:t,dir:e,gitdir:i,ref:n,track:!1,force:!0}),g}async function Hs({fs:t,dir:e,gitdir:i,refIdx:r=0}){const a=new Ms({fs:t,dir:e,gitdir:i}),n=await a.readStashCommit(r),{parent:s=null}=n.commit?n.commit:{};if(s&&Array.isArray(s))for(let r=0;r<s.length-1;r++){const a=(await ja({fs:t,cache:{},gitdir:i,oid:s[r+1]})).commit.message.startsWith("stash-Index");await Us({fs:t,dir:e,gitdir:i,stashCommit:s[r+1],parentCommit:s[r],wasStaged:a})}}async function qs({fs:t,dir:e,gitdir:i,refIdx:r=0}){const a=new Ms({fs:t,dir:e,gitdir:i});if(!(await a.readStashCommit(r)).commit)return;const n=a.refStashPath;await Ts(n,(async()=>{await t.exists(n)&&await t.rm(n)}));const s=await a.readStashReflogs({parsed:!1});if(!s.length)return;s.splice(r,1);const o=a.refLogsStashPath;await Ts({reflogEntries:s,stashReflogPath:o,stashMgr:a},(async()=>{if(s.length){await t.write(o,s.join("\n"),"utf8");const e=s[s.length-1].split(" ")[1];await a.writeStashRef(e)}else await t.rm(o)}))}async function Ls({fs:t,dir:e,gitdir:i}){return new Ms({fs:t,dir:e,gitdir:i}).readStashReflogs({parsed:!0})}async function Ws({fs:t,dir:e,gitdir:i}){const r=new Ms({fs:t,dir:e,gitdir:i}),a=[r.refStashPath,r.refLogsStashPath];await Ts(a,(async()=>{await Promise.all(a.map((async e=>{if(await t.exists(e))return t.rm(e)})))}))}async function Gs({fs:t,dir:e,gitdir:i,refIdx:r=0}){await Hs({fs:t,dir:e,gitdir:i,refIdx:r}),await qs({fs:t,dir:e,gitdir:i,refIdx:r})}async function Zs({fs:t,dir:e,gitdir:i=b.join(e,".git"),op:r="push",message:a="",refIdx:n=0}){la("fs",t),la("dir",e),la("gitdir",i),la("op",r);const s={push:Fs,apply:Hs,drop:qs,list:Ls,clear:Ws,pop:Gs},o=["apply","drop","pop"];try{const c=new ha(t);["refs","logs","logs/refs"].map((t=>b.join(i,t))).forEach((async t=>{await c.exists(t)||await c.mkdir(t)}));const f=s[r];if(f){if(o.includes(r)&&n<0)throw new jr(`stash@${n}`,"number that is in range of [0, num of stash pushed]");return await f({fs:c,dir:e,gitdir:i,message:a,refIdx:n})}throw new Error(`To be implemented: ${r}`)}catch(t){throw t.caller="git.stash",t}}async function Ks({fs:t,dir:e,gitdir:i=b.join(e,".git"),filepath:r,cache:a={}}){try{la("fs",t),la("gitdir",i),la("filepath",r);const n=new ha(t);if(await wa.isIgnored({fs:n,gitdir:i,dir:e,filepath:r}))return"ignored";const s=await async function({fs:t,cache:e,gitdir:i}){let r;try{r=await Ji.resolve({fs:t,gitdir:i,ref:"HEAD"})}catch(t){if(t instanceof Si)return[]}const{tree:a}=await Oa({fs:t,cache:e,gitdir:i,oid:r});return a}({fs:n,cache:a,gitdir:i}),o=await Vs({fs:n,cache:a,gitdir:i,tree:s,path:r}),c=await yi.acquire({fs:n,gitdir:i,cache:a},(async function(t){for(const e of t)if(e.path===r)return e;return null})),f=await n.lstat(b.join(e,r)),d=null!==o,h=null!==c,l=null!==f,u=async()=>{if(h&&!wi(c,f))return c.oid;{const t=await n.read(b.join(e,r)),s=await As({gitdir:i,type:"blob",object:t});return h&&c.oid===s&&-1!==f.size&&yi.acquire({fs:n,gitdir:i,cache:a},(async function(t){t.insert({filepath:r,stats:f,oid:s})})),s}};if(!d&&!l&&!h)return"absent";if(!d&&!l&&h)return"*absent";if(!d&&l&&!h)return"*added";if(!d&&l&&h){return await u()===c.oid?"added":"*added"}if(d&&!l&&!h)return"deleted";if(d&&!l&&h)return c.oid,"*deleted";if(d&&l&&!h){return await u()===o?"*undeleted":"*undeletemodified"}if(d&&l&&h){const t=await u();return t===o?t===c.oid?"unmodified":"*unmodified":t===c.oid?"modified":"*modified"}}catch(t){throw t.caller="git.status",t}}async function Vs({fs:t,cache:e,gitdir:i,tree:r,path:a}){"string"==typeof a&&(a=a.split("/"));const n=a.shift();for(const s of r)if(s.path===n){if(0===a.length)return s.oid;const{type:r,object:n}=await mr({fs:t,cache:e,gitdir:i,oid:s.oid});if("tree"===r){return Vs({fs:t,cache:e,gitdir:i,tree:rr.from(n),path:a})}if("blob"===r)throw new $i(s.oid,r,"blob",a.join("/"))}return null}async function Xs({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r="HEAD",filepaths:a=["."],filter:n,cache:s={},ignored:o=!1}){try{la("fs",t),la("gitdir",i),la("ref",r);const c=new ha(t);return await na({fs:c,cache:s,dir:e,gitdir:i,trees:[Qr({ref:r}),ea(),Ei()],map:async function(t,[i,r,s]){if(!i&&!s&&r&&!o){if(await wa.isIgnored({fs:c,dir:e,filepath:t}))return null}if(!a.some((e=>Ua(t,e))))return null;if(n&&!n(t))return;const[f,d,h]=await Promise.all([i&&i.type(),r&&r.type(),s&&s.type()]),l=[f,d,h].includes("blob");if(("tree"===f||"special"===f)&&!l)return;if("commit"===f)return null;if(("tree"===d||"special"===d)&&!l)return;if("commit"===h)return null;if(("tree"===h||"special"===h)&&!l)return;const u="blob"===f?await i.oid():void 0,g="blob"===h?await s.oid():void 0;let w;"blob"!==f&&"blob"===d&&"blob"!==h?w="42":"blob"===d&&(w=await r.oid());const p=[void 0,u,w,g],m=p.map((t=>p.indexOf(t)));return m.shift(),[t,...m]}})}catch(t){throw t.caller="git.statusMatrix",t}}async function Ys({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,object:a,force:n=!1}){try{la("fs",t),la("gitdir",i),la("ref",r);const e=new ha(t);if(void 0===r)throw new Or("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;const s=await Ji.resolve({fs:e,gitdir:i,ref:a||"HEAD"});if(!n&&await Ji.exists({fs:e,gitdir:i,ref:r}))throw new yr("tag",r);await Ji.writeRef({fs:e,gitdir:i,ref:r,value:s})}catch(t){throw t.caller="git.tag",t}}async function Js({fs:t,dir:e,gitdir:i=b.join(e,".git"),cache:r={},filepath:a,oid:n,mode:s,add:o,remove:c,force:f}){try{la("fs",t),la("gitdir",i),la("filepath",a);const d=new ha(t);if(c)return await yi.acquire({fs:d,gitdir:i,cache:r},(async function(t){if(!f){const t=await d.lstat(b.join(e,a));if(t){if(t.isDirectory())throw new $r("directory");return}}t.has({filepath:a})&&t.delete({filepath:a})}));let h;if(!n){if(h=await d.lstat(b.join(e,a)),!h)throw new Si(`file at "${a}" on disk and "remove" not set`);if(h.isDirectory())throw new $r("directory")}return await yi.acquire({fs:d,gitdir:i,cache:r},(async function(t){if(!o&&!t.has({filepath:a}))throw new Si(`file at "${a}" in index and "add" not set`);let r;if(n)r={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};else{r=h;const t=r.isSymbolicLink()?await d.readlink(b.join(e,a)):await d.read(b.join(e,a));n=await ya({fs:d,gitdir:i,type:"blob",format:"content",object:t})}return t.insert({filepath:a,oid:n,stats:r}),n}))}catch(t){throw t.caller="git.updateIndex",t}}function Qs(){try{return dn}catch(t){throw t.caller="git.version",t}}async function to({fs:t,dir:e,gitdir:i=b.join(e,".git"),trees:r,map:a,reduce:n,iterate:s,cache:o={}}){try{return la("fs",t),la("gitdir",i),la("trees",r),await na({fs:new ha(t),cache:o,dir:e,gitdir:i,trees:r,map:a,reduce:n,iterate:s})}catch(t){throw t.caller="git.walk",t}}async function eo({fs:t,dir:e,gitdir:i=b.join(e,".git"),blob:r}){try{return la("fs",t),la("gitdir",i),la("blob",r),await ya({fs:new ha(t),gitdir:i,type:"blob",object:r,format:"content"})}catch(t){throw t.caller="git.writeBlob",t}}async function io({fs:t,dir:e,gitdir:i=b.join(e,".git"),commit:r}){try{return la("fs",t),la("gitdir",i),la("commit",r),await Os({fs:new ha(t),gitdir:i,commit:r})}catch(t){throw t.caller="git.writeCommit",t}}async function ro({fs:t,dir:e,gitdir:i=b.join(e,".git"),type:r,object:a,format:n="parsed",oid:s,encoding:o}){try{const e=new ha(t);if("parsed"===n){switch(r){case"commit":a=Xr.from(a).toObject();break;case"tree":a=rr.from(a).toObject();break;case"blob":a=Buffer.from(a,o);break;case"tag":a=Kr.from(a).toObject();break;default:throw new $i(s||"",r,"blob|commit|tag|tree")}n="content"}return s=await ya({fs:e,gitdir:i,type:r,object:a,oid:s,format:n})}catch(t){throw t.caller="git.writeObject",t}}async function ao({fs:t,dir:e,gitdir:i=b.join(e,".git"),ref:r,value:a,force:n=!1,symbolic:s=!1}){try{la("fs",t),la("gitdir",i),la("ref",r),la("value",a);const e=new ha(t);if(r!==Xe.clean(r))throw new jr(r,Xe.clean(r));if(!n&&await Ji.exists({fs:e,gitdir:i,ref:r}))throw new yr("ref",r);s?await Ji.writeSymbolicRef({fs:e,gitdir:i,ref:r,value:a}):(a=await Ji.resolve({fs:e,gitdir:i,ref:a}),await Ji.writeRef({fs:e,gitdir:i,ref:r,value:a}))}catch(t){throw t.caller="git.writeRef",t}}async function no({fs:t,dir:e,gitdir:i=b.join(e,".git"),tag:r}){try{return la("fs",t),la("gitdir",i),la("tag",r),await async function({fs:t,gitdir:e,tag:i}){const r=Kr.from(i).toObject();return await ya({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}({fs:new ha(t),gitdir:i,tag:r})}catch(t){throw t.caller="git.writeTag",t}}async function so({fs:t,dir:e,gitdir:i=b.join(e,".git"),tree:r}){try{return la("fs",t),la("gitdir",i),la("tree",r),await Ca({fs:new ha(t),gitdir:i,tree:r})}catch(t){throw t.caller="git.writeTree",t}}var oo={Errors:qr,STAGE:Ei,TREE:Qr,WORKDIR:ea,add:ba,abortMerge:ga,addNote:Ia,addRemote:Ta,annotatedTag:Da,branch:Na,checkout:Fa,clone:yn,commit:_n,getConfig:Un,getConfigAll:Mn,setConfig:Ps,currentBranch:bn,deleteBranch:vn,deleteRef:xn,deleteRemote:kn,deleteTag:En,expandOid:$n,expandRef:jn,fastForward:In,fetch:zn,findMergeBase:Tn,findRoot:Nn,getRemoteInfo:Fn,getRemoteInfo2:qn,hashBlob:Ln,indexPack:Wn,init:Gn,isDescendent:Kn,isIgnored:Vn,listBranches:Xn,listFiles:Qn,listNotes:ts,listRefs:es,listRemotes:is,listServerRefs:rs,listTags:as,log:cs,merge:fs,packObjects:ls,pull:us,push:ps,readBlob:_s,readCommit:bs,readNote:vs,readObject:xs,readTag:ks,readTree:Es,remove:Ss,removeNote:$s,renameBranch:js,resetIndex:Bs,updateIndex:Js,resolveRef:Rs,status:Ks,statusMatrix:Xs,tag:Ys,version:Qs,walk:to,writeBlob:eo,writeCommit:io,writeObject:ro,writeRef:ao,writeTag:no,writeTree:so,stash:Zs};exports.Errors=qr,exports.STAGE=Ei,exports.TREE=Qr,exports.WORKDIR=ea,exports.abortMerge=ga,exports.add=ba,exports.addNote=Ia,exports.addRemote=Ta,exports.annotatedTag=Da,exports.branch=Na,exports.checkout=Fa,exports.clone=yn,exports.commit=_n,exports.currentBranch=bn,exports.default=oo,exports.deleteBranch=vn,exports.deleteRef=xn,exports.deleteRemote=kn,exports.deleteTag=En,exports.expandOid=$n,exports.expandRef=jn,exports.fastForward=In,exports.fetch=zn,exports.findMergeBase=Tn,exports.findRoot=Nn,exports.getConfig=Un,exports.getConfigAll=Mn,exports.getRemoteInfo=Fn,exports.getRemoteInfo2=qn,exports.hashBlob=Ln,exports.indexPack=Wn,exports.init=Gn,exports.isDescendent=Kn,exports.isIgnored=Vn,exports.listBranches=Xn,exports.listFiles=Qn,exports.listNotes=ts,exports.listRefs=es,exports.listRemotes=is,exports.listServerRefs=rs,exports.listTags=as,exports.log=cs,exports.merge=fs,exports.packObjects=ls,exports.pull=us,exports.push=ps,exports.readBlob=_s,exports.readCommit=bs,exports.readNote=vs,exports.readObject=xs,exports.readTag=ks,exports.readTree=Es,exports.remove=Ss,exports.removeNote=$s,exports.renameBranch=js,exports.resetIndex=Bs,exports.resolveRef=Rs,exports.setConfig=Ps,exports.stash=Zs,exports.status=Ks,exports.statusMatrix=Xs,exports.tag=Ys,exports.updateIndex=Js,exports.version=Qs,exports.walk=to,exports.writeBlob=eo,exports.writeCommit=io,exports.writeObject=ro,exports.writeRef=ao,exports.writeTag=no,exports.writeTree=so;
|
|
2
|
+
//# sourceMappingURL=index-c97017db.js.map
|