vault backup: 2026-09-29 23:28:16

This commit is contained in:
ben committed 2026-09-29 23:28:16 -07:00
1 parent c82807bc68
commit ffa27be971
19 files changed
+4324 -1982

No files matched your search

+166 -154
View File
@@ -3,28 +3,33 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git)
*/
var hF=Object.create;var uc=Object.defineProperty;var pF=Object.getOwnPropertyDescriptor;var mF=Object.getOwnPropertyNames;var gF=Object.getPrototypeOf,vF=Object.prototype.hasOwnProperty;var a_=t=>{throw TypeError(t)};var wF=(t,e,r)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var _F=(t,e)=>()=>(t&&(e=t(t=0)),e);var H=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bF=(t,e)=>{for(var r in e)uc(t,r,{get:e[r],enumerable:!0})},o_=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mF(e))!vF.call(t,n)&&n!==r&&uc(t,n,{get:()=>e[n],enumerable:!(i=pF(e,n))||i.enumerable});return t};var Ht=(t,e,r)=>(r=t!=null?hF(gF(t)):{},o_(e||!t||!t.__esModule?uc(r,"default",{value:t,enumerable:!0}):r,t)),yF=t=>o_(uc({},"__esModule",{value:!0}),t);var Ve=(t,e,r)=>wF(t,typeof e!="symbol"?e+"":e,r),Bp=(t,e,r)=>e.has(t)||a_("Cannot "+r);var R=(t,e,r)=>(Bp(t,e,"read from private field"),r?r.call(t):e.get(t)),pe=(t,e,r)=>e.has(t)?a_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),we=(t,e,r,i)=>(Bp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Me=(t,e,r)=>(Bp(t,e,"access private method"),r);var u_=H(vf=>{"use strict";m();vf.byteLength=EF;vf.toByteArray=kF;vf.fromByteArray=TF;var on=[],mi=[],xF=typeof Uint8Array!="undefined"?Uint8Array:Array,Hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Js=0,l_=Hp.length;Js<l_;++Js)on[Js]=Hp[Js],mi[Hp.charCodeAt(Js)]=Js;var Js,l_;mi[45]=62;mi[95]=63;function c_(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function EF(t){var e=c_(t),r=e[0],i=e[1];return(r+i)*3/4-i}function SF(t,e,r){return(e+r)*3/4-r}function kF(t){var e,r=c_(t),i=r[0],n=r[1],s=new xF(SF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=mi[t.charCodeAt(l)]<<18|mi[t.charCodeAt(l+1)]<<12|mi[t.charCodeAt(l+2)]<<6|mi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=mi[t.charCodeAt(l)]<<2|mi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=mi[t.charCodeAt(l)]<<10|mi[t.charCodeAt(l+1)]<<4|mi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function AF(t){return on[t>>18&63]+on[t>>12&63]+on[t>>6&63]+on[t&63]}function CF(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(AF(i));return n.join("")}function TF(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(CF(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(on[e>>2]+on[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(on[e>>10]+on[e>>4&63]+on[e<<2&63]+"=")),n.join("")}});var f_=H(Up=>{m();Up.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};Up.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Zp=H(So=>{"use strict";m();var Gp=u_(),xo=f_(),d_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=F;So.SlowBuffer=MF;So.INSPECT_MAX_BYTES=50;var wf=2147483647;So.kMaxLength=wf;F.TYPED_ARRAY_SUPPORT=PF();!F.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function PF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(F.prototype,"parent",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.buffer}});Object.defineProperty(F.prototype,"offset",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.byteOffset}});function jn(t){if(t>wf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,F.prototype),e}function F(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Wp(t)}return g_(t,e,r)}F.poolSize=8192;function g_(t,e,r){if(typeof t=="string")return $F(t,e);if(ArrayBuffer.isView(t))return FF(t);if(t==null)throw new TypeError("Line truncated
"use strict";var j$=Object.create;var _c=Object.defineProperty;var V$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var W$=Object.getPrototypeOf,q$=Object.prototype.hasOwnProperty;var Bb=t=>{throw TypeError(t)};var Y$=(t,e,r)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z$=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var H=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},K$=(t,e)=>{for(var r in e)_c(t,r,{get:e[r],enumerable:!0})},Hb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z$(e))!q$.call(t,n)&&n!==r&&_c(t,n,{get:()=>e[n],enumerable:!(i=V$(e,n))||i.enumerable});return t};var mt=(t,e,r)=>(r=t!=null?j$(W$(t)):{},Hb(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t)),X$=t=>Hb(_c({},"__esModule",{value:!0}),t);var Ue=(t,e,r)=>Y$(t,typeof e!="symbol"?e+"":e,r),dm=(t,e,r)=>e.has(t)||Bb("Cannot "+r);var $=(t,e,r)=>(dm(t,e,"read from private field"),r?r.call(t):e.get(t)),ge=(t,e,r)=>e.has(t)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),de=(t,e,r,i)=>(dm(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Se=(t,e,r)=>(dm(t,e,"access private method"),r);var jb=H(Lf=>{"use strict";m();Lf.byteLength=J$;Lf.toByteArray=tF;Lf.fromByteArray=nF;var dn=[],bi=[],Q$=typeof Uint8Array!="undefined"?Uint8Array:Array,hm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ca=0,Ub=hm.length;ca<Ub;++ca)dn[ca]=hm[ca],bi[hm.charCodeAt(ca)]=ca;var ca,Ub;bi[45]=62;bi[95]=63;function Gb(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function J$(t){var e=Gb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function eF(t,e,r){return(e+r)*3/4-r}function tF(t){var e,r=Gb(t),i=r[0],n=r[1],s=new Q$(eF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=bi[t.charCodeAt(l)]<<18|bi[t.charCodeAt(l+1)]<<12|bi[t.charCodeAt(l+2)]<<6|bi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=bi[t.charCodeAt(l)]<<2|bi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=bi[t.charCodeAt(l)]<<10|bi[t.charCodeAt(l+1)]<<4|bi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function rF(t){return dn[t>>18&63]+dn[t>>12&63]+dn[t>>6&63]+dn[t&63]}function iF(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(rF(i));return n.join("")}function nF(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(iF(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(dn[e>>2]+dn[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(dn[e>>10]+dn[e>>4&63]+dn[e<<2&63]+"=")),n.join("")}});var Vb=H(pm=>{m();pm.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};pm.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Em=H(Ao=>{"use strict";m();var mm=jb(),ko=Vb(),zb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ao.Buffer=D;Ao.SlowBuffer=uF;Ao.INSPECT_MAX_BYTES=50;var Nf=2147483647;Ao.kMaxLength=Nf;D.TYPED_ARRAY_SUPPORT=sF();!D.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(D.prototype,"parent",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.buffer}});Object.defineProperty(D.prototype,"offset",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.byteOffset}});function Wn(t){if(t>Nf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,D.prototype),e}function D(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bm(t)}return Zb(t,e,r)}D.poolSize=8192;function Zb(t,e,r){if(typeoLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u3(t,e){if(t){if(typeof t=="string")return sk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sk(t,e)}}function sk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function f3(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function d3(t){if(Array.isArray(t))return t}var ok=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,lk=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,ck=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,uk=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,fk=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,dk=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,hk=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function yu(t,e){return t.indexOf(e)>-1}function h3(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}})();return[f*60,u*100,c*100]}function p3(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=(function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]})(),u=Er(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var m3=(function(){function t(e){var r=Er(e,4),i=r[0],n=r[1],s=r[2],a=r[3];o3(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return l3(t,[{key:"toRgbString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=Er(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=h3(i,n,s),l=Er(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function cl(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new m3([r,i,n,s])}function vv(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return cl([r,i,n,1])}function Vd(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=p3(r,i,n),o=Er(a,3),l=o[0],c=o[1],u=o[2];return cl([l,c,u,s])}function pk(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return Vd([r,i,n,1])}function g3(t){var e=ok.exec(t)||lk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,cl([i,n,s,a])}function v3(t){var e=ck.exec(t)||fk.exec(t)||uk.exec(t)||dk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=yu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=yu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=yu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(yu(a,"%")?100:1),cl([i,n,s,a])}function w3(t){var e=hk.exec(t),r=Er(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,a3.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(yu(o,"%")?100:1),Vd([i,s,a,o])}function mk(t){return ik.default[t]?vv(ik.default[t]):ok.test(t)||lk.test(t)?g3(t):ck.test(t)||fk.test(t)||uk.test(t)||dk.test(t)?v3(t):hk.test(t)?w3(t):null}var b3={fromString:mk,fromRgb:vv,fromRgba:cl,fromHsl:pk,fromHsla:Vd};es.default=b3});var Tk=H((B9,Ak)=>{m();Ak.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,b,_,C){return{startX:g,startY:v,endX:b,endY:_,r:C}},p=function(g,v,b){var _,C,x,E,A;for(v>b?_=l[g-1+o]:_=l[g+1+o],A=x=Math Line truncated
`});fe=!1,z=Q.length}function Ie(yt,Tt){var Ke="="+j,J=yt.indexOf(Ke,Tt),L=c(yt.substring(yt.indexOf("=",Tt)+1,J)).split(" ");return X=L[0],j=L[L.length-1],J+Ke.length-1}for(y&&(y=y.split(" "),X=y[0],j=y[1]),ce=0;ce<P;ce++)B==T?u(X,S,ce)?(--ce,Ze(),B=I):S.charAt(ce)==`
`?cr(fe):K+=S.charAt(ce):B==I?(ce+=X.length-1,Ae=t.tags[S.charAt(ce+1)],re=Ae?S.charAt(ce+1):"_v",re=="="?(ce=Ie(S,ce),B=T):(Ae&&ce++,B=M),fe=ce):u(j,S,ce)?(Q.push({tag:re,n:c(K),otag:X,ctag:j,i:re=="/"?fe-X.length:ce+j.length}),K="",ce+=j.length-1,B=T,re=="{"&&(j=="}}"?ce++:l(Q[Q.length-1]))):K+=S.charAt(ce);return cr(fe,!0),Q};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,S,y){if(S.charAt(y)!=w.charAt(0))return!1;for(var P=1,T=w.length;P<T;P++)if(S.charAt(y+P)!=w.charAt(P))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,S,y,P){var T=[],I=null,M=null,B=null;for(M=y[y.length-1];w.length>0;){if(B=w.shift(),M&&M.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,P))y.push(B),B.nodes=d(w,B.tag,y,P);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(I=y.pop(),B.n!=I.n&&!p(B.n,I.n,P))throw new Error("Nesting error: "+I.n+" vs. "+B.n);return I.end=B.i,T}else B.tag==`
`&&(B.last=w.length==0||w[0].tag==`
`);T.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return T}function h(w,S){for(var y=0,P=S.length;y<P;y++)if(S[y].o==w.n)return w.tag="#",!0}function p(w,S,y){for(var P=0,T=y.length;P<T;P++)if(y[P].c==w&&y[P].o==S)return!0}function g(w){var S=[];for(var y in w)S.push('"'+_(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+S.join(",")+" }"}function v(w){var S=[];for(var y in w.partials)S.push('"'+_(y)+'":{name:"'+_(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+S.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,S,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var b=0;t.generate=function(w,S,y){b=0;var P={code:"",subs:{},partials:{}};return t.walk(w,P),y.asString?this.stringify(P,S,y):this.makeTemplate(P,S,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,S,y){var P=this.makePartials(w);return P.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(P,S,this,y)},t.makePartials=function(w){var S,y={subs:{},partials:w.partials,name:w.name};for(S in y.partials)y.partials[S]=this.makePartials(y.partials[S]);for(S in w.subs)y.subs[S]=new Function("c","p","t","i",w.subs[S]);return y};function _(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function C(w){return~w.indexOf(".")?"d":"f"}function x(w,S){var y="<"+(S.prefix||""),P=y+w.n+b++;return S.partials[P]={name:w.n,partials:{}},S.code+='t.b(t.rp("'+_(P)+'",c,p,"'+(w.indent||"")+'"));',P}t.codegen={"#":function(w,S){S.code+="if(t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,S),S.code+="});c.pop();}"},"^":function(w,S){S.code+="if(!t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,S),S.code+="};"},">":x,"<":function(w,S){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var P=S.partials[x(w,S)];P.subs=y.subs,P.partials=y.partials},$:function(w,S){var y={subs:{},code:"",partials:S.partials,prefix:w.n};t.walk(w.nodes,y),S.subs[w.n]=y.code,S.inPartial||(S.code+='t.sub("'+_(w.n)+'",c,p,i);')},"\n":function(w,S){S.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,S){S.code+="t.b(t.v(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'},_t:function(w,S){S.code+=A('"'+_(w.text)+'"')},"{":E,"&":E};function E(w,S){S.code+="t.b(t.t(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,S){for(var y,P=0,T=w.length;P<T;P++)y=t.codegen[w[P].tag],y&&y(w[P],S);return S},t.parse=function(w,S,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,S){return[w,!!S.asString,!!S.disableLambda,S.delimiters,!!S.modelGet].join("||")},t.compile=function(w,S){S=S||{};var y=t.cacheKey(w,S),P=this.cache[y];if(P){var T=P.partials;for(var I in T)delete T[I].instance;return P}return P=this.generate(this.parse(this.scan(w,S.delimiters),w,S),w,S),this.cache[y]=P}})(typeof r0!="undefined"?r0:Hogan)});var fP=H(i0=>{m();var B4={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,b,_){var C;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,b,_)),C=!!d,!g&&C&&h&&h.push(typeof d=="object"?d:h[h.length-1]),C)},d:function(d,h,p,g){var v,b=d.split("."),_=this.f(b[0],h,p,g),C=this.options.modelGet,x=null;if(d==="."&&f(h[h.length-2]))_=h[h.length-1];else for(var E=1;E<b.length;E++)v=e(b[E],_,C),v!==void 0?(x=_,_=v):_="";return g&&!_?!1:(!g&&typeof _=="function"&&(h.push(x),_=this.mv(_,h,p),h.pop()),_)},f:function(d,h,p,g){for(var v=!1,b=null,_=!1,C=this.options.modelGet,x=h.length-1;x>=0;x--)if(b=h[x],v=e(d,b,C),v!==void 0){_=!0;break}return _?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,b){var _=this.options.delimiters;return this.options.delimiters=b,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=_,!1},ct:functio Line truncated
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ue.code="InternalError";var zo=class t extends Ce{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var _i=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function pd(t,e){return-(t<e)||+(t>e)}function kE(t,e){return pd(t.path,e.path)}function AE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var gn=2**32;function tE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=tE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=tE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%gn,ctimeNanoseconds:r%gn,mtimeSeconds:i%gn,mtimeNanoseconds:n%gn,dev:t.dev%gn,ino:t.ino%gn,mode:AE(t.mode%gn),uid:t.uid%gn,gid:t.gid%gn,size:t.size>-1?t.size%gn:0}}function fL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var lg=null;async function wn(t){return lg===null&&(lg=await hL()),lg?CE(t):dL(t)}function dL(t){return new SE().update(t).digest("hex")}async function CE(t){let e=await crypto.subtle.digest("SHA-1",t);return fL(e)}async function hL(){try{return await CE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function pL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function mL(t){let 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)+((e.stage&3)<<12)+(e.nameLength&4095)}var bg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ue("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ue("Index file is empty (.git/index)");let r=new t,i=new _i(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new ue(`Invalid dircache magic file number: ${n}`);let s=await wn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new ue(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=pL(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new ue(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new zo(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new ue(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new ue("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(kE)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid Line truncated
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new _i(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(mL(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new _i(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await wn(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};function nd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var cg=null,ug=Symbol("IndexCache");function gL(){return{map:new Map,stats:new Map}}async function vL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await bg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function wL(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:nd(i,n)}var ft=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[ug]||(i[ug]=gL());let a=`${r}/index`;cg===null&&(cg=new Mc({maxPending:1/0}));let o,l=[];return await cg.acquire(a,async()=>{let c=i[ug];await wL(e,a,c)&&await vL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new Oc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ha(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function TE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(ha(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:sd(n),metadata:s,parent:r(ha(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function _L(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=ft.acquire({fs:e,gitdir:r,cache:i},async function(s){return TE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(pd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":_L(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},md=Symbol("GitWalkSymbol");function _a(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,gitdir:r,cache:i}){return new yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var He=class t extends Ce{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};He.code="NotFoundError";var yr=class t extends Ce{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};yr.code="ObjectTypeError";var As=class t extends Ce{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};As.code="InvalidOidError";var Lc=class t extends Ce{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};he.code="InternalError";var Ea=class t extends Pe{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Ea.code="UnsafeFilepathError";var zi=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Dd(t,e){return-(t<e)||+(t>e)}function aS(t,e){return Dd(t.path,e.path)}function oS(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var yn=2**32;function ME(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Ko(t){let[e,r]=ME(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=ME(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%yn,ctimeNanoseconds:r%yn,mtimeSeconds:i%yn,mtimeNanoseconds:n%yn,dev:t.dev%yn,ino:t.ino%yn,mode:oS(t.mode%yn),uid:t.uid%yn,gid:t.gid%yn,size:t.size>-1?t.size%yn:0}}function BO(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var Dg=null;async function En(t){return Dg===null&&(Dg=await UO()),Dg?lS(t):HO(t)}function HO(t){return new sv.default().update(t).digest("hex")}async function lS(t){let e=await crypto.subtle.digest("SHA-1",t);return BO(e)}async function UO(){try{return await lS(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function GO(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function jO(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(k.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var qg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(k.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new he("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new he("Index file is empty (.git/index)");let r=new t,i=new zi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new he(`Invalid dircache magic file number: ${n}`);let s=await En(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new he(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new he(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=GO(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new he(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new Ea(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new he(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new he("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(aS)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath Line truncated
`)}static async _entryToBuffer(e){let r=k.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=k.alloc(i),s=new zi(n),a=Ko(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(jO(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=k.alloc(12),r=new zi(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=k.concat(i),s=k.concat([e,n]),a=await En(s);return k.concat([s,k.from(a,"hex")])}};function Ed(t,e,r=!0,i=!0){let n=Ko(t),s=Ko(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var Og=null,Lg=Symbol("IndexCache");function VO(){return{map:new Map,stats:new Map}}async function zO(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await qg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function WO(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Ed(i,n)}var gt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Lg]||(i[Lg]=VO());let a=`${r}/index`;Og===null&&(Og=new Yo.default({maxPending:1/0}));let o,l=[];return await Og.acquire(a,async()=>{let c=i[Lg];await WO(e,a,c)&&await zO(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new zc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function Sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Sa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function cS(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Sa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Sd(n),metadata:s,parent:r(Sa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function qO(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new he(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=gt.acquire({fs:e,gitdir:r,cache:i},async function(s){return cS(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Dd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Ko(i.metadata);e._type=i.type==="tree"?"tree":qO(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},Od=Symbol("GitWalkSymbol");function sl(){let t=Object.create(null);return Object.defineProperty(t,Od,{value:function({fs:e,gitdir:r,cache:i}){return new Yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var ze=class t extends Pe{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};ze.code="NotFoundError";var xr=class t extends Pe{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};xr.code="ObjectTypeError";var Ms=class t extends Pe{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ms.code="InvalidOidError";var Wc=class t extends Pe{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
[remote "${e}"]
fetch = +refs/heads/*:refs/remotes/origin/*
`),this.code=this.name=t.code,this.data={remote:e}}};Lc.code="NoRefspecError";var ad=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
`),this.code=this.name=t.code,this.data={remote:e}}};Wc.code="NoRefspecError";var kd=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
`)+`
`}},od=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new ue("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},xg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(od.from(i));return new t(r)}add(e){let r=od.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function bL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function yL(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function xL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=yL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function O(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r];i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":xL(e)}var EL=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Ic=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},rE={core:{filemode:Ic,bare:Ic,logallrefupdates:Ic,symlinks:Ic,ignorecase:Ic,bigFileThreshold:EL}},SL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,kL=/^[A-Za-z0-9-.]+$/,AL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,CL=/^[A-Za-z][A-Za-z-]*$/,TL=/^(.*?)( *[#;].*)$/,PL=t=>{let e=SL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},RL=t=>{let e=AL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=$L(i),s=FL(n);return[r,s]}return null},$L=t=>{let e=TL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return iE(r)&&iE(i)?`${r}${i}`:r},iE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,FL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),nE=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[nE(t),e,nE(r)].filter(i=>i!=null).join("."),sE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Eg(r,n,i),sectionPath:Eg(r,n,null),isSection:!!r}},IL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Sg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
`).map(n=>{let s=null,a=null,o=n.trim(),l=PL(o),c=l!=null;if(c)[r,i]=l;else{let f=RL(o);f!=null&&([s,a]=f)}let u=Eg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=sE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=rE[s]&&rE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=sE(e),u=IL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(kL.test(n)&&CL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
`)}},dt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Sg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},rd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],ML=["config","description","index","shallow","commondir"],fg;async function Ss(t,e){return fg===void 0&&(fg=new Mc),fg.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new As(v);let u=await dt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Lc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=xg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(_=>`refs/tags/${_}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let _=n.get(v);d.set(v,_)}}let h=f.translate([...n.keys()]);for(let[v,_]of h){let b=n.get(v);d.set(_,b)}let p=f.translate([...s.keys()]);for(let[v,_]of p){let b=s.get(v),S=f.translateOne(b);S&&d.set(_,`ref: ${S}`)}let g=[];if(l){for(let v of f.localNamespaces()){let _=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of _)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,_]of d)await Ss(v,async()=>e.write(O(r,v),`${_.trim()}
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new As(n);await Ss(i,async()=>e.write(O(r,i),`${n.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ss(i,async()=>e.write(O(r,i),`ref: ${n.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(O(r,o))));let n=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=ad.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Ss("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=rd(i).filter(o=>!ML.includes(o));for(let o of a){let l=await Ss(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new He(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=rd(i);for(let a of s)if(await Ss(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new He(i)}static async expandAgainstMap({ref:e,map:r}){let i=rd(e);for(let n of i)if(await r.has(n))return n;throw new He(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=rd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new He(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return ad.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(bL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function DL(t,e){return pd(aE(t),aE(e))}function aE(t){return t.mode==="040000"?t.path+"/":t.path}function PE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function OL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=PE(s),o=t.slice(i+1,n).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new zo(o);let l=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:l,type:a})}return e}function LL(t){if(typeof t=="number"&&(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 ue(`Could not understand file mode: ${t}`)}function NL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=LL(t.mode),t.type||(t.type=PE(t.mode)),t}var Ir=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=OL(e);else if(Array.isArray(e))this._entries=e.map(NL);else throw new ue("invalid type passed to GitTree constructor");this._entries.sort(kE)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(DL),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Cs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new ue(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:Buffer.from(e.slice(i+1))}}};async function RE({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function BL(t,e){let r=new _i(t),i=oE(r);if(i!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=oE(r),s,a=cE(r,e);if(a.byteLength===n)s=a;else{s=Buffer.alloc(n);let o=new _i(s);for(o.copy(a);!r.eof();)o.copy(cE(r,e));let l=o.tell();if(n!==l)throw new ue(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`)}return s}function oE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function lE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function cE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=lE(t,r&n,4),o=lE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function HL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function $E(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:HL(t)}var ld=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=$E(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>UL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=Buffer.concat(r)}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 UL(t){return t.reduce((e,r)=>e+r.length,0)}async function GL(t,e){let r=new ld(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new ue(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new ue(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await jL(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new ue(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ue("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function jL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=Buffer.fro Line truncated
`,t}function cd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:JL(n)}}function JL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),eN(i)}function eN(t){return t===0?t:-t}var Kr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
`}},Cd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new he("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Zg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Cd.from(i));return new t(r)}add(e){let r=Cd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function YO(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function ZO(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function KO(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function XO(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=KO(t),r=t[0]==="/"||e!==null&&t[2]==="/",i=t.at(-1)==="/",n=e?t.slice(2):t,s=ZO(n,!r);if(!s.length){let a=e?r?e+"/":e:r?"/":".";return i&&!r?a+"/":a}return i&&(s+="/"),e?r?`${e}/${s}`:`${e}${s}`:r?`/${s}`:s}function N(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r].replace(/\\/g,"/");i.length!==0&&(/^[a-zA-Z]:\//.test(i)||e===void 0?e=i:e+="/"+i)}return e===void 0?".":XO(e)}var QO=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},jc=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},DE={core:{filemode:jc,bare:jc,logallrefupdates:jc,symlinks:jc,ignorecase:jc,bigFileThreshold:QO}},JO=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,eL=/^[A-Za-z0-9-.]+$/,tL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,rL=/^[A-Za-z][A-Za-z-]*$/,iL=/^(.*?)( *[#;].*)$/,nL=t=>{let e=JO.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},sL=t=>{let e=tL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=aL(i),s=oL(n);return[r,s]}return null},aL=t=>{let e=iL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return OE(r)&&OE(i)?`${r}${i}`:r},OE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,oL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),LE=t=>t!=null?t.toLowerCase():null,Kg=(t,e,r)=>[LE(t),e,LE(r)].filter(i=>i!=null).join("."),NE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Kg(r,n,i),sectionPath:Kg(r,n,null),isSection:!!r}},lL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Xg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
`).map(n=>{let s=null,a=null,o=n.trim(),l=nL(o),c=l!=null;if(c)[r,i]=l;else{let f=sL(o);f!=null&&([s,a]=f)}let u=Kg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=NE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=DE[s]&&DE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=NE(e),u=lL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(eL.test(n)&&rL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
`)}},vt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Xg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},yd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],cL=["config","description","index","shallow","commondir"],Ng;async function Fs(t,e){return Ng===void 0&&(Ng=new Yo.default),Ng.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new Ms(v);let u=await vt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Wc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=Zg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(b=>`refs/tags/${b}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let b=n.get(v);d.set(v,b)}}let h=f.translate([...n.keys()]);for(let[v,b]of h){let _=n.get(v);d.set(b,_)}let p=f.translate([...s.keys()]);for(let[v,b]of p){let _=s.get(v),C=f.translateOne(_);C&&d.set(b,`ref: ${C}`)}let g=[];if(l){for(let v of f.localNamespaces()){let b=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(_=>`${v}/${_}`);for(let _ of b)d.has(_)||g.push(_)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,b]of d)await Fs(v,async()=>e.write(N(r,v),`${b.trim()}
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Ms(n);await Fs(i,async()=>e.write(N(r,i),`${n.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Fs(i,async()=>e.write(N(r,i),`ref: ${n.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(N(r,o))));let n=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=kd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Fs("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0,visited:s=new Set}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n,visited:s});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let a=await t.packedRefs({fs:e,gitdir:r}),o=yd(i).filter(l=>!cL.includes(l));for(let l of o){let c=await Fs(l,async()=>await e.read(`${r}/${l}`,{encoding:"utf8"})||a.get(l));if(c){if(s.has(l))throw new he(`Circular reference detected while resolving ref "${l}"`);return s.add(l),t.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n,visited:s})}}throw new ze(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=yd(i);for(let a of s)if(await Fs(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new ze(i)}static async expandAgainstMap({ref:e,map:r}){let i=yd(e);for(let n of i)if(await r.has(n))return n;throw new ze(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=yd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new ze(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return kd.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(YO),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function uL(t,e){return Dd(BE(t),BE(e))}function BE(t){return t.mode==="040000"?t.path+"/":t.path}function uS(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new he(`Unexpected GitTree entry mode: ${t}`)}function fL(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=uS(s),o=t.slice(i+1,n).toString("utf8"),l=o.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),u=l.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(o.includes("\\")||o.includes("/")||l==="."||l===".."||u===".git"||/^\.?git~[1-9]$/.test(u))throw new Ea(o);let f=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:f,type:a})}return e}function dL(t){if(typeof t=="number"&&(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 he(`Could not understand file mode: ${t}`)}function hL(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=dL(t.mode),t.type||(t.type=uS(t.mode)),t}var Lr=class t{constructor(e){if(k.isBuffer(e))this._entries=fL(e);else if(Array.isArray(e))this._entries=e.map(hL);else throw new he("invalid type passed to GitTree constructor");this._entries.sort(aS)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(uL),k.concat(e.map(r=>{let i=k.from(r.mode.replace(/^0/,"")),n=k.from(" "),s=k.from(r.path,"utf8"),a=k.from([0]),o=k.from(r.oid,"hex");return k.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ds=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new he(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:k.from(e.slice(i+1))}}};async function fS({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function pL(t,e){let r=new zi(t),i=HE(r);if(i!==e.byteLength)throw new he(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=HE(r),s,a=GE(r,e);if(a.byteLength===n)s=a;else{let o=[a],l=a.byteLength;for(;!r.eof();){let c=GE(r,e);o.push(c),l+=c.byteLength}if(n!==l)throw new he(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`);s=k.concat(o,n)}return s}function HE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function UE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function GE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=UE(t,r&n,4),o=UE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function mL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function dS(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:mL(t)}var Ad=class{constructor(e){if(typeof k=="undefined")throw new Error("Missing Buffer dependency");this.stream=dS(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?k.alloc(0):(r&&(r=k.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>gL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=k.concat(r)}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 gL(t){return t.reduce((e,r)=>e+r.length,0)}async function vL(t,e){let r=new Ad(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new he(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new he(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await wL(r),f=new Md.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new he(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new he("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function wL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=k.from(o)}return r===7&&(s=await t.read(20)),{type:r,l Line truncated
`,t}function Td(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:PL(n)}}function PL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),RL(i)}function RL(t){return t===0?t:-t}var ni=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(k.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new he("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
type ${e.type}
tag ${e.tag}
tagger ${kg(e.tagger)}
tagger ${Qg(e.tagger)}
${e.message}
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
@@ -33,52 +38,52 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=cd(i.tagger)),i.committer&&(i.committer=cd(i.committer)),i}withoutSignature(){let e=Xn(this._tag);return e.indexOf(`
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=Td(i.tagger)),i.committer&&(i.committer=Td(i.committer)),i}withoutSignature(){let e=Qn(this._tag);return e.indexOf(`
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Xn(e)}payload(){return this.withoutSignature()+`
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Xn(s);let a=n+s;return t.from(a)}};function hg(t){return t.trim().split(`
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Qn(e)}payload(){return this.withoutSignature()+`
`}toObject(){return k.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Qn(s);let a=n+s;return t.from(a)}};function Hg(t){return t.trim().split(`
`).map(e=>" "+e).join(`
`)+`
`}function tN(t){return t.split(`
`}function $L(t){return t.split(`
`).map(e=>e.replace(/^ /,"")).join(`
`)}var Mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Xn(i+`
gpgsig`+hg(r)+`
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Xn(e.slice(e.indexOf(`
`)}var Nr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(k.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new he("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Qn(i+`
gpgsig`+Hg(r)+`
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return k.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Qn(e.slice(e.indexOf(`
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=cd(i.author)),i.committer&&(i.committer=cd(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=Td(i.author)),i.committer&&(i.committer=Td(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
`,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
`}let i=e.author;r+=`author ${kg(i)}
`;let n=e.committer||e.author;return r+=`committer ${kg(n)}
`,e.gpgsig&&(r+="gpgsig"+hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
`+Xn(e.message)}render(){return this._commit}withoutSignature(){let e=Xn(this._commit);if(e.indexOf(`
`,e.parent){if(e.parent.length===void 0)throw new he("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
`}let i=e.author;r+=`author ${Qg(i)}
`;let n=e.committer||e.author;return r+=`committer ${Qg(n)}
`,e.gpgsig&&(r+="gpgsig"+Hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
`+Qn(e.message)}render(){return this._commit}withoutSignature(){let e=Qn(this._commit);if(e.indexOf(`
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
`)+28);return Xn(r+`
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return tN(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Xn(a);let l=t.justHeaders(e._commit)+`
gpgsig`+hg(a)+`
`+s;return t.from(l)}};async function Ko({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Ir.from([]),oid:i};let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Mr.from(s).parse().tree,Ko({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new yr(i,n,"tree");return{tree:Ir.from(s),oid:i}}var Ag=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await W.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof He&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Ko({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Je({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new yr(l,c,o.type);let f=Ir.from(u);for(let d of f)a.set(O(r,d.path),d);return f.entries().map(d=>O(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=AE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await Je({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Zr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,md,{value:function({fs:r,gitdir:i,cache:n}){return new Ag({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(O(n,r));return s===null?null:s.map(a=>O(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await ft.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||nd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await wn(Cs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&nd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await dt.get({fs:e,gitdir:r}),this.config)}};function tl(){let t=Object.create(null);return Object.defineProperty(t,md,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new Cg({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function rN(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var ME=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Tg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){th Line truncated
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=Buffer.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(ha(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=ha(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(pd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function T(t,e){if(e===void 0)throw new Fr(t)}function aN(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ee({fsp:t,dotgit:e}){T("fsp",t),T("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>aN(i)?i:O(ha(e),i)):e}async function ud(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function DE({fs:t,dir:e,gitdir:r=O(e,".git"),commit:i="HEAD",cache:n={}}){try{T("fs",t),T("dir",e),T("gitdir",r);let s=new Q(t),a=[Zr({ref:i}),tl(),_a()],o=[],l=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Ps({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await ud(d,h),g=o.includes(u),v=!await ud(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new Qc(u)}});await ft.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Rs=class{static async isIgnored({fs:e,dir:r,gitdir:i=O(r,".git"),filepath:n}){if(sd(n)===".git")return!0;if(n===".")return!1;let s="",a=O(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:O(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:O(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=cL().add(s);d.add(f);let h=ha(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function oN({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new ue("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var pg=null;async function OE(t){return pg===null&&(pg=cN()),pg?lN(t):Fg.deflate(t)}async function lN(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function cN(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Dr({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Cs.wrap({type:r,object:i})),s=await wn(i),i=Buffer.from(await OE(i))),a||await oN({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function LE(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function NE({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{T("fs",t),T("dir",e),T("gitdir",r),T("filepath",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});await ft.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await dt.get({fs:o,gitdir:l})).get("core.autocrlf");return Rg({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function Rg({dir:t,gitdir:e,fs:r,filepath:i,in Line truncated
`,author:l,committer:c,signingKey:u})}async function jE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{T("fs",t),T("gitdir",i),T("oid",s),T("note",a),u&&T("onSign",e);let d=new Q(t),h=await $s({fs:d,gitdir:i,author:l});if(!h)throw new Zt("author");let p=await ga({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Zt("committer");let g=await ee({fsp:d,dotgit:i});return await uN({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var fN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function tu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!fN.test(t)&&(!!e||t.includes("/"))}async function VE({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=await dt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Ui("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await dt.save({fs:t,gitdir:e,config:s})}async function zE({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i,url:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("remote",i),T("url",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await VE({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function dN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await W.exists({fs:t,gitdir:i,ref:n}))throw new Ui("tag",n);let f=await W.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await Je({fs:t,cache:e,gitdir:i,oid:f}),h=Kr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Kr.sign(h,r,c));let p=await Dr({fs:t,gitdir:i,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function WE({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{T("fs",t),T("gitdir",i),T("ref",n),c&&T("onSign",e);let d=new Q(t),h=await ee({fsp:d,dotgit:i}),p=await $s({fs:d,gitdir:h,author:s});if(!p)throw new Zt("tagger");return await dN({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function hN({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let a=`refs/heads/${r}`;if(!s&&await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",r,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function qE({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let o=new Q(t),l=await ee({fsp:o,dotgit:r});return await hN({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var YE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await W.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let _;try{_=await W.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let S=`${a}/${o}`;if(_=await W.resolve({fs:t,gitdir:s,ref:S}),h){let k=await dt.get({fs:t,gitdir:s});await k.set(`branch.${o}.remote`,a),await k.set(`branch.${o}.merge`,`refs/heads/${o}`),await dt.save({fs:t,gitdir:s,config:k})}await W.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:_})}if(!c){let b;try{b=await pN({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof He&&w.data.what===_?new jc(o,_):w}let S=b.filter(([w])=>w==="conflict").map(([w,x])=>x);if(S.length>0)throw new Hc(S);let k=b.filter(([w])=>w==="error").map(([w,x])=>x);if(k.length>0)throw new ue(k.join(", "));if(f){i&&await i({previousHead:v,newHead:_,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=b.length;if(await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,y]){let C=`${n}/${y}`;x==="delete"&&await t.rm(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await ft.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[x,y]of b)if(x==="rmdir"||x==="rmdir-index"){let C=`${n}/${y}`;try{x==="rmdir"&&await t.rmdir(C),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}catch(P){if(P.code==="ENOTEMP Line truncated
`)+28);return Qn(r+`
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $L(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Qn(a);let l=t.justHeaders(e._commit)+`
gpgsig`+Hg(a)+`
`+s;return t.from(l)}};async function tl({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Lr.from([]),oid:i};let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,tl({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Nr.from(s).parse().tree,tl({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new xr(i,n,"tree");return{tree:Lr.from(s),oid:i}}var Jg=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await q.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof ze&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await tl({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await st({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new xr(l,c,o.type);let f=Lr.from(u);for(let d of f)a.set(N(r,d.path),d);return f.entries().map(d=>N(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=oS(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await st({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Dr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,gitdir:i,cache:n}){return new Jg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var ev=class{constructor({fs:e,dir:r,gitdir:i,cache:n,refresh:s=!0}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.refresh=s,this.config=null;let a=this;this.ConstructEntry=class{constructor(l){this._fullpath=l,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(e){if(await e.type()!=="tree")return null;let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(N(n,r));return s===null?null:s.map(a=>N(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Ko(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await gt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Ed(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await En(Ds.wrap({type:"blob",object:h})),r.refresh&&l&&a===l.oid&&(!f||c.mode===l.mode)&&Ed(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await vt.get({fs:e,gitdir:r}),this.config)}};function hu({refresh:t=!0}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,dir:i,gitdir:n,cache:s}){return new ev({fs:r,dir:i,gitdir:n,cache:s,refresh:t})}}),Object.freeze(e),e}function FL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var pS=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),tv=class{constructor(){this Line truncated
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=k.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(Sa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Sa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Dd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return k.isBuffer(i)?i:k.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Or(t)}function OL(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ie({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>OL(i)?i:N(Sa(e),i)):e}async function Pd(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function LL({fs:t,dir:e,gitdir:r=N(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new te(t),a=[Dr({ref:i}),hu(),sl()],o=[],l=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Jn({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await Pd(d,h),g=o.includes(u),v=!await Pd(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new ou(u)}});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Ls=class{static async isIgnored({fs:e,dir:r,gitdir:i=N(r,".git"),filepath:n}){if(Sd(n)===".git")return!0;if(n===".")return!1;let s="",a=N(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:N(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:N(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=(0,nS.default)().add(s);d.add(f);let h=Sa(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function NL({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new he("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var Ug=null;async function mS(t){return Ug===null&&(Ug=HL()),Ug?BL(t):Md.default.deflate(t)}async function BL(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function HL(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Br({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=Ds.wrap({type:r,object:i})),s=await En(i),i=k.from(await mS(i))),a||await NL({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function gS(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function UL({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});await gt.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await vt.get({fs:o,gitdir:l})).get("core.autocrlf");return iv({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function iv({dir:t,gitdir:e,fs:r,filepath:i, Line truncated
`,author:l,committer:c,signingKey:u})}async function VL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",i),R("oid",s),R("note",a),u&&R("onSign",e);let d=new te(t),h=await Ns({fs:d,gitdir:i,author:l});if(!h)throw new Jt("author");let p=await Ta({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Jt("committer");let g=await ie({fsp:d,dotgit:i});return await jL({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var zL=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function uu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!zL.test(t)&&(!!e||t.includes("/"))}async function yS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=await vt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Wi("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await vt.save({fs:t,gitdir:e,config:s})}async function WL({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i,url:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("remote",i),R("url",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await yS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function qL({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await q.exists({fs:t,gitdir:i,ref:n}))throw new Wi("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await st({fs:t,cache:e,gitdir:i,oid:f}),h=ni.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await ni.sign(h,r,c));let p=await Br({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function YL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",i),R("ref",n),c&&R("onSign",e);let d=new te(t),h=await ie({fsp:d,dotgit:i}),p=await Ns({fs:d,gitdir:h,author:s});if(!p)throw new Jt("tagger");return await qL({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function ZL({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",r,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function KL({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await ZL({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}async function fu(t,e,r){let i=r.split("/");i.pop();let n=e;for(let s of i){if(s===""||s===".")continue;n=`${n}/${s}`;let a=await t.lstat(n);if(a&&a.isSymbolicLink())throw new Ea(r)}}var xS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function ov({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(_){v="0000000000000000000000000000000000000000"}let b;try{b=await q.resolve({fs:t,gitdir:s,ref:o})}catch(_){if(o==="HEAD")throw _;let C=`${a}/${o}`;if(b=await q.resolve({fs:t,gitdir:s,ref:C}),h){let x=await vt.get({fs:t,gitdir:s});await x.set(`branch.${o}.remote`,a),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await vt.save({fs:t,gitdir:s,config:x})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:b})}if(!c){let _;try{_=await XL({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof ze&&w.data.what===b?new Qc(o,b):w}let C=_.filter(([w])=>w==="conflict").map(([w,S])=>S);if(C.length>0)throw new Zc(C);let x=_.filter(([w])=>w==="error").map(([w,S])=>S);if(x.length>0)throw new he(x.join(", "));if(f){i&&await i({previousHead:v,newHead:b,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=_.length;if(await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(_.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,y]){let P=`${n}/${y}`;S==="delete"&&await t.rm(P),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[S,y Line truncated
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i}
`);return{cleanMerge:h,mergedText:d}}async function XE({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Zr({ref:s}),g=Zr({ref:a}),v=Zr({ref:o}),_=[],b=[],S=[],k=[],E=await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,x,y]){let C=sd(A),P=await ud(w,x),L=await ud(y,x);switch(`${P}-${L}`){case"false-false":return{mode:await x.mode(),path:C,oid:await x.oid(),type:await x.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:C,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:C,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return wN({fs:t,gitdir:i,path:C,ours:w,base:x,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async N=>{if(N.cleanMerge)d||n.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(_.push(A),b.push(A),!d){let B="";x&&await x.type()==="blob"&&(B=await x.oid());let ge=await w.oid(),Le=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:ge,stage:2}),n.insert({filepath:A,oid:Le,stage:3})}return N.mergeResult});if(x&&!w&&y&&await x.type()==="blob"&&await y.type()==="blob"){if(_.push(A),S.push(A),!d){let N=await x.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(x&&w&&!y&&await x.type()==="blob"&&await w.type()==="blob"){if(_.push(A),k.push(A),!d){let N=await x.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:C}}if(x&&!w&&!y&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new Yo}}},reduce:_.length!==0&&(!r||d)?void 0:async(A,w)=>{let x=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&x.length===0&&A.path!==".")){if(x.length>0||A.path==="."&&x.length===0){let C=new Ir(x).toObject(),P=await Dr({fs:t,gitdir:i,type:"tree",object:C,dryRun:f});A.oid=P}return A}}});return _.length!==0?(r&&!d&&await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[Zr({ref:E.oid})],map:async function(A,[w]){let x=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),C=new TextDecoder().decode(await w.content());await t.write(x,C,{mode:y})}return!0}}),new pa(_,b,S,k)):E.oid}async function wN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=vN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=Buffer.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=Buffer.from(await i.content()).toString("utf8"),_=Buffer.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,a,o],contents:[p,v,_],path:r}),k=await Dr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:r,oid:k,type:f}}}var _N={stage:_a,workdir:tl},gg;async function Qo(t,e){return gg===void 0&&(gg=new Mc),gg.acquire(t,e)}async function bN(t,e,r,i,n=null){let s=O(r,i),a=await t.lstat(s);if(!a)throw new He(s);if(a.isDirectory())throw new ue(`${s}: file expected, but found directory`);let o=n?await RE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(LE):await t.read(s);if(c===null)throw new He(s);l=await Dr({fs:t,gitdir:e,type:"blob",object:c})}),l}async function yN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await nu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await bN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function mE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?_N[h]():h),a=[],u=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)& Line truncated
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){fa===null&&(fa=new Mc);let n=O(r,"shallow");if(i.size>0){let s=[...i].join(`
`);return{cleanMerge:h,mergedText:d}}async function SS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Dr({ref:s}),g=Dr({ref:a}),v=Dr({ref:o}),b=[],_=[],C=[],x=[],E=await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,S,y]){let P=Sd(A),T=await Pd(w,S),I=await Pd(y,S);switch(`${T}-${I}`){case"false-false":return{mode:await S.mode(),path:P,oid:await S.oid(),type:await S.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:P,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return tN({fs:t,gitdir:i,path:P,ours:w,base:S,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async M=>{if(M.cleanMerge)d||n.insert({filepath:A,oid:M.mergeResult.oid,stage:0});else if(b.push(A),_.push(A),!d){let B="";S&&await S.type()==="blob"&&(B=await S.oid());let re=await w.oid(),Ae=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:re,stage:2}),n.insert({filepath:A,oid:Ae,stage:3})}return M.mergeResult});if(S&&!w&&y&&await S.type()==="blob"&&await y.type()==="blob"){if(b.push(A),C.push(A),!d){let M=await S.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:P}}if(S&&w&&!y&&await S.type()==="blob"&&await w.type()==="blob"){if(b.push(A),x.push(A),!d){let M=await S.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:P}}if(S&&!w&&!y&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new Qo}}},reduce:b.length!==0&&(!r||d)?void 0:async(A,w)=>{let S=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let P=new Lr(S).toObject(),T=await Br({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});A.oid=T}return A}}});return b.length!==0?(r&&!d&&await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[Dr({ref:E.oid})],map:async function(A,[w]){let S=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),P=await w.content();await t.write(S,P,{mode:y})}return!0}}),new ka(b,_,C,x)):E.oid}async function tN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=eN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=k.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=k.from(await i.content()).toString("utf8"),b=k.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:C}=await u({branches:[l,a,o],contents:[p,v,b],path:r}),x=await Br({fs:t,gitdir:e,type:"blob",object:k.from(_,"utf8"),dryRun:c});return{cleanMerge:C,mergeResult:{mode:g,path:r,oid:x,type:f}}}var rN={stage:sl,workdir:hu},jg;async function rl(t,e){return jg===void 0&&(jg=new Yo.default),jg.acquire(t,e)}async function iN(t,e,r,i,n=null){let s=N(r,i),a=await t.lstat(s);if(!a)throw new ze(s);if(a.isDirectory())throw new he(`${s}: file expected, but found directory`);let o=n?await fS({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await rl({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(gS):await t.read(s);if(c===null)throw new ze(s);l=await Br({fs:t,gitdir:e,type:"blob",object:c})}),l}async function nN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await gu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await iN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function YE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?rN[h]():h),a=[],u=await Jn({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Ls.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),pa Line truncated
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ya===null&&(ya=new Yo.default);let n=N(r,"shallow");if(i.size>0){let s=[...i].join(`
`)+`
`;await fa.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await fa.acquire(n,async function(){await e.rm(n)})}};async function kN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(O(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Ig({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new ue(l.error);if(l.offsets.has(i))return!0}return!1}async function xE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),a=await kN({fs:t,gitdir:r,oid:i});return a||(a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function CN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function JE(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var gd={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"},Vo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function TN(t){let e=t.indexOf("\r"),r=t.indexOf(`
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function eS(t){let e=new Vo,r="";return(async()=>(await su(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=TN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var dd=class{static demux(e){let r=ot.streamReader(e),i=new Vo,n=new Vo,s=new Vo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function PN(t){let{packetlines:e,packfile:r,progress:i}=dd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{su(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function RN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(ot.encode(`want ${c}${l}
`)),l="";for(let c of i)o.push(ot.encode(`shallow ${c}
`));n!==null&&o.push(ot.encode(`deepen ${n}
`)),s!==null&&o.push(ot.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of a)o.push(ot.encode(`deepen-not ${c}
`));o.push(ot.flush());for(let c of r)o.push(ot.encode(`have ${c}
`));return o.push(ot.encode(`done
`)),o}async function Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:_=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:E=!1,pruneTags:A=!1}){let w=c||await Is({fs:t,gitdir:l,test:!0}),x=await dt.get({fs:t,gitdir:l}),y=f||w&&await x.get(`branch.${w}.remote`)||"origin",C=d||await x.get(`remote.${y}.url`);if(typeof C=="undefined")throw new Fr("remote OR url");let P=u||w&&await x.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let L=el.getRemoteHelperFor({url:C}),N=await L.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),B=N.auth,ge=N.refs;if(ge.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ks("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ks("deepen-since","since");if(v.length>0&&!N.capabilities.has("deepen-not"))throw new ks("deepen-not","exclude");if(_===!0&&!N.capabilities.has("deepen-relative"))throw new ks("deepen-relative","relative");let{oid:Le,fullref:ke}=W.resolveAgainstMap({ref:P,map:ge});for(let D of ge.keys())D===ke||D==="HEAD"||D.startsWith("refs/heads/")||b&&D.startsWith("refs/tags/")||ge.delete(D);let ne=JE([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${gd.agent}`]);_&&ne.push("deepen-relative");let Ee=S?[Le]:ge.values(),_e=S?[w]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let D of _e)try{D=await W.expand({fs:t,gitdir:l,ref:D});let M=await W.resolve({fs:t,gitdir:l,ref:D});await xE({fs:t,cache:e,gitdir:l,oid:M})&&z.push(M)}catch(M){}z=[...new Set(z)];let X=await va.read({fs:t,gitdir:l}),V=N.capabilities.has("shallow")?[...X]:[],Ne=RN({capabilities:ne,wants:Ee,haves:z,shallows:V,depth:p,since:g,exclude:v}),gr=Buffer.from(await fd(Ne)),Nt=await L.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:C,auth:B,body:[gr],headers:k}),Fe=await PN(Nt.body);Nt.headers&&(Fe.headers=Nt.headers);for(let D of Fe.shallows)if(!X.has(D))try{let{object:M}=await Je({fs:t,cache:e,gitdir:l,oid:D}),ae=new Mr(M),Te=await Promise.all(ae.headers().parent.map(Tr=>xE({fs:t,cache:e,gitdir:l,oid:Tr})));Te.length===0||Te.every(Tr=>Tr)||X.add(D)}catch(M){X.add(D)}for(let D of Fe.unshallows)X.delete(D);if(await va.write({fs:t,gitdir:l,oids:X}),S){let D=new Map([[ke,Le]]),M=new Map,ae=10,Te=ke;for(;ae--;){let vo=N.symrefs.get(Te);if(vo===void 0)break;M.set(Te,vo),Te=vo}let Bt=ge.get(Te);Bt&&D.set(Te,Bt);let{pruned:Tr}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:D,symrefs:M,tags:b,prune:E});E&&(Fe.pruned=Tr)}else{let{pruned:D}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:ge,symrefs:N.symrefs,tags:b,prune:E,pruneTags:A});E&&(Fe.pruned=D)}if(Fe.HEAD=N.symrefs.get("HEAD"),Fe.HEAD===void 0){let{oid:D}=W.resolveAgainstMap({ref:"HEAD",map:ge});for(let[M,ae]of ge.entries())if(M!=="HEAD"&&ae===D){Fe.HEAD=M;break}}let Pt=ke.startsWith("refs/tags")?"tag":"branch";if(Fe.FETCH_HEAD={oid:Le,description:`${Pt} '${da(ke)}' of ${C}`},i||n){let D=eS(Fe.progress);su(D,async M=>{if(n&&await n(M),i){let ae=M.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ae&&await i({phase:ae[1].trim(),loaded:parseInt(ae[2],10),total:parseInt(ae[3],10)})}})}let Rt=Buffer.from(await fd(Fe.packfile));if(Nt.body.error)throw Nt.body.error;let Ye=Rt.slice(-20).toString("hex"),J={defaultBranch:Fe.HEAD,fetchHead:Fe.FETCH_HEAD.oid,fetchHeadDescription:Fe.FETCH_HEAD.description};if(Fe.headers&&(J.headers=Fe.headers),E&&(J.pruned=Fe.pruned),Ye!==""&&!CN(Rt)){J.packfile=`objects/pack/pack-${Ye}.pack`;let D=O(l,J.packfile);await t.write(D,Rt);let M=Te=>Je({fs:t,cache:e,gitdir:l,oid:Te}),ae=await Nc.fromPack({pack:Rt,getExternalRefDelta:M,onProgress:i});await t.write(D.replace(/\.pack$/,".idx"),await ae.toBuffer())}return J}async function tS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:O(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
`;await ya.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ya.acquire(n,async function(){await e.rm(n)})}};async function cN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(N(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await av({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new he(l.error);if(l.offsets.has(i))return!0}return!1}async function tS({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>st({fs:t,cache:e,gitdir:r,oid:o}),a=await cN({fs:t,gitdir:r,oid:i});return a||(a=await uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function $d({config:t,onAuth:e}){return e&&(async(r,i)=>{let n=i.username||await t.get(`credential.${r}.username`);return e(r,n?{...i,username:n}:i)})}function fN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function AS(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Ld={name:"isomorphic-git",version:"1.40.0",agent:"git/isomorphic-git@1.40.0"},qo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function dN(t){let e=t.indexOf("\r"),r=t.indexOf(`
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function TS(t){let e=new qo,r="";return(async()=>(await vu(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=dN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var Fd=class{static demux(e){let r=dt.streamReader(e),i=new qo,n=new qo,s=new qo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function hN(t){let{packetlines:e,packfile:r,progress:i}=Fd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{vu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function pN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(dt.encode(`want ${c}${l}
`)),l="";for(let c of i)o.push(dt.encode(`shallow ${c}
`));n!==null&&o.push(dt.encode(`deepen ${n}
`)),s!==null&&o.push(dt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of a)o.push(dt.encode(`deepen-not ${c}
`));o.push(dt.flush());for(let c of r)o.push(dt.encode(`have ${c}
`));return o.push(dt.encode(`done
`)),o}async function lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:b=!1,tags:_=!1,singleBranch:C=!1,headers:x={},prune:E=!1,pruneTags:A=!1}){let w=c||await Bs({fs:t,gitdir:l,test:!0}),S=await vt.get({fs:t,gitdir:l}),y=f||w&&await S.get(`branch.${w}.remote`)||"origin",P=d||await S.get(`remote.${y}.url`);if(typeof P=="undefined")throw new Or("remote OR url");let T=u||w&&await S.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let I=nl.getRemoteHelperFor({url:P}),M=await I.discover({http:r,onAuth:$d({config:S,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:S,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:P,headers:x,protocolVersion:1}),B=M.auth,re=M.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!M.capabilities.has("shallow"))throw new Is("shallow","depth");if(g!==null&&!M.capabilities.has("deepen-since"))throw new Is("deepen-since","since");if(v.length>0&&!M.capabilities.has("deepen-not"))throw new Is("deepen-not","exclude");if(b===!0&&!M.capabilities.has("deepen-relative"))throw new Is("deepen-relative","relative");let{oid:Ae,fullref:K}=q.resolveAgainstMap({ref:T,map:re});for(let L of re.keys())L===K||L==="HEAD"||L.startsWith("refs/heads/")||_&&L.startsWith("refs/tags/")||re.delete(L);let Q=AS([...M.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ld.agent}`]);b&&Q.push("deepen-relative");let fe=C?[Ae]:re.values(),ce=C?[w]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let L of ce)try{L=await q.expand({fs:t,gitdir:l,ref:L});let W=await q.resolve({fs:t,gitdir:l,ref:L});await tS({fs:t,cache:e,gitdir:l,oid:W})&&z.push(W)}catch(W){}z=[...new Set(z)];let X=await Pa.read({fs:t,gitdir:l}),j=M.capabilities.has("shallow")?[...X]:[],Ze=pN({capabilities:Q,wants:fe,haves:z,shallows:j,depth:p,since:g,exclude:v}),$r=k.from(await Rd(Ze)),cr=await I.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:B,body:[$r],headers:x}),Ie=await hN(cr.body);cr.headers&&(Ie.headers=cr.headers);for(let L of Ie.shallows)if(!X.has(L))try{let{object:W}=await st({fs:t,cache:e,gitdir:l,oid:L}),xe=new Nr(W),Xe=await Promise.all(xe.headers().parent.map(ti=>tS({fs:t,cache:e,gitdir:l,oid:ti})));Xe.length===0||Xe.every(ti=>ti)||X.add(L)}catch(W){X.add(L)}for(let L of Ie.unshallows)X.delete(L);if(await Pa.write({fs:t,gitdir:l,oids:X}),C){let L=new Map([[K,Ae]]),W=new Map,xe=10,Xe=K;for(;xe--;){let aa=M.symrefs.get(Xe);if(aa===void 0)break;W.set(Xe,aa),Xe=aa}let Dt=re.get(Xe);Dt&&L.set(Xe,Dt);let{pruned:ti}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:L,symrefs:W,tags:_,prune:E});E&&(Ie.pruned=ti)}else{let{pruned:L}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:re,symrefs:M.symrefs,tags:_,prune:E,pruneTags:A});E&&(Ie.pruned=L)}if(Ie.HEAD=M.symrefs.get("HEAD"),Ie.HEAD===void 0){let{oid:L}=q.resolveAgainstMap({ref:"HEAD",map:re});for(let[W,xe]of re.entries())if(W!=="HEAD"&&xe===L){Ie.HEAD=W;break}}let yt=K.startsWith("refs/tags")?"tag":"branch";if(Ie.FETCH_HEAD={oid:Ae,description:`${yt} '${xa(K)}' of ${P}`},i||n){let L=TS(Ie.progress);vu(L,async W=>{if(n&&await n(W),i){let xe=W.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);xe&&await i({phase:xe[1].trim(),loaded:parseInt(xe[2],10),total:parseInt(xe[3],10)})}})}let Tt=k.from(await Rd(Ie.packfile));if(cr.body.error)throw cr.body.error;let Ke=Tt.slice(-20).toString("hex"),J={defaultBranch:Ie.HEAD,fetchHead:Ie.FETCH_HEAD.oid,fetchHeadDescription:Ie.FETCH_HEAD.description};if(Ie.headers&&(J.headers=Ie.headers),E&&(J.pruned=Ie.pruned),Ke!==""&&!fN(Tt)){J.packfile=`objects/pack/pack-${Ke}.pack`;let L=N(l,J.packfile);await t.write(L,Tt);let W=Xe=>st({fs:t,cache:e,gitdir:l,oid:Xe}),xe=await qc.fromPack({pack:Tt,getExternalRefDelta:W,onProgress:i});await t.write(L.replace(/\.pack$/,".idx"),await xe.toBuffer())}return J}async function PS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:N(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
repositoryformatversion = 0
filemode = false
bare = ${e}
@@ -86,23 +91,18 @@ gpgsig`+hg(a)+`
`)+` symlinks = false
ignorecase = true
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
`)}async function $N({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:_,relative:b,singleBranch:S,noCheckout:k,noTags:E,headers:A,nonBlocking:w,batchSize:x=100}){try{if(await tS({fs:t,gitdir:u}),await VE({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let P=await dt.get({fs:t,gitdir:u});await P.set("http.corsProxy",d),await dt.save({fs:t,gitdir:u,config:P})}let{defaultBranch:y,fetchHead:C}=await Og({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:_,relative:b,singleBranch:S,headers:A,tags:!E});if(C===null)return;h=h||y,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:k,nonBlocking:w,batchSize:x})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function rS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=O(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:_=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:x=100}){try{T("fs",t),T("http",e),T("gitdir",c),S||T("dir",l),T("url",u);let y=new Q(t),C=await ee({fsp:y,dotgit:c});return await $N({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:C,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:_,singleBranch:b,noCheckout:S,noTags:k,headers:E,nonBlocking:w,batchSize:x})}catch(y){throw y.caller="git.clone",y}}async function iS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{T("fs",t),l||T("message",n),o&&T("onSign",e);let g=new Q(t),v=await ee({fsp:g,dotgit:i});return await ru({fs:g,cache:p,onSign:e,gitdir:v,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function nS({fs:t,dir:e,gitdir:r=O(e,".git"),fullname:i=!1,test:n=!1}){try{T("fs",t),T("gitdir",r);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await Is({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function FN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:t,gitdir:e,ref:r}))throw new He(r);let n=await W.expand({fs:t,gitdir:e,ref:r}),s=await Is({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await W.resolve({fs:t,gitdir:e,ref:n});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:n});let a=da(r),o=await dt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await dt.save({fs:t,gitdir:e,config:o})}async function sS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await FN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function aS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});await W.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function IN({fs:t,gitdir:e,remote:r}){let i=await dt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await dt.save({fs:t,gitdir:e,config:i})}async function oS({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i}){try{T("fs",t),T("remote",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await IN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function MN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:t,gitdir:e,ref:r})}async function lS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{T("fs",t),T("ref",i);let n=new Q(t),s=await ee({fsp:n,dotgit:r});return await MN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function DN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(O(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Ig({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function LN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>Je({fs:t,cache:e,gitdir:r,oid:o}),s=await DN({fs:t,gitdir:r,oid:i}),a=await ON({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Bc("oids",i,s):new He(`an object matching "${i}"`)}async function cS({fs:t,dir:e,gitdir: Line truncated
`)),i.push(ot.encode(`agent=${gd.agent}
`)),(r||e||t)&&i.push(ot.delim()),r&&i.push(ot.encode("peel")),e&&i.push(ot.encode("symrefs")),t&&i.push(ot.encode(`ref-prefix ${t}`)),i.push(ot.flush()),i}async function DS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{T("http",t),T("url",s);let d=await Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return yS(d,c,u,f);let h=await zN({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return VN(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function OS({fs:t,dir:e,gitdir:r=O(e,".git")}){try{T("fs",t),T("gitdir",r);let i=new Q(t),n=await ee({fsp:i,dotgit:r});return W.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function WN(t,e){return t.committer.timestamp-e.committer.timestamp}var qN="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function EE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===qN)return;let s=i,a,o=await Ko({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await LS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function LS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=O(o,c.path),a.push(u)):c.type==="tree"&&(u=Je({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return LS({fs:t,cache:e,gitdir:r,tree:Ir.from(f),fileId:n,oid:s,filepaths:a,parentPath:O(o,c.path)})})),u});return await Promise.all(l),a}async function YN({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await va.read({fs:t,gitdir:r}),d=await W.resolve({fs:t,gitdir:r,ref:n}),h=[await vn({fs:t,cache:e,gitdir:r,oid:d})],p,g,v;function _(b){v&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let S;try{S=await iu({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&p!==S&&u.push(g),p=S,g=b,v=!0}catch(k){if(k instanceof He){let E=l&&p;if(E&&(E=await EE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),E))if(Array.isArray(E)){if(g){let A=await EE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(E=E.filter(w=>A.indexOf(w)===-1),E.length===1)E=E[0],i=E,g&&u.push(g);else{E=!1,g&&u.push(g);break}}}else i=E,g&&u.push(g);if(!E){if(v&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,v=!1}else throw k}}else u.push(b);if(s!==void 0&&u.length===s){_(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await vn({fs:t,cache:e,gitdir:r,oid:S});h.map(E=>E.oid).includes(k.oid)||h.push(k)}h.length===0&&_(b),h.sort((S,k)=>WN(S.commit,k.commit))}return u}async function NS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{T("fs",t),T("gitdir",r),T("ref",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});return await YN({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function BS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:_=!1}){try{T("fs",t),p&&T("onSign",e);let b=new Q(t),S=await ee({fsp:b,dotgit:i}),k=await $s({fs:b,gitdir:S,author:d});if(!k&&(!o||!a))throw new Zt("author");let E=await ga({fs:b,gitdir:S,author:k,committer:h});if(!E&&(!o||!a))throw new Zt("committer");return await fS({fs:b,cache:g,dir:r,gitdir:S,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:k,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:_})}catch(b){throw b.caller="git.merge",b}}var XN={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function HS({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),oids:n}){let s=new SE,a=[];function o(u,f){let d=Buffer.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=XN[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let v=(p|d|g).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await OE(f)))}o("PACK"),o("00000002","hex"),o($g(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await Je({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function ZN({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await HS({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await fd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(O(r,`objects/pack/${l}`),a),{filename:l}):{fil Line truncated
`)}async function mN({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:b,relative:_,singleBranch:C,noCheckout:x,noTags:E,headers:A,nonBlocking:w,batchSize:S=100}){try{if(await PS({fs:t,gitdir:u}),await yS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await vt.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await vt.save({fs:t,gitdir:u,config:T})}let{defaultBranch:y,fetchHead:P}=await lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:b,relative:_,singleBranch:C,headers:A,tags:!E});if(P===null)return;h=h||y,h=h.replace("refs/heads/",""),await ov({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:x,nonBlocking:w,batchSize:S})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function gN({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=N(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:b=!1,singleBranch:_=!1,noCheckout:C=!1,noTags:x=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:S=100}){try{R("fs",t),R("http",e),R("gitdir",c),C||R("dir",l),R("url",u);let y=new te(t),P=await ie({fsp:y,dotgit:c});return await mN({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:b,singleBranch:_,noCheckout:C,noTags:x,headers:E,nonBlocking:w,batchSize:S})}catch(y){throw y.caller="git.clone",y}}async function vN({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:g={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let v=new te(t),b=await ie({fsp:v,dotgit:i});return await pu({fs:v,cache:g,onSign:e,gitdir:b,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(v){throw v.caller="git.commit",v}}async function wN({fs:t,dir:e,gitdir:r=N(e,".git"),fullname:i=!1,test:n=!1}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Bs({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function bN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:t,gitdir:e,ref:r}))throw new ze(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Bs({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await q.resolve({fs:t,gitdir:e,ref:n});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:n});let a=xa(r),o=await vt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await vt.save({fs:t,gitdir:e,config:o})}async function _N({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await bN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function yN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});await q.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function xN({fs:t,gitdir:e,remote:r}){let i=await vt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await vt.save({fs:t,gitdir:e,config:i})}async function EN({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i}){try{R("fs",t),R("remote",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await xN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function SN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:t,gitdir:e,ref:r})}async function kN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await SN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function CN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(N(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await av({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new he(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function TN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>st({fs:t,cache:e,gitdir:r,oid:o}),s=await CN({fs:t,gitdir:r,oid:i}),a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Yc("oids",i,s):new ze(`an object matching "${iLine truncated
`)),i.push(dt.encode(`agent=${Ld.agent}
`)),(r||e||t)&&i.push(dt.delim()),r&&i.push(dt.encode("peel")),e&&i.push(dt.encode("symrefs")),t&&i.push(dt.encode(`ref-prefix ${t}`)),i.push(dt.flush()),i}async function iB({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let d=await il.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return IS(d,c,u,f);let h=await rB({prefix:c,symrefs:u,peelTags:f}),p=await il.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return tB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function nB({fs:t,dir:e,gitdir:r=N(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return q.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function sB(t,e){return t.committer.timestamp-e.committer.timestamp}var aB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function rS({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===aB)return;let s=i,a,o=await tl({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await OS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function OS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=N(o,c.path),a.push(u)):c.type==="tree"&&(u=st({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return OS({fs:t,cache:e,gitdir:r,tree:Lr.from(f),fileId:n,oid:s,filepaths:a,parentPath:N(o,c.path)})})),u});return await Promise.all(l),a}async function oB({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c}){let u=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),f=[],d=await Pa.read({fs:t,gitdir:r}),h=await q.resolve({fs:t,gitdir:r,ref:n}),p=[await xn({fs:t,cache:e,gitdir:r,oid:h})],g,v,b;function _(C){b&&i&&f.push(C)}for(;p.length>0;){let C=p.pop();if(u!==void 0&&C.commit.committer.timestamp<=u)break;if(i){let x;try{x=await mu({fs:t,cache:e,gitdir:r,oid:C.commit.tree,filepath:i}),v&&g!==x&&f.push(v),g=x,v=C,b=!0}catch(E){if(E instanceof ze){let A=l&&g;if(A&&(A=await rS({fs:t,cache:e,gitdir:r,oid:C.commit.tree,fileId:g}),A))if(Array.isArray(A)){if(v){let w=await rS({fs:t,cache:e,gitdir:r,oid:v.commit.tree,fileId:g});if(Array.isArray(w))if(A=A.filter(S=>w.indexOf(S)===-1),A.length===1)A=A[0],i=A,v&&f.push(v);else{A=!1,v&&f.push(v);break}}}else i=A,v&&f.push(v);if(!A){if(b&&g&&(f.push(v),!o))break;if(!o&&!l)throw E}v=C,b=!1}else throw E}}else f.push(C);if(s!==void 0&&f.length===s){_(C);break}if(!d.has(C.oid))for(let x of C.commit.parent){let E=await xn({fs:t,cache:e,gitdir:r,oid:x});p.map(A=>A.oid).includes(E.oid)||p.push(E)}p.length===0&&_(C),p.sort((x,E)=>sB(x.commit,E.commit))}if(c)for(let C of f)C.commit.changes=await lB({fs:t,cache:e,gitdir:r,commit:C,shallow:d.has(C.oid)});return f}async function lB({fs:t,cache:e,gitdir:r,commit:i,shallow:n}){let s=n||!i.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":i.commit.parent[0];return Jn({fs:t,cache:e,gitdir:r,trees:[Dr({ref:i.oid}),Dr({ref:s})],map:async(a,[o,l])=>{let[c,u]=await Promise.all([o&&o.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),a]:void 0;if(u==="tree")return c?[await o.oid(),null,a]:void 0;let[f,d]=await Promise.all([o?o.oid():null,l?l.oid():null]);if(f!==d)return[f,d,a]}})}async function cB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,includeChanges:c=!1,cache:u={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let f=new te(t),d=await ie({fsp:f,dotgit:r});return await oB({fs:f,cache:u,gitdir:d,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c})}catch(f){throw f.caller="git.log",f}}async function uB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:b=!1}){try{R("fs",t),p&&R("onSign",e);let _=new te(t),C=await ie({fsp:_,dotgit:i}),x=await Ns({fs:_,gitdir:C,author:d});if(!x&&(!o||!a))throw new Jt("author");let E=await Ta({fs:_,gitdir:C,author:x,committer:h});if(!E&&(!o||!a))throw new Jt("committer");return await RS({fs:_,cache:g,dir:r,gitdir:C,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:x,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}var fB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function LS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),oids:n}){let s=new sv.default,a=[];function o(u,f){let d=k.from(u,f);a.push(d),s.update(d) Line truncated
`),n=await i();let s=r.toString("utf8").split(`
`);if(n=s.shift(),!n.startsWith("unpack "))throw new ma('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function JN({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(ot.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
`)),i="";return r.push(ot.flush()),r}async function eB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={}}){let b=u||await Is({fs:t,gitdir:c});if(typeof b=="undefined")throw new Fr("ref");let S=await dt.get({fs:t,gitdir:c});d=d||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=h||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof k=="undefined")throw new Fr("remote OR url");let E=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Fr("remoteRef");v===void 0&&(v=await S.get("http.corsProxy"));let A=await W.expand({fs:t,gitdir:c,ref:b}),w=g?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:A}),x=el.getRemoteHelperFor({url:k}),y=await x.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:k,headers:_,protocolVersion:1}),C=y.auth,P;if(!E)P=A;else try{P=await W.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof He)P=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let L=y.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:k,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:P,oid:L}}))throw new Zo;let N=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],V=new Set;if(L!=="0000000000000000000000000000000000000000"){let Ne=await Lg({fs:t,cache:e,gitdir:c,oids:[w,L]});for(let gr of Ne)X.push(gr);N&&(V=await _g({fs:t,cache:e,gitdir:c,oids:Ne}))}if(!X.includes(w)){let Ne=await KN({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await _g({fs:t,cache:e,gitdir:c,oids:Ne})}if(N){try{let Ne=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:gr}=await W.resolveAgainstMap({ref:Ne.replace(`refs/remotes/${d}/`,""),fullref:Ne,map:y.refs}),Nt=[gr];for(let Fe of await _g({fs:t,cache:e,gitdir:c,oids:Nt}))V.add(Fe)}catch(Ne){}for(let Ne of V)B.delete(Ne)}if(w===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Xo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await AS({fs:t,cache:e,gitdir:c,oid:w,ancestor:L,depth:-1}))throw new Xo("not-fast-forward")}}let ge=JE([...y.capabilities],["report-status","side-band-64k",`agent=${gd.agent}`]),Le=await JN({capabilities:ge,triplets:[{oldoid:L,oid:w,fullRef:P}]}),ke=g?[]:await HS({fs:t,cache:e,gitdir:c,oids:[...B]}),ne=await x.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:k,auth:C,headers:_,body:[...Le,...ke]}),{packfile:Ee,progress:_e}=await dd.demux(ne.body);if(n){let X=eS(_e);su(X,async V=>{await n(V)})}let z=await QN(Ee);if(ne.headers&&(z.headers=ne.headers),d&&z.ok&&z.refs[P].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await W.deleteRef({fs:t,gitdir:c,ref:X}):await W.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([V,Ne])=>!Ne.ok).map(([V,Ne])=>`
- ${V}: ${Ne.error}`).join("");throw new Wc(X,z)}}async function jS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=O(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:_={},cache:b={}}){try{T("fs",t),T("http",e),T("gitdir",c);let S=new Q(t),k=await ee({fsp:S,dotgit:c});return await eB({fs:S,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:k,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:_})}catch(S){throw S.caller="git.push",S}}async function VS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,VS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new yr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function zS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await iu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await VS({fs:t,cache:e,gitdir:r,oid:i})}async function WS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await zS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function Ng({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await vn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function tB({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await W.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await zS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function qS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oid",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await tB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function YS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});s!==void 0&&(i=await iu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await Je({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Mr.from(f.object).parse();break;case"tree":f.object=Ir.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Kr.from(f.object).parse();break;default:throw new yr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function rB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Je({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new yr(i,n,"tag");let a=Kr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function XS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await rB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function ZS({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{T("fs",t),T("gitdir",r),T("oid",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function KS({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});await ft.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function iB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof He))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await nu({fs:t,gitdir:i,tree:f});return await ru({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:a,committer:o,signingKey:l})}async function QS({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{T("fs",t),T("gitdir",i),T("oid",s);let u=new Q(t),f=await ee({fsp:u,dotgit:i}),d=await $s({fs:u,gitdir:f,author:a});if(!d)throw new Zt("author");let h=await ga({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Zt("committer");return await iB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function nB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!tu(i,!0))throw new Gi(i,Dc.clean(i));if(!tu(r,!0))throw new Gi(r,Dc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await W.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",i,!1);let l=await W.resolve({fs:t,gitdir:e,ref:s,depth:1});await W.writeRef({fs:t,gitdir:e,ref:a,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:s});let u=await Is({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function JS({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i),T("oldref",n);let a=new Q(t),o=await ee({fsp:a,dotgit:r});return await nB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function ek({gitdir:t,type:e,object:r}){return wn(Cs.wrap({type:e,object:r}))}async function tk({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n,cache:s={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l,c;try{l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await iu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(O(e,i));f&&(c=await ek({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(O(e,i)))),await ft.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function rk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,depth:n}){try{T("fs",t),T("gitdir",r),T("ref",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});return await W.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function ik({fs:t,dir:e,gitdir:r=O(e,".git"),path:i,value:n,append:s=!1}){try{T("fs",t),T("gitdir",r),T("path",i);let a=new Q(t),o=await ee({fsp:a,dotgit:r}),l=await dt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await dt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function nk({fs:t,gitdir:e,commit:r}){let i=Mr.from(r).toObject();return await Dr({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var hd=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
`);if(n=s.shift(),!n.startsWith("unpack "))throw new Aa('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function vB({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(dt.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
`)),i="";return r.push(dt.flush()),r}async function wB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={}}){let _=u||await Bs({fs:t,gitdir:c});if(typeof _=="undefined")throw new Or("ref");let C=await vt.get({fs:t,gitdir:c});d=d||await C.get(`branch.${_}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${_}.remote`)||"origin";let x=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof x=="undefined")throw new Or("remote OR url");let E=f||await C.get(`branch.${_}.merge`);if(typeof x=="undefined")throw new Or("remoteRef");v===void 0&&(v=await C.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:_}),w=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),S=nl.getRemoteHelperFor({url:x}),y=await S.discover({http:r,onAuth:$d({config:C,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:C,onAuth:o}),corsProxy:v,service:"git-receive-pack",url:x,headers:b,protocolVersion:1}),P=y.auth,T;if(!E)T=A;else try{T=await q.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof ze)T=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let I=y.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:T,oid:I}}))throw new el;let M=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],j=new Set;if(I!=="0000000000000000000000000000000000000000"){let Ze=await cv({fs:t,cache:e,gitdir:c,oids:[w,I]});for(let $r of Ze)X.push($r);M&&(j=await Wg({fs:t,cache:e,gitdir:c,oids:Ze}))}if(!X.includes(w)){let Ze=await mB({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await Wg({fs:t,cache:e,gitdir:c,oids:Ze})}if(M){try{let Ze=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:$r}=await q.resolveAgainstMap({ref:Ze.replace(`refs/remotes/${d}/`,""),fullref:Ze,map:y.refs}),cr=[$r];for(let Ie of await Wg({fs:t,cache:e,gitdir:c,oids:cr}))j.add(Ie)}catch(Ze){}for(let Ze of j)B.delete(Ze)}if(w===I&&(p=!0),!p){if(A.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Jo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await MS({fs:t,cache:e,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new Jo("not-fast-forward")}}let re=AS([...y.capabilities],["report-status","side-band-64k",`agent=${Ld.agent}`]),Ae=await vB({capabilities:re,triplets:[{oldoid:I,oid:w,fullRef:T}]}),K=g?[]:await LS({fs:t,cache:e,gitdir:c,oids:[...B]}),Q=await S.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:x,auth:P,headers:b,body:[...Ae,...K]}),{packfile:fe,progress:ce}=await Fd.demux(Q.body);if(n){let X=TS(ce);vu(X,async j=>{await n(j)})}let z=await gB(fe);if(Q.headers&&(z.headers=Q.headers),d&&z.ok&&z.refs[T].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:X}):await q.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([j,Ze])=>!Ze.ok).map(([j,Ze])=>`
- ${j}: ${Ze.error}`).join("");throw new ru(X,z)}}async function bB({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=N(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={},cache:_={}}){try{R("fs",t),R("http",e),R("gitdir",c);let C=new te(t),x=await ie({fsp:C,dotgit:c});return await wB({fs:C,cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:x,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:b})}catch(C){throw C.caller="git.push",C}}async function NS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,NS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new xr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function BS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await mu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await NS({fs:t,cache:e,gitdir:r,oid:i})}async function wu({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await BS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function HS({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await xn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function _B({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await q.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await BS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function yB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oid",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await _B({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function xB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});s!==void 0&&(i=await mu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await st({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Nr.from(f.object).parse();break;case"tree":f.object=Lr.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=ni.from(f.object).parse();break;default:throw new xr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function EB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new xr(i,n,"tag");let a=ni.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function SB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await EB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function kB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await al({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function CB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function AB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof ze))throw p}let f=(await al({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await gu({fs:t,gitdir:i,tree:f});return await pu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:a,committer:o,signingKey:l})}async function TB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",i),R("oid",s);let u=new te(t),f=await ie({fsp:u,dotgit:i}),d=await Ns({fs:u,gitdir:f,author:a});if(!d)throw new Jt("author");let h=await Ta({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Jt("committer");return await AB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function PB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!uu(i,!0))throw new qi(i,Zo.default.clean(i));if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",i,!1);let l=await q.resolve({fs:t,gitdir:e,ref:s,depth:1});await q.writeRef({fs:t,gitdir:e,ref:a,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:s});let u=await Bs({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function RB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oldref",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await PB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function US({gitdir:t,type:e,object:r}){return En(Ds.wrap({type:e,object:r}))}async function $B({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l,c;try{l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await mu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(N(e,i));f&&(c=await US({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(N(e,i)))),await gt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function FB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,depth:n}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await q.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function IB({fs:t,dir:e,gitdir:r=N(e,".git"),path:i,value:n,append:s=!1}){try{R("fs",t),R("gitdir",r),R("path",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l=await vt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await vt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function GS({fs:t,gitdir:e,commit:r}){let i=Nr.from(r).toObject();return await Br({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Id=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
`}static getStashReflogEntry(e,r=!1){return e.split(`
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},wa=class t{constructor({fs:e,dir:r,gitdir:i=O(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O(this.gitdir,t.refStash)}get refLogsStashPath(){return O(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await $s({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return nk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Gi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?vn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return W.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=hd.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return hd.getStashReflogEntry(r,e)}};async function sk({fs:t,dir:e,gitdir:r,message:i=""}){let n=new wa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Is({fs:t,gitdir:r,fullname:!1}),a=await W.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Ng({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Zr({ref:"HEAD"}),d=await mE({fs:t,dir:e,gitdir:r,treePair:[Zr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=_a()}let h=await mE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new He("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function sB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await sk({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await Dg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function aB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await sk({fs:t,dir:e,gitdir:r,message:i});return n}async function ak({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new wa({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await vn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await ZE({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function ok({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new wa({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await Qo(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},Ra=class t{constructor({fs:e,dir:r,gitdir:i=N(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return N(this.gitdir,t.refStash)}get refLogsStashPath(){return N(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ns({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Jt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return GS({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new qi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?xn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Id.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await rl({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Id.getStashReflogEntry(r,e)}};async function jS({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Ra({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Bs({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await HS({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Dr({ref:"HEAD"}),d=await YE({fs:t,dir:e,gitdir:r,treePair:[Dr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=sl()}let h=await YE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new ze("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function MB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await jS({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await ES({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function DB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await jS({fs:t,dir:e,gitdir:r,message:i});return n}async function VS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Ra({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await xn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await kS({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function zS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Ra({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await rl(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await rl({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
`)+`
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function oB({fs:t,dir:e,gitdir:r}){return new wa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function lB({fs:t,dir:e,gitdir:r}){let i=new wa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function cB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await ak({fs:t,dir:e,gitdir:r,refIdx:i}),await ok({fs:t,dir:e,gitdir:r,refIdx:i})}async function lk({fs:t,dir:e,gitdir:r=O(e,".git"),op:i="push",message:n="",refIdx:s=0}){T("fs",t),T("dir",e),T("gitdir",r),T("op",i);let a={push:sB,apply:ak,drop:ok,list:oB,clear:lB,pop:cB,create:aB},o=["apply","drop","pop"];try{let l=new Q(t),c=await ee({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>O(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Gi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function ck({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{T("fs",t),T("gitdir",r),T("filepath",i);let s=new Q(t),a=await ee({fsp:s,dotgit:r});if(await Rs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await uB({fs:s,cache:n,gitdir:a}),c=await uk({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await ft.acquire({fs:s,gitdir:a,cache:n},async function(v){for(let _ of v)if(_.path===i)return _;return null}),f=await s.lstat(O(e,i)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!nd(u,f))return u.oid;{let v=await s.read(O(e,i)),_=await ek({gitdir:a,type:"blob",object:v});return h&&u.oid===_&&f.size!==-1&&ft.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:_})}),_}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await g()===u.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return c===u.oid,"*deleted";if(d&&p&&!h)return await g()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let v=await g();return v===c?v===u.oid?"unmodified":"*unmodified":v===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function uk({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await Je({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Ir.from(l);return uk({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new yr(a.oid,o,"blob",n.join("/"))}return null}async function uB({fs:t,cache:e,gitdir:r}){let i;try{i=await W.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof He)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function fk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let l=new Q(t),c=await ee({fsp:l,dotgit:r});return await Ps({fs:l,cache:a,dir:e,gitdir:c,trees:[Zr({ref:i}),tl(),_a()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Rs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(w=>YE(u,w)))return null;if(s&&!s(u))return;let[p,g,v]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),_=[p,g,v].includes("blob");if((p==="tree"||p==="special")&&!_)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!_)return;if(v==="commit")return null;if((v==="tree"||v==="special")&&!_)return;let b=p==="blob"?await f.oid():void 0,S=v==="blob"?await h.oid():void 0,k;p!=="blob"&&g==="blob"&&v!=="blob"?k="42":g==="blob"&&(k=await d.oid());let E=[void 0,b,k,S],A=E.map(w=>E.indexOf(w));return A.shift(),[u,...A]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function dk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,force:s=!1}){try{T("fs",t),T("gitdir",r),T("ref",i);let a=new Q(t);if(i===void 0)throw new Fr("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ee({fsp:a,dotgit:r}),l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await W.exists({fs:a,gitdir:o,ref:i}))throw new Ui("tag",i);await W.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function hk({fs:t,dir:e,gitdir:r=O(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{T("fs",t),T("gitdir",r),T("filepath",n);let u=new Q(t),f=await ee({fsp:u,dotgit:r});if(l)return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(O(e,n));if(p){if(p.isDirectory())throw new Ts("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(O(e,n)),!d)throw new He(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Ts("directory")}return await ft.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new He(`filLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kB(t,e){if(t){if(typeof t=="string")return Nk(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Nk(t,e)}}function Nk(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function AB(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function CB(t){if(Array.isArray(t))return t}var Hk=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,Uk=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,Gk=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,jk=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Vk=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,zk=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Wk=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function lu(t,e){return t.indexOf(e)>-1}function TB(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}}();return[f*60,u*100,c*100]}function PB(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]}(),u=xr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var RB=function(){function t(e){var r=xr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];xB(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return EB(t,[{key:"toRgbString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=xr(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=xr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=TB(i,n,s),l=xr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t}();function ol(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new RB([r,i,n,s])}function tv(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return ol([r,i,n,1])}function Cd(t){var e=xr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=PB(r,i,n),o=xr(a,3),l=o[0],c=o[1],u=o[2];return ol([l,c,u,s])}function qk(t){var e=xr(t,3),r=e[0],i=e[1],n=e[2];return Cd([r,i,n,1])}function $B(t){var e=Hk.exec(t)||Uk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,ol([i,n,s,a])}function FB(t){var e=Gk.exec(t)||Vk.exec(t)||jk.exec(t)||zk.exec(t),r=xr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=lu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=lu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=lu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(lu(a,"%")?100:1),ol([i,n,s,a])}function IB(t){var e=Wk.exec(t),r=xr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,yB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(lu(o,"%")?100:1),Cd([i,s,a,o])}function Yk(t){return Ok.default[t]?tv(Ok.default[t]):Hk.test(t)||Uk.test(t)?$B(t):Gk.test(t)||Vk.test(t)||jk.test(t)||zk.test(t)?FB(t):Wk.test(t)?IB(t):null}var MB={fromString:Yk,fromRgb:tv,fromRgba:ol,fromHsl:qk,fromHsla:Cd};Zn.default=MB});var oA=H((n9,aA)=>{m();aA.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,_,b,S){return{startX:g,startY:v,endX:_,endY:b,r:S}},p=function(g,v,_){var b,S,k,E,A;for(v>_?b=l[g-1+o]:b=l[g+1+o],A=k=Math.max(v Line truncated
`});Ee=!1,z=ne.length}function Fe(Pt,Rt){var Ye="="+V,J=Pt.indexOf(Ye,Rt),D=c(Pt.substring(Pt.indexOf("=",Rt)+1,J)).split(" ");return X=D[0],V=D[D.length-1],J+Ye.length-1}for(y&&(y=y.split(" "),X=y[0],V=y[1]),_e=0;_e<C;_e++)B==P?u(X,x,_e)?(--_e,Ne(),B=L):x.charAt(_e)==`
`?Nt(Ee):ke+=x.charAt(_e):B==L?(_e+=X.length-1,Le=t.tags[x.charAt(_e+1)],ge=Le?x.charAt(_e+1):"_v",ge=="="?(_e=Fe(x,_e),B=P):(Le&&_e++,B=N),Ee=_e):u(V,x,_e)?(ne.push({tag:ge,n:c(ke),otag:X,ctag:V,i:ge=="/"?Ee-X.length:_e+V.length}),ke="",_e+=V.length-1,B=P,ge=="{"&&(V=="}}"?_e++:l(ne[ne.length-1]))):ke+=x.charAt(_e);return Nt(Ee,!0),ne};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,x,y){if(x.charAt(y)!=w.charAt(0))return!1;for(var C=1,P=w.length;C<P;C++)if(x.charAt(y+C)!=w.charAt(C))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,x,y,C){var P=[],L=null,N=null,B=null;for(N=y[y.length-1];w.length>0;){if(B=w.shift(),N&&N.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,C))y.push(B),B.nodes=d(w,B.tag,y,C);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(L=y.pop(),B.n!=L.n&&!p(B.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+B.n);return L.end=B.i,P}else B.tag==`
`&&(B.last=w.length==0||w[0].tag==`
`);P.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return P}function h(w,x){for(var y=0,C=x.length;y<C;y++)if(x[y].o==w.n)return w.tag="#",!0}function p(w,x,y){for(var C=0,P=y.length;C<P;C++)if(y[C].c==w&&y[C].o==x)return!0}function g(w){var x=[];for(var y in w)x.push('"'+b(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+x.join(",")+" }"}function v(w){var x=[];for(var y in w.partials)x.push('"'+b(y)+'":{name:"'+b(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+x.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,x,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var _=0;t.generate=function(w,x,y){_=0;var C={code:"",subs:{},partials:{}};return t.walk(w,C),y.asString?this.stringify(C,x,y):this.makeTemplate(C,x,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,x,y){var C=this.makePartials(w);return C.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(C,x,this,y)},t.makePartials=function(w){var x,y={subs:{},partials:w.partials,name:w.name};for(x in y.partials)y.partials[x]=this.makePartials(y.partials[x]);for(x in w.subs)y.subs[x]=new Function("c","p","t","i",w.subs[x]);return y};function b(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function S(w){return~w.indexOf(".")?"d":"f"}function k(w,x){var y="<"+(x.prefix||""),C=y+w.n+_++;return x.partials[C]={name:w.n,partials:{}},x.code+='t.b(t.rp("'+b(C)+'",c,p,"'+(w.indent||"")+'"));',C}t.codegen={"#":function(w,x){x.code+="if(t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,x),x.code+="});c.pop();}"},"^":function(w,x){x.code+="if(!t.s(t."+S(w.n)+'("'+b(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,x),x.code+="};"},">":k,"<":function(w,x){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var C=x.partials[k(w,x)];C.subs=y.subs,C.partials=y.partials},$:function(w,x){var y={subs:{},code:"",partials:x.partials,prefix:w.n};t.walk(w.nodes,y),x.subs[w.n]=y.code,x.inPartial||(x.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,x){x.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,x){x.code+="t.b(t.v(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,x){x.code+=A('"'+b(w.text)+'"')},"{":E,"&":E};function E(w,x){x.code+="t.b(t.t(t."+S(w.n)+'("'+b(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,x){for(var y,C=0,P=w.length;C<P;C++)y=t.codegen[w[C].tag],y&&y(w[C],x);return x},t.parse=function(w,x,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,x){return[w,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},t.compile=function(w,x){x=x||{};var y=t.cacheKey(w,x),C=this.cache[y];if(C){var P=C.partials;for(var L in P)delete P[L].instance;return C}return C=this.generate(this.parse(this.scan(w,x.delimiters),w,x),w,x),this.cache[y]=C}})(typeof Mw!="undefined"?Mw:Hogan)});var UP=H(Dw=>{m();var z5={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,_,b){var S;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,_,b)),S=!!d,!g&&S&&h&&h.push(typeof d=="object"?d:h[h.length-1]),S)},d:function(d,h,p,g){var v,_=d.split("."),b=this.f(_[0],h,p,g),S=this.options.modelGet,k=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var E=1;E<_.length;E++)v=e(_[E],b,S),v!==void 0?(k=b,b=v):b="";return g&&!b?!1:(!g&&typeof b=="function"&&(h.push(k),b=this.mv(b,h,p),h.pop()),b)},f:function(d,h,p,g){for(var v=!1,_=null,b=!1,S=this.options.modelGet,k=h.length-1;k>=0;k--)if(_=h[k],v=e(d,_,S),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,_){var b=this.options.delimiters;return this.options.delimiters=_,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=b,!1},ct:functio Line truncated
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function OB({fs:t,dir:e,gitdir:r}){return new Ra({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function LB({fs:t,dir:e,gitdir:r}){let i=new Ra({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await rl(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function NB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await VS({fs:t,dir:e,gitdir:r,refIdx:i}),await zS({fs:t,dir:e,gitdir:r,refIdx:i})}async function BB({fs:t,dir:e,gitdir:r=N(e,".git"),op:i="push",message:n="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",r),R("op",i);let a={push:MB,apply:VS,drop:zS,list:OB,clear:LB,pop:NB,create:DB},o=["apply","drop","pop"];try{let l=new te(t),c=await ie({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>N(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new qi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function HB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={},refresh:s=!0}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});if(await Ls.isIgnored({fs:a,gitdir:o,dir:e,filepath:i}))return"ignored";let c=await UB({fs:a,cache:n,gitdir:o}),u=await WS({fs:a,cache:n,gitdir:o,tree:c,path:i}),f=await gt.acquire({fs:a,gitdir:o,cache:n},async function(b){for(let _ of b)if(_.path===i)return _;return null}),d=await a.lstat(N(e,i)),h=u!==null,p=f!==null,g=d!==null,v=async()=>{if(p&&!Ed(f,d))return f.oid;{let b=await a.read(N(e,i)),_=await US({gitdir:o,type:"blob",object:b});return s&&p&&f.oid===_&&d.size!==-1&&gt.acquire({fs:a,gitdir:o,cache:n},async function(C){C.insert({filepath:i,stats:d,oid:_})}),_}};if(!h&&!g&&!p)return"absent";if(!h&&!g&&p)return"*absent";if(!h&&g&&!p)return"*added";if(!h&&g&&p)return await v()===f.oid?"added":"*added";if(h&&!g&&!p)return"deleted";if(h&&!g&&p)return u===f.oid,"*deleted";if(h&&g&&!p)return await v()===u?"*undeleted":"*undeletemodified";if(h&&g&&p){let b=await v();return b===u?b===f.oid?"unmodified":"*unmodified":b===f.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function WS({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await st({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Lr.from(l);return WS({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new xr(a.oid,o,"blob",n.join("/"))}return null}async function UB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof ze)return[]}let{tree:n}=await al({fs:t,cache:e,gitdir:r,oid:i});return n}async function GB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1,refresh:l=!0}){try{R("fs",t),R("gitdir",r),R("ref",i);let c=new te(t),u=await ie({fsp:c,dotgit:r});return await Jn({fs:c,cache:a,dir:e,gitdir:u,trees:[Dr({ref:i}),hu({refresh:l}),sl()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!o&&await Ls.isIgnored({fs:c,dir:e,filepath:f})||!n.some(S=>xS(f,S)))return null;if(s&&!s(f))return;let[g,v,b]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),_=[g,v,b].includes("blob");if((g==="tree"||g==="special")&&!_)return;if(g==="commit")return null;if((v==="tree"||v==="special")&&!_)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!_)return;let C=g==="blob"?await d.oid():void 0,x=b==="blob"?await p.oid():void 0,E;g!=="blob"&&v==="blob"&&b!=="blob"?E="42":v==="blob"&&(E=await h.oid());let A=[void 0,C,E,x],w=A.map(S=>A.indexOf(S));return w.shift(),[f,...w]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function jB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let a=new te(t);if(i===void 0)throw new Or("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ie({fsp:a,dotgit:r}),l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await q.exists({fs:a,gitdir:o,ref:i}))throw new Wi("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function VB({fs:t,dir:e,gitdir:r=N(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{R("fs",t),R("gitdir",r),R("filepath",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});if(l)return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(N(e,n));if(p){if(p.isDirectory())throw new Os("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(N(e,n)),!d)throw new ze(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Os("directory")}return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){ Line truncated
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
@@ -125,72 +125,72 @@ done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"
`,Sk=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var _n=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,_=()=>{for(let b=Math.max(g,-c);b<=Math.min(v,c);b+=2){let S,k=h[b-1],E=h[b+1];k&&(h[b-1]=void 0);let A=!1;if(E){let x=E.oldPos-b;A=E&&0<=x&&x<o}let w=k&&k.oldPos+1<l;if(!A&&!w){h[b]=void 0;continue}if(!w||A&&k.oldPos<E.oldPos?S=this.addToPath(E,!0,!1,0,i):S=this.addToPath(k,!1,!0,1,i),p=this.extractCommon(S,r,e,b,i),S.oldPos+1>=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(v=Math.min(v,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);_()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=_();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Gg=class extends _n{},kk=new Gg;function jg(t,e,r){return kk.diff(t,e,r)}m();m();function Vg(t,e){let r;for(r=0;r<t.length&&r<e.length;r++)if(t[r]!=e[r])return t.slice(0,r);return t.slice(0,r)}function zg(t,e){let r;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(r=0;r<t.length&&r<e.length;r++)if(t[t.length-(r+1)]!=e[e.length-(r+1)])return t.slice(-r);return t.slice(-r)}function xd(t,e,r){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is Line truncated
`,ZS=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var bu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<E.oldPos?C=this.addToPath(E,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+1>=o&&(g=Math.max(g,_+1))}c++};if(n)(function _(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);b()||_()},0)})();else for(;c<=u&&Date.now()<=d;){let _=b();if(_)return _}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var dv=class extends bu{constructor(){super(...arguments),this.tokenize=r3}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(`
`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),r.endsWith(`
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},gB=new Kg;function Qg(t,e,r){return gB.diff(t,e,r)}function vB(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();var Tk={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Jg(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;Qg(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(Qg(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(S){return" "+S})}let d=[],h=0,p=0,g=[],v=1,_=1;for(let b=0;b<u.length;b++){let S=u[b],k=S.lines||wB(S.value);if(S.lines=k,S.added||S.removed){if(!h){let E=u[b-1];h=v,p=_,E&&(g=l>0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of k)g.push((S.added?"+":"-")+E);S.added?_+=k.length:v+=k.length}else{if(h)if(k.length<=l*2&&b<u.length-2)for(let E of f(k))g.push(E);else{let E=Math.min(k.length,l);for(let w of f(k.slice(0,E)))g.push(w);let A={oldStart:h,oldLines:v-h+E,newStart:p,newLines:_-p+E,lines:g};d.push(A),h=0,p=0,g=[]}v+=k.length,_+=k.length}}for(let b of d)for(let S=0;S<b.lines.length;S++)b.lines[S].endsWith(`
`)?b.lines[S]=b.lines[S].slice(0,-1):(b.lines.splice(S+1,0,"\\ No newline at end of file"),S++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function Ad(t,e){if(e||(e=Tk),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(i=>Ad(i,e)).join(`
`)}let r=[];e.includeIndex&&t.oldFileName==t.newFileName&&r.push("Index: "+t.oldFileName),e.includeUnderline&&r.push("==================================================================="),e.includeFileHeaders&&(r.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),r.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader)));for(let i=0;i<t.hunks.length;i++){let n=t.hunks[i];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),r.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let s of n.lines)r.push(s)}return r.join(`
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},t3=new dv;function hv(t,e,r){return t3.diff(t,e,r)}function r3(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();function i3(t){for(let e=0;e<t.length;e++)if(t[e]<" "||t[e]>"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Gs(t){if(!i3(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i<r.length;){let n=r[i];n===7?e+="\\a":n===8?e+="\\b":n===9?e+="\\t":n===10?e+="\\n":n===11?e+="\\v":n===12?e+="\\f":n===13?e+="\\r":n===34?e+='\\"':n===92?e+="\\\\":n>=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var pv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function mv(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;hv(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(hv(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(_){return _.map(function(C){return" "+C})}let d=[],h=0,p=0,g=[],v=1,b=1;for(let _=0;_<u.length;_++){let C=u[_],x=C.lines||n3(C.value);if(C.lines=x,C.added||C.removed){if(!h){let E=u[_-1];h=v,p=b,E&&(g=l>0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of x)g.push((C.added?"+":"-")+E);C.added?b+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&_<u.length-2)for(let E of f(x))g.push(E);else{let E=Math.min(x.length,l);for(let w of f(x.slice(0,E)))g.push(w);let A={oldStart:h,oldLines:v-h+E,newStart:p,newLines:b-p+E,lines:g};d.push(A),h=0,p=0,g=[]}v+=x.length,b+=x.length}}for(let _ of d)for(let C=0;C<_.lines.length;C++)_.lines[C].endsWith(`
`)?_.lines[C]=_.lines[C].slice(0,-1):(_.lines.splice(C+1,0,"\\ No newline at end of file"),C++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function jd(t,e){var r,i,n,s,a,o;if(e||(e=pv),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders&&!t.every(u=>u.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(u=>jd(u,e)).join(`
`)}let l=[];if(t.isGit){if(e=pv,!t.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!t.newFileName)throw new Error("newFileName must be specified for Git patches");let u=t.oldFileName,f=t.newFileName;t.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):t.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+Gs(u)+" "+Gs(f)),t.isDelete&&l.push("deleted file mode "+((r=t.oldMode)!==null&&r!==void 0?r:"100644")),t.isCreate&&l.push("new file mode "+((i=t.newMode)!==null&&i!==void 0?i:"100644")),t.oldMode&&t.newMode&&!t.isDelete&&!t.isCreate&&(l.push("old mode "+t.oldMode),l.push("new mode "+t.newMode)),t.isRename&&(l.push("rename from "+Gs(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Gs(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Gs(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Gs(((o=t.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&t.oldFileName==t.newFileName&&t.oldFileName!==void 0&&l.push("Index: "+t.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=t.hunks.length>0;e.includeFileHeaders&&t.oldFileName!==void 0&&t.newFileName!==void 0&&(!t.isGit||c)&&(l.push("--- "+Gs(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Gs(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u<t.hunks.length;u++){let f=t.hunks[u],d=f.oldLines===0?f.oldStart-1:f.oldStart,h=f.newLines===0?f.newStart-1:f.newStart;l.push("@@ -"+d+","+f.oldLines+" +"+h+","+f.newLines+" @@");for(let p of f.lines)l.push(p)}return l.join(`
`)+`
`}function Pk(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;Jg(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?Ad(l,a.headerOptions):void 0)}}))}else{let o=Jg(t,e,r,i,n,s,a);return o?Ad(o,a==null?void 0:a.headerOptions):void 0}}function ou(t,e,r,i,n,s){return Pk(t,t,e,r,i,n,s)}function wB(t){let e=t.endsWith(`
`}function KS(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;mv(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?jd(l,a.headerOptions):void 0)}}))}else{let o=mv(t,e,r,i,n,s,a);return o?jd(o,a==null?void 0:a.headerOptions):void 0}}function _u(t,e,r,i,n,s){return KS(t,t,e,r,i,n,s)}function n3(t){let e=t.endsWith(`
`),r=t.split(`
`).map(i=>i+`
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var re=Ht(Bg(),1),xa=require("obsidian");m();function Rk(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var al=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var $k=require("obsidian"),bB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},et=class extends $k.SuggestModal{constructor(e,r){if(super(e.app),this.config={...bB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var Zk=Ht(Xk(),1),Kk=require("child_process"),Kn=require("obsidian");function Td(t){throw new Error(`Unexpected object: ${t}`)}function cu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var rv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function ji(t,e){let r;if(e){if(e.button===0||e.button===1){let i=Kn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function bn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new Kn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new Kn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Os(t){throw new Error("Impossible branch: "+t)}function iv(t){return`rgb(${t.r},${t.g},${t.b})`}function Qk(t){var s;let e=(s=Zk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function Jk(t){return t.diff(Kn.moment.unix(0),"seconds")}function eA(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function uu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function tA(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function rA(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function nv(t,e,r){return t<=e&&e<=r}function Qn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function yn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function iA(t){return t===1?"1 minute":`${t} minutes`}function DB(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ll(t){if(t.endsWith(".md"))return!1;let e=DB(t);return Sk.includes(e)}function sv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function cl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Kn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function nA({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ul(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function fu(t,e,r={}){return new Promise((i,n)=>{let s=(0,Kk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var sA=require("os"),Pd=require("obsidian"),fl=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/")) Line truncated
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var Cn=require("obsidian");m();function XS(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var ll=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var QS=require("obsidian"),s3={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},at=class extends QS.SuggestModal{constructor(e,r){if(super(e.app),this.config={...s3,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var vk=mt(gk(),1),wk=require("child_process"),ts=require("obsidian");function zd(t){throw new Error(`Unexpected object: ${String(t)}`)}function xu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var wv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Yi(t,e){let r;if(e){if(e.button===0||e.button===1){let i=ts.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function Hr(t){return t.getRoot().side==="left"?"right":"left"}function Sn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new ts.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new ts.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function js(t){throw new Error(`Impossible branch: ${String(t)}`)}function bv(t){return`rgb(${t.r},${t.g},${t.b})`}function bk(t){var s;let e=(s=vk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function _k(t){return t.diff(ts.moment.unix(0),"seconds")}function yk(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function Eu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function xk(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function Ek(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function _v(t,e,r){return t<=e&&e<=r}function Vs(t){let[e,...r]=t.split("/");return[e!=null?e:"",r.length===0?void 0:r.join("/")]}function kn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function Sk(t){return t===1?"1 minute":`${t} minutes`}function _3(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ul(t){if(t.endsWith(".md"))return!1;let e=_3(t);return ZS.includes(e)}function yv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function fl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof ts.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function kk({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function dl(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function Su(t,e,r={}){return new Promise((i,n)=>{let s=(0,wk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:o,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var Ck=require("os"),qd=require("obsidian");var hl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,r){var i;this.plugin.setPluginState({operation:e});try{return await r()}finally{(i=this.plugin.statusBar)==null||i.clearProgress(!1),this.plugin.setPluginState({operation:0})}}getRelativeVaultPath(e){return this.plugin.settings.basePath?e===""||e==="."?this.plugin.settings.basePath:thi Line truncated
`):n="Too many files to list",e=e+`
Affected files:
`+n}return e}};m();var Ls=require("obsidian"),Rd=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof Ls.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let i=this.vault.getAbstractFileByPath(e);return i instanceof Ls.TFile?this.vault.modifyBinary(i,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Ls.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Ls.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var fA=Ht(uA(),1),Vi=class extends fl{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Rd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new xa.Notice("Authentication failed. Please try with different credentials");let r=await new et(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new et(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await BB(s));let o=await(0,xa.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:NB(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await Line truncated
`+n}return e}};m();var Wt=require("obsidian"),Yd=class extends Error{constructor(r){super(`File not found: ${r}`);this.code="ENOENT";this.name="FileNotFoundError"}},Zd=class{constructor(e,r){this.plugin=r;this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises={readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),readdir:this.readdir.bind(this),mkdir:this.mkdir.bind(this),rmdir:this.rmdir.bind(this),stat:this.stat.bind(this),unlink:this.unlink.bind(this),lstat:this.lstat.bind(this),readlink:this.readlink.bind(this),symlink:this.symlink.bind(this)}}async readFile(e,r){var n;if(e===void 0)return;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(r)),(typeof r=="string"?r:r==null?void 0:r.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.read(s)):this.adapter.read(e)}else{if(this.isIndexPath(e))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,r){var i;if(this.maybeLog("Write: "+e),e=(0,Wt.normalizePath)(e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);if(n instanceof Wt.TFile)return this.vault.modify(n,r);if(!this.isHiddenPath(e))await this.vault.create(e,r);else return this.adapter.write(e,r)}else{let n=y3(r);if(this.isIndexPath(e)){this.index=n;let s=Date.now();(i=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFile)return this.vault.modifyBinary(s,n);if(!this.isHiddenPath(e))await this.vault.createBinary(e,n);else return this.adapter.writeBinary(e,n)}}}async readdir(e){e=(0,Wt.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Wt.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){if(e=(0,Wt.normalizePath)(e),!(e==="."||e==="/")){if(!this.isHiddenPath(e)){if(this.vault.getFolderByPath(e))return;await this.vault.createFolder(e);return}return this.adapter.mkdir(e)}}async rmdir(e,r){var i,n;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(r)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFolder){await this.vault.delete(s,(r==null?void 0:r.recursive)===!0||((i=r==null?void 0:r.options)==null?void 0:i.recursive)===!0);return}}return this.adapter.rmdir(e,(r==null?void 0:r.recursive)===!0||((n=r==null?void 0:r.options)==null?void 0:n.recursive)===!0)}async stat(e){if(e=(0,Wt.normalizePath)(e),this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw new Yd(e);return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Wt.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw new Yd(e)}}async unlink(e){if(e=(0,Wt.normalizePath)(e),!this.isHiddenPath(e)){let r=this.vault.getAbstractFileByPath(e);if(r instanceof Wt.TFile)return this.vault.delete(r)}return this.adapter.remove(e)}async lstat(e){return this.stat(e)}readlink(e){return Promise.reject(new Error(`readlink of (${e}) is not implemented.`))}symlink(e){return Promise.reject(new Error(`symlink of (${e}) is not implemented.`))}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.getIndexPath(),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}getIndexPath(){return this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index")}isIndexPath(e){return e===this.getIndexPath()}isHiddenPath(e){return e.startsWith(this.gitDir)?!0:e.split("/").some(r=>r.startsWith(".")&&r!==".")}maybeLog(e){}};function y3(t){return t instanceof ArrayBuffer?t:t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice().buf Line truncated
`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
`);return{message:(c=l[0])!=null?c:"",author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Qn(r),s=await this.branchInfo();await this.wrapFS(re.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[re.default.TREE({ref:r}),re.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(re.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!rv(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[re.default.TREE({ref:"HEAD"}),re.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new xa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(re.default.walk({...s,trees:[re.default.WORKDIR(),re.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await re.default.isIgnored({...s,filepath:o})||!rv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await re.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h}),u=await re.default.readCommit({...this.getRepo(),oid:n}),f=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h});return ou(s,f!=null?f:"",c!=null?c:"")}let o=(await re.default.walk({...this.getRepo(),trees:[re.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,re.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof re.default.Errors.NotFoundError))throw f});return ou(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",ou(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await re.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new xa.Notice(r,i?this.noticeLength:void 0)}};async function*NB(t){yield new Uint8Array(t)}async function BB(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}m();var o2=Ht(Id(),1),ei=Ht(require("fs/promises"),1),Jn=require("obsidian"),ze=Ht(require("path"),1),yu=require("path");m();var jd=Ht(vA(),1);m();var ov=new WeakMap;function gl(...t){let e=new String(t);return ov.set(e,t),e}function yi(t){return t instanceof String&&ov.has(t)}function vl(t){var e;return(e=ov.get(t))!=null?e:[]}var Ud=Ht(Id(),1),qC=require("child_process");var $T=Ht(cv(),1),GT=require("node:path");m();function*wA(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var nH=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),sH=new Set(["--get","--get-all" Line truncated
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Fv(t,e){return vu(t,!0).map(r=>e(r))}function Iv(t){return(0,jd.exists)(t,jd.FOLDER)}function Si(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function cC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Vd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function xn(t){return Array.isArray(t)?t:[t]}function uC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function El(t){return xn(t).map(e=>e instanceof String?e:String(e))}function Xe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function pu(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function mu(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function fC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function gv(t=0){return new Promise(e=>setTimeout(e,t))}function vv(t){if(t!==!1)return t}var bl,Ta,wu,zd=q({"src/lib/utils/util.ts"(){"use strict";Mv(),bl="\0",Ta=()=>{},wu=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ar(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function wv(t,e){let r=yi(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Wd(t){return!!t&&wu(t)==="[object Object]"}function dC(t){return typeof t=="function"}var _u,hC,pt,Bd,qd,Mv=q({"src/lib/utils/argument-filters.ts"(){"use strict";zd(),_u=t=>Array.isArray(t),hC=t=>typeof t=="number",pt=t=>typeof t=="string"||yi(t),Bd=t=>pt(t)||Array.isArray(t)&&t.every(pt),qd=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),_v,NH=q({"src/lib/utils/exit-codes.ts"(){"use strict";_v=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(_v||{})}}),Hd,BH=q({"src/lib/utils/git-output-streams.ts"(){"use strict";Hd=class pC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new pC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function HH(){throw new Error("LineParser:useMatches not implemented")}var ve,Ns,UH=q({"src/lib/utils/line-parser.ts"(){"use strict";ve=class{constructor(t,e){this.matches=[],this.useMatches=HH,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},Ns=class extends ve{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function mC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...gC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var gC,GH=q({"src/lib/utils/simple-git-options.ts"(){"use strict";gC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Dv(t,e=[]){return Wd(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(yi(n))r.push(n);else if(wv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)wv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Er(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Dv(Ov(t),i),r||i.push(...jH(t)),i}function jH(t){let e=typeof Ca(t)=="function";return El(ar(Ca(t,e?1:0),_u,[]))}function Ov(t){let e=dC(Ca(t));return ar(Ca(t,e?1:0),Wd)}function it(t,e=!0){let r=nC(Ca(t));return e||sC(r)?r:void 0}var VH=q({"src/lib/utils/task-options.ts"(){"use strict";Mv(),zd()}});function bv(t,e){return t(e.stdOut,e.stdErr)}function Br(t,e,r,i=!0){return xn(r).forEach(n=>{for(let s=vu(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var zH=q({"src/lib/utils/task-parser.ts"(){"use strict";zd()}}),vC={};xt(vC,{ExitCodes:()=>_v,GitOutputStreams:()=>Hd,LineParser:()=>ve,NOOP:()=>Ta,NULL:()=>bl,RemoteLineParser:()=>Ns,append:()=>Si,appendTaskOptions:()=>Dv,asArray:()=>xn,asCamelCase:()=>uC,asFunction:()=>nC,asNumber:()=>Xe,asStringArray:()=>El,bufferToString:()=>mu,callTaskParser:()=>bv,createInstanceConfig:()=>mC,delay:()=>gv,filterArray:()=>_u,filterFunction:()=>dC,filterHasLength:()=>qd,filterNumber:()=>hC,filterPlainObject:()=>Wd,filterPrimitives:()=>wv,filterString:()=>pt,filterStringOrStringArray:()=>Bd,filterType:()=>ar,first:()=>oC,folderExists:()=>Iv,forEachLineWithContent:()=>Fv,getTrailingOptions:()=>Er,including:()=>cC,isUserFunction:()=>sC,last:()=>Ca,objectToString:()=>wu,orVoid:()=>vv,parseStringResponse:()=>Br,pick:()=>fC,prefixedArray:()=>pu,remove:()=>Vd,splitOn:()=>aC,toLinesWithContent:()=>vu,trailingFunctionArgument:()=>it,trailingOptionsArg Line truncated
`)){let l=aC(a,`
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var MC,s3=q({"src/lib/responses/ConfigList.ts"(){"use strict";fe(),MC=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ca(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function uv(t,e){return typeof t=="string"&&Object.hasOwn(Ev,t)?t:e}function a3(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function o3(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return i3(i,t)}}}function l3(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return r3(r)}}}function c3(){return{addConfig(t,e,...r){return this._runTask(a3(t,e,r[0]===!0,uv(r[1],"local")),it(arguments))},getConfig(t,e){return this._runTask(o3(t,uv(e,void 0)),it(arguments))},listConfig(...t){return this._runTask(l3(uv(t[0],void 0)),it(arguments))}}}var Ev,DC=q({"src/lib/tasks/config.ts"(){"use strict";s3(),fe(),Ev=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Ev||{})}});function u3(t){return OC.has(t)}var fv,OC,LC=q({"src/lib/tasks/diff-name-status.ts"(){"use strict";fv=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(fv||{}),OC=new Set(Object.values(fv))}});function f3(...t){return new BC().param(...t)}function d3(t){let e=new Set,r={};return Fv(t,i=>{let[n,s,a]=i.split(bl);e.add(n),(r[n]=r[n]||[]).push({line:Xe(s),path:n,preview:a})}),{paths:e,results:r}}function h3(){return{grep(t){let e=it(arguments),r=Er(arguments);for(let n of NC)if(r.includes(n))return this._runTask(Lr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=f3().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return d3(n)}},e)}}}var NC,hu,kA,BC,HC=q({"src/lib/tasks/grep.ts"(){"use strict";fe(),_t(),NC=["-h"],hu=Symbol("grepQuery"),BC=class{constructor(){this[kA]=[]}*[(kA=hu,Symbol.iterator)](){for(let t of this[hu])yield t}and(...t){return t.length&&this[hu].push("--and","(",...pu(t,"-e"),")"),this}param(...t){return this[hu].push(...pu(t,"-e")),this}}}}),UC={};xt(UC,{ResetMode:()=>Od,getResetMode:()=>m3,resetTask:()=>p3});function p3(t,e){let r=["reset"];return GC(t)&&r.push(`--${t}`),r.push(...e),Sr(r)}function m3(t){if(GC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function GC(t){return typeof t=="string"&&jC.includes(t)}var Od,jC,VC=q({"src/lib/tasks/reset.ts"(){"use strict";fe(),_t(),Od=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Od||{}),jC=El(Object.values(Od))}});function g3(){return(0,Ud.default)("simple-git")}function AA(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function v3(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function Gv(t,e,r,i=g3()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=v3(ar(e,pt),a,i);return c(r);function l(u,f){return Si(s,Gv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&AA(a,f)||Ta,h=AA(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var zC=q({"src/lib/git-logger.ts"(){"use strict";fe(),Ud.default.formatters.L=t=>String(qd(t)?t.length:"-"),Ud.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):wu(t)}}),WC,w3=q({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Bs(),zC(),WC=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=Gv(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Nr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.lo Line truncated
`).map(h6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return d6(Dd(a[0]),Dd(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=e2(Dd(a[l]),Dd(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new KA(r,i)}}}),r2={};xt(r2,{addAnnotatedTagTask:()=>v6,addTagTask:()=>g6,tagListTask:()=>m6});function m6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return t2(r,e)}}}function g6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function v6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var w6=q({"src/lib/tasks/tag.ts"(){"use strict";p6()}}),_6=OH({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(y3(),wt(YC)),{SimpleGitApi:i}=(y8(),wt(PT)),{Scheduler:n}=(x8(),wt(RT)),{adhocExecTask:s,configurationErrorTask:a}=(_t(),wt(xv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(fe(),wt(vC)),{applyPatchTask:v}=(S8(),wt(IT)),{branchTask:_,branchLocalTask:b,deleteBranchesTask:S,deleteBranchTask:k}=(D8(),wt(HT)),{checkIgnoreTask:E}=(B8(),wt(VT)),{checkIsRepoTask:A}=(yC(),wt(wC)),{cleanWithOptionsTask:w,isCleanOptionsArray:x}=(FC(),wt(RC)),{diffSummaryTask:y}=(Xv(),wt(oT)),{fetchTask:C}=(V8(),wt(WT)),{moveTask:P}=(Y8(),wt(YT)),{pullTask:L}=(Z8(),wt(XT)),{pushTagsTask:N}=(xT(),wt(yT)),{addRemoteTask:B,getRemotesTask:ge,listRemotesTask:Le,remoteTask:ke,removeRemoteTask:ne}=(s6(),wt(KT)),{getResetMode:Ee,resetTask:_e}=(VC(),wt(UC)),{stashListTask:z}=(o6(),wt(QT)),{addSubModuleTask:X,initSubModuleTask:V,subModuleTask:Ne,updateSubModuleTask:gr}=(f6(),wt(JT)),{addAnnotatedTagTask:Nt,addTagTask:Fe,tagListTask:Pt}=(w6(),wt(r2)),{straightThroughBufferTask:Rt,straightThroughStringTask:Ye}=(_t(),wt(xv));function J(D,M){this._plugins=M,this._executor=new r(D.baseDir,new n(D.maxConcurrentProcesses),M),this._trimmed=D.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(D){return this._plugins.reconfigure("binary",D),this},J.prototype.env=function(D,M){return arguments.length===1&&typeof D=="object"?this._executor.env=D:(this._executor.env=this._executor.env||{})[D]=M,this},J.prototype.stashList=function(D){return this._runTask(z(g(arguments)||{},l(D)&&D||[]),p(arguments))},J.prototype.mv=function(D,M){return this._runTask(P(D,M),p(arguments))},J.prototype.checkoutLatestTag=function(D){var M=this;return this.pull(function(){M.tags(function(ae,Te){M.checkout(Te.latest,D)})})},J.prototype.pull=function(D,M,ae,Te){return this._runTask(L(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.fetch=function(D,M){return this._runTask(C(d(D,u),d(M,u),h(arguments)),p(arguments))},J.prototype.silent=function(D){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(D,M){return this._runTask(Pt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ye(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(D){return this._runTask(_e(Ee(D),h(arguments)),p(arguments))},J.prototype.revert=function(D){let M=p(arguments);return typeof D!="string"?this._runTask(a("Commit must be a string"),M):this._runTask(Ye(["revert",...h(arguments,0,!0),D]),M)},J.prototype.addTag=function(D){let M=typeof D=="string"?Fe(D):a("Git.addTag requires a tag name");return this._runTask(M,p(arguments))},J.prototype.addAnnotatedTag=function(D,M){return this._runTask(Nt(D,M),p(arguments))},J.prototype.deleteLocalBranch=function(D,M,ae){return this._runTask(k(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.deleteLocalBranches=function(D,M,ae){return this._runTask(S(D,typeof M=="boolean"?M:!1),p(arguments))},J.prototype.branch=function(D,M){return this._runTask(_(h(arguments)),p(arguments))},J.prototype.branchLocal=function(D){return this._runTask(b(),p(arguments))},J.prototype.raw=function(D){let M=!Array.isArray(D),ae=[].slice.call(M?arguments:D,0);for(let Bt=0;Bt<ae.length&&M;Bt++)if(!c(ae[Bt])){ae.splice(Bt,ae.length-Bt);break}ae.push(...h(arguments,0,!0));var Te=p(arguments);return ae.length?this._runTask(Ye(ae,this._trimmed),Te):this._runTask(a("Raw: must supply one or more command to execute"),Te)},J.prototype.submoduleAdd=function(D,M,ae){return this._runTask(X(D,M),p(arguments))},J.prototype.submoduleUpdate=function(D,M){return this._runTask(gr(h(arguments,!0)),p(arguments))},J.prototype.submoduleInit=function(D,M){return this._runTask(V(h(arguments,!0)),p(arguments))},J.prototype.subModule=function(D,M){return this._runTask(Ne(h(arguments)),p(arguments))},J.prototype.listRemote=function(){return this._runTask(Le(h(arguments)),p(arguments))},J.prototype.addRe Line truncated
`).some(l=>l.contains(n))||await ei.appendFile(r,n+`
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",ze.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+yu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${_d}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Os(i)}a.push("--",o);let c=await this.git.raw(a);return B6(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let i=ze.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Aa.RECURSIVE+Aa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=aw Line truncated
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Qn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(ze.dirname(r)))return;let i=await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",ze.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(ze.normalize(r)),o=ze.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Nr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await fu(r||"git",["--version"],{});if(i.error)if(Jn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${bd}) of Git for Windows.`);let n=await fu(bd,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Nr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new al(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},l2={hash:"000000",isZeroCommit:!0,summary:""};function B6(t){let r=t.replace(`\r
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}getGitDirPath(){return(0,Cn.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async updateUpstreamBranch(r){let[i,n]=Vs(r),s=await this.branchInfo();await this.wrapFS(pe.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[pe.TREE({ref:r}),pe.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return this.wrapFS(xv({...this.getRepo(),trees:r,map:async function(n,[s,a]){if(!wv(n,i))return null;if(await(s==null?void 0:s.type())==="tree"||await(a==null?void 0:a.type())==="tree")return;let o=await(s==null?void 0:s.oid()),l=await(a==null?void 0:a.oid()),c="equal";if(o!==l&&(c="M"),o===void 0&&(c="A"),l===void 0&&(c="D"),o===void 0&&l===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(a)),c!=="equal")return{path:n,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[pe.TREE({ref:"HEAD"}),pe.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new Cn.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(xv({...s,trees:[pe.WORKDIR(),pe.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await pe.isIgnored({...s,filepath:o})||!wv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await pe.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await wu({...this.getRepo(),filepath:r,oid:n}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p}),f=(await pe.readCommit({...this.getRepo(),oid:n})).commit.parent.first(),d;return f&&(d=await wu({...this.getRepo(),filepath:r,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p})),_u(s,d!=null?d:"",c!=null?c:"")}let o=(await xv({...this.getRepo(),trees:[pe.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>wu({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof pe.Errors.NotFoundError))throw f});return _u(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",_u(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await pe.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){var s,a;let i=`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`,n=this.status_mapping[i];if(n===void 0)throw new Error(`Unsupported status matrix row: ${i}`);return{index:n[0]=="?"?"U":(s=n[0])!=null?s:" ",workingDir:n[1]=="?"?"U":(a=n[1])!=null?a:" ",path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new Cn.Notice(r,i?this.noticeLength:void 0)}};async function xv(t){let e=await pe.walk(t);if(!Array.isArray(e))throw new TypeError("isomorphic-git walk returned a non-array result");return e}function S3(t){let e=[new Uint8Array(t)].values();return{next:()=>Promise.resolve(e.next()),[Symbol.asyncIterator](){return this}}}async function k3(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}async function C3(t){let e=new Uint8Array(t);if(e.length<2||e[0]!==31||e[1]!==139)return t;try{let r=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(r).arrayBuffer()}catch(r){return t}}m();var PT=mt(Qd(),1),oi=mt(require("fs/promises"),1),rs=require("obsidian"),Be=mt(require("path"),1),Mu=require("path");m();var lh=mt(Nk(),1);m();var Ev=new W Line truncated
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Yv(t,e){return Ru(t,!0).map(r=>e(r))}function Zv(t){return(0,lh.exists)(t,lh.FOLDER)}function Ai(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function RC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ch(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function An(t){return Array.isArray(t)?t:[t]}function $C(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function kl(t){return An(t).map(e=>e instanceof String?e:String(e))}function rt(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Au(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function Tu(t){return(Array.isArray(t)?k.concat(t):t).toString("utf-8")}function FC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function Fv(t=0){return new Promise(e=>setTimeout(e,t))}function Iv(t){if(t!==!1)return t}var xl,La,$u,uh=Y({"src/lib/utils/util.ts"(){"use strict";Kv(),xl="\0",La=()=>{},$u=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ur(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Mv(t,e){let r=Si(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function fh(t){return!!t&&$u(t)==="[object Object]"}function IC(t){return typeof t=="function"}var Fu,MC,wt,nh,dh,Kv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";uh(),Fu=t=>Array.isArray(t),MC=t=>typeof t=="number",wt=t=>typeof t=="string"||Si(t),nh=t=>wt(t)||Array.isArray(t)&&t.every(wt),dh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Dv,k8=Y({"src/lib/utils/exit-codes.ts"(){"use strict";Dv=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Dv||{})}}),sh,C8=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";sh=class DC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new DC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function A8(){throw new Error("LineParser:useMatches not implemented")}var be,zs,T8=Y({"src/lib/utils/line-parser.ts"(){"use strict";be=class{constructor(t,e){this.matches=[],this.useMatches=A8,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},zs=class extends be{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function OC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...LC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var LC,P8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";LC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Xv(t,e=[]){return fh(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(Si(n))r.push(n);else if(Mv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)Mv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Sr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Xv(Qv(t),i),r||i.push(...R8(t)),i}function R8(t){let e=typeof Oa(t)=="function";return kl(ur(Oa(t,e?1:0),Fu,[]))}function Qv(t){let e=IC(Oa(t));return ur(Oa(t,e?1:0),fh)}function ct(t,e=!0){let r=kC(Oa(t));return e||CC(r)?r:void 0}var $8=Y({"src/lib/utils/task-options.ts"(){"use strict";Kv(),uh()}});function Ov(t,e){return t(e.stdOut,e.stdErr)}function Vr(t,e,r,i=!0){return An(r).forEach(n=>{for(let s=Ru(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var F8=Y({"src/lib/utils/task-parser.ts"(){"use strict";uh()}}),NC={};Pt(NC,{ExitCodes:()=>Dv,GitOutputStreams:()=>sh,LineParser:()=>be,NOOP:()=>La,NULL:()=>xl,RemoteLineParser:()=>zs,append:()=>Ai,appendTaskOptions:()=>Xv,asArray:()=>An,asCamelCase:()=>$C,asFunction:()=>kC,asNumber:()=>rt,asStringArray:()=>kl,bufferToString:()=>Tu,callTaskParser:()=>Ov,createInstanceConfig:()=>OC,delay:()=>Fv,filterArray:()=>Fu,filterFunction:()=>IC,filterHasLength:()=>dh,filterNumber:()=>MC,filterPlainObject:()=>fh,filterPrimitives:()=>Mv,filterString:()=>wt,filterStringOrStringArray:()=>nh,filterType:()=>ur,first:()=>TC,folderExists:()=>Zv,forEachLineWithContent:()=>Yv,getTrailingOptions:()=>Sr,including:()=>RC,isUserFunction:()=>CC,last:()=>Oa,objectToString:()=>$u,orVoid:()=>Iv,parseStringResponse:()=>Vr,pick:()=>FC,prefixedArray:()=>Au,remove:()=>ch,splitOn:()=>AC,toLinesWithContent:()=>Ru,trailingFunctionArgument:()=>ct,trailingOptionsArgument Line truncated
`)){let l=AC(a,`
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var tA,W8=Y({"src/lib/responses/ConfigList.ts"(){"use strict";ve(),tA=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Oa(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function Cv(t,e){return typeof t=="string"&&Object.hasOwn(Bv,t)?t:e}function q8(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function Y8(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return V8(i,t)}}}function Z8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return j8(r)}}}function K8(){return{addConfig(t,e,...r){return this._runTask(q8(t,e,r[0]===!0,Cv(r[1],"local")),ct(arguments))},getConfig(t,e){return this._runTask(Y8(t,Cv(e,void 0)),ct(arguments))},listConfig(...t){return this._runTask(Z8(Cv(t[0],void 0)),ct(arguments))}}}var Bv,rA=Y({"src/lib/tasks/config.ts"(){"use strict";W8(),ve(),Bv=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Bv||{})}});function X8(t){return iA.has(t)}var Av,iA,nA=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";Av=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(Av||{}),iA=new Set(Object.values(Av))}});function Q8(...t){return new aA().param(...t)}function J8(t){let e=new Set,r={};return Yv(t,i=>{let[n,s,a]=i.split(xl);e.add(n),(r[n]=r[n]||[]).push({line:rt(s),path:n,preview:a})}),{paths:e,results:r}}function eH(){return{grep(t){let e=ct(arguments),r=Sr(arguments);for(let n of sA)if(r.includes(n))return this._runTask(Gr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=Q8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return J8(n)}},e)}}}var sA,Cu,Wk,aA,oA=Y({"src/lib/tasks/grep.ts"(){"use strict";ve(),kt(),sA=["-h"],Cu=Symbol("grepQuery"),aA=class{constructor(){this[Wk]=[]}*[(Wk=Cu,Symbol.iterator)](){for(let t of this[Cu])yield t}and(...t){return t.length&&this[Cu].push("--and","(",...Au(t,"-e"),")"),this}param(...t){return this[Cu].push(...Au(t,"-e")),this}}}}),lA={};Pt(lA,{ResetMode:()=>th,getResetMode:()=>rH,resetTask:()=>tH});function tH(t,e){let r=["reset"];return cA(t)&&r.push(`--${t}`),r.push(...e),kr(r)}function rH(t){if(cA(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function cA(t){return typeof t=="string"&&uA.includes(t)}var th,uA,fA=Y({"src/lib/tasks/reset.ts"(){"use strict";ve(),kt(),th=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(th||{}),uA=kl(Object.values(th))}});function iH(){return(0,ah.default)("simple-git")}function qk(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function nH(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function nw(t,e,r,i=iH()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=nH(ur(e,wt),a,i);return c(r);function l(u,f){return Ai(s,nw(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&qk(a,f)||La,h=qk(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var dA=Y({"src/lib/git-logger.ts"(){"use strict";ve(),ah.default.formatters.L=t=>String(dh(t)?t.length:"-"),ah.default.formatters.B=t=>k.isBuffer(t)?t.toString("utf8"):$u(t)}}),hA,sH=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Ws(),dA(),hA=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=nw(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new jr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger( Line truncated
`).map(e5).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return J6(eh(a[0]),eh(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=yT(eh(a[l]),eh(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new wC(r,i)}}}),ET={};Pt(ET,{addAnnotatedTagTask:()=>n5,addTagTask:()=>i5,tagListTask:()=>r5});function r5(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return xT(r,e)}}}function i5(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function n5(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var s5=Y({"src/lib/tasks/tag.ts"(){"use strict";t5()}}),a5=E8({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(lH(),St(mA)),{SimpleGitApi:i}=(l6(),St(KA)),{Scheduler:n}=(c6(),St(XA)),{adhocExecTask:s,configurationErrorTask:a}=(kt(),St(Nv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ve(),St(NC)),{applyPatchTask:v}=(f6(),St(eT)),{branchTask:b,branchLocalTask:_,deleteBranchesTask:C,deleteBranchTask:x}=(x6(),St(oT)),{checkIgnoreTask:E}=(C6(),St(fT)),{checkIsRepoTask:A}=(GC(),St(BC)),{cleanWithOptionsTask:w,isCleanOptionsArray:S}=(JC(),St(XC)),{diffSummaryTask:y}=(fw(),St(TA)),{fetchTask:P}=($6(),St(hT)),{moveTask:T}=(D6(),St(mT)),{pullTask:I}=(L6(),St(gT)),{pushTagsTask:M}=(jA(),St(GA)),{addRemoteTask:B,getRemotesTask:re,listRemotesTask:Ae,remoteTask:K,removeRemoteTask:Q}=(W6(),St(wT)),{getResetMode:fe,resetTask:ce}=(fA(),St(lA)),{stashListTask:z}=(Y6(),St(bT)),{addSubModuleTask:X,initSubModuleTask:j,subModuleTask:Ze,updateSubModuleTask:$r}=(Q6(),St(_T)),{addAnnotatedTagTask:cr,addTagTask:Ie,tagListTask:yt}=(s5(),St(ET)),{straightThroughBufferTask:Tt,straightThroughStringTask:Ke}=(kt(),St(Nv));function J(L,W){this._plugins=W,this._executor=new r(L.baseDir,new n(L.maxConcurrentProcesses),W),this._trimmed=L.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(L){return this._plugins.reconfigure("binary",L),this},J.prototype.env=function(L,W){return arguments.length===1&&typeof L=="object"?this._executor.env=L:(this._executor.env=this._executor.env||{})[L]=W,this},J.prototype.stashList=function(L){return this._runTask(z(g(arguments)||{},l(L)&&L||[]),p(arguments))},J.prototype.mv=function(L,W){return this._runTask(T(L,W),p(arguments))},J.prototype.checkoutLatestTag=function(L){var W=this;return this.pull(function(){W.tags(function(xe,Xe){W.checkout(Xe.latest,L)})})},J.prototype.pull=function(L,W,xe,Xe){return this._runTask(I(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.fetch=function(L,W){return this._runTask(P(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.silent=function(L){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(L,W){return this._runTask(yt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ke(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(L){return this._runTask(ce(fe(L),h(arguments)),p(arguments))},J.prototype.revert=function(L){let W=p(arguments);return typeof L!="string"?this._runTask(a("Commit must be a string"),W):this._runTask(Ke(["revert",...h(arguments,0,!0),L]),W)},J.prototype.addTag=function(L){let W=typeof L=="string"?Ie(L):a("Git.addTag requires a tag name");return this._runTask(W,p(arguments))},J.prototype.addAnnotatedTag=function(L,W){return this._runTask(cr(L,W),p(arguments))},J.prototype.deleteLocalBranch=function(L,W,xe){return this._runTask(x(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.deleteLocalBranches=function(L,W,xe){return this._runTask(C(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.branch=function(L,W){return this._runTask(b(h(arguments)),p(arguments))},J.prototype.branchLocal=function(L){return this._runTask(_(),p(arguments))},J.prototype.raw=function(L){let W=!Array.isArray(L),xe=[].slice.call(W?arguments:L,0);for(let Dt=0;Dt<xe.length&&W;Dt++)if(!c(xe[Dt])){xe.splice(Dt,xe.length-Dt);break}xe.push(...h(arguments,0,!0));var Xe=p(arguments);return xe.length?this._runTask(Ke(xe,this._trimmed),Xe):this._runTask(a("Raw: must supply one or more command to execute"),Xe)},J.prototype.submoduleAdd=function(L,W,xe){return this._runTask(X(L,W),p(arguments))},J.prototype.submoduleUpdate=function(L,W){return this._runTask($r(h(arguments,!0)),p(arguments))},J.prototype.submoduleInit=function(L,W){return this._runTask(j(h(arguments,!0)),p(arguments))},J.prototype.subModule=function(L,W){return this._runTask(Ze(h(arguments)),p(arguments))},J.prototype.listRemote=function(){return this._runTask(Ae(h(arguments)),p(arguments))},J.prototype.addRemo Line truncated
`).some(l=>l.contains(n))||await oi.appendFile(r,n+`
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path,n=await this.git.status(i!=null?["--",i]:[]),s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",Be.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.absoluteRepoPath;n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Mu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Hd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:js(i)}a.push("--",o);let c=await this.git.raw(a);return C5(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}await this.git.add("-A");let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes})}async commit({message:r,amend:i}){return this.withGitOperation(2,async()=>{let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),n})}async stage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r])}async stageAll({dir:r}){await this.git.add(r!=null?r:"-A")}async unstageAll({dir:r}){await this.git.reset(r!=null?["--",r]:[])}async unstage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r])}async discard(r){await this.isTracked(r)&&await this.git.checkout(["--progress","--",r])}async applyPatch(r){let i=Be.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path,n=[];return i!=null&&n.push("--",i),(await this.git.clean(Da.RECURSIVE+Da.DRY_RUN,n)).paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){return this.withGitOperation(1,async()=>{try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo();if(!r.current){this.plugin.displayError("No current branch found. Cannot pull.");return}let i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${TT(o)}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.git.reset([])}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${TT(o)}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}})}async push(){return this.withGitOperation(3,async()=>{try{if(this.plugin.settings.updateSubmodules){let a=await this.git.subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let i=(await this.git.status()).current;if(!i){this.plugin.displayError("No current branch found. Cannot push.");return}let n=await this.getPushTarget(i);if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No push target found. Ignoring push of main repo and updating submodules only.");return}let s=null;return n!=null&&n.e Line truncated
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Vs(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" "),n=i[0];return n===void 0?"":await this.git.raw(n,...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Be.dirname(r)))return;let i=await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(Be.normalize(r)),o=Be.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof jr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await Su(r||"git",["--version"],{});if(i.error)if(rs.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Ud}) of Git for Windows.`);let n=await Su(Ud,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof jr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new ll(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},RT={hash:"000000",isZeroCommit:!0,summary:""};function C5(t){let r=t.replace(`\r
`,`
`).split(`
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){if(s2(r[s])){let a=r[s].split(" "),o=H6(a,n,i);for(s++;s2(r[s]);s++){let l=r[s].split(" ");U6(l,i,n)}G6(i.commits.get(o)),n+=1}else if(!(r[s]===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${r[s]}`);s++}return i}function H6(t,e,r){let i=t[0];if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(t[1])),r.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return i}function U6(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=a2(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=a2(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function G6(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Jv(t.author)&&(t.author=void 0),Jv(t.committer)&&(t.committer=void 0),Jv(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Jv(t){return!t||Object.keys(t).length===0}function s2(t){return t.length>0&&t[0].trim()===t[0]}function a2(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var M2=require("@codemirror/state");m();var ew=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},es=new ew;m();var Jd=require("@codemirror/state"),c2=Ht(tw(),1);function u2(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var f2=Jd.StateEffect.define();function d2(t,e,r){return r.update({effects:f2.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Sl=Jd.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(f2))return r.value;return j6(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function eh(t){var s;let e=c2.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var xu={get:void 0,save:void 0};function h2(t,e){xu.get=t,xu.save=e}function th(t){var e,r;return(r=(e=Eu(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Eu(ht.lineAuthor.coloringMaxAge).asDays()}function j6(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let v=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,_=f===g,b=h-d;_&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}m();function p2(){kl=void 0,rw=[],rh=0,nh.clear(),sh.clear(),Al.clear()}var kl,ih=()=>kl;function m2(t,e){var n;let r=e.length;if(r<((n=kl==null?void 0:kl.length)!=null?n:0))return;kl={gutter:t,length:r,text:e};let i=jt.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&jt.plugin.localStorage.setGutterSpacingFallbackLength(r)}var rw=[],V6=15,rh=0;function g2(t){rw[rh]=t,rh=(rh+1)%V6}function v2(){return eA(rw)}var nh=new Map,sh=new Map,Al=new Set;m();var $2=require("@codemirror/state"),F2=require("@codemirror/view");m();var aw=require("@codemirror/view"),A2=Ht(tw(),1),Cl=require("obsidian");m();m();var ah={x:-10,y:-10};function w2(){ah.x===-10&&window.addEventListener("mousedown",t=>{ah.x=t.clientX,ah.y=t.clientY})}function _2(){for(let t of Al)if(z6(t,ah))return t}function z6(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var b2="data-commit";function y2(t,e,r){if(e.hasFocus())return;let i=_2();if(!i)return;let n=q6(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&W6(n,t),iw("showCommitHash",t),iw("authorDisplay",t),iw("dateTimeFormatOptions",t))}function W6(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon(" Line truncated
If turned on, do auto ${n} every ${iA(i.settings.autoSaveInterval)} after stopping file edits.
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(ht.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=ht.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(ht.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=ht.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(ht.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=ht.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading();let c=new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${ht.commitMessage}"`).onClick(()=>{f.setValue(ht.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=ht.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${Ug}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:O2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new U.Setting(r).setName("Preview commit message").addButton(f=>f.se Line truncated
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){let a=r[s];if(CT(a)){let o=a.split(" "),l=A5(o,n,i);for(s++;CT(r[s]);s++){let c=r[s].split(" ");T5(c,i,n)}P5(i.commits.get(l)),n+=1}else if(!(a===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${a}`);s++}return i}function A5(t,e,r){let i=t[0],n=t[1],s=t[2];if(i===void 0||n===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${t.join(" ")}`);if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(n)),r.finalFileLineNrPerLine.push(parseInt(s)),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return i}function T5(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r];if(s===void 0)throw Error(`No commit hash found for git-blame line ${r}`);let a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=AT(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=AT(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function P5(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);mw(t.author)&&(t.author=void 0),mw(t.committer)&&(t.committer=void 0),mw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function mw(t){return!t||Object.keys(t).length===0}function CT(t){return t===void 0?!1:t.length>0&&t[0].trim()===t[0]}function AT(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}function TT(t){return t instanceof Error?t.message:String(t)}m();var t2=require("@codemirror/state");m();var gw=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}init(){this.removeStalesSubscribersTimer===void 0&&this.startRemoveStalesSubscribersInterval()}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){this.removeStalesSubscribersTimer!==void 0&&(window.clearInterval(this.removeStalesSubscribersTimer),this.removeStalesSubscribersTimer=void 0),this.eventsPerFilepath.clear()}},Ti=new gw;m();var wh=require("@codemirror/state");m();function R5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $T={exports:{}};(function(t){(function(){var e="input is invalid type",r=typeof window=="object",i=r?window:{};i.JS_SHA256_NO_WINDOW&&(r=!1);var n=!r&&typeof self=="object";n&&(i=self);var s=!i.JS_SHA256_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",o="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],d=[];(i.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),a&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var h=function(x,E){return function(A){return new b(E,!0).update(A)[x]()}},p=function(x){var E=h("hex",x);E.create=function(){return new b(x)},E.update=function(S){return E.create().update(S)};for(var A=0;A<f.length;++A){var w=f[A];E[w]=h(w,x)}return E},g=function(x,E){return function(A,w){return new _(A,E,!0).update(w)[x]()}},v=function(x){var E=g("hex",x);E.create=function(S){return new _(S,x)},E.update=function(S,y){return E.create(S).update(y)};for(var A=0;A<f.length;++A){var w=f[A];E[w]=g Line truncated
If turned on, do auto ${n} every ${Sk(i.settings.autoSaveInterval)} after stopping file edits.
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(tt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=tt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(tt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=tt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(tt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=tt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit").setHeading(),new U.Setting(r).setName("Stage all changes when nothing is staged").setDesc("When using Commit with nothing staged, stage and commit all changes. When disabled, changes must be staged first. Commit all changes and Commit-and-sync are unaffected.").addToggle(f=>f.setValue(i.settings.autoStageOnEmptyIndex).onChange(async d=>{i.settings.autoStageOnEmptyIndex=d,await i.saveSettings()}));let c=new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${tt.commitMessage}"`).onClick(()=>{f.setValue(tt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=tt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${fv}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:i2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for mor Line truncated
`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(`
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
`))})}),i.gitManager instanceof ke&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(`
`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
`))})}),i.gitManager instanceof ke&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
Sets the relative path to the vault from which the Git binary should be executed.
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:s5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${_d} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d Line truncated
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Relative paths are resolved from the custom base path, or the vault root when no base path is configured. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:Y5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${Hd} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d Line truncated
Either your local time-zone (default),
the author's time-zone during commit creation or
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Eu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=uw(r,this.settings.lineAuthor),a=uw(r,ht.lineAuthor);n.setPlaceholder(iv(a)),n.setValue(iv(s)),n.onChange(async o=>{let l=Qk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,uw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?lh(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:O2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Eu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];ht[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function uw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Eu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var ti=require("obsidian");var fh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,ti.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,ti.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=`
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var hh=require("obsidian"),dh=class extends hh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,hh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var L2=require("obsidian"),Su=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,L2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCom Line truncated
`)}static newName(){let e=V2[j2]||1;return V2[j2]=e+1,fw+e.toString(36)}static mount(e,r,i){let n=e[dw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new hw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},z2=new Map,hw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=z2.get(i);if(s)return e[dw]=s;this.sheet=new n.CSSStyleSheet,z2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[dw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var cP=require("@codemirror/language"),a5=require("@lezer/highlight"),Et=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function $a(t,e,r,i,n,s){if(t==i)return[];let a=yw(t,e,r,i,n,s),o=xw(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new Et(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Et(e,e+f,n,n),new Et(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Et(e,e,n,n+f),new Et(r,r,n+f+l,s)]}if(l==1||c==1)return[new Et(e,r,n,s)];let u=fP(t,e,r,i,n,s);if(u){let[f,d,h]=u;return $a(t,e,f,i,n,d).concat($a(t,f+h,r,i,d+h,s))}return o5(t,e,r,i,n,s)}var Au=1e9,Cu=0,bw=!1;function o5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Au<1e9&&Math.min(a,o)>Au*16||Cu>0&&Date.now()>Cu)return Math.min(a,o)>Au*64?[new Et(e,r,n,s)]:W2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);pw.reset(l),mw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?mw:null,d=f?null:pw;for(let h=0;h<l;h++){if(h>Au||Cu>0&&!(h&63)&&Date.now()>Cu)return W2(t,e,r,i,n,s);let p=pw.advance(h,a,o,l,f,!1,c)||mw.advance(h,a,o,l,d,!0,u);if(p)return l5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Et(e,r,n,s)]}var yh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},pw=new yh,mw=new yh;function l5(t,e,r,i,n,s,a,o){let l=!1;return!Rl(t,i)&&++i==r&&(l=!0),!Rl(n,o)&&++o==a&&(l=!0),l?[new Et(e,r,s,a)]:$a(t,e,i,n,s,o).concat($a(t,i,r,n,o,a))}function uP(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function yw(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=uP(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Rl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function xw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=uP(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Rl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function gw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Rl(t,u)||u++;let f=u+a;if(Rl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=yw(t,f,r,i,n+h+d.length,s),g=xw(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function fP(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=fP(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:gw(t,e,r,i,n,s,Math.floor(a/4),-1)}function W2(t,e,r,i,n,s){bw=!0;let a=r-e,o=s-n,l;if(a<o){let d=gw(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=gw(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new Et(e,r,n,s)];let[c,u,f]=l;return $a(t,e,c,i,n,u).concat($a(t,c+f,r,i,u+f,s))}function dP(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Et(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function c5(t,e,r){for(;;){dP(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=yw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=xw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Et(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new Et(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new Et(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function u5(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=Y2(e,s.fromA,c),d=q2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,_,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(b-h,b)?(s=t[n]=new Et(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=q2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(_,_+p)&&(s=t[n]=new Et(d-a,d,s.fromB+p,s.toB+p),d=s. Line truncated
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Lu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=kw(r,this.settings.lineAuthor),a=kw(r,tt.lineAuthor);n.setPlaceholder(bv(a)),n.setValue(bv(s)),n.onChange(async o=>{let l=bk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,kw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?Ah(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:i2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Lu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];tt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function kw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Lu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var zr=require("obsidian");var Rh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}displayProgress(e){this.progress=e,this.display()}clearProgress(e=!0){this.progress=void 0,e&&this.display()}display(){this.progress?this.displayState():this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){if((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,zr.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,zr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,zr.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress");return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,zr.setIcon)(this.iconEl,"git-commit"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"commit");break;case 3:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pushing changes..."),(0,zr.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,zr.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,zr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let r=this.progress.stage?`${this.progress.stage}: `:"";if(this.progress.progress===void 0)return this.progress.stage?`${this.progress.action}: ${this.progress.stage}...`:`${this.progress.action}...`;let i=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${r}${Math.round(this.progress.progress)}%${i}`}getCompactProgressText(){return this.progress?this.progress.progress===void 0?`${this.progress.action}...`:`${this.progress.action} ${Math.round(this.progress.progress)}%`:""}getProgressIcon(){var e;switch((e=this.progress) Line truncated
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,zr.setIcon)(this.iconEl,"globe"):(0,zr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus?this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()):this.textEl.empty(),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var Fh=require("obsidian"),$h=class extends Fh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,Fh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var n2=require("obsidian"),Nu=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,n2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged?"staged":"all";return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,mode:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,mode:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLa Line truncated
`)}static newName(){let e=f2[u2]||1;return f2[u2]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[Cw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Aw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},d2=new Map,Aw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=d2.get(i);if(s)return e[Cw]=s;this.sheet=new n.CSSStyleSheet,d2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[Cw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var R2=require("@codemirror/language"),Z5=require("@lezer/highlight"),Rt=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function Ha(t,e,r,i,n,s){if(t==i)return[];let a=Dw(t,e,r,i,n,s),o=Ow(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new Rt(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Rt(e,e+f,n,n),new Rt(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Rt(e,e,n,n+f),new Rt(r,r,n+f+l,s)]}if(l==1||c==1)return[new Rt(e,r,n,s)];let u=F2(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ha(t,e,f,i,n,d).concat(Ha(t,f+h,r,i,d+h,s))}return K5(t,e,r,i,n,s)}var Hu=1e9,Uu=0,Mw=!1;function K5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Hu<1e9&&Math.min(a,o)>Hu*16||Uu>0&&Date.now()>Uu)return Math.min(a,o)>Hu*64?[new Rt(e,r,n,s)]:h2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);Tw.reset(l),Pw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?Pw:null,d=f?null:Tw;for(let h=0;h<l;h++){if(h>Hu||Uu>0&&!(h&63)&&Date.now()>Uu)return h2(t,e,r,i,n,s);let p=Tw.advance(h,a,o,l,f,!1,c)||Pw.advance(h,a,o,l,d,!0,u);if(p)return X5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Rt(e,r,n,s)]}var Hh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},Tw=new Hh,Pw=new Hh;function X5(t,e,r,i,n,s,a,o){let l=!1;return!Fl(t,i)&&++i==r&&(l=!0),!Fl(n,o)&&++o==a&&(l=!0),l?[new Rt(e,r,s,a)]:Ha(t,e,i,n,s,o).concat(Ha(t,i,r,n,o,a))}function $2(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function Dw(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=$2(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Fl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function Ow(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=$2(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Fl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function Rw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Fl(t,u)||u++;let f=u+a;if(Fl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Dw(t,f,r,i,n+h+d.length,s),g=Ow(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function F2(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=F2(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:Rw(t,e,r,i,n,s,Math.floor(a/4),-1)}function h2(t,e,r,i,n,s){Mw=!0;let a=r-e,o=s-n,l;if(a<o){let d=Rw(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=Rw(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new Rt(e,r,n,s)];let[c,u,f]=l;return Ha(t,e,c,i,n,u).concat(Ha(t,c+f,r,i,u+f,s))}function I2(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Rt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function Q5(t,e,r){for(;;){I2(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=Dw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Rt(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=Ow(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new Rt(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new Rt(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new Rt(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function J5(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=m2(e,s.fromA,c),d=p2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,b,_]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(_-h,_)?(s=t[n]=new Rt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=p2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(b,b+p)&&(s=t[n]=new Rt(d-a,d,s.fromB+p,s.toB+p),d=s. Line truncated
`),s=e.split(`
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Vt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Aw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:Sh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:Sh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var EP={scanLimit:1e3,timeout:200};function A5(t,e,r,i){let n=Sw.Text.of(t.split(`
`)),s=Sw.Text.of(e.split(`
`)),a=r&&i?ts.updateB(r,n,s,i,EP):ts.build(n,s,EP),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Aw(c,n,s);o.push(u)}return{hunks:kw(t,e,o),chunks:a}}function SP(t,e,r,i){return A5(t,e,r,i)}var Fl=require("obsidian");function Sh(t,e){let r=t.lineAt(e);return!(r.text.length==0&&r.number==t.lines)?r.number:r.number-1}var Wi=class{static hasHunksData(e){let r=e.field(Hr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Hr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Hr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return Vt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Hr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=Sh(e.doc,s),l=this.getHunks(e,r),c=Vt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Hr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=qt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Hw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:jh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:jh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var V2={scanLimit:1e3,timeout:200};function m4(t,e,r,i){let n=Nw.Text.of(t.split(`
`)),s=Nw.Text.of(e.split(`
`)),a=r&&i?is.updateB(r,n,s,i,V2):is.build(n,s,V2),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Hw(c,n,s);o.push(u)}return{hunks:Bw(t,e,o),chunks:a}}function z2(t,e,r,i){return m4(t,e,r,i)}var ns=require("obsidian"),Ki=class{static hasHunksData(e){let r=e.field(Wr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Wr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Wr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return qt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Wr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=jh(e.doc,s),l=this.getHunks(e,r),c=qt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Wr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(`
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(`
`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(`
`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(`
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(`
`).length&&!u.compareText.endsWith(`
`)&&(c.removed.no_nl_at_eof=!0);return c}},Hr=$l.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is(Il)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Pu)&&kP(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=C5(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&kP(r,n,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function kP(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(Fl.editorInfoField).file;(s=(n=jt.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Cw=$l.StateField.define({create:()=>({debouncer:(0,Fl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=AP(e,r,i,n);e.field(Fl.editorEditorField).dispatch({effects:Pu.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Pu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function AP(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=SP(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function C5(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(Cw);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,AP(n,e,r,t.changes)}var Il=$l.StateEffect.define(),Pu=$l.StateEffect.define();function CP(t,e){return e.update({effects:Il.of(t)})}m();m();m();var nt;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(nt||(nt={}));var TP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},PP={LINES:"lines",WORDS:"words",NONE:"none"},RP={WORD:"word",CHAR:"char"},Ia;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ia||(Ia={}));m();var T5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],P5=RegExp("["+T5.join("\\")+"]","g");function $P(t){return t.replace(P5,"\\$&")}function Tw(t){return t&&t.replace(/\\/g,"/")}function FP(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function kh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function IP(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function MP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var DP=["a/","b/","i/","w/","c/","o/"];function Hs(t,e,r){let i=r!==void 0?[...DP,r]:DP,n=e?new RegExp(`^${$P(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function R5(t,e){return Hs(t,"---",e)}function $5(t,e){return Hs(t,"+++",e)}function OP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,_=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,k=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,L=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`)&&(c.removed.no_nl_at_eof=!0);return c}},Wr=Il.StateField.define({create:t=>{},update:(t,e)=>{var n,s,a;let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let o of e.effects)if(o.is(Ml)&&(r.compareText=o.value.compareText,r.compareTextHead=o.value.compareTextHead,i=(t==null?void 0:t.compareText)!==o.value.compareText,i&&(r.chunks=void 0,r.changeDesc=void 0)),o.is(Vh)){let l=(n=e.startState.field(ju,!1))==null?void 0:n.revision;if(o.value.revision!==l)continue;W2(r,o.value.result,e.state),r.changeDesc=void 0}if(e.docChanged){let o=!r.changeDesc||r.changeDesc.newLength===e.changes.length;console.assert(o,"Git: Hunk changes belong to different document histories."),o||(r.chunks=void 0),r.changeDesc=g4(r.changeDesc,e.changes)}if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let o=v4(e,r.compareText,r.chunks,r.changeDesc,r.maxDiffTimeMs);o&&(W2(r,o,e.state),r.changeDesc=void 0)}}else{r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;let o=e.state.field(ns.editorInfoField).file;(a=(s=Et.plugin)==null?void 0:s.editorIntegration.signsFeature.changeStatusBar)==null||a.display(r.hunks,o)}return r}});function W2(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(ns.editorInfoField).file;(s=(n=Et.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var ju=Il.StateField.define({create:t=>{var e,r;return{debouncer:(0,ns.debounce)(i=>{let{state:n,compareText:s,previousChunks:a,changeDesc:o,revision:l}=i,c=n.field(ns.editorEditorField,!1);if(!c)return;let u=c.state.field(ju,!1);if((u==null?void 0:u.revision)!==l)return;let f=q2(n,s,a,o);c.dispatch({effects:Vh.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(r=(e=t.field(ns.editorInfoField,!1))==null?void 0:e.file)==null?void 0:r.path}},update:(t,e)=>{var i,n;let r=(n=(i=e.state.field(ns.editorInfoField,!1))==null?void 0:i.file)==null?void 0:n.path;return e.docChanged||r!==t.filePath?{...t,revision:{},filePath:r}:t}});function g4(t,e){return!t||t.newLength!==e.length?e:t.composeDesc(e)}function q2(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=z2(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function v4(t,e,r,i,n){let s=t.state,a=Math.abs(t.changes.length-t.changes.newLength),o=s.field(ju);if(a>1e3||n>16){o.debouncer({state:s,compareText:e,previousChunks:r,changeDesc:i,revision:o.revision});return}else return q2(s,e,r,i)}var Ml=Il.StateEffect.define(),Vh=Il.StateEffect.define();function Y2(t,e){return e.update({effects:Ml.of(t)})}m();m();m();var ut;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(ut||(ut={}));var Z2={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},K2={LINES:"lines",WORDS:"words",NONE:"none"},X2={WORD:"word",CHAR:"char"},Ua;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ua||(Ua={}));m();var w4=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],b4=RegExp("["+w4.join("\\")+"]","g");function Q2(t){return t.replace(b4,"\\$&")}function Uw(t){return t&&t.replace(/\\/g,"/")}function J2(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function zh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function eP(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function tP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var rP=["a/","b/","i/","w/","c/","o/"];function qs(t,e,r){let i=r!==void 0?[...rP,r]:rP,n=e?new RegExp(`^${Q2(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function _4(t,e){return qs(t,"---",e)}function y4(t,e){return qs(t,"+++",e)}function iP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,_=/^copy to "?(.+)"?/,C=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,M=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`).split(`
`);function ge(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Le(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function ke(){ge(),Le(),i={blocks:[],deletedLines:0,addedLines:0}}function ne(z){ge();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function Ee(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},V=i.isCombined?["+ "," +","++"]:["+"],Ne=i.isCombined?["- "," -","--"]:["-"];MP(z,V)?(i.addedLines++,X.type=nt.INSERT,X.oldNumber=void 0,X.newNumber=o++):MP(z,Ne)?(i.deletedLines++,X.type=nt.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=nt.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function _e(z,X){let V=X;for(;V<B.length-3;){if(z.startsWith("diff"))return!1;if(B[V].startsWith(u)&&B[V+1].startsWith(f)&&B[V+2].startsWith(d))return!0;V++}return!1}return B.forEach((z,X)=>{if(!z||z.startsWith("*"))return;let V,Ne=B[X-1],gr=B[X+1],Nt=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(ke(),(V=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(ke(),(V=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Hs(V[1],void 0,e.dstPrefix),c=Hs(V[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&gr.startsWith(f)&&Nt.startsWith(d))&&ke(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let Pt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";ne(Pt);return}if(z.startsWith(u)&&gr.startsWith(f)||z.startsWith(f)&&Ne.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(V=R5(z,e.srcPrefix))){i.oldName=V,i.language=IP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(V=$5(z,e.dstPrefix))){i.newName=V,i.language=IP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){ne(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){Ee(z);return}let Fe=!_e(z,X);if(i===null)throw new Error("Where is my file !!!");(V=h.exec(z))?i.oldMode=V[1]:(V=p.exec(z))?i.newMode=V[1]:(V=g.exec(z))?(i.deletedFileMode=V[1],i.isDeleted=!0):(V=v.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=_.exec(z))?(Fe&&(i.oldName=V[1]),i.isCopy=!0):(V=b.exec(z))?(Fe&&(i.newName=V[1]),i.isCopy=!0):(V=S.exec(z))?(Fe&&(i.oldName=V[1]),i.isRename=!0):(V=k.exec(z))?(Fe&&(i.newName=V[1]),i.isRename=!0):(V=x.exec(z))?(i.isBinary=!0,i.oldName=Hs(V[1],void 0,e.srcPrefix),i.newName=Hs(V[2],void 0,e.dstPrefix),ne("Binary file")):y.test(z)?(i.isBinary=!0,ne(z)):(V=E.exec(z))?i.unchangedPercentage=parseInt(V[1],10):(V=A.exec(z))?i.changedPercentage=parseInt(V[1],10):(V=w.exec(z))?(i.checksumBefore=V[1],i.checksumAfter=V[2],V[3]&&(i.mode=V[3])):(V=C.exec(z))?(i.checksumBefore=[V[2],V[3]],i.checksumAfter=V[1]):(V=P.exec(z))?(i.oldMode=[V[2],V[3]],i.newMode=V[1]):(V=L.exec(z))?(i.newFileMode=V[1],i.isNew=!0):(V=N.exec(z))&&(i.deletedFileMode=V[1],i.isDeleted=!0)}),ge(),Le(),r}m();m();m();function I5(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return I5(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l<i.length;++l)for(let c=0;c<n.length;++c){let u=JSON.stringify([i[l],n[c]]),f;s.has(u)&&(f=s.get(u))||(f=t(i[l],n[c]),s.set(u,f)),f<a&&(a=f,o={indexA:l,indexB:c,score:a})}return o}function r(i,n,s=0,a=new Map){let o=e(i,n,a);if(!o||i.length+n.length<3)return[[i,n]];let l=i.slice(0,o.indexA),c=n.slice(0,o.indexB),u=[i[o.indexA]],f=[n[o.indexB]],d=o.indexA+1,h=o.indexB+1,p=i.slice(d),g=n.slice(h),v=r(l,c,s+1,a),_=r(u,f,s+1,a),b=r(p,g,s+1,a),S=_;return(o.indexA>0||o.indexB>0)&&(S=v.concat(S)),(i.length>d||n.length>h)&&(S=S.concat(b)),S}return r}var Qt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO: Line truncated
`);return this.hoganUtils.render(NP,"wrapper",{colorScheme:Ll(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Fw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ru="generic",BP="line-by-line",H5="icon",U5="tag",$u=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Fw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(Ru,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(BP,"file-diff"),n=this.hoganUtils.template(Ru,"file-path"),s=this.hoganUtils.template(H5,"file"),a=this.hoganUtils.template(U5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Ru,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Qt})}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Ru,"block-header",{CSSLineClass:Qt,blockHeader:e.isTooBig?i.header:Us(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Qt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Ah(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(l.content,r)),{type:Ol(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(c.content,r)),{type:Ol(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(BP,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(Ru,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?"&nbsp;":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var Iw=Object.assign(Object.assign({},Ma),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Fu="generic",G5="side-by-side",j5="icon",V5="tag",Iu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Iw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(Fu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(G5,"file-diff"),n=this.hoganUtils.template(Fu,"file-path"),s=this.hoganUtils.template(j5,"file"),a=this.hoganUtils.template(V5,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Da(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Fu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Qt})}}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Qt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Qt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==nt.INSERT&&n.length||a.type===nt.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===nt.CONTEXT?r.push([[a],[],[]]):a.type===nt.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===nt.INSERT&&i.length>0?n.push(a):a.type===nt.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=kh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(Fu,"block-header",{CSSLineClass:Qt,blockHeader:r!=null&&r.isTooBig?e:Us(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Ah(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},ki(o.content,e)),{type:Ol(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},ki(l.content,e)),{type:Ol(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(Fu,"line",{type:(e==null?void 0:e.type)||`${Qt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?"&nbsp;":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var Lw=Ht(Ow());m();var St=Ht(Ow()),bt={};bt["file-summary-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
`);function re(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Ae(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function K(){re(),Ae(),i={blocks:[],deletedLines:0,addedLines:0}}function Q(z){re();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function fe(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},j=i.isCombined?["+ "," +","++"]:["+"],Ze=i.isCombined?["- "," -","--"]:["-"];tP(z,j)?(i.addedLines++,X.type=ut.INSERT,X.oldNumber=void 0,X.newNumber=o++):tP(z,Ze)?(i.deletedLines++,X.type=ut.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=ut.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function ce(z,X){let j=X;for(;j<B.length-3;){if(z.startsWith("diff"))return!1;if(B[j].startsWith(u)&&B[j+1].startsWith(f)&&B[j+2].startsWith(d))return!0;j++}return!1}return B.forEach((z,X)=>{if(!z||z.startsWith("*"))return;let j,Ze=B[X-1],$r=B[X+1],cr=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(K(),(j=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(K(),(j=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&$r.startsWith(f)&&cr.startsWith(d))&&K(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let yt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";Q(yt);return}if(z.startsWith(u)&&$r.startsWith(f)||z.startsWith(f)&&Ze.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(j=_4(z,e.srcPrefix))){i.oldName=j,i.language=eP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(j=y4(z,e.dstPrefix))){i.newName=j,i.language=eP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){Q(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){fe(z);return}let Ie=!ce(z,X);if(i===null)throw new Error("Where is my file !!!");(j=h.exec(z))?i.oldMode=j[1]:(j=p.exec(z))?i.newMode=j[1]:(j=g.exec(z))?(i.deletedFileMode=j[1],i.isDeleted=!0):(j=v.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=b.exec(z))?(Ie&&(i.oldName=j[1]),i.isCopy=!0):(j=_.exec(z))?(Ie&&(i.newName=j[1]),i.isCopy=!0):(j=C.exec(z))?(Ie&&(i.oldName=j[1]),i.isRename=!0):(j=x.exec(z))?(Ie&&(i.newName=j[1]),i.isRename=!0):(j=S.exec(z))?(i.isBinary=!0,i.oldName=qs(j[1],void 0,e.srcPrefix),i.newName=qs(j[2],void 0,e.dstPrefix),Q("Binary file")):y.test(z)?(i.isBinary=!0,Q(z)):(j=E.exec(z))?i.unchangedPercentage=parseInt(j[1],10):(j=A.exec(z))?i.changedPercentage=parseInt(j[1],10):(j=w.exec(z))?(i.checksumBefore=j[1],i.checksumAfter=j[2],j[3]&&(i.mode=j[3])):(j=P.exec(z))?(i.checksumBefore=[j[2],j[3]],i.checksumAfter=j[1]):(j=T.exec(z))?(i.oldMode=[j[2],j[3]],i.newMode=j[1]):(j=I.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=M.exec(z))&&(i.deletedFileMode=j[1],i.isDeleted=!0)}),re(),Ae(),r}m();m();m();m();var Ys=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<E.oldPos?C=this.addToPath(E,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+ Line truncated
`);return this.hoganUtils.render(lP,"wrapper",{colorScheme:Hl(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var e0=Object.assign(Object.assign({},ja),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),zu="generic",cP="line-by-line",M4="icon",D4="tag",Wu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},e0),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(zu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(cP,"file-diff"),n=this.hoganUtils.template(zu,"file-path"),s=this.hoganUtils.template(M4,"file"),a=this.hoganUtils.template(D4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(zu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:tr})}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(zu,"block-header",{CSSLineClass:tr,blockHeader:e.isTooBig?i.header:Zs(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:tr.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==ut.INSERT&&n.length||a.type===ut.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Kh(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:tr.DELETE_CHANGES}:Object.assign(Object.assign({},Ri(l.content,r)),{type:Bl(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:tr.INSERT_CHANGES}:Object.assign(Object.assign({},Ri(c.content,r)),{type:Bl(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(cP,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(zu,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?"&nbsp;":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var t0=Object.assign(Object.assign({},ja),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),qu="generic",O4="side-by-side",L4="icon",N4="tag",Yu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},t0),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
`);return this.hoganUtils.render(qu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(O4,"file-diff"),n=this.hoganUtils.template(qu,"file-path"),s=this.hoganUtils.template(L4,"file"),a=this.hoganUtils.template(N4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(qu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:tr})}}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:tr.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:tr.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==ut.INSERT&&n.length||a.type===ut.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(qu,"block-header",{CSSLineClass:tr,blockHeader:r!=null&&r.isTooBig?e:Zs(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Kh(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:tr.DELETE_CHANGES}:Object.assign(Object.assign({},Ri(o.content,e)),{type:Bl(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:tr.INSERT_CHANGES}:Object.assign(Object.assign({},Ri(l.content,e)),{type:Bl(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(qu,"line",{type:(e==null?void 0:e.type)||`${tr.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?"&nbsp;":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var s0=mt(n0());m();var $t=mt(n0()),Ct={};Ct["file-summary-line"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
`+r),i.b(' <span class="d2h-file-name-wrapper">'),i.b(`
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <a href="#'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-name">'),i.b(i.v(i.f("fileName",t,e,0))),i.b("</a>"),i.b(`
`+r),i.b(' <span class="d2h-file-stats">'),i.b(`
@@ -198,7 +198,7 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
`+r),i.b(' <span class="d2h-lines-deleted">'),i.b(i.v(i.f("deletedLines",t,e,0))),i.b("</span>"),i.b(`
`+r),i.b(" </span>"),i.b(`
`+r),i.b(" </span>"),i.b(`
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});bt["file-summary-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});Ct["file-summary-wrapper"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-list-header">'),i.b(`
`+r),i.b(' <span class="d2h-file-list-title">Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")</span>"),i.b(`
`+r),i.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),i.b(`
@@ -207,24 +207,24 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
`+r),i.b(' <ol class="d2h-file-list">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(`
`+r),i.b(" </ol>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["generic-block-header"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["generic-block-header"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('"></td>'),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b("&nbsp;"),i.b("</div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-empty-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-empty-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" File without changes"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-file-path"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-file-path"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <span class="d2h-file-name">'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b("</span>"),i.b(`
`+r),i.b(i.rp("<fileTag1",t,e," ")),i.b("</span>"),i.b(`
`+r),i.b('<label class="d2h-file-collapse">'),i.b(`
`+r),i.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),i.b(`
`+r),i.b(" Viewed"),i.b(`
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});bt["generic-line"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});Ct["generic-line"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(`
`+r),i.b(" </td>"),i.b(`
@@ -236,23 +236,23 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-ctn"><br></span>'),i.b(`
`+r)),i.b(" </div>"),i.b(`
`+r),i.b(" </td>"),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});bt["generic-wrapper"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});Ct["generic-wrapper"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["icon-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["icon-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
`+r),i.b(' width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
`+r),i.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["icon-file"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["icon-file"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
`+r),i.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});bt["line-by-line-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});Ct["line-by-line-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
`+r),i.b(" </div>"),i.b(`
@@ -265,8 +265,8 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
`+r),i.b(" </table>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["line-by-line-numbers"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["side-by-side-file-diff"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["line-by-line-numbers"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["side-by-side-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
`+r),i.b(" </div>"),i.b(`
@@ -290,80 +290,80 @@ Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsPrope
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b(" </div>"),i.b(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});bt["tag-file-added"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-changed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-deleted"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});bt["tag-file-renamed"]=new St.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var Mu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=Lw.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},bt),e),i)}static compile(e){return Lw.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var W5=Object.assign(Object.assign(Object.assign({},Fw),Iw),{outputFormat:TP.LINE_BY_LINE,drawFileList:!0});function Ph(t,e={}){let r=Object.assign(Object.assign({},W5),e),i=typeof t=="string"?OP(t,r):t,n=new Mu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Ch(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Iu(n,r).render(i):new $u(n,r).render(i);return o+l}var qP=Ht(zP(),1);var Oa=require("obsidian"),Nw=Du.StateEffect.define();function Gs(t,e){let r=t.state,i=r.field($h),n=r.field(Hr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Vt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(Oa.editorEditorField).dispatch({effects:Nw.of({pos:o,add:!l})})}var $h=Du.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(Nw)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),YP=Du.StateField.define({create:t=>WP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Il)||r.is(Nw))?WP(e.state):t},provide:t=>Rh.showTooltip.computeN([t],e=>e.field(t))}),XP=Rh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function WP(t){let e=t.field(Hr);return e?[...t.field($h)].map(i=>{let n=t.doc.lineAt(i),s=Vt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>q5(s,t,i)}}).filter(i=>i!==void 0):[]}function q5(t,e,r){var g,v;let i=Vt.createPatch("file",[t],"10064",!1).join(`
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});Ct["tag-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});Ct["tag-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var Zu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=s0.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Ct),e),i)}static compile(e){return s0.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var H4=Object.assign(Object.assign(Object.assign({},e0),t0),{outputFormat:Z2.LINE_BY_LINE,drawFileList:!0});function Jh(t,e={}){let r=Object.assign(Object.assign({},H4),e),i=typeof t=="string"?iP(t,r):t,n=new Zu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Xh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Yu(n,r).render(i):new Wu(n,r).render(i);return o+l}var vP=mt(mP(),1);var za=require("obsidian"),a0=Ku.StateEffect.define();function Ks(t,e){let r=t.state,i=r.field(tp),n=r.field(Wr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=qt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(za.editorEditorField).dispatch({effects:a0.of({pos:o,add:!l})})}var tp=Ku.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(a0)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),wP=Ku.StateField.define({create:t=>gP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Ml)||r.is(a0))?gP(e.state):t},provide:t=>ep.showTooltip.computeN([t],e=>e.field(t))}),bP=ep.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function gP(t){let e=t.field(Wr);return e?[...t.field(tp)].map(i=>{let n=t.doc.lineAt(i),s=qt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>U4(s,t,i)}}).filter(i=>i!==void 0):[]}function U4(t,e,r){var g,v;let i=qt.createPatch("file",[t],"10064",!1).join(`
`)+`
`,n=Ph(i,{colorScheme:qP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=activeDocument.createDiv(),o=activeDocument.createDiv();o.addClass("tooltip-toolbar");let l=(_,b)=>{let S=activeDocument.createDiv();return(0,Oa.setIcon)(S,_),S.setAttr("aria-label",b),S.addClass("clickable-icon"),S},c=l("x","Close hunk"),u=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(c),o.appendChild(u),o.appendChild(f),a.appendChild(o),a.appendChild(s),a.addClass("git-diff-tooltip","git-diff");let d=e.field(Oa.editorEditorField);c.onclick=()=>{Gs(d,r)},u.onclick=()=>{let _=jt.plugin;_&&(_.promiseQueue.addTask(()=>_.hunkActions.stageHunk(r)),Gs(d,r))},f.onclick=()=>{let _=jt.plugin;_&&(_.hunkActions.resetHunk(r),Gs(d,r))};let h=(v=(g=jt.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Oa.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(_,b)=>{Gs(d,r)});return{dom:a,destroy:()=>{p&&(h==null||h.unregister(p))},update:_=>{r=_.changes.mapPos(r)}}}function ZP(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Kt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Kt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(bi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:bi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return N2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return B2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof qi.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),qi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.pr Line truncated
`,n=Jh(i,{colorScheme:vP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(b,_)=>{let C=createDiv();return(0,za.setIcon)(C,b),C.setAttr("aria-label",_),C.addClass("clickable-icon"),C},l=o("x","Close hunk"),c=o("plus","Stage hunk"),u=o("undo","Reset hunk");a.appendChild(l),a.appendChild(c),a.appendChild(u);let f=createDiv();f.appendChild(a),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(za.editorEditorField);l.onclick=()=>{Ks(d,r)},c.onclick=()=>{let b=Et.plugin;b&&(b.promiseQueue.addTask(()=>b.hunkActions.stageHunk(r)),Ks(d,r))},u.onclick=()=>{let b=Et.plugin;b&&(b.hunkActions.resetHunk(r),Ks(d,r))};let h=(v=(g=Et.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(za.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(b,_)=>{Ks(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:b=>{r=b.changes.mapPos(r)}}}function _P(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new Mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(er.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:er.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Ei.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Ei.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);return t.tools.openDiff({aFile:n,aRef:""}),!0}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return s2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return a2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.addFileToGitignore(i.path,i instanceof Xi.TFolder).catch(n=>t.displayError(n)),!0)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,mode:"all"}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),t.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),Xi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged"}))}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCom Line truncated
- ${s.map(o=>o.vaultPath).join(`
- `)}
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Hl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=ji(this.plugin.app,s))==null||l.setViewState({type:Ms.type,active:!0,state:o}):a=="git_unified"&&((c=ji(this.plugin.app,s))==null||c.setViewState({type:Ds.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Se))return;let i=await new et(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Hl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Ih=require("obsidian");var La=class extends Ih.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ds.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ds.name}getIcon(){return Ds.icon}async setState(r,i){this.state=r,Ih.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Se&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(ol,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&ol.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(ol,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;jl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=Yi(this.plugin.app,s))==null||l.setViewState({type:Hs.type,active:!0,state:o}):a=="git_unified"&&((c=Yi(this.plugin.app,s))==null||c.setViewState({type:Us.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof ke))return;let i=await new at(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new jl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var ip=require("obsidian");var Wa=class extends ip.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Us.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Us.name}getIcon(){return Us.icon}async setState(r,i){this.state=r,ip.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof ke&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null
+++ ${this.state.bFile}
@@ -0,0 +1,${s.split(`
`).length} @@`.split(`
`),...s.split(`
`).map(o=>`+${o}`)].join(`
`)}}if(i){let s=this.parser.parseFromString(Ph(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var rs=require("obsidian");var Gl=require("@codemirror/commands");var Mh=require("@codemirror/search"),Ul=require("@codemirror/state"),Ci=require("@codemirror/view");var Na=class extends rs.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,rs.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ms.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ms.name}getIcon(){return Ms.icon}async setState(r,i){this.state=r,rs.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Nr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Ul.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(){let r=activeDocument.createDiv(),i=r.createDiv();if(i.addClass("clickable-icon"),i.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,rs.setIcon)(i,this.state.bRef==null?"plus":"minus"),i.onmousedown=async n=>{var h;let s=this.mergeView.b,a=this.mergeView.a,o=Ew(s.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),c=o.chunks[l],u=Aw(c,a.state.doc,s.state.doc),f=kw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[u])[0],d=Vt.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(`
`)}}if(i){let s=this.parser.parseFromString(Jh(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var ss=require("obsidian");var zl=require("@codemirror/commands");var sp=require("@codemirror/search"),Vl=require("@codemirror/state"),Qi=require("@codemirror/view");m();var np=require("obsidian"),o0=require("@codemirror/view");function G4(t){return t.selection.ranges.filter(e=>!e.empty).map(e=>t.sliceDoc(e.from,e.to)).join(t.lineBreak)}function j4(t){t.dispatch({...t.state.replaceSelection(""),userEvent:"delete.cut"})}function yP(t,e){t.dispatch({...t.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function xP(t){if(!t&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let r of e)if(r.types.includes("text/html")){let i=await(await r.getType("text/html")).text();return(0,np.htmlToMarkdown)(i)}}return navigator.clipboard.readText()}var EP=o0.EditorView.domEventHandlers({contextmenu(t,e){t.preventDefault();let r=G4(e.state),i=!e.state.readOnly&&e.state.facet(o0.EditorView.editable),n=np.Menu.forEvent(t);return n.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!i||r.length===0).onClick(async()=>{await navigator.clipboard.writeText(r),j4(e)})),n.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(r.length===0).onClick(()=>navigator.clipboard.writeText(r))),n.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!i).onClick(async()=>yP(e,await xP(!1)))),n.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!i).onClick(async()=>yP(e,await xP(!0)))),n.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),n.showAtMouseEvent(t),!0}});var SP=Qi.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),V4=10;function z4(t,e){let r=Number.isInteger(t)&&t>0?t:tt.diffTimeout;return e?r:r*V4}var qa=class extends ss.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ss.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Hs.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Hs.name}getIcon(){return Hs.icon}async setState(r,i){this.state=r,ss.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof jr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adap Line truncated
`)+`
`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let n=r.createDiv();n.addClass("clickable-icon"),n.setAttr("aria-label","Reset hunk"),(0,rs.setIcon)(n,"undo"),n.onmousedown=s=>{var f;let a=this.mergeView.a,o=this.mergeView.b,l=Ew(o.state),c=(f=r.parentElement)==null?void 0:f.indexOf(r),u=l.chunks[c];if(u){let d=u.fromA,h=u.toA,p=u.fromB,g=u.toB,v=a.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=a.state.lineBreak),o.dispatch({changes:{from:p,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},r}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Ci.lineNumbers)(),(0,Mh.highlightSelectionMatches)(),(0,Ci.drawSelection)(),Ci.keymap.of([...Gl.standardKeymap,Gl.indentWithTab]),(0,Gl.history)(),(0,Mh.search)(),Ci.EditorView.lineWrapping],c=this,u=Ci.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(_=>_.annotation(Ul.Transaction.remote))){let _=g.state.doc.toString();c.fileSaveDebouncer(_)}}})),f={doc:a,extensions:[...l,Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Se&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Eh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons():void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var U$=require("obsidian");m();m();m();var KP="5";var QP,JP,eR;typeof window!="undefined"&&((eR=(JP=(QP=window.__svelte)!=null?QP:window.__svelte={}).v)!=null?eR:JP.v=new Set).add(KP);m();m();m();var jl="[",Ba="[!",Bw="[?",Ha="]",is={};var Ze=Symbol(),Ti=Symbol("filename"),tR=Symbol("hmr"),Dh="http://www.w3.org/1999/xhtml";m();m();m();m();var Oh=!0;m();var I=!1;m();var ns=Array.isArray,rR=Array.prototype.indexOf,Yi=Array.prototype.includes,Vl=Array.from,Hw=Object.keys,or=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Uw=Object.getOwnPropertyDescriptors,Gw=Object.prototype,iR=Array.prototype,zl=Object.getPrototypeOf,jw=Object.isExtensible;function Vw(t){return typeof t=="function"}var lr=()=>{};function Lh(t){for(var e=0;e<t.length;e++)t[e]()}function Nh(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var Jt=Symbol("$state"),Lu=Symbol("legacy props"),sR=Symbol(""),Bh=Symbol("proxy path"),zw=Symbol("hmr anchor"),ri=new class extends Error{constructor(){super(...arguments);Ve(this,"name","StaleReactionError");Ve(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},nR,Ww=!!((nR=globalThis.document)!=null&&nR.contentType)&&globalThis.document.contentType.includes("xml");var Wl=3,Pi=8;m();m();function aR(t){if(I){let e=new Error(`invariant_violation
`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=i.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,ss.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=Lw(l.state),u=(d=i.parentElement)==null?void 0:d.indexOf(i),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,v=f.toB,b=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&v<=l.state.doc.length&&(b+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,v),insert:b},userEvent:"revert"})}}}return i.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},i}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let p=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(p)?o=await this.app.vault.adapter.read(p):o=""}let l=[(0,Qi.lineNumbers)(),(0,sp.highlightSelectionMatches)(),(0,Qi.drawSelection)(),Qi.keymap.of([...zl.standardKeymap,zl.indentWithTab]),(0,zl.history)(),(0,sp.search)(),Qi.EditorView.lineWrapping,EP],c=Qi.ViewPlugin.define(p=>({update:g=>{if(g.docChanged&&!g.transactions.some(v=>v.annotation(Vl.Transaction.remote))){let v=p.state.doc.toString();this.fileSaveDebouncer(v)}}})),u={doc:a,extensions:[...l,Vl.EditorState.readOnly.of(!0),SP]},f=[...l];this.bIsEditable?f.push(c):f.push(Vl.EditorState.readOnly.of(!0),SP);let d={doc:o,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof ke&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Gh({b:d,a:u,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:h?()=>this.renderButtons(s):void 0,revertControls:h?"a-to-b":void 0,diffConfig:{timeout:z4(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s}),this.refreshing=!1}}};m();var p$=require("obsidian");m();m();m();var kP,CP,AP;typeof window!="undefined"&&((AP=(CP=(kP=window.__svelte)!=null?kP:window.__svelte={}).v)!=null?AP:CP.v=new Set).add("5");m();m();m();var as={};var Qe=Symbol("uninitialized"),Fi=Symbol("filename");var ap="http://www.w3.org/1999/xhtml";m();m();m();m();var op=!0;m();var O=!1;m();var os=Array.isArray,TP=Array.prototype.indexOf,Xs=Array.prototype.includes,Wl=Array.from,l0=Object.keys,fr=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,c0=Object.getOwnPropertyDescriptors,u0=Object.prototype,PP=Array.prototype,ql=Object.getPrototypeOf,f0=Object.isExtensible;function d0(t){return typeof t=="function"}var dr=()=>{};function lp(t){for(var e=0;e<t.length;e++)t[e]()}function cp(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var rr=Symbol("$state"),Qu=Symbol("legacy props"),$P=Symbol(""),up=Symbol("proxy path"),fp=Symbol("attributes"),Ju=Symbol("class"),h0=Symbol("style"),ef=Symbol("text"),Ya=Symbol("form reset"),p0=Symbol("hmr anchor"),ls=new class extends Error{constructor(){super(...arguments);Ue(this,"name","StaleReactionError");Ue(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},RP,m0=!!((RP=globalThis.document)!=null&&RP.contentType)&&globalThis.document.contentType.includes("xml");var Yl=3,Ii=8;m();m();function FP(t){if(O){let e=new Error(`invariant_violation
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Hh(t){if(I){let e=new Error(`lifecycle_outside_component
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function dp(t){if(O){let e=new Error(`lifecycle_outside_component
\`${t}(...)\` can only be used during component initialisation
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function lR(){if(I){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function qw(){if(I){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function cR(){if(I){let t=new Error(`derived_references_self
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function MP(){if(O){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function g0(){if(O){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function DP(){if(O){let t=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function Yw(t,e,r){if(I){let i=new Error(`each_key_duplicate
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function v0(t,e,r){if(O){let i=new Error(`each_key_duplicate
${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function uR(t,e,r){if(I){let i=new Error(`each_key_volatile
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function OP(t,e,r){if(O){let i=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function fR(t){if(I){let e=new Error(`effect_in_teardown
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function LP(t){if(O){let e=new Error(`effect_in_teardown
\`${t}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function dR(){if(I){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function hR(t){if(I){let e=new Error(`effect_orphan
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function NP(){if(O){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function BP(t){if(O){let e=new Error(`effect_orphan
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function pR(){if(I){let t=new Error(`effect_update_depth_exceeded
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function HP(){if(O){let t=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function mR(){if(I){let t=new Error(`hydration_failed
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function UP(){if(O){let t=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function gR(t){if(I){let e=new Error(`props_invalid_value
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function GP(t){if(O){let e=new Error(`props_invalid_value
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function vR(t){if(I){let e=new Error(`rune_outside_svelte
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function jP(t){if(O){let e=new Error(`rune_outside_svelte
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function wR(){if(I){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function _R(){if(I){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function bR(){if(I){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function yR(){if(I){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Sn="font-weight: bold",kn="font-weight: normal";function xR(t){I?console.warn(`%c[svelte] await_reactivity_loss
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function VP(){if(O){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zP(){if(O){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function WP(){if(O){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function qP(){if(O){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Rn="font-weight: bold",$n="font-weight: normal";function YP(t){O?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,Sn,kn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ER(t,e){I?console.warn(`%c[svelte] await_waterfall
https://svelte.dev/e/await_reactivity_loss`,Rn,$n):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ZP(t,e){O?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
https://svelte.dev/e/await_waterfall`,Sn,kn):console.warn("https://svelte.dev/e/await_waterfall")}function SR(){I?console.warn(`%c[svelte] derived_inert
https://svelte.dev/e/await_waterfall`,Rn,$n):console.warn("https://svelte.dev/e/await_waterfall")}function KP(){O?console.warn(`%c[svelte] derived_inert
%cReading a derived belonging to a now-destroyed effect may result in stale values
https://svelte.dev/e/derived_inert`,Sn,kn):console.warn("https://svelte.dev/e/derived_inert")}function kR(t,e,r){I?console.warn(`%c[svelte] hydration_attribute_changed
https://svelte.dev/e/derived_inert`,Rn,$n):console.warn("https://svelte.dev/e/derived_inert")}function XP(t,e,r){O?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Sn,kn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Ua(t){I?console.warn(`%c[svelte] hydration_mismatch
https://svelte.dev/e/hydration_attribute_changed`,Rn,$n):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Za(t){O?console.warn(`%c[svelte] hydration_mismatch
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/hydration_mismatch")}function AR(){I?console.warn(`%c[svelte] lifecycle_double_unmount
https://svelte.dev/e/hydration_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/hydration_mismatch")}function QP(){O?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Sn,kn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Uh(t){I?console.warn(`%c[svelte] state_proxy_equality_mismatch
https://svelte.dev/e/lifecycle_double_unmount`,Rn,$n):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function hp(t){O?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function CR(){I?console.warn(`%c[svelte] state_proxy_unmount
https://svelte.dev/e/state_proxy_equality_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function JP(){O?console.warn(`%c[svelte] state_proxy_unmount
%cTried to unmount a state proxy, rather than a component
https://svelte.dev/e/state_proxy_unmount`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function TR(){I?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Sn,kn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function PR(t){I?console.warn(`%c[svelte] transition_slide_display
https://svelte.dev/e/state_proxy_unmount`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_unmount")}function eR(){O?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Rn,$n):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function tR(t){O?console.warn(`%c[svelte] transition_slide_display
%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\`
https://svelte.dev/e/transition_slide_display`,Sn,kn):console.warn("https://svelte.dev/e/transition_slide_display")}var ie=!1;function Ft(t){ie=t}var me;function Ue(t){if(t===null)throw Ua(),is;return me=t}function cr(){return Ue(tr(me))}function G(t){if(ie){if(tr(me)!==null)throw Ua(),is;me=t}}function Ga(t=1){if(ie){for(var e=t,r=me;e--;)r=tr(r);me=r}}function An(t=!0){for(var e=0,r=me;;){if(r.nodeType===Pi){var i=r.data;if(i===Ha){if(e===0)return r;e-=1}else(i===jl||i===Ba||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=tr(r);t&&r.remove(),r=n}}function Nu(t){if(!t||t.nodeType!==Pi)throw Ua(),is;return t.data}m();m();m();m();function Gh(t){return t===this.v}function Xw(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jh(t){return!Xw(t,this.v)}m();var kt=!1,ss=!1,Xi=!1;m();m();m();var Bu=null;function ur(t,e){return t.label=e,zh(t.v,e),t}function zh(t,e){var r;return(r=t==null?void 0:t[Bh])==null||r.call(t,e),t}m();function Ki(t){let e=new Error,r=Y5();return r.length===0?null:(r.unshift(`
`),or(e,"stack",{value:r.join(`
`)}),or(e,"name",{value:t}),e)}function Y5(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function $R(t,e){if(!I)throw new Error("invariant(...) was not guarded by if (DEV)");t||aR(e)}m();var ye=null;function as(t){ye=t}var Cn=null;function ql(t){Cn=t}var Qi=null;function Wh(t){Qi=t}function lt(t,e=!1,r){ye={p:ye,i:!1,c:null,e:null,s:t,x:null,r:Z,l:ss&&!e?{s:null,u:null,$:[]}:null},I&&(ye.function=r,Qi=r)}function ct(t){var n;var e=ye,r=e.e;if(r!==null){e.e=null;for(var i of r)Zw(i)}return t!==void 0&&(e.x=t),e.i=!0,ye=e.p,I&&(Qi=(n=ye==null?void 0:ye.function)!=null?n:null),t!=null?t:{}}function Tn(){return!ss||ye!==null&&ye.l===null}m();m();var ja=[];function FR(){var t=ja;ja=[],Lh(t)}function It(t){if(ja.length===0&&!Va){var e=ja;queueMicrotask(()=>{e===ja&&FR()})}ja.push(t)}function IR(){for(;ja.length>0;)FR()}m();var Kw=new WeakMap;function qh(t){var e=Z;if(e===null)return oe.f|=8388608,t;if(I&&t instanceof Error&&!Kw.has(t)&&Kw.set(t,X5(t,e)),!(e.f&32768)&&!(e.f&4))throw I&&!e.parent&&t instanceof Error&&MR(t),t;Ri(t,e)}function Ri(t,e){for(;e!==null;){if(e.f&128){if(!(e.f&32768))throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw I&&t instanceof Error&&MR(t),t}function X5(t,e){var a,o,l;let r=Ur(t,"message");if(!(r&&!r.configurable)){for(var i=Uu?" ":" ",n=`
https://svelte.dev/e/transition_slide_display`,Rn,$n):console.warn("https://svelte.dev/e/transition_slide_display")}var se=!1;function Lt(t){se=t}var we;function We(t){if(t===null)throw Za(),as;return we=t}function hr(){return We(nr(we))}function G(t){if(se){if(nr(we)!==null)throw Za(),as;we=t}}function Ka(t=1){if(se){for(var e=t,r=we;e--;)r=nr(r);we=r}}function Fn(t=!0){for(var e=0,r=we;;){if(r.nodeType===Ii){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=nr(r);t&&r.remove(),r=n}}function rf(t){if(!t||t.nodeType!==Ii)throw Za(),as;return t.data}m();m();m();m();function pp(t){return t===this.v}function w0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function mp(t){return!w0(t,this.v)}m();var Ft=!1,cs=!1,Ji=!1;m();m();m();var nf=null;function pr(t,e){return t.label=e,vp(t.v,e),t}function vp(t,e){var r;return(r=t==null?void 0:t[up])==null||r.call(t,e),t}m();function en(t){let e=new Error,r=q4();return r.length===0?null:(r.unshift(`
`),fr(e,"stack",{value:r.join(`
`)}),fr(e,"name",{value:t}),e)}function q4(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function iR(t,e){if(!O)throw new Error("invariant(...) was not guarded by if (DEV)");t||FP(e)}m();var Ee=null;function us(t){Ee=t}var In=null;function Xl(t){In=t}var tn=null;function wp(t){tn=t}function ht(t,e=!1,r){Ee={p:Ee,i:!1,c:null,e:null,s:t,x:null,r:ee,l:cs&&!e?{s:null,u:null,$:[]}:null},O&&(Ee.function=r,tn=r)}function pt(t){var n;var e=Ee,r=e.e;if(r!==null){e.e=null;for(var i of r)b0(i)}return t!==void 0&&(e.x=t),e.i=!0,Ee=e.p,O&&(tn=(n=Ee==null?void 0:Ee.function)!=null?n:null),t!=null?t:{}}function Mn(){return!cs||Ee!==null&&Ee.l===null}m();m();var Xa=[];function nR(){var t=Xa;Xa=[],lp(t)}function At(t){if(Xa.length===0&&!Qa){var e=Xa;queueMicrotask(()=>{e===Xa&&nR()})}Xa.push(t)}function sR(){for(;Xa.length>0;)nR()}m();var _0=new WeakMap;function bp(t){var e=ee;if(e===null)return oe.f|=8388608,t;if(O&&t instanceof Error&&!_0.has(t)&&_0.set(t,Y4(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw O&&!e.parent&&t instanceof Error&&aR(t),t;nn(t,e)}function nn(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw O&&t instanceof Error&&aR(t),t}}function Y4(t,e){var a,o,l;let r=qr(t,"message");if(!(r&&!r.configurable)){for(var i=af?" ":" ",n=`
${i}in ${((a=e.fn)==null?void 0:a.name)||"<unknown>"}`,s=e.ctx;s!==null;)n+=`
${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+`
${i}in ${(o=s.function)==null?void 0:o[Fi].split("/").pop()}`,s=s.p;return{message:t.message+`
${n}
`,stack:(l=t.stack)==null?void 0:l.split(`
`).filter(c=>!c.includes("svelte/src/internal")).join(`
`)}}}function MR(t){let e=Kw.get(t);e&&(or(t,"message",{value:e.message}),or(t,"stack",{value:e.stack}))}m();m();var Z5=-7169;function Ge(t,e){t.f=t.f&Z5|e}function Yl(t){t.f&512||t.deps===null?Ge(t,1024):Ge(t,4096)}function DR(t){if(t!==null)for(let e of t)!(e.f&2)||!(e.f&65536)||(e.f^=65536,DR(e.deps))}function Yh(t,e,r){t.f&2048?e.add(t):t.f&4096&&r.add(t),DR(t.deps),Ge(t,1024)}m();m();m();var OR=!1,Xh=!1,UZ=Symbol();function Qw(t){var e=Xh;try{return Xh=!1,[t(),Xh]}finally{Xh=e}}m();var Pn=new Set,le=null,ju=null,Ct=null,e0=null,Va=!1,Jw=!1,qa=null,Gu=null,LR=0,J5=I?new Set:null,e4=1,Zl,Kl,Ya,ls,Rn,Vu,Gr,zu,Vs,cs,$n,Ql,Jl,zs,yt,Zh,BR,Kh,t0,Qh,HR,Jh=class Jh{constructor(){pe(this,yt);Ve(this,"id",e4++);Ve(this,"current",new Map);Ve(this,"previous",new Map);pe(this,Zl,new Set);pe(this,Kl,new Set);pe(this,Ya,new Set);pe(this,ls,new Map);pe(this,Rn,new Map);pe(this,Vu,null);pe(this,Gr,[]);pe(this,zu,[]);pe(this,Vs,new Set);pe(this,cs,new Set);pe(this,$n,new Map);pe(this,Ql,new Set);Ve(this,"is_fork",!1);pe(this,Jl,!1);pe(this,zs,new Set)}skip_effect(e){R(this,$n).has(e)||R(this,$n).set(e,{d:[],m:[]}),R(this,Ql).delete(e)}unskip_effect(e,r=i=>this.schedule(i)){var i=R(this,$n).get(e);if(i){R(this,$n).delete(e);for(var n of i.d)Ge(n,2048),r(n);for(n of i.m)Ge(n,4096),r(n)}R(this,Ql).add(e)}capture(e,r,i=!1){e.v!==Ze&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[r,i]),Ct==null||Ct.set(e,r)),this.is_fork||(e.v=r)}activate(){le=this}deactivate(){le=null,Ct=null}flush(){var e=I?new Set:null;try{Jw=!0,le=this,Me(this,yt,Kh).call(this)}finally{if(LR=0,e0=null,qa=null,Gu=null,Jw=!1,le=null,Ct=null,us.clear(),I)for(let r of e)r.updated=null}}discard(){for(let e of R(this,Kl))e(this);R(this,Kl).clear(),R(this,Ya).clear(),Pn.delete(this)}register_created_effect(e){R(this,zu).push(e)}increment(e,r){var n,s;let i=(n=R(this,ls).get(r))!=null?n:0;if(R(this,ls).set(r,i+1),e){let a=(s=R(this,Rn).get(r))!=null?s:0;R(this,Rn).set(r,a+1)}}decrement(e,r,i){var s,a;let n=(s=R(this,ls).get(r))!=null?s:0;if(n===1?R(this,ls).delete(r):R(this,ls).set(r,n-1),e){let o=(a=R(this,Rn).get(r))!=null?a:0;o===1?R(this,Rn).delete(r):R(this,Rn).set(r,o-1)}R(this,Jl)||i||(we(this,Jl,!0),It(()=>{we(this,Jl,!1),this.flush()}))}transfer_effects(e,r){for(let i of e)R(this,Vs).add(i);for(let i of r)R(this,cs).add(i);e.clear(),r.clear()}oncommit(e){R(this,Zl).add(e)}ondiscard(e){R(this,Kl).add(e)}on_fork_commit(e){R(this,Ya).add(e)}run_fork_commit_callbacks(){for(let e of R(this,Ya))e(this);R(this,Ya).clear()}settled(){var e;return((e=R(this,Vu))!=null?e:we(this,Vu,Nh())).promise}static ensure(){if(le===null){let e=le=new Jh;Jw||(Pn.add(le),Va||It(()=>{le===e&&e.flush()}))}return le}apply(){if(!kt||!this.is_fork&&Pn.size===1){Ct=null;return}Ct=new Map;for(let[i,[n]]of this.current)Ct.set(i,n);for(let i of Pn)if(!(i===this||i.is_fork)){var e=!1,r=!1;if(i.id<this.id)for(let[n,[,s]]of i.current)s||(e||(e=this.current.has(n)),r||(r=!this.current.has(n)));if(e&&r)R(this,zs).add(i);else for(let[n,s]of i.previous)Ct.has(n)||Ct.set(n,s)}}schedule(e){var n;if(e0=e,(n=e.b)!=null&&n.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var r=e;r.parent!==null;){r=r.parent;var i=r.f;if(qa!==null&&r===Z&&(kt||(oe===null||!(oe.f&2))&&!OR))return;if(i&96){if(!(i&1024))return;r.f^=1024}}R(this,Gr).push(r)}};Zl=new WeakMap,Kl=new WeakMap,Ya=new WeakMap,ls=new WeakMap,Rn=new WeakMap,Vu=new WeakMap,Gr=new WeakMap,zu=new WeakMap,Vs=new WeakMap,cs=new WeakMap,$n=new WeakMap,Ql=new WeakMap,Jl=new WeakMap,zs=new WeakMap,yt=new WeakSet,Zh=function(){return this.is_fork||R(this,Rn).size>0},BR=function(){for(let i of R(this,zs))for(let n of R(i,Rn).keys()){for(var e=!1,r=n;r.parent!==null;){if(R(this,$n).has(r)){e=!0;break}r=r.parent}if(!e)return!0}return!1},Kh=function(){var o,l;if(LR++>1e3&&(Pn.delete(this),t4()),!Me(this,yt,Zh).call(this)){for(let c of R(this,Vs))R(this,cs).delete(c),Ge(c,2048),this.schedule(c);for(let c of R(this,cs))Ge(c,4096),this.schedule(c)}let e=R(this,Gr);we(this,Gr,[]),this.apply();var r=qa=[],i=[],n=Gu=[];for(let c of e)try{Me(this,yt,t0).call(this,c,r,i)}catch(u){throw jR(c),u}if(le=null,n.length>0){var s=Jh.ensure();for(let c of n)s.schedule(c)}if(qa=null,Gu=null,Me(this,yt,Zh).call(this)||Me(this,yt,BR).call(this)){Me(this,yt,Qh).call(this,i),Me(this,yt,Qh).call(this,r);for(let[c,u]of R(this,$n))GR(c,u)}else{R(this,ls).size===0&&Pn.delete(this),R(this,Vs).clear(),R(this,cs).clear();for(let c of R(this,Zl))c(this);R(this,Zl).clear(),ju=this,NR(i),NR(r),ju=null,(o=R(this,Vu))==null||o.resolve()}var a=le;if(R(this,Gr).length>0){let c=a!=null?a:a=this;R(c,Gr).push(...R(this,Gr).filter(u=>!R(c,Gr).includes(u)))}if(a!==null){if(Pn.add(a),I)for(let c of this.current.keys())J5.add(c);Me(l=a,yt,Kh).call(l)}kt&&!Pn.has(this)&&Me(this,yt,HR).call(this)},t0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||R(this,$n).has(n);if(!l&&n.fn!== Line truncated
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==is&&console.warn("Failed to hydrate: ",o),e.recover===!1&&mR(),cp(),sc(r),Ft(!1),Xs(t,e)}finally{Ft(i),Ue(n)}}var vp=new Map;function S$(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){cp();var l=void 0,c=c$(()=>{var u=r!=null?r:e.appendChild(Lt());l0(u,{pending:()=>{}},h=>{lt({});var p=ye;if(s&&(p.c=s),n&&(i.$$events=n),ie&&Nn(h,null),wp=a,l=t(h,i)||{},wp=!0,ie&&(Z.nodes.end=me,me===null||me.nodeType!==Pi||me.data!==Ha))throw Ua(),is;ct()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=E$(g);for(let S of[e,document]){var _=vp.get(S);_===void 0&&(_=new Map,vp.set(S,_));var b=_.get(g);b===void 0?(S.addEventListener(g,gp,{passive:v}),_.set(g,1)):_.set(g,b+1)}}}};return d(Vl(E0)),mp.add(d),()=>{var v;for(var h of f)for(let _ of[e,document]){var p=vp.get(_),g=p.get(h);--g==0?(_.removeEventListener(h,gp),p.delete(h),p.size===0&&vp.delete(_)):p.set(h,g)}mp.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return C0.set(l,c),l}var C0=new WeakMap;function ds(t,e){let r=C0.get(t);return r?(C0.delete(t),r(e)):(I&&(Jt in t?CR():AR()),Promise.resolve())}m();m();m();var rn,Bn,di,lo,tf,rf,_p,hs=class{constructor(e,r=!0){Ve(this,"anchor");pe(this,rn,new Map);pe(this,Bn,new Map);pe(this,di,new Map);pe(this,lo,new Set);pe(this,tf,!0);pe(this,rf,e=>{if(R(this,rn).has(e)){var r=R(this,rn).get(e),i=R(this,Bn).get(r);if(i)ef(i),R(this,lo).delete(r);else{var n=R(this,di).get(r);n&&(R(this,Bn).set(r,n.effect),R(this,di).delete(r),I&&(n.fragment.lastChild[zw]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of R(this,rn)){if(R(this,rn).delete(s),s===e)break;let o=R(this,di).get(a);o&&(mt(o.effect),R(this,di).delete(a))}for(let[s,a]of R(this,Bn)){if(s===r||R(this,lo).has(s))continue;let o=()=>{if(Array.from(R(this,rn).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(Lt()),R(this,di).set(s,{effect:a,fragment:c})}else mt(a);R(this,lo).delete(s),R(this,Bn).delete(s)};R(this,tf)||!i?(R(this,lo).add(s),Mn(a,o,!1)):o()}}});pe(this,_p,e=>{R(this,rn).delete(e);let r=Array.from(R(this,rn).values());for(let[i,n]of R(this,di))r.includes(i)||(mt(n.effect),R(this,di).delete(i))});this.anchor=e,we(this,tf,r)}ensure(e,r){var i=le,n=up();if(r&&!R(this,Bn).has(e)&&!R(this,di).has(e))if(n){var s=document.createDocumentFragment(),a=Lt();s.append(a),R(this,di).set(e,{effect:qt(()=>r(a)),fragment:s})}else R(this,Bn).set(e,qt(()=>r(this.anchor)));if(R(this,rn).set(i,e),n){for(let[o,l]of R(this,Bn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of R(this,di))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(R(this,rf)),i.ondiscard(R(this,_p))}else ie&&(this.anchor=me),R(this,rf).call(this,i)}};rn=new WeakMap,Bn=new WeakMap,di=new WeakMap,lo=new WeakMap,tf=new WeakMap,rf=new WeakMap,_p=new WeakMap;if(I){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;vR(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){ye===null&&Hh("onMount"),ss&&ye.l!==null?y4(ye).m.push(t):mr(()=>{let e=We(t);if(typeof e=="function")return e})}function y4(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var C$=new Map;function T$(t,e){var r=C$.get(t);r||(r=new Set,C$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Re(t,e,r=!1){var i;ie&&(i=me,cr());var n=new hs(t),s=r?65536:0;function a(o,l){if(ie){var c=Nu(i);if(o!==parseInt(c.substring(1))){var u=An();Ue(u),n.anchor=u,Ft(!1),n.ensure(o,l),Ft(!0);return}}n.ensure(o,l)}oi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();var $ie=Symbol("NaN");m();m();function hi(t,e){return e}function T4(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];Mn(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;P0(t,Vl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;sc(u),u.append(c),t.items.clear()}P0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function P0(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();rc(s,a)}else mt(e[n],r)}}var ac;function pi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=ie?Ue(sr(c)):c.appendChild(Lt())}ie&&cr();var u=null,f=to(()=>{var S=r();return ns(S)?S:S==null?[]:Vl(S)});I&&ur(f,"{#each ...}");var d,h=new Map,p=!0;function g(S){b.effect.f&16384||(b.pending.delete(S),b.fallback=u,P4(b,d,a,e,i),u!==null&&(d.length===0?u.f&33554432?(u.f^=33554432,sf(u,null,a)):ef(u):Mn(u Line truncated
\r\f\xA0\v\uFEFF`];function D$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||M$.includes(i[a-1]))&&(o===i.length||M$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function gt(t,e,r,i,n,s){var a=t.__className;if(ie||a!==r||a===void 0){var o=D$(r,i,s);(!ie||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var z4=Symbol("class"),W4=Symbol("style"),q4=Symbol("is custom element"),Y4=Symbol("is html"),X4=Ww?"link":"LINK";function xe(t,e,r,i){var n=Z4(t);if(ie&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===X4)){i||Q4(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[sR]=r),r==null?t.removeAttribute(e):typeof r!="string"&&K4(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function Z4(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[q4]:t.nodeName.includes("-"),[Y4]:t.namespaceURI===Dh}}var O$=new Map;function K4(t){var e=t.getAttribute("is")||t.nodeName,r=O$.get(e);if(r)return r;O$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Uw(n);for(var a in i)i[a].set&&r.push(a);n=zl(n)}return r}function Q4(t,e,r){var i;I&&(e==="srcset"&&J4(t,r)||$0((i=t.getAttribute(e))!=null?i:"",r)||kR(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function $0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function L$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function J4(t,e){var r=L$(t.srcset),i=L$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&($0(r[a][0],n)||$0(n,r[a][0])))}m();m();m();function M0(t,e,r=e){var i=new WeakSet;_0(t,"input",async n=>{I&&t.type==="checkbox"&&qw();var s=n?t.defaultValue:t.value;if(s=F0(t)?I0(s):s,r(s),le!==null&&i.add(le),await pp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ie&&t.defaultValue!==t.value||We(e)==null&&t.value)&&(r(F0(t)?I0(t.value):t.value),le!==null&&i.add(le)),nr(()=>{I&&t.type==="checkbox"&&qw();var n=e();if(t===document.activeElement){var s=kt?ju:le;if(i.has(s))return}F0(t)&&n===I0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function F0(t){var e=t.type;return e==="number"||e==="range"}function I0(t){return t===""?null:+t}m();m();m();m();m();function B$(t,e){return t===e||(t==null?void 0:t[Jt])===e}function at(t={},e,r,i){var n=ye.r,s=Z;return qr(()=>{var a,o;return nr(()=>{a=o,o=(i==null?void 0:i())||[],We(()=>{t!==r(...o)&&(e(t,...o),a&&B$(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&B$(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var S,k;var n=!ss||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=()=>(l&&(l=!1,o=a?We(i):i),o);let u;if(s){var f=Jt in t||Lu in t;u=(k=(S=Ur(t,e))==null?void 0:S.set)!=null?k:f&&e in t?E=>t[e]=E:void 0}var d,h=!1;s?[d,h]=Qw(()=>t[e]):d=t[e],d===void 0&&i!==void 0&&(d=c(),u&&(n&&gR(e),u(d)));var p;if(n?p=()=>{var E=t[e];return E===void 0?c():(l=!0,E)}:p=()=>{var E=t[e];return E!==void 0&&(o=void 0),E===void 0?o:E},n&&!(r&4))return p;if(u){var g=t.$$legacy;return function(E,A){return arguments.length>0?((!n||!A||g||h)&&u(A?p():E),E):p()}}var v=!1,_=(r&1?eo:to)(()=>(v=!1,p()));I&&(_.label=e),s&&$(_);var b=Z;return function(E,A){if(arguments.length>0){let w=A?$(_):n&&s?Qe(E):E;return se(_,w),v=!0,o!==void 0&&(o=w),E}return li&&v||b.f&16384?_.v:$(_)}}m();m();m();function H$(t){return new O0(t)}var ps,Oi,O0=class{constructor(e){pe(this,ps);pe(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=za(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return $((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Lu?!0:($((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return se((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});we(this,Oi,(e.hydrate?T0:Xs)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!kt&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&Za(),we(this,ps,n.$$events);for(let o of Object.keys(R(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||or(this,o,{get(){return R(this,Oi)[o]},set(l){R(this,Oi)[o]=l},enumerable:!0});R(this,Oi).$set=o=>{Object.assign(n,o)},R(this,Oi).$destroy=()=>{ds(R(this,Oi))}}$set(e){R(this,Oi).$set(e)}$on(e,r){R(this,ps)[e]=R(this,ps)[e]||[] Line truncated
`:""}${(x=e.log.author)==null?void 0:x.name}
${(0,B0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}`}]),de("click",u,()=>se(n,!$(n))),ce(t,o),ct()}Tt(["click"]);var PU=he('<div class="tree-item nav-folder mod-root"></div>'),RU=he('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),$U={hash:"svelte-12n6twc",code:""};function G0(t,e){lt(e,!0),an(t,$U);let r=Di(e,"plugin",15),i=Oe(!1),n=Qe([]),s=Oe(void 0),a=Oe(Qe(r().settings.treeStructure)),o;mr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)))}),mr(()=>{n.forEach(k=>(0,U0.setIcon)(k,k.getAttr("data-icon")))}),co(()=>{let k=new IntersectionObserver(A=>{A[0].isIntersecting&&!$(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&k.observe(E),()=>{k.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady){se(s,void 0);return}se(i,!0);let E=r().gitManager instanceof Se,A;((k=$(s)===null||$(s)===void 0?void 0:$(s).length)!==null&&k!==void 0?k:0)==0?A=E?50:10:A=$(s).length,se(s,yield r().gitManager.log(void 0,!1,A),!0),se(i,!1)})}function u(){return uo(this,void 0,void 0,function*(){var k;if(!r().gitReady||$(s)===void 0)return;se(i,!0);let A=r().gitManager instanceof Se?50:10,w=yield r().gitManager.log(void 0,!1,A,(k=$(s).last())===null||k===void 0?void 0:k.hash);$(s).push(...w.slice(1)),se(i,!1)})}var f=RU(),d=j(f),h=j(d),p=j(h);at(p,k=>n[0]=k,()=>n==null?void 0:n[0]);var g=te(p,2);let v;at(g,k=>n[1]=k,()=>n==null?void 0:n[1]),G(h),G(d);var _=te(d,2),b=j(_);{var S=k=>{var E=PU();pi(E,21,()=>$(s),hi,(A,w)=>{H0(A,{get view(){return e.view},get showTree(){return $(a)},get log(){return $(w)},get plugin(){return r()}})}),G(E),ce(k,E)};Re(b,k=>{$(s)&&k(S)})}Ga(4),G(_),G(f),Be(()=>{xe(p,"data-icon",$(a)?"list":"folder"),v=gt(g,1,"clickable-icon nav-action-button",null,v,{loading:$(i)})}),de("click",p,()=>{se(a,!$(a)),(0,U0.setIcon)(n[0],$(a)?"list":"folder"),r(r().settings.treeStructure=$(a),!0),r().saveSettings()}),de("click",g,l),ce(t,f),ct()}Tt(["click"]);var lf=class extends U$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return bi.type}getDisplayText(){return bi.name}getIcon(){return bi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Xs(G0,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var G$=require("obsidian"),Ep=class extends G$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var z$=require("obsidian");m();var po=require("obsidian");m();var cf=require("obsidian");m();var j$=require("obsidian");var oc=class extends j$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${cu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${cu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${cu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${cu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resol Line truncated
`)}}}function aR(t){let e=_0.get(t);e&&(fr(t,"message",{value:e.message}),fr(t,"stack",{value:e.stack}))}m();m();var Z4=-7169;function Ge(t,e){t.f=t.f&Z4|e}function Ql(t){(t.f&512)!==0||t.deps===null?Ge(t,1024):Ge(t,4096)}function oR(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,oR(e.deps))}function _p(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),oR(t.deps),Ge(t,1024)}m();m();m();var lR=!1,yp=!1;function y0(t){var e=yp;try{return yp=!1,[t(),yp]}finally{yp=e}}m();m();m();m();function x0(t){se&&or(t)!==null&&ec(t)}var cR=!1;function E0(){cR||(cR=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ya])==null||e.call(r)})},{capture:!0}))}function Zr(t){var e=oe,r=ee;Ht(null),Ut(null);try{return t()}finally{Ht(e),Ut(r)}}function S0(t,e,r,i=r){t.addEventListener(e,()=>Zr(r));let n=t[Ya];n?t[Ya]=()=>{n(),i(!0)}:t[Ya]=()=>i(!0),E0()}m();m();m();function uR(t){let e=0,r=gr(0),i;return O&&pr(r,"createSubscriber version"),()=>{Qs()&&(F(r),lr(()=>(e===0&&(i=Je(()=>t(()=>to(r)))),e+=1,()=>{At(()=>{e-=1,e===0&&(i==null||i(),i=void 0,to(r))})})))}}var X4=589824;function R0(t,e,r,i){new k0(t,e,r,i)}var li,of,Oi,ro,Kr,Li,Ar,ci,ds,io,Js,tc,lf,cf,Dn,Sp,qe,dR,hR,C0,pR,A0,xp,Ep,T0,P0,k0=class{constructor(e,r,i,n){ge(this,qe);Ue(this,"parent");Ue(this,"is_pending",!1);Ue(this,"transform_error");ge(this,li);ge(this,of,se?we:null);ge(this,Oi);ge(this,ro);ge(this,Kr);ge(this,Li,null);ge(this,Ar,null);ge(this,ci,null);ge(this,ds,null);ge(this,io,0);ge(this,Js,0);ge(this,tc,!1);ge(this,lf,new Set);ge(this,cf,new Set);ge(this,Dn,null);ge(this,Sp,uR(()=>(de(this,Dn,gr($(this,io))),O&&pr($(this,Dn),"$effect.pending()"),()=>{de(this,Dn,null)})));var s,a;de(this,li,e),de(this,Oi,r),de(this,ro,o=>{var l=ee;l.b=this,l.f|=128,i(o)}),this.parent=ee.b,this.transform_error=(a=n!=null?n:(s=this.parent)==null?void 0:s.transform_error)!=null?a:(o=>o),de(this,Kr,fi(()=>{if(se){let o=$(this,of);hr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Se(this,qe,hR).call(this,u)}else l?Se(this,qe,pR).call(this):Se(this,qe,dR).call(this)}else Se(this,qe,A0).call(this)},X4)),se&&de(this,li,we)}defer_effect(e){_p(e,$(this,lf),$(this,cf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!$(this,Oi).pending}update_pending_count(e,r){Se(this,qe,T0).call(this,e,r),de(this,io,$(this,io)+e),!(!$(this,Dn)||$(this,tc))&&(de(this,tc,!0),At(()=>{de(this,tc,!1),$(this,Dn)&&sn($(this,Dn),$(this,io))}))}get_effect_pending(){return $(this,Sp).call(this),F($(this,Dn))}error(e){var r;if(!$(this,Oi).onerror&&!$(this,Oi).failed)throw e;(r=le)!=null&&r.is_fork?($(this,Li)&&le.skip_effect($(this,Li)),$(this,Ar)&&le.skip_effect($(this,Ar)),$(this,ci)&&le.skip_effect($(this,ci)),le.oncommit(()=>{Se(this,qe,P0).call(this,e)})):Se(this,qe,P0).call(this,e)}};li=new WeakMap,of=new WeakMap,Oi=new WeakMap,ro=new WeakMap,Kr=new WeakMap,Li=new WeakMap,Ar=new WeakMap,ci=new WeakMap,ds=new WeakMap,io=new WeakMap,Js=new WeakMap,tc=new WeakMap,lf=new WeakMap,cf=new WeakMap,Dn=new WeakMap,Sp=new WeakMap,qe=new WeakSet,dR=function(){try{de(this,Li,Gt(()=>$(this,ro).call(this,$(this,li))))}catch(e){this.error(e)}},hR=function(e){let r=$(this,Oi).failed,{reset:i,invoke_onerror:n}=Se(this,qe,C0).call(this,e);At(n),r&&de(this,ci,Gt(()=>{r($(this,li),()=>e,()=>i)}))},C0=function(e){var r=!1,i=!1;let n=()=>{if(r){eR();return}r=!0,i&&qP(),$(this,ci)!==null&&On($(this,ci),()=>{de(this,ci,null)}),Se(this,qe,Ep).call(this,()=>{Se(this,qe,A0).call(this)})};return{reset:n,invoke_onerror:()=>{var a,o;try{i=!0,(o=(a=$(this,Oi)).onerror)==null||o.call(a,e,n),i=!1}catch(l){nn(l,$(this,Kr)&&$(this,Kr).parent)}}}},pR=function(){let e=$(this,Oi).pending;e&&(this.is_pending=!0,de(this,Ar,Gt(()=>e($(this,li)))),At(()=>{var r=de(this,ds,document.createDocumentFragment()),i=jt();r.append(i),de(this,Li,Se(this,qe,Ep).call(this,()=>Gt(()=>$(this,ro).call(this,i)))),$(this,Js)===0&&($(this,li).before(r),de(this,ds,null),On($(this,Ar),()=>{de(this,Ar,null)}),Se(this,qe,xp).call(this,le))}))},A0=function(){try{if(this.is_pending=this.has_pending_snippet(),de(this,Js,0),de(this,io,0),de(this,Li,Gt(()=>{$(this,ro).call(this,$(this,li))})),$(this,Js)>0){var e=de(this,ds,document.createDocumentFragment());rc($(this,Li),e);let r=$(this,Oi).pending;de(this,Ar,Gt(()=>r($(this,li))))}else Se(this,qe,xp).call(this,le)}catch(r){this.error(r)}},xp=function(e){this.is_pending=!1,e.transfer_effects($(this,lf),$(this,cf))},Ep=function(e){var r=ee,i=oe,n=Ee;Ut($(this,Kr)),Ht($(this,Kr)),us($(this,Kr).ctx);try{return ui.ensure(),e()}catch(s){return bp(s),null}finally{Ut(r),Ht(i),us(n)}},T0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Se(i=this.parent,qe,T0).call(i,e,r);return}de(this,Js,$(this,Js)+e),$(this,Js)===0&&(Se(this,qe,xp).call(this,r),$(this,Ar)&&On($(this,Ar),()=>{de(this,Ar,null)}),$( Line truncated
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==as&&console.warn("Failed to hydrate: ",o),e.recover===!1&&UP(),Ip(),ec(r),Lt(!1),na(t,e)}finally{Lt(i),We(n)}}var Hp=new Map;function QR(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){Ip();var l=void 0,c=LR(()=>{var u=r!=null?r:e.appendChild(jt());R0(u,{pending:()=>{}},h=>{ht({});var p=Ee;if(s&&(p.c=s),n&&(i.$$events=n),se&&on(h,null),Up=a,l=t(h,i)||{},Up=!0,se&&(ee.nodes.end=we,we===null||we.nodeType!==Ii||we.data!=="]"))throw Za(),as;pt()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=XR(g);for(let C of[e,document]){var b=Hp.get(C);b===void 0&&(b=new Map,Hp.set(C,b));var _=b.get(g);_===void 0?(C.addEventListener(g,Bp,{passive:v}),b.set(g,1)):b.set(g,_+1)}}}};return d(Wl(K0)),Np.add(d),()=>{var v;for(var h of f)for(let b of[e,document]){var p=Hp.get(b),g=p.get(h);--g==0?(b.removeEventListener(h,Bp),p.delete(h),p.size===0&&Hp.delete(b)):p.set(h,g)}Np.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return eb.set(l,c),l}var eb=new WeakMap;function _s(t,e){let r=eb.get(t);return r?(eb.delete(t),r(e)):(O&&(rr in t?JP():QP()),Promise.resolve())}m();m();m();var ln,Un,gi,mo,bf,_f,Gp,ys=class{constructor(e,r=!0){Ue(this,"anchor");ge(this,ln,new Map);ge(this,Un,new Map);ge(this,gi,new Map);ge(this,mo,new Set);ge(this,bf,!0);ge(this,_f,e=>{if($(this,ln).has(e)){var r=$(this,ln).get(e),i=$(this,Un).get(r);if(i)mc(i),$(this,mo).delete(r);else{var n=$(this,gi).get(r);n&&(mc(n.effect),$(this,Un).set(r,n.effect),$(this,gi).delete(r),O&&(n.fragment.lastChild[p0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of $(this,ln)){if($(this,ln).delete(s),s===e)break;let o=$(this,gi).get(a);o&&(_t(o.effect),$(this,gi).delete(a))}for(let[s,a]of $(this,Un)){if(s===r||$(this,mo).has(s))continue;let o=()=>{if(Array.from($(this,ln).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(jt()),$(this,gi).set(s,{effect:a,fragment:c})}else _t(a);$(this,mo).delete(s),$(this,Un).delete(s)};$(this,bf)||!i?($(this,mo).add(s),On(a,o,!1)):o()}}});ge(this,Gp,e=>{$(this,ln).delete(e);let r=Array.from($(this,ln).values());for(let[i,n]of $(this,gi))r.includes(i)||(_t(n.effect),$(this,gi).delete(i))});this.anchor=e,de(this,bf,r)}ensure(e,r){var i=le,n=Mp();if(r&&!$(this,Un).has(e)&&!$(this,gi).has(e))if(n){var s=document.createDocumentFragment(),a=jt();s.append(a),$(this,gi).set(e,{effect:Gt(()=>r(a)),fragment:s})}else $(this,Un).set(e,Gt(()=>r(this.anchor)));if($(this,ln).set(i,e),n){for(let[o,l]of $(this,Un))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of $(this,gi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit($(this,_f)),i.ondiscard($(this,Gp))}else se&&(this.anchor=we),$(this,_f).call(this,i)}};ln=new WeakMap,Un=new WeakMap,gi=new WeakMap,mo=new WeakMap,bf=new WeakMap,_f=new WeakMap,Gp=new WeakMap;if(O){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;jP(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function go(t){Ee===null&&dp("onMount"),cs&&Ee.l!==null?bU(Ee).m.push(t):vr(()=>{let e=Je(t);if(typeof e=="function")return e})}function bU(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var t$=new Map;function r$(t,e){var r=t$.get(t);r||(r=new Set,t$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function $e(t,e,r=!1){var i;se&&(i=we,hr());var n=new ys(t),s=r?65536:0;function a(o,l){if(se){var c=rf(i);if(o!==parseInt(c.substring(1))){var u=Fn();We(u),n.anchor=u,Lt(!1),n.ensure(o,l),Lt(!0);return}}n.ensure(o,l)}fi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function vi(t,e){return e}function AU(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];On(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;rb(t,Wl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;ec(u),u.append(c),t.items.clear()}rb(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function rb(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();rc(s,a)}else _t(e[n],r)}}var gc;function wi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=se?We(or(c)):c.appendChild(jt())}se&&hr();var u=null,f=no(()=>{var C=r();return os(C)?C:C==null?[]:Wl(C)});O&&pr(f,"{#each ...}");var d,h=new Map,p=!0;function g(C){(_.effect.f&16384)===0&&(_.pending.delete(C),_.fallback=u,TU(_,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?mc(u):(u.f^=33554432,xf(u,null,a)) Line truncated
\r\f\xA0\v\uFEFF`];function c$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||l$.includes(i[a-1]))&&(o===i.length||l$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function ft(t,e,r,i,n,s){var a=t[Ju];if(se||a!==r||a===void 0){var o=c$(r,i,s);(!se||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Ju]=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var VU=Symbol("is custom element"),zU=Symbol("is html"),WU=m0?"link":"LINK";function ye(t,e,r,i){var n=qU(t);if(se&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===WU)){i||ZU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[$P]=r),r==null?t.removeAttribute(e):typeof r!="string"&&YU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function qU(t){var e,r;return(r=t[e=fp])!=null?r:t[e]={[VU]:t.nodeName.includes("-"),[zU]:t.namespaceURI===ap}}var u$=new Map;function YU(t){var e=t.getAttribute("is")||t.nodeName,r=u$.get(e);if(r)return r;u$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=c0(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=ql(n)}return r}function ZU(t,e,r){var i;O&&(e==="srcset"&&KU(t,r)||nb((i=t.getAttribute(e))!=null?i:"",r)||XP(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function nb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function f$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function KU(t,e){var r=f$(t.srcset),i=f$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(nb(r[a][0],n)||nb(n,r[a][0])))}m();m();m();function ob(t,e,r=e){var i=new WeakSet;S0(t,"input",async n=>{O&&t.type==="checkbox"&&g0();var s=n?t.defaultValue:t.value;if(s=sb(t)?ab(s):s,r(s),le!==null&&i.add(le),await Lp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(se&&t.defaultValue!==t.value||Je(e)==null&&t.value)&&(r(sb(t)?ab(t.value):t.value),le!==null&&i.add(le)),lr(()=>{O&&t.type==="checkbox"&&g0();var n=e();if(t===document.activeElement){var s=Ft?ps:le;if(i.has(s))return}sb(t)&&n===ab(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function sb(t){var e=t.type;return e==="number"||e==="range"}function ab(t){return t===""?null:+t}m();m();m();m();m();function lb(t,e){return t===e||(t==null?void 0:t[rr])===e}function ot(t={},e,r,i){var n=Ee.r,s=ee;return ei(()=>{var a,o;return lr(()=>{a=o,o=(i==null?void 0:i())||[],Je(()=>{lb(r(...o),t)||(e(t,...o),a&&lb(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&lb(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Bi(t,e,r,i){var x,E;var n=!cs||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=ea(i)),F(c)):(l&&(l=!1,o=a?Je(i):i),o);let f;if(s){var d=rr in t||Qu in t;f=(E=(x=qr(t,e))==null?void 0:x.set)!=null?E:d&&e in t?A=>t[e]=A:void 0}var h,p=!1;s?[h,p]=y0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&GP(e),f(h)));var g;if(n?g=()=>{var A=t[e];return A===void 0?u():(l=!0,A)}:g=()=>{var A=t[e];return A!==void 0&&(o=void 0),A===void 0?o:A},n&&(r&4)===0)return g;if(f){var v=t.$$legacy;return(function(A,w){return arguments.length>0?((!n||!w||v||p)&&f(w?g():A),A):g()})}var b=!1,_=((r&1)!==0?ea:no)(()=>(b=!1,g()));O&&(_.label=e),s&&F(_);var C=ee;return(function(A,w){if(arguments.length>0){let S=w?F(_):n&&s?nt(A):A;return ae(_,S),b=!0,o!==void 0&&(o=S),A}return di&&b||(C.f&16384)!==0?_.v:F(_)})}m();m();m();function h$(t){return new ub(t)}var xs,Hi,ub=class{constructor(e){ge(this,xs);ge(this,Hi);var s,a;var r=new Map,i=(o,l)=>{var c=Ja(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Qu?!0:(F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return ae((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});de(this,Hi,(e.hydrate?tb:na)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Ft&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&co(),de(this,xs,n.$$events);for(let o of Object.keys($(this,Hi)))o==="$set"||o==="$destroy"||o==="$on"||fr(this,o,{get(){return $(this,Hi)[o]},set(l){$(this,Hi)[o]=l},enumerable:!0});$(this,Hi).$set=o=>{Object.assign(n,o)},$(this,Hi).$destroy=()=>{_s($(this,Hi))}}$set(e){$(this,Hi).$se Line truncated
`:""}${(S=e.log.author)==null?void 0:S.name}
${(0,hb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}`}]),me("click",u,()=>ae(n,!F(n))),ue(t,o),pt()}Mt(["click"]);var CG=_e('<div class="tree-item nav-folder mod-root"></div>'),AG=_e('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),TG={hash:"svelte-12n6twc",code:""};function gb(t,e){ht(e,!0),fn(t,TG);let r=Bi(e,"plugin",15),i=Ne(!1),n=nt([]),s=Ne(void 0),a=Ne(nt(r().settings.treeStructure)),o;vr(()=>{o&&o.empty()}),go(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),vr(()=>{n.forEach(x=>(0,mb.setIcon)(x,x.getAttr("data-icon")))}),go(()=>{let x=new IntersectionObserver(A=>{var w;(w=A[0])!=null&&w.isIntersecting&&!F(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}async function c(){var A,w;if(!r().gitReady){ae(s,void 0);return}ae(i,!0);let x=r().gitManager instanceof ke,E;((w=(A=F(s))==null?void 0:A.length)!=null?w:0)==0?E=x?50:10:E=F(s).length,ae(s,await r().gitManager.log(void 0,!1,E),!0),ae(i,!1)}async function u(){var w;if(!r().gitReady||F(s)===void 0)return;ae(i,!0);let E=r().gitManager instanceof ke?50:10,A=await r().gitManager.log(void 0,!1,E,(w=F(s).last())==null?void 0:w.hash);F(s).push(...A.slice(1)),ae(i,!1)}var f=AG(),d=V(f),h=V(d),p=V(h);ot(p,x=>n[0]=x,()=>n==null?void 0:n[0]);var g=ne(p,2);let v;ot(g,x=>n[1]=x,()=>n==null?void 0:n[1]),G(h),G(d);var b=ne(d,2),_=V(b);{var C=x=>{var E=CG();wi(E,21,()=>F(s),vi,(A,w)=>{pb(A,{get view(){return e.view},get showTree(){return F(a)},get log(){return F(w)},get plugin(){return r()}})}),G(E),ue(x,E)};$e(_,x=>{F(s)&&x(C)})}Ka(4),G(b),G(f),Ve(()=>{ye(p,"data-icon",F(a)?"list":"folder"),v=ft(g,1,"clickable-icon nav-action-button",null,v,{loading:F(i)})}),me("click",p,()=>{ae(a,!F(a)),(0,mb.setIcon)(n[0],F(a)?"list":"folder"),r(r().settings.treeStructure=F(a),!0),r().saveSettings()}),me("click",g,l),ue(t,f),pt()}Mt(["click"]);var kf=class extends p$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Ei.type}getDisplayText(){return Ei.name}getIcon(){return Ei.icon}async onClose(){return this._view&&await _s(this._view),super.onClose()}async reload(){this._view&&await _s(this._view),this._view=na(gb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};m();var m$=require("obsidian"),Wp=class extends m$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var w$=require("obsidian");m();var zn=require("obsidian");m();var Cf=require("obsidian");m();var g$=require("obsidian");var vc=class extends g$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${xu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${xu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${xu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${xu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty Line truncated
`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=`
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Wi.getHunk(r.state,!1,e),n=!1;if(i||(i=Wi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(W$.editorInfoField).file.path,a=Vt.createPatch(s,[i],"100644",n).join(`
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Ki.getHunk(r.state,!1,e),n=!1;if(i||(i=Ki.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(b$.editorInfoField).file.path,a=qt.createPatch(s,[i],"100644",n).join(`
`)+`
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Wi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Vt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var mo=require("obsidian");var Cp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof mo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),h2(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;E2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new ch(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&mo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(D2),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),w2(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof mo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof mo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",y2)}};m();var lc=require("obsidian");m();m();var go=require("@codemirror/state"),Pp=require("@codemirror/view");var Tp=class extends Pp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=activeDocument.createElement("div");return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},V0=go.StateField.define({create:()=>go.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Hr,!1);if(!r)ret Line truncated
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof be.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof be.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof be.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(J$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Rk(ht,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return be.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new fh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Se(this),await this.gitManager.setGitInstance()):this.gitManager=new Vi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new be.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),be.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new kp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new be.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new be.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new et(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new et(this,{options:this.gitManager instanceof Vi?[n]:[],placeholder Line truncated
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Ki.getHunks(r.state,!1),s=i.getCursor().line+1,a=qt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var bo=require("obsidian");var Kp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof bo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),DT(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;zT(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Th(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&bo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof ke?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(r2),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),HT(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;e&&((r=this.lineAuthorInfoProvider)==null||r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof bo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof bo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",jT)}};m();var wc=require("obsidian");m();m();var _o=require("@codemirror/state"),Qp=require("@codemirror/view");var Xp=class extends Qp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=createDiv();return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},_b=_o.StateField.define({create:()=>_o.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Wr,!1);if(!r)return _o.RangeSet.empty;let i=e.effects.some(s=>s.is(Vh)),n=e.effects.some(s=>s.is(Ml));if(i||n||(e. Line truncated
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof Ce.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(k$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=XS(tt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Ce.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(!this.localStorage.getPluginDisabled()){if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new Rh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new ke(this),await this.gitManager.setGitInstance()):this.gitManager=new Zi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Ce.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,Ce.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Yp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;(o=this.branchBar)==null?void 0:o.display().catch(console.error)},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new Ce.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+String(n))}}catch(n){this.displayError(n),console.error(n)}}}async createNewRepo(){try{await this.gitManager.init(),new Ce.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new at(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new at(this,{options:this.gitManager instanceof Zi?[n]:[],placeho Line truncated
# Additional Instructions
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
@@ -374,7 +374,7 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
File changes in remote repository
>>>>>>> origin/main
\`\`\``]),await this.tools.writeAndOpenFile(i==null?void 0:i.join(`
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new et(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,sv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new et(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new et(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new et(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof La||i instanceof Na))return;let n=this.app.workspace.getLeavesOfType(Kt.type).first(),s=this.app.workspace.getLeavesOfType(bi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof La||(r==null?void 0:r.view)instanceof Na){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new be.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof Q$.Errors.UserCanceledError){new be.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new be.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new at(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,yv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new at(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof Wa||i instanceof qa))return;let n=this.app.workspace.getLeavesOfType(er.type).first(),s=this.app.workspace.getLeavesOfType(Ei.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Wa||(r==null?void 0:r.view)instanceof qa){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Ce.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof du.UserCanceledError){new Ce.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.settings.showErrorNotices&&new Ce.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
/*! Bundled license information:
ieee754/index.js:
@@ -394,20 +394,32 @@ safe-buffer/index.js:
crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
isomorphic-git/index.cjs:
isomorphic-git/index.js:
(*!
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
* SPDX-License-Identifier: LGPL-3.0-or-later
* Copyright (c) James Prevett and other ZenFS contributors.
*
* Windows support added:
* - Backslashes are normalised to forward slashes before processing.
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
* normalisation, so absolute Windows paths are handled correctly.
* - An absolute argument passed to join() resets the accumulated path,
* matching Node behaviour and handling worktree gitdir paths properly.
*
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
* backslashes are normalised to forward slashes and then collapsed by
* normalizeString, losing the UNC root. Git on Windows works with
* drive-letter paths, so this is not expected to be a practical issue.
*)
js-sha256/src/sha256.js:
js-sha256/build/sha256.mjs:
(**
* [js-sha256]{@link https://github.com/emn178/js-sha256}
*
* @version 0.9.0
* @version 0.12.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @copyright Chen, Yi-Cyuan 2014-2026
* @license MIT
*)
*/
+1 -1
View File
@@ -6,5 +6,5 @@
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.38.3"
"version": "2.40.0"
}