first commit

This commit is contained in:
admin committed 2026-11-05 15:16:24 +08:00
commit 9399a88d39
347 files changed
+167716

No files matched your search

+415
View File
@@ -0,0 +1,415 @@
/*
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)
*/
"use strict";var GO=Object.create;var Yc=Object.defineProperty;var UO=Object.getOwnPropertyDescriptor;var jO=Object.getOwnPropertyNames;var zO=Object.getPrototypeOf,VO=Object.prototype.hasOwnProperty;var ax=r=>{throw TypeError(r)};var WO=(r,e,t)=>e in r?Yc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var qO=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var G=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},YO=(r,e)=>{for(var t in e)Yc(r,t,{get:e[t],enumerable:!0})},lx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jO(e))!VO.call(r,i)&&i!==t&&Yc(r,i,{get:()=>e[i],enumerable:!(n=UO(e,i))||n.enumerable});return r};var nt=(r,e,t)=>(t=r!=null?GO(zO(r)):{},lx(e||!r||!r.__esModule?Yc(t,"default",{value:r,enumerable:!0}):t,r)),KO=r=>lx(Yc({},"__esModule",{value:!0}),r);var Xe=(r,e,t)=>WO(r,typeof e!="symbol"?e+"":e,t),gg=(r,e,t)=>e.has(r)||ax("Cannot "+t);var O=(r,e,t)=>(gg(r,e,"read from private field"),t?t.call(r):e.get(r)),Re=(r,e,t)=>e.has(r)?ax("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Se=(r,e,t,n)=>(gg(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(gg(r,e,"access private method"),t);var fx=G(yd=>{"use strict";g();yd.byteLength=XO;yd.toByteArray=JO;yd.fromByteArray=rF;var Ni=[],Vn=[],ZO=typeof Uint8Array!="undefined"?Uint8Array:Array,wg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(jo=0,cx=wg.length;jo<cx;++jo)Ni[jo]=wg[jo],Vn[wg.charCodeAt(jo)]=jo;var jo,cx;Vn[45]=62;Vn[95]=63;function ux(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function XO(r){var e=ux(r),t=e[0],n=e[1];return(t+n)*3/4-n}function QO(r,e,t){return(e+t)*3/4-t}function JO(r){var e,t=ux(r),n=t[0],i=t[1],s=new ZO(QO(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Vn[r.charCodeAt(l)]<<18|Vn[r.charCodeAt(l+1)]<<12|Vn[r.charCodeAt(l+2)]<<6|Vn[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Vn[r.charCodeAt(l)]<<2|Vn[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Vn[r.charCodeAt(l)]<<10|Vn[r.charCodeAt(l+1)]<<4|Vn[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function eF(r){return Ni[r>>18&63]+Ni[r>>12&63]+Ni[r>>6&63]+Ni[r&63]}function tF(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(eF(n));return i.join("")}function rF(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(tF(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(Ni[e>>2]+Ni[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ni[e>>10]+Ni[e>>4&63]+Ni[e<<2&63]+"=")),i.join("")}});var dx=G(vg=>{g();vg.read=function(r,e,t,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,c=l>>1,u=-7,f=t?i-1:0,d=t?-1:1,h=r[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=a;u>0;s=s*256+r[e+f],f+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+r[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(h?-1:1)*o*Math.pow(2,s-n)};vg.write=function(r,e,t,n,i,s){var o,a,l,c=s*8-i-1,u=(1<<c)-1,f=u>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;r[t+h]=a&255,h+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;r[t+h]=o&255,h+=p,o/=256,c-=8);r[t+h-p]|=m*128}});var Cg=G(il=>{"use strict";g();var bg=fx(),rl=dx(),hx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;il.Buffer=L;il.SlowBuffer=lF;il.INSPECT_MAX_BYTES=50;var _d=2147483647;il.kMaxLength=_d;L.TYPED_ARRAY_SUPPORT=nF();!L.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 nF(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch(r){return!1}}Object.defineProperty(L.prototype,"parent",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.buffer}});Object.defineProperty(L.prototype,"offset",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.byteOffset}});function ws(r){if(r>_d)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,L.prototype),e}function L(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Eg(r)}return wx(r,e,t)}L.poolSize=8192;function wx(r,e,t){if(typeoLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kG(r,e){if(r){if(typeof r=="string")return pT(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pT(r,e)}}function pT(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function AG(r,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(r)))){var t=[],n=!0,i=!1,s=void 0;try{for(var o=r[Symbol.iterator](),a;!(n=(a=o.next()).done)&&(t.push(a.value),!(e&&t.length===e));n=!0);}catch(l){i=!0,s=l}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw s}}return t}}function CG(r){if(Array.isArray(r))return r}var gT=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,wT=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,vT=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,bT=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,yT=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,_T=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,xT=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Ju(r,e){return r.indexOf(e)>-1}function TG(r,e,t){var n=r/255,i=e/255,s=t/255,o=Math.max(n,i,s),a=Math.min(n,i,s),l=o-a,c=(o+a)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(o){case n:return(i-s)/l%6;case i:return(s-n)/l+2;default:return(n-i)/l+4}})();return[f*60,u*100,c*100]}function RG(r,e,t){var n=r/60,i=e/100,s=t/100,o=(1-Math.abs(2*s-1))*i,a=o*(1-Math.abs(n%2-1)),l=s-o/2,c=(function(){return n<1?[o,a,0]:n<2?[a,o,0]:n<3?[0,o,a]:n<4?[0,a,o]:n<5?[a,0,o]:[o,0,a]})(),u=Mr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var $G=(function(){function r(e){var t=Mr(e,4),n=t[0],i=t[1],s=t[2],o=t[3];xG(this,r),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),o==null?1:Math.max(Math.min(parseFloat(o),255),0)]}return EG(r,[{key:"toRgbString",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3];return o===1?"rgb(".concat(n,", ").concat(i,", ").concat(s,")"):"rgba(".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,")")}},{key:"toHslString",value:function(){var t=this.toHslaArray(),n=Mr(t,4),i=n[0],s=n[1],o=n[2],a=n[3];return a===1?"hsl(".concat(i,", ").concat(s,"%, ").concat(o,"%)"):"hsla(".concat(i,", ").concat(s,"%, ").concat(o,"%, ").concat(a,")")}},{key:"toHexString",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),o=o<1?parseInt(o*255,10).toString(16).padStart(2,"0"):"","#".concat(n).concat(i).concat(s).concat(o)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3],a=TG(n,i,s),l=Mr(a,3),c=l[0],u=l[1],f=l[2];return[c,u,f,o]}}]),r})();function jl(r){var e=Mr(r,4),t=e[0],n=e[1],i=e[2],s=e[3];return new $G([t,n,i,s])}function O0(r){var e=Mr(r,3),t=e[0],n=e[1],i=e[2];return jl([t,n,i,1])}function $h(r){var e=Mr(r,4),t=e[0],n=e[1],i=e[2],s=e[3],o=RG(t,n,i),a=Mr(o,3),l=a[0],c=a[1],u=a[2];return jl([l,c,u,s])}function ET(r){var e=Mr(r,3),t=e[0],n=e[1],i=e[2];return $h([t,n,i,1])}function PG(r){var e=gT.exec(r)||wT.exec(r),t=Mr(e,5),n=t[1],i=t[2],s=t[3],o=t[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,16),s=parseInt(s.length<2?s.repeat(2):s,16),o=o&&(parseInt(o.length<2?o.repeat(2):o,16)/255).toPrecision(1)||1,jl([n,i,s,o])}function IG(r){var e=vT.exec(r)||yT.exec(r)||bT.exec(r)||_T.exec(r),t=Mr(e,5),n=t[1],i=t[2],s=t[3],o=t[4];return n=Ju(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ju(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),s=Ju(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),o=o===void 0?1:parseFloat(o)/(Ju(o,"%")?100:1),jl([n,i,s,o])}function OG(r){var e=xT.exec(r),t=Mr(e,6),n=t[1],i=t[2],s=t[3],o=t[4],a=t[5];return i=i||"deg",n=(0,_G.default)(parseFloat(n),i,"deg"),s=parseFloat(s),o=parseFloat(o),a=a===void 0?1:parseFloat(a)/(Ju(a,"%")?100:1),$h([n,s,o,a])}function ST(r){return dT.default[r]?O0(dT.default[r]):gT.test(r)||wT.test(r)?PG(r):vT.test(r)||yT.test(r)||bT.test(r)||_T.test(r)?IG(r):xT.test(r)?OG(r):null}var FG={fromString:ST,fromRgb:O0,fromRgba:jl,fromHsl:ET,fromHsla:$h};As.default=FG});var DT=G((rK,MT)=>{g();MT.exports=function(r,e){var t=r,n=e,i=t.length,s=n.length,o=!1,a=i+1,l=[],c=[],u,f,d=function(){i>=s&&(u=t,f=i,t=n,n=u,i=s,s=f,o=!0,a=i+1)},h=function(m,w,y,v,A){return{startX:m,startY:w,endX:y,endY:v,r:A}},p=function(m,w,y){var v,A,C,S,T;for(w>y?v=l[m-1+a]:v=l[m+1+a],T=C=Math Line truncated
`});fe=!1,Y=oe.length}function tt(j,Ce){var z="="+U,we=j.indexOf(z,Ce),ee=c(j.substring(j.indexOf("=",Ce)+1,we)).split(" ");return J=ee[0],U=ee[ee.length-1],we+z.length-1}for(E&&(E=E.split(" "),J=E[0],U=E[1]),Z=0;Z<k;Z++)P==$?u(J,x,Z)?(--Z,et(),P=M):x.charAt(Z)==`
`?vt(fe):Q+=x.charAt(Z):P==M?(Z+=J.length-1,_e=r.tags[x.charAt(Z+1)],F=_e?x.charAt(Z+1):"_v",F=="="?(Z=tt(x,Z),P=$):(_e&&Z++,P=D),fe=Z):u(U,x,Z)?(oe.push({tag:F,n:c(Q),otag:J,ctag:U,i:F=="/"?fe-J.length:Z+U.length}),Q="",Z+=U.length-1,P=$,F=="{"&&(U=="}}"?Z++:l(oe[oe.length-1]))):Q+=x.charAt(Z);return vt(fe,!0),oe};function l(b){b.n.substr(b.n.length-1)==="}"&&(b.n=b.n.substring(0,b.n.length-1))}function c(b){return b.trim?b.trim():b.replace(/^\s*|\s*$/g,"")}function u(b,x,E){if(x.charAt(E)!=b.charAt(0))return!1;for(var k=1,$=b.length;k<$;k++)if(x.charAt(E+k)!=b.charAt(k))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(b,x,E,k){var $=[],M=null,D=null,P=null;for(D=E[E.length-1];b.length>0;){if(P=b.shift(),D&&D.tag=="<"&&!(P.tag in f))throw new Error("Illegal content in < super tag.");if(r.tags[P.tag]<=r.tags.$||h(P,k))E.push(P),P.nodes=d(b,P.tag,E,k);else if(P.tag=="/"){if(E.length===0)throw new Error("Closing tag without opener: /"+P.n);if(M=E.pop(),P.n!=M.n&&!p(P.n,M.n,k))throw new Error("Nesting error: "+M.n+" vs. "+P.n);return M.end=P.i,$}else P.tag==`
`&&(P.last=b.length==0||b[0].tag==`
`);$.push(P)}if(E.length>0)throw new Error("missing closing tag: "+E.pop().n);return $}function h(b,x){for(var E=0,k=x.length;E<k;E++)if(x[E].o==b.n)return b.tag="#",!0}function p(b,x,E){for(var k=0,$=E.length;k<$;k++)if(E[k].c==b&&E[k].o==x)return!0}function m(b){var x=[];for(var E in b)x.push('"'+v(E)+'": function(c,p,t,i) {'+b[E]+"}");return"{ "+x.join(",")+" }"}function w(b){var x=[];for(var E in b.partials)x.push('"'+v(E)+'":{name:"'+v(b.partials[E].name)+'", '+w(b.partials[E])+"}");return"partials: {"+x.join(",")+"}, subs: "+m(b.subs)}r.stringify=function(b,x,E){return"{code: function (c,p,i) { "+r.wrapMain(b.code)+" },"+w(b)+"}"};var y=0;r.generate=function(b,x,E){y=0;var k={code:"",subs:{},partials:{}};return r.walk(b,k),E.asString?this.stringify(k,x,E):this.makeTemplate(k,x,E)},r.wrapMain=function(b){return'var t=this;t.b(i=i||"");'+b+"return t.fl();"},r.template=r.Template,r.makeTemplate=function(b,x,E){var k=this.makePartials(b);return k.code=new Function("c","p","i",this.wrapMain(b.code)),new this.template(k,x,this,E)},r.makePartials=function(b){var x,E={subs:{},partials:b.partials,name:b.name};for(x in E.partials)E.partials[x]=this.makePartials(E.partials[x]);for(x in b.subs)E.subs[x]=new Function("c","p","t","i",b.subs[x]);return E};function v(b){return b.replace(s,"\\\\").replace(t,'\\"').replace(n,"\\n").replace(i,"\\r").replace(o,"\\u2028").replace(a,"\\u2029")}function A(b){return~b.indexOf(".")?"d":"f"}function C(b,x){var E="<"+(x.prefix||""),k=E+b.n+y++;return x.partials[k]={name:b.n,partials:{}},x.code+='t.b(t.rp("'+v(k)+'",c,p,"'+(b.indent||"")+'"));',k}r.codegen={"#":function(b,x){x.code+="if(t.s(t."+A(b.n)+'("'+v(b.n)+'",c,p,1),c,p,0,'+b.i+","+b.end+',"'+b.otag+" "+b.ctag+'")){t.rs(c,p,function(c,p,t){',r.walk(b.nodes,x),x.code+="});c.pop();}"},"^":function(b,x){x.code+="if(!t.s(t."+A(b.n)+'("'+v(b.n)+'",c,p,1),c,p,1,0,0,"")){',r.walk(b.nodes,x),x.code+="};"},">":C,"<":function(b,x){var E={partials:{},code:"",subs:{},inPartial:!0};r.walk(b.nodes,E);var k=x.partials[C(b,x)];k.subs=E.subs,k.partials=E.partials},$:function(b,x){var E={subs:{},code:"",partials:x.partials,prefix:b.n};r.walk(b.nodes,E),x.subs[b.n]=E.code,x.inPartial||(x.code+='t.sub("'+v(b.n)+'",c,p,i);')},"\n":function(b,x){x.code+=T('"\\n"'+(b.last?"":" + i"))},_v:function(b,x){x.code+="t.b(t.v(t."+A(b.n)+'("'+v(b.n)+'",c,p,0)));'},_t:function(b,x){x.code+=T('"'+v(b.text)+'"')},"{":S,"&":S};function S(b,x){x.code+="t.b(t.t(t."+A(b.n)+'("'+v(b.n)+'",c,p,0)));'}function T(b){return"t.b("+b+");"}r.walk=function(b,x){for(var E,k=0,$=b.length;k<$;k++)E=r.codegen[b[k].tag],E&&E(b[k],x);return x},r.parse=function(b,x,E){return E=E||{},d(b,"",[],E.sectionTags||[])},r.cache={},r.cacheKey=function(b,x){return[b,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},r.compile=function(b,x){x=x||{};var E=r.cacheKey(b,x),k=this.cache[E];if(k){var $=k.partials;for(var M in $)delete $[M].instance;return k}return k=this.generate(this.parse(this.scan(b,x.delimiters),b,x),b,x),this.cache[E]=k}})(typeof dy!="undefined"?dy:Hogan)});var qP=G(hy=>{g();var h9={};(function(r){r.Template=function(d,h,p,m){d=d||{},this.r=d.code||this.r,this.c=p,this.options=m||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},r.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,m){return this.ri([h],p||{},m)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],m=h[p.name];if(p.instance&&p.base==m)return p.instance;if(typeof m=="string"){if(!this.c)throw new Error("No compiler available.");m=this.c.compile(m,this.options)}if(!m)return null;if(this.partials[d].base=m,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);m=t(m,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=m,m},rp:function(d,h,p,m){var w=this.ep(d,p);return w?w.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);return}for(var w=0;w<m.length;w++)d.push(m[w]),p(d,h,this),d.pop()},s:function(d,h,p,m,w,y,v){var A;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,m,w,y,v)),A=!!d,!m&&A&&h&&h.push(typeof d=="object"?d:h[h.length-1]),A)},d:function(d,h,p,m){var w,y=d.split("."),v=this.f(y[0],h,p,m),A=this.options.modelGet,C=null;if(d==="."&&f(h[h.length-2]))v=h[h.length-1];else for(var S=1;S<y.length;S++)w=e(y[S],v,A),w!==void 0?(C=v,v=w):v="";return m&&!v?!1:(!m&&typeof v=="function"&&(h.push(C),v=this.mv(v,h,p),h.pop()),v)},f:function(d,h,p,m){for(var w=!1,y=null,v=!1,A=this.options.modelGet,C=h.length-1;C>=0;C--)if(y=h[C],w=e(d,y,A),w!==void 0){v=!0;break}return v?(!m&&typeof w=="function"&&(w=this.mv(w,h,p)),w):m?!1:""},ls:function(d,h,p,m,w,y){var v=this.options.delimiters;return this.options.delimiters=y,this.b(this.ct(c(d.call(h,w,p)),h,m)),this.options.delimiters=v,!1},ct:functio Line truncated
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
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=r.code,this.data={message:e}}};be.code="InternalError";var ia=class r extends Me{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};ia.code="UnsafeFilepathError";var Kn=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}},Kk=/[\ud800-￿]/;function Zk(r,e,t){if(t<55296||t>57343)return!1;if(t<56320){let i=e+1<r.length?r.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?r.charCodeAt(e-1):0;return n<55296||n>56319}function mh(r,e){if(!Kk.test(r)&&!Kk.test(e))return-(r<e)||+(r>e);let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=r.charCodeAt(n),s=e.charCodeAt(n);if(i!==s){if(Zk(r,n,i)&&(i=65533),Zk(e,n,s)&&(s=65533),i===s)continue;return i>=55296&&s>=55296&&(i+=i>=57344?-2048:8192,s+=s>=57344?-2048:8192),i<s?-1:1}}return r.length<e.length?-1:r.length>e.length?1:0}function AA(r,e){return mh(r.path,e.path)}function CA(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var qi=2**32;function Xk(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=Math.floor((t-i*1e3)*1e6);return[i,s]}function ao(r){let[e,t]=Xk(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=Xk(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%qi,ctimeNanoseconds:t%qi,mtimeSeconds:n%qi,mtimeNanoseconds:i%qi,dev:r.dev%qi,ino:r.ino%qi,mode:CA(r.mode%qi),uid:r.uid%qi,gid:r.gid%qi,size:r.size>-1?r.size%qi:0}}function NN(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var Ww=null;async function mi(r){return Ww===null&&(Ww=await HN()),Ww?TA(r):BN(r)}function BN(r){return new yv.default().update(r).digest("hex")}async function TA(r){let e=await crypto.subtle.digest("SHA-1",r);return NN(e)}async function HN(){try{return await TA(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function GN(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095,skipWorktree:!1,intentToAdd:!1}}var rv=16384,nv=8192;function iv(r){return!!(r.flags.skipWorktree||r.flags.intentToAdd)}function UN(r){let e=r.flags;return e.extended=iv(r),e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}function jN(r){return(r.flags.skipWorktree?rv:0)+(r.flags.intentToAdd?nv:0)}var sv=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(null);throw new be("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new be("Index file is empty (.git/index)");let t=new r,n=new Kn(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new be(`Invalid dircache magic file number: ${i}`);let s=await mi(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new be(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=n.readUInt32BE();if(a!==2&&a!==3)throw new be(`Unsupported dircache version: ${a}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();if(u.flags=GN(f),u Line truncated
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=iv(e),i=Math.ceil((62+(n?2:0)+t.length+1)/8)*8,s=_.alloc(i),o=new Kn(s),a=ao(e);return o.writeUInt32BE(a.ctimeSeconds),o.writeUInt32BE(a.ctimeNanoseconds),o.writeUInt32BE(a.mtimeSeconds),o.writeUInt32BE(a.mtimeNanoseconds),o.writeUInt32BE(a.dev),o.writeUInt32BE(a.ino),o.writeUInt32BE(a.mode),o.writeUInt32BE(a.uid),o.writeUInt32BE(a.gid),o.writeUInt32BE(a.size),o.write(e.oid,20,"hex"),o.writeUInt16BE(UN(e)),n&&o.writeUInt16BE(jN(e)),o.write(e.path,t.length,"utf8"),s}async toObject(){let e=_.alloc(12),t=new Kn(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(this.entriesFlat.some(iv)?3:2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let a of this.entries)if(n.push(r._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),o=await mi(s);return _.concat([s,_.from(o,"hex")])}};function nh(r,e,t=!0,n=!0){let i=ao(r),s=ao(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.mtimeNanoseconds!==s.mtimeNanoseconds||i.ctimeSeconds!==s.ctimeSeconds||i.ctimeNanoseconds!==s.ctimeNanoseconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var qw;function zN(){return qw===void 0&&(qw=new xA.default({maxPending:1/0})),qw}function ir(r,e){return zN().acquire(r,e)}var Yw=Symbol("IndexCache");function VN(){return{map:new Map,stats:new Map}}async function WN(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await sv.from(i);t.map.set(e,s),t.stats.set(e,n)}async function qN(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);if(i===null)return!1;if(nh(n,i))return!0;let s=ao(n),o=ao(i);return s.mtimeNanoseconds!==o.mtimeNanoseconds||s.ctimeNanoseconds!==o.ctimeNanoseconds}var Ct=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[Yw]||(n[Yw]=VN());let o=`${t}/index`,a,l=[];return await ir(o,async()=>{let c=n[Yw];await qN(e,o,c)&&await WN(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new _u(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}};function ih(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e>-1&&(r=r.slice(e+1)),r}function sa(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e===-1?".":e===0?"/":r.slice(0,e)}function RA(r){let e=new Map,t=function(i){if(!e.has(i)){let s={type:"tree",fullpath:i,basename:ih(i),metadata:{},children:[]};e.set(i,s),s.parent=t(sa(i)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(i)},n=function(i,s){if(!e.has(i)){let o={type:"blob",fullpath:i,basename:ih(i),metadata:s,parent:t(sa(i)),children:[]};o.parent&&o.parent.children.push(o),e.set(i,o)}return e.get(i)};t(".");for(let i of r)n(i.path,i);return e}function YN(r){switch(r){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new be(`Unexpected GitTree entry mode: ${r.toString(8)}`)}var ov=class{constructor({fs:e,gitdir:t,cache:n}){this.treePromise=Ct.acquire({fs:e,gitdir:t,cache:n},async function(s){return RA(s.entries)});let i=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,i=(await this.treePromise).get(t);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let s=i.children.map(o=>o.fullpath);return s.sort(mh),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:ao(n.metadata);e._type=n.type==="tree"?"tree":YN(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},gh=Symbol("GitWalkSymbol");function lo(){let r=Object.create(null);return Object.defineProperty(r,gh,{value:function({fs:e,gitdir:t,cache:n}){return new ov({fs:e,gitdir:t,cache:n})}}),Object.freeze(r),r}var Be=class r extends Me{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};Be.code="NotFoundError";var sr=class r extends Me{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};sr.code="ObjectTypeError";var co=class r extends Me{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),t Line truncated
[remote "${e}"]
fetch = +refs/heads/*:refs/remotes/origin/*
`),this.code=this.name=r.code,this.data={remote:e}}};xu.code="NoRefspecError";var sh=class r{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let t=null;this.parsedConfig=e.trim().split(`
`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let s=n.slice(1);return this.refs.set(t+"^{}",s),{line:n,ref:t,peeled:s}}else{let s=n.slice(0,i);return t=n.slice(i+1),this.refs.set(t,s),{line:n,ref:t,oid:s}}})}return this}static from(e){return new r(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(t=>t.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
`)+`
`}},oh=class r{constructor({remotePath:e,localPath:t,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:i})}static from(e){let[t,n,i,s,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),a=t==="+",l=i==="*";if(l!==(o==="*"))throw new be("Invalid refspec");return new r({remotePath:n,localPath:s,force:a,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}},av=class r{constructor(e=[]){this.rules=e}static from(e){let t=[];for(let n of e)t.push(oh.from(n));return new r(t)}add(e){let t=oh.from(e);this.rules.push(t)}translate(e){let t=[];for(let n of this.rules)for(let i of e){let s=n.translate(i);s&&t.push([i,s])}return t}translateOne(e){let t=null;for(let n of this.rules){let i=n.translate(e);i&&(t=i)}return t}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function KN(r,e){let t=r.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(t<n)||+(t>n);return i===0?r.endsWith("^{}")?1:-1:i}var ZN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function Al(r,e){if(typeof r!="string")throw new TypeError("Reference name must be a string");return!ZN.test(r)&&(!!e||r.includes("/"))}function XN(r,e){let t="",n=0,i=-1,s=0,o="\0";for(let a=0;a<=r.length;++a){if(a<r.length)o=r[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(i===a-1||s===1))if(s===2){if(t.length<2||n!==2||t.at(-1)!=="."||t.at(-2)!=="."){if(t.length>2){let l=t.lastIndexOf("/");l===-1?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=a,s=0;continue}else if(t.length!==0){t="",n=0,i=a,s=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,a):t=r.slice(i+1,a),n=a-i-1;i=a,s=0}else o==="."&&s!==-1?++s:s=-1}return t}function QN(r){return r.length>=2&&/^[a-zA-Z]:/.test(r)?r.slice(0,2):null}function JN(r){if(!r.length)return".";r=r.replace(/\\/g,"/");let e=QN(r),t=r[0]==="/"||e!==null&&r[2]==="/",n=r.at(-1)==="/",i=e?r.slice(2):r,s=XN(i,!t);if(!s.length){let o=e?t?e+"/":e:t?"/":".";return n&&!t?o+"/":o}return n&&(s+="/"),e?t?`${e}/${s}`:`${e}${s}`:t?`/${s}`:s}function B(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){let n=r[t].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":JN(e)}var eB=r=>{if(typeof r=="number")return r;r=r.toLowerCase();let e=parseInt(r);return r.endsWith("k")&&(e*=1024),r.endsWith("m")&&(e*=1024*1024),r.endsWith("g")&&(e*=1024*1024*1024),e},wu=r=>{if(typeof r=="boolean")return r;if(r=r.trim().toLowerCase(),r==="true"||r==="yes"||r==="on")return!0;if(r==="false"||r==="no"||r==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${r}`)},Qk={core:{filemode:wu,bare:wu,logallrefupdates:wu,symlinks:wu,ignorecase:wu,bigFileThreshold:eB}},tB=/^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/,rB=/^[A-Za-z0-9-.]+$/,nB=/^([A-Za-z][A-Za-z0-9-]*)(?:\s*=\s*(.*))?$/,iB=/^[A-Za-z][A-Za-z0-9-]*$/,sB=r=>{let e=tB.exec(r);if(e!=null){let[t,n]=e.slice(1);return[t,n&&n.replace(/\\(.)/g,"$1")]}return null},oB=r=>{let e=nB.exec(r);if(e!=null){let[t,n="true"]=e.slice(1);return[t,aB(n)]}return null},Jk=new Map([["t"," "],["b","\b"],["n",`
`],["\\","\\"],['"','"']]),aB=r=>{let e="",t="",n=!1;for(let i=0;i<r.length;i++){let s=r[i];if(!n&&/[ \t\r\v\f]/.test(s)){e!==""&&(t+=s);continue}if(!n&&(s==="#"||s===";"))break;e+=t,t="",s==="\\"&&Jk.has(r[i+1])?e+=Jk.get(r[++i]):s==='"'?n=!n:e+=s}return e},lB=r=>{if(typeof r!="string")return r;let e=r.startsWith(" ")||r.endsWith(" ")||/[#;]/.test(r)?'"':"",t=r.replace(/[\\"\n\t]/g,n=>n===`
`?"\\n":n===" "?"\\t":`\\${n}`);return`${e}${t}${e}`},eA=r=>r!=null?r.toLowerCase():null,lv=(r,e,t)=>[eA(r),e,eA(t)].filter(n=>n!=null).join("."),tA=r=>{let e=r.split("."),t=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:t,subsection:i,name:n,path:lv(t,i,n),sectionPath:lv(t,i,null),isSection:!!t}},cB=(r,e)=>r.reduce((t,n,i)=>e(n)?i:t,-1),cv=class r{constructor(e){let t=null,n=null;this.parsedConfig=e?e.split(`
`).map(i=>{let s=null,o=null,a=i.trim(),l=sB(a),c=l!=null;if(c)[t,n]=l;else{let f=oB(a);f!=null&&([s,o]=f)}let u=lv(t,n,s);return{line:i,isSection:c,section:t,subsection:n,name:s,value:o,path:u}}):[]}static from(e){return new r(e)}async get(e,t=!1){let n=tA(e).path,i=this.parsedConfig.filter(s=>s.path===n).map(({section:s,name:o,value:a})=>{let l=Qk[s]&&Qk[s][o];return l?l(a):a});return t?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(t=>t.isSection&&t.section===e).map(t=>t.subsection)}async deleteSection(e,t){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===t))}async append(e,t){return this.set(e,t,!0)}async set(e,t,n=!1){let{section:i,subsection:s,name:o,path:a,sectionPath:l,isSection:c}=tA(e),u=cB(this.parsedConfig,f=>f.path===a);if(t==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:o,value:t,modified:!0});n?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:s,name:o,value:t,modified:!0,path:a};if(rB.test(i)&&iB.test(o))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:i,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:t,subsection:n,name:i,value:s,modified:o=!1})=>o?i!=null&&s!=null?` ${i} = ${lB(s)}`:n!=null?`[${t} "${n}"]`:`[${t}]`:e).join(`
`)}},Tt=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:"utf8"});return cv.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:"utf8"})}},vu=r=>[`${r}`,`refs/${r}`,`refs/tags/${r}`,`refs/heads/${r}`,`refs/remotes/${r}`,`refs/remotes/${r}/HEAD`],uv=["config","description","index","shallow","commondir"];function ta(r){if(uv.includes(r))throw new _n(r,`refs/heads/${r}`);if(!Al(r,!0))throw new _n(r,na.default.clean(r))}var q=class r{static async updateRemoteRefs({fs:e,gitdir:t,remote:n,refs:i,symrefs:s,tags:o,refspecs:a=void 0,prune:l=!1,pruneTags:c=!1}){for(let y of i.values())if(!y.match(/[0-9a-f]{40}/))throw new co(y);let u=await Tt.get({fs:e,gitdir:t});if(!a){if(a=await u.getall(`remote.${n}.fetch`),a.length===0)throw new xu(n);a.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=av.from(a),d=new Map,h=f.translate([...i.keys()]),p=[];for(let[y,v]of f.translate([...s.keys()])){let A=f.translateOne(s.get(y));A&&(ta(A),p.push([v,`ref: ${A}`]))}let m=o?[...i.keys()].filter(y=>y.startsWith("refs/tags")&&!y.endsWith("^{}")):[];for(let[,y]of h)ta(y);for(let[y]of p)ta(y);if(m.forEach(ta),c){let y=await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"});await r.deleteRefs({fs:e,gitdir:t,refs:y.map(v=>`refs/tags/${v}`)})}for(let y of m)if(!await r.exists({fs:e,gitdir:t,ref:y})){let v=i.get(y);d.set(y,v)}for(let[y,v]of h){let A=i.get(y);d.set(v,A)}for(let[y,v]of p)d.set(y,v);let w=[];if(l){for(let y of f.localNamespaces()){let v=(await r.listRefs({fs:e,gitdir:t,filepath:y})).map(A=>`${y}/${A}`);for(let A of v)d.has(A)||w.push(A)}w.length>0&&await r.deleteRefs({fs:e,gitdir:t,refs:w})}for(let[y,v]of d)await ir(y,async()=>e.write(B(t,y),`${v.trim()}
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:t,ref:n,value:i}){if(ta(n),!i.match(/[0-9a-f]{40}/))throw new co(i);await ir(n,async()=>e.write(B(t,n),`${i.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:i}){ta(n),await ir(n,async()=>e.write(B(t,n),`ref: ${i.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:t,ref:n}){return r.deleteRefs({fs:e,gitdir:t,refs:[n]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){n.forEach(ta),await Promise.all(n.map(a=>e.rm(B(t,a))));let i=await ir("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"})),s=sh.from(i),o=s.refs.size;for(let a of n)s.refs.has(a)&&s.delete(a);s.refs.size<o&&(i=s.toString(),await ir("packed-refs",async()=>e.write(`${t}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:t,ref:n,depth:i=void 0,visited:s=new Set}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),r.resolve({fs:e,gitdir:t,ref:n,depth:i,visited:s});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let o=await r.packedRefs({fs:e,gitdir:t}),a=vu(n).filter(l=>!uv.includes(l));for(let l of a){let c=await ir(l,async()=>await e.read(`${t}/${l}`,{encoding:"utf8"})||o.get(l));if(c){if(s.has(l))throw new be(`Circular reference detected while resolving ref "${l}"`);return s.add(l),r.resolve({fs:e,gitdir:t,ref:c.trim(),depth:i,visited:s})}}throw new Be(n)}static async isUnbornBranch({fs:e,gitdir:t,ref:n}){let i;try{i=await r.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2})}catch(s){if(s instanceof Be)return!1;throw s}return i.startsWith("refs/heads/")?n==="HEAD"||vu(n).includes(i):!1}static async exists({fs:e,gitdir:t,ref:n}){try{return await r.expand({fs:e,gitdir:t,ref:n}),!0}catch(i){if(i instanceof Be)return!1;throw i}}static async expand({fs:e,gitdir:t,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await r.packedRefs({fs:e,gitdir:t}),s=vu(n).filter(o=>!uv.includes(o));for(let o of s)if(await ir(o,async()=>e.exists(`${t}/${o}`))||i.has(o))return o;throw new Be(n)}static async expandAgainstMap({ref:e,map:t}){let n=vu(e);for(let i of n)if(await t.has(i))return i;throw new Be(e)}static resolveAgainstMap({ref:e,fullref:t=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:t,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),r.resolveAgainstMap({ref:e,fullref:t,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:t,oid:e};let s=vu(e);for(let o of s){let a=i.get(o);if(a)return r.resolveAgainstMap({ref:a.trim(),fullref:o,depth:n,map:i})}throw new Be(e)}static async packedRefs({fs:e,gitdir:t}){let n=await ir("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"}));return sh.from(n).refs}static async listRefs({fs:e,gitdir:t,filepath:n}){let i=await r.packedRefs({fs:e,gitdir:t}),s=null;try{s=await e.readdirDeep(`${t}/${n}`),s=s.map(o=>o.replace(`${t}/${n}/`,""))}catch(o){s=[]}for(let o of i.keys())o.startsWith(n)&&(o=o.replace(n+"/",""),s.includes(o)||s.push(o));return s.sort(KN),s}static async listBranches({fs:e,gitdir:t,remote:n}){return n?r.listRefs({fs:e,gitdir:t,filepath:`refs/remotes/${n}`}):r.listRefs({fs:e,gitdir:t,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:t}){return(await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function uB(r,e){return mh(rA(r),rA(e))}function rA(r){return r.mode==="040000"?r.path+"/":r.path}function $A(r){switch(r){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new be(`Unexpected GitTree entry mode: ${r}`)}function fB(r){let e=[],t=0;for(;t<r.length;){let n=r.indexOf(32,t);if(n===-1)throw new be(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);let i=r.indexOf(0,t);if(i===-1)throw new be(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let s=r.slice(t,n).toString("utf8");s==="40000"&&(s="040000");let o=$A(s),a=r.slice(n+1,i).toString("utf8"),l=a.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),u=l.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(a.includes("\\")||a.includes("/")||l==="."||l===".."||u===".git"||/^\.?git~[1-9]$/.test(u))throw new ia(a);let f=r.slice(i+1,i+21).toString("hex");t=i+21,e.push({mode:s,path:a,oid:f,type:o})}return e}function dB(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new be(`Could not understand file mode: ${r}`)}function hB(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=dB(r.mode),r.type||(r.type=$A(r.mode)),r}var Zr=class r{constructor(e){if(_.isBuffer(e))this._entries=fB(e);else if(Array.isArray(e))this._entries=e.map(hB);else throw new be("invalid type passed to GitTree constructor");this._entries.sort(AA)}static from(e){return new r(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(uB),_.concat(e.map(t=>{let n=_.from(t.mode.replace(/^0/,"")),i=_.from(" "),s=_.from(t.path,"utf8"),o=_.from([0]),a=_.from(t.oid,"hex");return _.concat([n,i,s,o,a])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ss=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\0`,i=n.length,s=i+t.length,o=new Uint8Array(s);for(let a=0;a<i;a++)o[a]=n.charCodeAt(a);return o.set(t,i),o}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,t).toString("utf8"),s=e.slice(t+1,n).toString("utf8"),o=e.length-(n+1);if(parseInt(s)!==o)throw new be(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:i,object:_.from(e.slice(n+1))}}};async function PA({fs:r,gitdir:e,oid:t}){let n=`objects/${t.slice(0,2)}/${t.slice(2)}`,i=await r.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function IA(r,e){let t=new Kn(r),n=nA(t);if(n!==e.byteLength)throw new be(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=nA(t),s,o=sA(t,e);if(o.byteLength===i)s=o;else{let a=[o],l=o.byteLength;for(;!t.eof();){let c=sA(t,e);a.push(c),l+=c.byteLength}if(i!==l)throw new be(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`);s=_.concat(a,i)}return s}function nA(r){let e=0,t=0,n=null;do n=r.readUInt8(),e|=(n&127)<<t,t+=7;while(n&128);return e}function iA(r,e,t){let n=0,i=0;for(;t--;)e&1&&(n|=r.readUInt8()<<i),e>>=1,i+=8;return n}function sA(r,e){let t=r.readUInt8(),n=128,i=15,s=112;if(t&n){let o=iA(r,t&i,4),a=iA(r,(t&s)>>4,3);return a===0&&(a=65536),e.slice(o,o+a)}else return r.slice(t)}function pB(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function OA(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:pB(r)}var ah=class{constructor(e){if(typeof _=="undefined")throw new Error("Missing Buffer dependency");this.stream=OA(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:t}=await this.stream.next();return e&&(this._ended=!0,!t)?_.alloc(0):(t&&(t=_.from(t)),t)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let t=[this.buffer];for(;this.cursor+e>mB(t);){let n=await this._next();if(this._ended)break;t.push(n)}this.buffer=_.concat(t)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function mB(r){return r.reduce((e,t)=>e+t.length,0)}async function gB(r,e){let t=new ah(r),n=await t.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new be(`Invalid PACK header '${n}'`);let i=await t.read(4);if(i=i.readUInt32BE(0),i!==2)throw new be(`Invalid packfile version: ${i}`);let s=await t.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!t.eof()&&s--;){let o=t.tell(),{type:a,length:l,ofs:c,reference:u}=await wB(t),f=new ph.default.Inflate;for(;!f.result;){let d=await t.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new be(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new be("Inflated object size is different from that stated in packfile.");await t.undo(),await t.read(d.length-f.strm.avail_in);let h=t.tell();await e({data:f.result,type:a,num:s,offset:o,end:h,reference:u,ofs:c})}}}}async function wB(r){let e=await r.byte(),t=e>>4&7,n=e&15;if(e&128){let o=4;do e=await r.byte(),n|=(e&127)<<o,o+=7;while(e&128)}let i,s;if(t===6){let o=0;i=0;let a=[];do e=await r.byte(),i|=(e&127)<<o,o+=7,a.push(e);while(e&128);s=_.from(a)}return t===7&&(s=await r.read(20)),{type:t,l Line truncated
`,r}function lh(r){let[,e,t,n,i]=r.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:t,timestamp:Number(n),timezoneOffset:$B(i)}}function $B(r){let[,e,t,n]=r.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(t)*60+Number(n)),PB(n)}function PB(r){return r===0?r:-r}var Xr=class r{constructor(e){if(typeof e=="string")this._tag=e;else if(_.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=r.render(e);else throw new be("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new r(e)}static render(e){return`object ${e.object}
type ${e.type}
tag ${e.tag}
tagger ${dv(e.tagger)}
${e.message}
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
`),t=[];for(let s of e)s[0]===" "?t[t.length-1]+=`
`+s.slice(1):t.push(s);let n={},i=new Set;for(let s of t){let o=s.slice(0,s.indexOf(" ")),a=s.slice(s.indexOf(" ")+1);i.has(o)||(i.add(o),n[o]=a)}return n.tagger&&(n.tagger=lh(n.tagger)),n.committer&&(n.committer=lh(n.committer)),n}withoutSignature(){let e=Es(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 Es(e)}payload(){return this.withoutSignature()+`
`}toObject(){return _.from(this._tag,"utf8")}static async sign(e,t,n){let i=e.payload(),{signature:s}=await t({payload:i,secretKey:n});s=Es(s);let o=i+s;return r.from(o)}};function Zw(r){return r.trim().split(`
`).map(e=>" "+e).join(`
`)+`
`}function IB(r){return r.split(`
`).map(e=>e.replace(/^ /,"")).join(`
`)}var Qr=class r{constructor(e){if(typeof e=="string")this._commit=e;else if(_.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=r.render(e);else throw new be("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:t}){let n=r.justHeaders(e),i=r.justMessage(e),s=Es(n+`
gpgsig`+Zw(t)+`
`+i);return new r(s)}static from(e){return new r(e)}toObject(){return _.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return r.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Es(e.slice(e.indexOf(`
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
`))}parseHeaders(){let e=r.justHeaders(this._commit).split(`
`),t=[];for(let l of e)l[0]===" "?t[t.length-1]+=`
`+l.slice(1):t.push(l);let n={parent:[]},i=l=>l.slice(0,l.indexOf(" ")),s=l=>l.slice(l.indexOf(" ")+1);if(t.length===0||i(t[0])!=="tree")throw new gi("tree as the first commit header",i(t[0]||""));n.tree=s(t[0]);let o=1;for(;o<t.length&&i(t[o])==="parent";)n.parent.push(s(t[o])),o++;let a=new Set(["tree","parent"]);for(;o<t.length;o++){let l=i(t[o]);a.has(l)||(a.add(l),n[l]=s(t[o]))}return n.author&&(n.author=lh(n.author)),n.committer&&(n.committer=lh(n.committer)),n}static renderHeaders(e){let t="";if(e.tree?t+=`tree ${e.tree}
`:t+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
`,e.parent){if(e.parent.length===void 0)throw new be("commit 'parent' property should be an array");for(let s of e.parent)t+=`parent ${s}
`}let n=e.author;t+=`author ${dv(n)}
`;let i=e.committer||e.author;return t+=`committer ${dv(i)}
`,e.gpgsig&&(t+="gpgsig"+Zw(e.gpgsig)),t}static render(e){return r.renderHeaders(e)+`
`+Es(e.message)}render(){return this._commit}withoutSignature(){let e=Es(this._commit);if(e.indexOf(`
gpgsig`)===-1)return e;let t=e.slice(0,e.indexOf(`
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
`)+28);return Es(t+`
`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return IB(e)}static async sign(e,t,n){let i=e.withoutSignature(),s=r.justMessage(e._commit),{signature:o}=await t({payload:i,secretKey:n});o=Es(o);let l=r.justHeaders(e._commit)+`
gpgsig`+Zw(o)+`
`+s;return r.from(l)}};async function Ol({fs:r,cache:e,gitdir:t,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Zr.from([]),oid:n};let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=Xr.from(s).parse().object,Ol({fs:r,cache:e,gitdir:t,oid:n});if(i==="commit")return n=Qr.from(s).parse().tree,Ol({fs:r,cache:e,gitdir:t,oid:n});if(i!=="tree")throw new sr(n,i,"tree");return{tree:Zr.from(s),oid:n}}var hv=class{constructor({fs:e,gitdir:t,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=t,this.mapPromise=(async()=>{let o=new Map,a;try{a=await q.resolve({fs:e,gitdir:t,ref:n})}catch(c){if(c instanceof Be&&await q.isUnbornBranch({fs:e,gitdir:t,ref:n}))a="4b825dc642cb6eb9a060e54bf8d69288fbee4904";else throw c}let l=await Ol({fs:e,cache:this.cache,gitdir:t,oid:a});return l.type="tree",l.mode="40000",o.set(".",l),o})();let s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,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 t=e._fullpath,{fs:n,cache:i,gitdir:s}=this,o=await this.mapPromise,a=o.get(t);if(!a)throw new Error(`No obj for ${t}`);let l=a.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(a)}`);if(a.type!=="tree")return null;let{type:c,object:u}=await pt({fs:n,cache:i,gitdir:s,oid:l});if(c!==a.type)throw new sr(l,c,a.type);let f=Zr.from(u);for(let d of f)o.set(B(t,d.path),d);return f.entries().map(d=>B(t,d.path))}async type(e){if(e._type===!1){let t=await this.mapPromise,{type:n}=t.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let t=await this.mapPromise,{mode:n}=t.get(e._fullpath);e._mode=CA(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let t=await this.mapPromise,{fs:n,cache:i,gitdir:s}=this,a=t.get(e._fullpath).oid,{type:l,object:c}=await pt({fs:n,cache:i,gitdir:s,oid:a});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function mr({ref:r="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,gh,{value:function({fs:t,gitdir:n,cache:i}){return new hv({fs:t,gitdir:n,ref:r,cache:i})}}),Object.freeze(e),e}var pv=class{constructor({fs:e,dir:t,gitdir:n,cache:i,refresh:s=!0}){this.fs=e,this.cache=i,this.dir=t,this.gitdir=n,this.refresh=s,this.refreshQueue=[],this.flushed=!1,this.config=null;let o=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 o.type(this)}async mode(){return o.mode(this)}async stat(){return o.stat(this)}async content(){return o.content(this)}async oid(){return o.oid(this)}}}async readdir(e){if(await e.type()!=="tree")return null;let t=e._fullpath,{fs:n,dir:i}=this,s=await n.readdir(B(i,t));return s===null?null:s.map(o=>B(t,o))}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:t,dir:n}=this,i=await t.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=i.isDirectory()?"tree":"blob";s==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(s="special"),e._type=s,i=ao(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:t,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await t.readlink(`${n}/${e._fullpath}`);else{let a=await(await this._getGitConfig(t,i)).get("core.autocrlf");s=await t.read(`${n}/${e._fullpath}`,{autocrlf:a})}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 t=this,{fs:n,gitdir:i,cache:s}=this,o;await Ct.acquire({fs:n,gitdir:i,cache:s},async function(a){let l=a.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await t._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||nh(c,l,f,d)){let h=await e.content();h===void 0?o=void 0:(o=await mi(Ss.wrap({type:"blob",object:h})),t.refresh&&l&&!l.flags.intentToAdd&&o===l.oid&&(!f||c.mode===l.mode)&&nh(c,l,f,d)&&(t.flushed?a.insert({filepath:e._fullpath,stats:c,oid:o}):t.refreshQueue.push({filepath:e._fullpath,stage:l,stats:c,oid:o})))}else o=l.oid}),e._oid=o}return e._oid}async flush(){let{fs:e,gitdir:t,cache:n,refreshQueue:i}=this;this.refreshQueue=[],this.flushed=!0,i.length!==0&&await Ct.acquire({fs:e,gitdir:t,cache:n},async s=>{for(let{filepath:o,stage:a,stats:l,oid:c}of i)s.entriesMap.get(o)===a&&s.insert({filepath:o,stats:l,oid:c})})}async _getGitConfig(e,t){return this.config?this. Line truncated
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(sa(e)),await this._writeFile(e,t,n)}}async mkdir(e){await LA(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let t;try{t=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(bu(n))return[];throw n}return t.sort(mh),t}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(bu(t))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(bu(n))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};function I(r,e){if(e===void 0)throw new Kr(r)}function LB(r){return r.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(r)}async function le({fsp:r,dotgit:e}){I("fsp",r),I("dotgit",e);let t=await r._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return t.isDirectory()?e:t.isFile()?r._readFile(e,"utf8").then(n=>n.trimRight().substr(8)).then(n=>LB(n)?n:B(sa(e),n)):e}async function ch(r,e){return!r&&!e?!1:r&&!e||!r&&e?!0:!(await r.type()==="tree"&&await e.type()==="tree"||await r.type()===await e.type()&&await r.mode()===await e.mode()&&await r.oid()===await e.oid())}async function NB({fs:r,dir:e,gitdir:t=B(e,".git"),commit:n="HEAD",cache:i={}}){try{I("fs",r),I("dir",e),I("gitdir",t);let s=new re(r),o=[mr({ref:n}),Dl(),lo()],a=[],l=await le({fsp:s,dotgit:t});await Ct.acquire({fs:s,gitdir:l,cache:i},async function(u){a=u.unmergedPaths});let c=await vi({fs:s,cache:i,dir:e,gitdir:l,trees:o,map:async function(u,[f,d,h]){let p=!await ch(d,h),m=a.includes(u),w=!await ch(h,f);if(p||m)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(w)return!1;throw new Lu(u)}});await Ct.acquire({fs:s,gitdir:l,cache:i},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 uo=class{static async isIgnored({fs:e,dir:t,gitdir:n=B(t,".git"),filepath:i}){if(ih(i)===".git")return!0;if(i===".")return!1;let s="",o=B(n,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let a=[{gitignore:B(t,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");a.push({gitignore:B(t,f,".gitignore"),filepath:d})}let c=!1;for(let[u,f]of a.entries()){let d=await e.read(f.gitignore,"utf8"),h=(0,SA.default)();u===0&&h.add(s),h.add(d);let p=sa(f.filepath);if(p!=="."&&h.ignores(p))return!0;c?c=!h.test(f.filepath).unignored:c=h.test(f.filepath).ignored}return c}};async function BB({fs:r,gitdir:e,object:t,format:n,oid:i}){if(n!=="deflated")throw new be("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${i.slice(0,2)}/${i.slice(2)}`,o=`${e}/${s}`;await r.exists(o)||await r.write(o,t)}var Xw=null;async function NA(r){return Xw===null&&(Xw=GB()),Xw?HB(r):ph.default.deflate(r)}async function HB(r){let e=new CompressionStream("deflate"),t=new Blob([r]).stream().pipeThrough(e);return new Uint8Array(await new Response(t).arrayBuffer())}function GB(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(r){return!1}}async function Jr({fs:r,gitdir:e,type:t,object:n,format:i="content",oid:s=void 0,dryRun:o=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=Ss.wrap({type:t,object:n})),s=await mi(n),n=_.from(await NA(n))),o||await BB({fs:r,gitdir:e,object:n,format:"deflated",oid:s}),s}function BA(r){let e;for(;~(e=r.indexOf(92));)r[e]=47;return r}async function UB({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={},force:s=!1,parallel:o=!0}){try{I("fs",r),I("dir",e),I("gitdir",t),I("filepath",n);let a=new re(r),l=await le({fsp:a,dotgit:t});await Ct.acquire({fs:a,gitdir:l,cache:i},async c=>{let f=await(await Tt.get({fs:a,gitdir:l})).get("core.autocrlf");return wv({dir:e,gitdir:l,fs:a,filepath:n,index:c,force:s,parallel:o,autocrlf:f})})}catch(a){throw a.caller="git.add",a}}function jB(r,e){if(r.has({filepath:e}))return!0;let t=`${e}/`;for(let n of r.entriesMap.keys())if(n.startsWith(t))return!0;return!1}async function wv({dir:r,gitdir:e,fs:t,filepath:n,index:i,force:s,parallel:o,autocrlf:a}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!s&&!jB(i,d)&&await uo.isIgnored({fs:t,dir:r,gitdir:e,filepath: Line truncated
`,author:l,committer:c,signingKey:u})}async function YB({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i="refs/notes/commits",oid:s,note:o,force:a,author:l,committer:c,signingKey:u,cache:f={}}){try{I("fs",r),I("gitdir",n),I("oid",s),I("note",o),u&&I("onSign",e);let d=new re(r),h=await fo({fs:d,gitdir:n,author:l});if(!h)throw new gr("author");let p=await la({fs:d,gitdir:n,author:h,committer:c});if(!p)throw new gr("committer");let m=await le({fsp:d,dotgit:n});return await qB({fs:d,cache:f,onSign:e,gitdir:m,ref:i,oid:s,note:o,force:a,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function zA({fs:r,gitdir:e,remote:t,url:n,force:i}){if(!Al(t,!0))throw new _n(t,na.default.clean(t));let s=await Tt.get({fs:r,gitdir:e});if(!i&&(await s.getSubsections("remote")).includes(t)&&n!==await s.get(`remote.${t}.url`))throw new wi("remote",t);await s.set(`remote.${t}.url`,n),await s.set(`remote.${t}.fetch`,`+refs/heads/*:refs/remotes/${t}/*`),await Tt.save({fs:r,gitdir:e,config:s})}async function KB({fs:r,dir:e,gitdir:t=B(e,".git"),remote:n,url:i,force:s=!1}){try{I("fs",r),I("gitdir",t),I("remote",n),I("url",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await zA({fs:o,gitdir:a,remote:n,url:i,force:s})}catch(o){throw o.caller="git.addRemote",o}}async function ZB({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:r,gitdir:n,ref:i}))throw new wi("tag",i);let f=await q.resolve({fs:r,gitdir:n,ref:l||"HEAD"}),{type:d}=await pt({fs:r,cache:e,gitdir:n,oid:f}),h=Xr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:s,message:o,gpgsig:a});c&&(h=await Xr.sign(h,t,c));let p=await Jr({fs:r,gitdir:n,type:"tag",object:h.toObject()});await q.writeRef({fs:r,gitdir:n,ref:i,value:p})}async function XB({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1,cache:f={}}){try{I("fs",r),I("gitdir",n),I("ref",i),c&&I("onSign",e);let d=new re(r),h=await le({fsp:d,dotgit:n}),p=await fo({fs:d,gitdir:h,author:s});if(!p)throw new gr("tagger");return await ZB({fs:d,cache:f,onSign:e,gitdir:h,ref:i,tagger:p,message:o,gpgsig:a,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function QB({fs:r,gitdir:e,ref:t,object:n,checkout:i=!1,force:s=!1}){if(!Al(t,!0))throw new _n(t,na.default.clean(t));let o=`refs/heads/${t}`;if(!s&&await q.exists({fs:r,gitdir:e,ref:o}))throw new wi("branch",t,!1);let a;try{a=await q.resolve({fs:r,gitdir:e,ref:n||"HEAD"})}catch(l){if(!(l instanceof Be))throw l}a&&(a=(await Gu({fs:r,cache:{},gitdir:e,oid:a})).oid,await q.writeRef({fs:r,gitdir:e,ref:o,value:a})),i&&await q.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:o})}async function JB({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,object:i,checkout:s=!1,force:o=!1}){try{I("fs",r),I("gitdir",t),I("ref",n);let a=new re(r),l=await le({fsp:a,dotgit:t});return await QB({fs:a,gitdir:l,ref:n,object:i,checkout:s,force:o})}catch(a){throw a.caller="git.branch",a}}async function Hu(r,e,t){let n=t.split("/");n.pop();let i=e;for(let s of n){if(s===""||s===".")continue;i=`${i}/${s}`;let o=await r.lstat(i);if(o&&o.isSymbolicLink())throw new ia(t)}}var xv=(r,e)=>{if(r==="."||e==null||e.length===0||e===".")return!0;let t=e.endsWith("/")?e.slice(0,-1):e;return t==="."?!0:t.length>=r.length?t===r||t.startsWith(`${r}/`):r.startsWith(`${t}/`)};async function Ev({fs:r,cache:e,onProgress:t,onPostCheckout:n,dir:i,gitdir:s,remote:o,ref:a,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,restoreFromIndex:p=!1,nonBlocking:m=!1,batchSize:w=100}){let y;if(n)try{y=await q.resolve({fs:r,gitdir:s,ref:"HEAD"})}catch(A){y="0000000000000000000000000000000000000000"}let v;try{v=await q.resolve({fs:r,gitdir:s,ref:a})}catch(A){if(a==="HEAD"||!(A instanceof Be))throw A;let C=`${o}/${a}`;if(v=await q.resolve({fs:r,gitdir:s,ref:C}),h){let S=await Tt.get({fs:r,gitdir:s});await S.set(`branch.${a}.remote`,o),await S.set(`branch.${a}.merge`,`refs/heads/${a}`),await Tt.save({fs:r,gitdir:s,config:S})}await q.writeRef({fs:r,gitdir:s,ref:`refs/heads/${a}`,value:v})}if(!u)try{v=(await Gu({fs:r,cache:e,gitdir:s,oid:v})).oid}catch(A){throw A instanceof Be?new Tl(a,A.data.what):A}if(!c){let A;try{A=await eH({fs:r,cache:e,onProgress:t,dir:i,gitdir:s,ref:a,force:d,filepaths:l,restoreFromIndex:p})}catch(x){throw x instanceof Be&&x.data.what===v?new Tl(a,v):x}let C=A.filter(([x])=>x==="conflict").map(([x,E])=>E);if(C.length>0)throw new ku(C);let S=A.filter(([x])=>x==="error").map(([x,E])=>E);if(S.length>0)throw new be(S.join(", "));if(f){n&&await n({previousHead:y,newHead:v,type:l!=null&&l.length>0?"file":"branch"});return}let T=0,b=A.length;if(await Ct.acquire({fs:r,gitdir:s,cache:e},async function(x){await Promise.all(A.filter(([E])=>E==="delete"||E==="delete-index").map(async function([E,k]){let $=`${i}/${k}`;E==="delete"&&await r.rm($),x.delete({filepath:k}) Line truncated
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
`);return{cleanMerge:h,mergedText:d}}async function WA({fs:r,cache:e,dir:t,gitdir:n=B(t,".git"),index:i,ourOid:s,baseOid:o,theirOid:a,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=mr({ref:s}),m=mr({ref:o}),w=mr({ref:a}),y=[],v=[],A=[],C=[],S=await vi({fs:r,cache:e,dir:t,gitdir:n,trees:[p,m,w],map:async function(T,[b,x,E]){let k=ih(T),$=await ch(b,x),M=await ch(E,x);switch(`${$}-${M}`){case"false-false":return{mode:await x.mode(),path:k,oid:await x.oid(),type:await x.type()};case"false-true":return!E&&await b.type()==="tree"?{mode:await b.mode(),path:k,oid:await b.oid(),type:await b.type()}:E?{mode:await E.mode(),path:k,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!b&&await E.type()==="tree"?{mode:await E.mode(),path:k,oid:await E.oid(),type:await E.type()}:b?{mode:await b.mode(),path:k,oid:await b.oid(),type:await b.type()}:void 0;case"true-true":{if(b&&E&&await b.type()==="tree"&&await E.type()==="tree")return{mode:await b.mode(),path:k,oid:await b.oid(),type:"tree"};if(b&&E&&await b.type()==="blob"&&await E.type()==="blob")return iH({fs:r,gitdir:n,path:k,ours:b,base:x,theirs:E,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async D=>{if(D.cleanMerge)d||i.insert({filepath:T,oid:D.mergeResult.oid,stage:0});else if(y.push(T),v.push(T),!d){let P="";x&&await x.type()==="blob"&&(P=await x.oid());let F=await b.oid(),_e=await E.oid();i.delete({filepath:T}),P&&i.insert({filepath:T,oid:P,stage:1}),i.insert({filepath:T,oid:F,stage:2}),i.insert({filepath:T,oid:_e,stage:3})}return D.mergeResult});if(x&&!b&&E&&await x.type()==="blob"&&await E.type()==="blob"){if(y.push(T),A.push(T),!d){let D=await x.oid(),P=await E.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:D,stage:1}),i.insert({filepath:T,oid:P,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:k}}if(x&&b&&!E&&await x.type()==="blob"&&await b.type()==="blob"){if(y.push(T),C.push(T),!d){let D=await x.oid(),P=await b.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:D,stage:1}),i.insert({filepath:T,oid:P,stage:2})}return{mode:await b.mode(),oid:await b.oid(),type:"blob",path:k}}if(x&&!b&&!E&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new $l}}},reduce:y.length!==0&&(!t||d)?void 0:async(T,b)=>{let x=b.filter(Boolean);if(T&&!(T&&T.type==="tree"&&x.length===0&&T.path!==".")){if(x.length>0||T.path==="."&&x.length===0){let k=new Zr(x).toObject(),$=await Jr({fs:r,gitdir:n,type:"tree",object:k,dryRun:f});T.oid=$}return T}}});return y.length!==0?(t&&!d&&await vi({fs:r,cache:e,dir:t,gitdir:n,trees:[mr({ref:S.oid})],map:async function(T,[b]){let x=`${t}/${T}`;if(await b.type()==="blob"){let E=await b.mode(),k=await b.content();await r.write(x,k,{mode:E})}return!0}}),new oa(y,v,A,C)):S.oid}async function iH({fs:r,gitdir:e,path:t,ours:n,base:i,theirs:s,ourName:o,theirName:a,baseName:l,dryRun:c,mergeDriver:u=nH}){let f="blob",d="100755",h="",p="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),p=_.from(await i.content()).toString("utf8"));let m=d===await n.mode()?await s.mode():await n.mode();if(await n.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await n.oid(),type:f}};let w=_.from(await n.content()).toString("utf8"),y=_.from(await s.content()).toString("utf8"),{mergedText:v,cleanMerge:A}=await u({branches:[l,o,a],contents:[p,w,y],path:t}),C=await Jr({fs:r,gitdir:e,type:"blob",object:_.from(v,"utf8"),dryRun:c});return{cleanMerge:A,mergeResult:{mode:m,path:t,oid:C,type:f}}}var sH={stage:lo,workdir:Dl};async function oH(r,e,t,n,i=null){let s=B(t,n),o=await r.lstat(s);if(!o)throw new Be(s);if(o.isDirectory())throw new be(`${s}: file expected, but found directory`);let a=i?await PA({fs:r,gitdir:e,oid:i}):void 0,l=a?i:void 0;return a||await ir(s,async()=>{let c=o.isSymbolicLink()?await r.readlink(s).then(BA):await r.read(s);if(c===null)throw new Be(s);l=await Jr({fs:r,gitdir:e,type:"blob",object:c})}),l}async function aH({fs:r,dir:e,gitdir:t,entries:n}){async function i(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(i));s.oid=await ju({fs:r,gitdir:t,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await oH(r,t,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(n.map(i))}async function fA({fs:r,dir:e,gitdir:t,treePair:n}){let i=n[1]==="stage",s=n.map(h=>typeof h=="string"?sH[h]():h),o=[],u=await vi({fs:r,cache:{},dir:e,gitdir:t,trees:s,map:async(h,[p,m])=>{if(!(h==="."||await uo.isIgnored({fs:r,dir:e,gitdir:t,filepath:h}))&&m)return(!p||await p.oid()!==await m.oid()&&await m.oid()!==void 0)&&o.push([p,m]),{mode:await m.mode(),path:h,oid:await m.oid(),type:await m.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0?p Line truncated
`).map(o=>i.add(o))}),i}static async write({fs:e,gitdir:t,oids:n}){let i=B(t,"shallow");if(n.size>0){let s=[...n].join(`
`)+`
`;await ir(i,async function(){await e.write(i,s,{encoding:"utf8"})})}else await ir(i,async function(){await e.rm(i)})}};function fh({config:r,onAuth:e}){return e&&(async(t,n)=>{let i=n.username||await r.get(`credential.${t}.username`);return e(t,i?{...n,username:i}:n)})}function gH(r){let i="5041434b"+"00000002"+"00000000";return r.slice(0,12).toString("hex")===i}function KA(r,e){let t=r.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return t.includes(i)})}var vh={name:"isomorphic-git",version:"1.44.10",agent:"git/isomorphic-git@1.44.10"},kl=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 t=this._waiting;this._waiting=null,t({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 wH(r){let e=r.indexOf("\r"),t=r.indexOf(`
`);return e===-1&&t===-1?-1:e===-1?t+1:t===-1?e+1:t===e+1?t+1:Math.min(e,t)+1}function ZA(r){let e=new kl,t="";return(async()=>(await zu(r,n=>{for(n=n.toString("utf8"),t+=n;;){let i=wH(t);if(i===-1||i===t.length&&t[i-1]==="\r")break;e.write(t.slice(0,i)),t=t.slice(i)}}),t.length>0&&e.write(t),e.end()))(),e}var dh=class{static demux(e){let t=At.streamReader(e),n=new kl,i=new kl,s=new kl,o=async function(){let a=await t();if(a===null)return o();if(a===!0){n.end(),s.end(),e.error?i.destroy(e.error):i.end();return}switch(a[0]){case 1:{i.write(a.slice(1));break}case 2:{s.write(a.slice(1));break}case 3:{let l=a.slice(1);s.write(l),n.end(),s.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(a)}o()};return o(),{packetlines:n,packfile:i,progress:s}}};async function vH(r){let{packetlines:e,packfile:t,progress:n}=dh.demux(r),i=[],s=[],o=[],a=!1,l=!1;return new Promise((c,u)=>{zu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new co(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new co(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");o.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(a=!0,l=!0):(l=!0,a=!0);l&&(r.error?u(r.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:t,progress:n}))}).finally(()=>{l||(r.error?u(r.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:t,progress:n}))})})}function bH({capabilities:r=[],wants:e=[],haves:t=[],shallows:n=[],depth:i=null,since:s=null,exclude:o=[]}){let a=[];e=[...new Set(e)];let l=` ${r.join(" ")}`;for(let c of e)a.push(At.encode(`want ${c}${l}
`)),l="";for(let c of n)a.push(At.encode(`shallow ${c}
`));i!==null&&a.push(At.encode(`deepen ${i}
`)),s!==null&&a.push(At.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of o)a.push(At.encode(`deepen-not ${c}
`));a.push(At.flush());for(let c of t)a.push(At.encode(`have ${c}
`));return a.push(At.encode(`done
`)),a}async function Sv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:w=[],relative:y=!1,tags:v=!1,singleBranch:A=!1,headers:C={},prune:S=!1,pruneTags:T=!1}){let b=c||await po({fs:r,gitdir:l,test:!0}),x=await Tt.get({fs:r,gitdir:l}),E=f||b&&await x.get(`branch.${b}.remote`)||"origin",k=d||await x.get(`remote.${E}.url`);if(typeof k=="undefined")throw new Kr("remote OR url");let $=u||b&&await x.get(`branch.${b}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let M=Ml.getRemoteHelperFor({url:k}),D=await M.discover({http:t,onAuth:fh({config:x,onAuth:s}),onAuthSuccess:o,onAuthFailure:fh({config:x,onAuth:a}),corsProxy:h,service:"git-upload-pack",url:k,headers:C,protocolVersion:1}),P=D.auth,F=D.refs;if(F.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!D.capabilities.has("shallow"))throw new oo("shallow","depth");if(m!==null&&!D.capabilities.has("deepen-since"))throw new oo("deepen-since","since");if(w.length>0&&!D.capabilities.has("deepen-not"))throw new oo("deepen-not","exclude");if(y===!0&&!D.capabilities.has("deepen-relative"))throw new oo("deepen-relative","relative");let{oid:_e,fullref:Q}=q.resolveAgainstMap({ref:$,map:F});for(let ee of F.keys())ee===Q||ee==="HEAD"||ee.startsWith("refs/heads/")||v&&ee.startsWith("refs/tags/")||F.delete(ee);let oe=KA([...D.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${vh.agent}`]);y&&oe.push("deepen-relative");let fe=A?[_e]:F.values(),Z=A?[b]:await q.listRefs({fs:r,gitdir:l,filepath:"refs"}),Y=[];for(let ee of Z)try{ee=await q.expand({fs:r,gitdir:l,ref:ee});let Oe=await q.resolve({fs:r,gitdir:l,ref:ee});await vv({fs:r,cache:e,gitdir:l,oid:Oe})&&Y.push(Oe)}catch(Oe){}Y=[...new Set(Y)];let J=await ho.read({fs:r,gitdir:l}),U=D.capabilities.has("shallow")?[...J]:[],et=bH({capabilities:oe,wants:fe,haves:Y,shallows:U,depth:p,since:m,exclude:w}),se=_.from(await uh(et)),vt=await M.connect({http:t,onProgress:n,corsProxy:h,service:"git-upload-pack",url:k,auth:P,body:[se],headers:C}),tt=await vH(vt.body);vt.headers&&(tt.headers=vt.headers);for(let ee of tt.shallows)if(!J.has(ee))try{let{object:Oe}=await pt({fs:r,cache:e,gitdir:l,oid:ee}),Te=new Qr(Oe),bt=await Promise.all(Te.headers().parent.map(Vr=>vv({fs:r,cache:e,gitdir:l,oid:Vr})));bt.length===0||bt.every(Vr=>Vr)||J.add(ee)}catch(Oe){J.add(ee)}for(let ee of tt.unshallows)J.delete(ee);if(await ho.write({fs:r,gitdir:l,oids:J}),A){let ee=new Map([[Q,_e]]),Oe=new Map,Te=10,bt=Q;for(;Te--;){let jc=D.symrefs.get(bt);if(jc===void 0)break;Oe.set(bt,jc),bt=jc}let vn=F.get(bt);vn&&ee.set(bt,vn);let{pruned:Vr}=await q.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:ee,symrefs:Oe,tags:v,prune:S});S&&(tt.pruned=Vr)}else{let{pruned:ee}=await q.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:F,symrefs:D.symrefs,tags:v,prune:S,pruneTags:T});S&&(tt.pruned=ee)}if(tt.HEAD=D.symrefs.get("HEAD"),tt.HEAD===void 0){let{oid:ee}=q.resolveAgainstMap({ref:"HEAD",map:F});for(let[Oe,Te]of F.entries())if(Oe!=="HEAD"&&Te===ee){tt.HEAD=Oe;break}}let j=Q.startsWith("refs/tags")?"tag":"branch";if(tt.FETCH_HEAD={oid:_e,description:`${j} '${ra(Q)}' of ${k}`},n||i){let ee=ZA(tt.progress);zu(ee,async Oe=>{if(i&&await i(Oe),n){let Te=Oe.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);Te&&await n({phase:Te[1].trim(),loaded:parseInt(Te[2],10),total:parseInt(Te[3],10)})}})}let Ce=_.from(await uh(tt.packfile));if(vt.body.error)throw vt.body.error;let z=Ce.slice(-20).toString("hex"),we={defaultBranch:tt.HEAD,fetchHead:tt.FETCH_HEAD.oid,fetchHeadDescription:tt.FETCH_HEAD.description};if(tt.headers&&(we.headers=tt.headers),S&&(we.pruned=tt.pruned),z!==""&&!gH(Ce)){we.packfile=`objects/pack/pack-${z}.pack`;let ee=B(l,we.packfile);await r.write(ee,Ce);let Oe=bt=>pt({fs:r,cache:e,gitdir:l,oid:bt}),Te=await Eu.fromPack({pack:Ce,getExternalRefDelta:Oe,onProgress:n});await r.write(ee.replace(/\.pack$/,".idx"),await Te.toBuffer())}return we}async function XA({fs:r,bare:e=!1,dir:t,gitdir:n=e?t:B(t,".git"),defaultBranch:i="master"}){if(await r.exists(n+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(o=>n+"/"+o);for(let o of s)await r.mkdir(o);await r.write(n+"/config",`[core]
repositoryformatversion = 0
filemode = false
bare = ${e}
`+(e?"":` logallrefupdates = true
`)+` symlinks = false
ignorecase = true
`),await r.write(n+"/HEAD",`ref: refs/heads/${i}
`)}async function yH({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:w,exclude:y,relative:v,singleBranch:A,noCheckout:C,noTags:S,headers:T,nonBlocking:b,batchSize:x=100}){try{if(await XA({fs:r,gitdir:u}),await zA({fs:r,gitdir:u,remote:p,url:f,force:!1}),d){let $=await Tt.get({fs:r,gitdir:u});await $.set("http.corsProxy",d),await Tt.save({fs:r,gitdir:u,config:$})}let{defaultBranch:E,fetchHead:k}=await Sv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:w,exclude:y,relative:v,singleBranch:A,headers:T,tags:!S});if(k===null)return;h=h||E,h=h.replace("refs/heads/",""),await Ev({fs:r,cache:e,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:C,nonBlocking:b,batchSize:x})}catch(E){throw await r.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}async function _H({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:w=[],relative:y=!1,singleBranch:v=!1,noCheckout:A=!1,noTags:C=!1,headers:S={},cache:T={},nonBlocking:b=!1,batchSize:x=100}){try{I("fs",r),I("http",e),I("gitdir",c),A||I("dir",l),I("url",u);let E=new re(r),k=await le({fsp:E,dotgit:c});return await yH({fs:E,cache:T,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:k,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:w,relative:y,singleBranch:v,noCheckout:A,noTags:C,headers:S,nonBlocking:b,batchSize:x})}catch(E){throw E.caller="git.clone",E}}async function xH({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:m={}}){try{I("fs",r),l||I("message",i),a&&I("onSign",e);let w=new re(r),y=await le({fsp:w,dotgit:n});return await Uu({fs:w,cache:m,onSign:e,gitdir:y,message:i,author:s,committer:o,signingKey:a,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(w){throw w.caller="git.commit",w}}async function EH({fs:r,dir:e,gitdir:t=B(e,".git"),fullname:n=!1,test:i=!1}){try{I("fs",r),I("gitdir",t);let s=new re(r),o=await le({fsp:s,dotgit:t});return await po({fs:s,gitdir:o,fullname:n,test:i})}catch(s){throw s.caller="git.currentBranch",s}}async function SH({fs:r,gitdir:e,ref:t}){if(t=t.startsWith("refs/heads/")?t:`refs/heads/${t}`,!await q.exists({fs:r,gitdir:e,ref:t}))throw new Be(t);let i=await q.expand({fs:r,gitdir:e,ref:t}),s=await po({fs:r,gitdir:e,fullname:!0});if(i===s){let l=await q.resolve({fs:r,gitdir:e,ref:i});await q.writeRef({fs:r,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:r,gitdir:e,ref:i});let o=ra(t),a=await Tt.get({fs:r,gitdir:e});await a.deleteSection("branch",o),await Tt.save({fs:r,gitdir:e,config:a})}async function kH({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await SH({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function AH({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});await q.deleteRef({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function CH({fs:r,gitdir:e,remote:t}){let n=await Tt.get({fs:r,gitdir:e});await n.deleteSection("remote",t),await Tt.save({fs:r,gitdir:e,config:n})}async function TH({fs:r,dir:e,gitdir:t=B(e,".git"),remote:n}){try{I("fs",r),I("remote",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await CH({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function RH({fs:r,gitdir:e,ref:t}){t=t.startsWith("refs/tags/")?t:`refs/tags/${t}`,await q.deleteRef({fs:r,gitdir:e,ref:t})}async function $H({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await RH({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function PH({fs:r,gitdir:e,oid:t}){let n=t.slice(0,2);return(await r.readdir(`${e}/objects/${n}`)).map(s=>`${n}${s}`).filter(s=>s.startsWith(t))}async function IH({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i}){let s=[],o=await r.readdir(B(t,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${t}/objects/pack/${a}`,c=await _v({fs:r,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new be(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&s.push(u)}return s}async function OH({fs:r,cache:e,gitdir:t,oid:n}){let i=a=>pt({fs:r,cache:e,gitdir:t,oid:a}),s=await PH({fs:r,gitdir:t,oid:n}),o=await IH({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i});for(let a of o)s.indexOf(a)===-1&&s.push(a);if(s.length===1)return s[0];throw s.length>1?new Su("oids",n,s):new Be(`an object matching "${nLine truncated
`)),n.push(At.encode(`agent=${vh.agent}
`)),(t||e||r)&&n.push(At.delim()),t&&n.push(At.encode("peel")),e&&n.push(At.encode("symrefs")),r&&n.push(At.encode(`ref-prefix ${r}`)),n.push(At.flush()),n}async function l3({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{I("http",r),I("url",s);let d=await Fl.discover({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(d.protocolVersion===1)return tC(d,c,u,f);let h=await a3({prefix:c,symrefs:u,peelTags:f}),p=await Fl.connect({http:r,auth:d.auth,headers:o,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,body:h});return o3(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function c3({fs:r,dir:e,gitdir:t=B(e,".git")}){try{I("fs",r),I("gitdir",t);let n=new re(r),i=await le({fsp:n,dotgit:t});return q.listTags({fs:n,gitdir:i})}catch(n){throw n.caller="git.listTags",n}}function u3(r,e){return r.committer.timestamp-e.committer.timestamp}var f3="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function _A({fs:r,cache:e,gitdir:t,oid:n,fileId:i}){if(i===f3)return;let s=n,o,a=await Ol({fs:r,cache:e,gitdir:t,oid:n}),l=a.tree;return i===a.oid?o=a.path:(o=await iC({fs:r,cache:e,gitdir:t,tree:l,fileId:i,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function iC({fs:r,cache:e,gitdir:t,tree:n,fileId:i,oid:s,filepaths:o=[],parentPath:a=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=B(a,c.path),o.push(u)):c.type==="tree"&&(u=pt({fs:r,cache:e,gitdir:t,oid:c.oid}).then(function({object:f}){return iC({fs:r,cache:e,gitdir:t,tree:Zr.from(f),fileId:i,oid:s,filepaths:o,parentPath:B(a,c.path)})})),u});return await Promise.all(l),o}async function d3({fs:r,cache:e,gitdir:t,filepath:n,ref:i,depth:s,since:o,author:a,force:l,follow:c,includeChanges:u}){let f=typeof o=="undefined"?void 0:Math.floor(o.valueOf()/1e3),d=a==null?void 0:new RegExp(a,"i"),h=({commit:x})=>d===void 0?!0:x.author?d.test(`${x.author.name} <${x.author.email}>`):!1,p=[],m=x=>{h(x)&&p.push(x)},w=await ho.read({fs:r,gitdir:t}),y=await q.resolve({fs:r,gitdir:t,ref:i}),v=[await Yi({fs:r,cache:e,gitdir:t,oid:y})],A,C,S,T;function b(x){T&&n&&m(x)}for(;v.length>0;){let x=v.pop();if(f!==void 0&&x.commit.committer.timestamp<=f)break;if(n){let E;try{E=await UA({fs:r,cache:e,gitdir:t,oid:x.commit.tree,filepath:n}),S&&(A!==E.oid||C!==E.mode)&&m(S),A=E.oid,C=E.mode,S=x,T=!0}catch(k){if(k instanceof Be){let $=c&&A;if($&&($=await _A({fs:r,cache:e,gitdir:t,oid:x.commit.tree,fileId:A}),$))if(Array.isArray($)){if(S){let M=await _A({fs:r,cache:e,gitdir:t,oid:S.commit.tree,fileId:A});if(Array.isArray(M))if($=$.filter(D=>M.indexOf(D)===-1),$.length===1)$=$[0],n=$,S&&m(S);else{$=!1,S&&m(S);break}}}else n=$,S&&m(S);if(!$){if(T&&A&&(m(S),!l))break;if(!l&&!c)throw k}S=x,T=!1}else throw k}}else m(x);if(s!==void 0&&p.length===s){b(x);break}if(!w.has(x.oid))for(let E of x.commit.parent){let k=await Yi({fs:r,cache:e,gitdir:t,oid:E});v.map($=>$.oid).includes(k.oid)||v.push(k)}v.length===0&&b(x),v.sort((E,k)=>u3(E.commit,k.commit))}if(u)for(let x of p)x.commit.changes=await h3({fs:r,cache:e,gitdir:t,commit:x,shallow:w.has(x.oid)});return p}async function h3({fs:r,cache:e,gitdir:t,commit:n,shallow:i}){let s=i||!n.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":n.commit.parent[0];return vi({fs:r,cache:e,gitdir:t,trees:[mr({ref:n.oid}),mr({ref:s})],map:async(o,[a,l])=>{let[c,u]=await Promise.all([a&&a.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),o]:void 0;if(u==="tree")return c?[await a.oid(),null,o]:void 0;let[f,d]=await Promise.all([a?a.oid():null,l?l.oid():null]);if(f!==d)return[f,d,o]}})}async function p3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,ref:i="HEAD",depth:s,since:o,author:a,force:l,follow:c,includeChanges:u=!1,cache:f={}}){try{I("fs",r),I("gitdir",t),I("ref",i);let d=new re(r),h=await le({fsp:d,dotgit:t});return await d3({fs:d,cache:f,gitdir:h,filepath:n,ref:i,depth:s,since:o,author:a,force:l,follow:c,includeChanges:u})}catch(d){throw d.caller="git.log",d}}async function m3({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:w,allowUnrelatedHistories:y=!1}){try{I("fs",r),p&&I("onSign",e);let v=new re(r),A=await le({fsp:v,dotgit:n}),C=await fo({fs:v,gitdir:A,author:d});if(!C&&(!a||!o))throw new gr("author");let S=await la({fs:v,gitdir:A,author:C,committer:h});if(!S&&(!a||!o))throw new gr("committer");return await QA({fs:v,cache:m,dir:t,gitdir:A,ours:i,theirs:s,fastForward:o,fastForwardOnly:a,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:C,committer:S,signingKey:p,onSign:e,mergeDriver:w,allowUnrelatedHistories:y})}catch(v){throw v.caller="git.merge",v}}var g3={commit:16,tree:32,blob:48,tag:64,ofs_d Line truncated
`),i=await n();let s=t.toString("utf8").split(`
`);if(i=s.shift(),!i.startsWith("unpack "))throw new gi('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let a=o.slice(0,2),l=o.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:a==="ok",error:f}}return e}async function x3({capabilities:r=[],triplets:e=[]}){let t=[],n=`\0 ${r.join(" ")}`;for(let i of e)t.push(At.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
`)),n="";return t.push(At.flush()),t}async function E3({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:w,headers:y={},signal:v}){let A=u||await po({fs:r,gitdir:c});if(typeof A=="undefined")throw new Kr("ref");let C=await Tt.get({fs:r,gitdir:c});d=d||await C.get(`branch.${A}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${A}.remote`)||"origin";let S=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof S=="undefined")throw new Kr("remote OR url");let T=f||await C.get(`branch.${A}.merge`);if(typeof S=="undefined")throw new Kr("remoteRef");w===void 0&&(w=await C.get("http.corsProxy"));let b=await q.expand({fs:r,gitdir:c,ref:A}),x=m?"0000000000000000000000000000000000000000":await q.resolve({fs:r,gitdir:c,ref:b}),E=Ml.getRemoteHelperFor({url:S}),k=await E.discover({http:t,onAuth:fh({config:C,onAuth:s}),onAuthSuccess:o,onAuthFailure:fh({config:C,onAuth:a}),corsProxy:w,service:"git-receive-pack",url:S,headers:y,protocolVersion:1,signal:v}),$=k.auth,M;if(!T)M=b;else try{M=await q.expandAgainstMap({ref:T,map:k.refs})}catch(U){if(U instanceof Be)M=T.startsWith("refs/")?T:`refs/heads/${T}`;else throw U}let D=k.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:S,localRef:{ref:m?"(delete)":b,oid:x},remoteRef:{ref:M,oid:D}}))throw new Il;let P=!k.capabilities.has("no-thin"),F=new Set;if(!m){let U=[...k.refs.values()],et=new Set;if(D!=="0000000000000000000000000000000000000000"){let se=[];try{se=await kv({fs:r,cache:e,gitdir:c,oids:[x,D]})}catch(vt){se=[]}for(let vt of se)U.push(vt);P&&(et=await tv({fs:r,cache:e,gitdir:c,oids:se}))}if(!U.includes(x)){let se=await y3({fs:r,cache:e,gitdir:c,start:[x],finish:U});F=await tv({fs:r,cache:e,gitdir:c,oids:se})}if(P){try{let se=await q.resolve({fs:r,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:vt}=await q.resolveAgainstMap({ref:se.replace(`refs/remotes/${d}/`,""),fullref:se,map:k.refs}),tt=[vt];for(let j of await tv({fs:r,cache:e,gitdir:c,oids:tt}))et.add(j)}catch(se){}for(let se of et)F.delete(se)}if(x===D&&(p=!0),!p){if(b.startsWith("refs/tags")&&D!=="0000000000000000000000000000000000000000")throw new Pl("tag-exists");if(x!=="0000000000000000000000000000000000000000"&&D!=="0000000000000000000000000000000000000000"&&!await rC({fs:r,cache:e,gitdir:c,oid:x,ancestor:D,depth:-1}))throw new Pl("not-fast-forward")}}let _e=KA([...k.capabilities],["report-status","side-band-64k",`agent=${vh.agent}`]),Q=await x3({capabilities:_e,triplets:[{oldoid:D,oid:x,fullRef:M}]}),oe=m?[]:await sC({fs:r,cache:e,gitdir:c,oids:[...F]}),fe=await E.connect({http:t,onProgress:n,corsProxy:w,service:"git-receive-pack",url:S,auth:$,headers:y,body:[...Q,...oe],signal:v}),{packfile:Z,progress:Y}=await dh.demux(fe.body);if(i){let U=ZA(Y);zu(U,async et=>{await i(et)})}let J=await _3(Z);if(fe.headers&&(J.headers=fe.headers),d&&J.ok&&J.refs[M].ok&&!b.startsWith("refs/tags")){let U=`refs/remotes/${d}/${M.replace("refs/heads/","")}`;m?await q.deleteRef({fs:r,gitdir:c,ref:U}):await q.writeRef({fs:r,gitdir:c,ref:U,value:x})}if(J.ok&&Object.values(J.refs).every(U=>U.ok))return J;{let U=Object.entries(J.refs).filter(([et,se])=>!se.ok).map(([et,se])=>`
- ${et}: ${se.error}`).join("");throw new Iu(U,J)}}async function S3({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:w,headers:y={},cache:v={},signal:A}){try{I("fs",r),I("http",e),I("gitdir",c);let C=new re(r),S=await le({fsp:C,dotgit:c});return await E3({fs:C,cache:v,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,gitdir:S,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:w,headers:y,signal:A})}catch(C){throw C.caller="git.push",C}}async function oC({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=Xr.from(s).parse().object,oC({fs:r,cache:e,gitdir:t,oid:n});if(i!=="blob")throw new sr(n,i,"blob");return{oid:n,blob:new Uint8Array(s)}}async function aC({fs:r,cache:e,gitdir:t,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await wh({fs:r,cache:e,gitdir:t,oid:n,filepath:i})),await oC({fs:r,cache:e,gitdir:t,oid:n})}async function Nl({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,filepath:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let o=new re(r),a=await le({fsp:o,dotgit:t});return await aC({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function lC({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await Yi({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readCommit",s}}async function k3({fs:r,cache:e,gitdir:t,ref:n="refs/notes/commits",oid:i}){let s=await q.resolve({gitdir:t,fs:r,ref:n}),{blob:o}=await aC({fs:r,cache:e,gitdir:t,oid:s,filepath:i});return o}async function A3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n="refs/notes/commits",oid:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("ref",n),I("oid",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await k3({fs:o,cache:s,gitdir:a,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function C3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,format:i="parsed",filepath:s=void 0,encoding:o=void 0,cache:a={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let l=new re(r),c=await le({fsp:l,dotgit:t});s!==void 0&&(n=await wh({fs:l,cache:a,gitdir:c,oid:n,filepath:s}));let f=await pt({fs:l,cache:a,gitdir:c,oid:n,format:i==="parsed"?"content":i});if(f.oid=n,i==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Qr.from(f.object).parse();break;case"tree":f.object=Zr.from(f.object).entries();break;case"blob":o?f.object=f.object.toString(o):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Xr.from(f.object).parse();break;default:throw new sr(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 T3({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n,format:"content"});if(i!=="tag")throw new sr(n,i,"tag");let o=Xr.from(s);return{oid:n,tag:o.parse(),payload:o.payload()}}async function R3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await T3({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readTag",s}}async function $3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,filepath:i=void 0,cache:s={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let o=new re(r),a=await le({fsp:o,dotgit:t});return await Ll({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function P3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("filepath",n);let s=new re(r),o=await le({fsp:s,dotgit:t});await Ct.acquire({fs:s,gitdir:o,cache:i},async function(a){let l=Array.isArray(n)?n:[n];for(let c of l)a.delete({filepath:c})})}catch(s){throw s.caller="git.remove",s}}async function I3({fs:r,cache:e,onSign:t,gitdir:n,ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l}){let c;try{c=await q.resolve({gitdir:n,fs:r,ref:i})}catch(p){if(!(p instanceof Be))throw p}let f=(await Ll({fs:r,cache:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await ju({fs:r,gitdir:n,tree:f});return await Uu({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:o,committer:a,signingKey:l})}async function O3({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l,cache:c={}}){try{I("fs",r),I("gitdir",n),I("oid",s);let u=new re(r),f=await le({fsp:u,dotgit:n}),d=await fo({fs:u,gitdir:f,author:o});if(!d)throw new gr("author");let h=await la({fs:u,gitdir:f,author:d,committer:a});if(!h)throw new gr("committer");return await I3({fs:u,cache:c,onSign:e,gitdir:f,ref:i,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function F3({fs:r,gitdir:e,oldref:t,ref:n,checkout:i=!1}){if(!Al(n,!0))throw new _n(n,na.default.clean(n));if(!Al(t,!0))throw new _n(t,na.default.clean(t));let s=`refs/heads/${t}`,o=`refs/heads/${n}`;if(await q.exists({fs:r,gitdir:e,ref:o}))throw new wi("branch",n,!1);let l=await q.resolve({fs:r,gitdir:e,ref:s,depth:1});await q.writeRef({fs:r,gitdir:e,ref:o,value:l}),await q.deleteRef({fs:r,gitdir:e,ref:s});let u=await po({fs:r,gitdir:e,fullname:!0})===s;(i||u)&&await q.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:o})}async function M3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,oldref:i,checkout:s=!1}){try{I("fs",r),I("gitdir",t),I("ref",n),I("oldref",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await F3({fs:o,gitdir:a,ref:n,oldref:i,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}async function cC({gitdir:r,type:e,object:t}){return mi(Ss.wrap({type:e,object:t}))}async function D3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,ref:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("filepath",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l,c;try{l=await q.resolve({fs:o,gitdir:a,ref:i||"HEAD"})}catch(d){if(i||!(d instanceof Be))throw d}if(l)try{l=await wh({fs:o,cache:s,gitdir:a,oid:l,filepath:n})}catch(d){if(!(d instanceof Be)&&!(d instanceof ks)&&!(d instanceof sr&&d.data.filepath))throw 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 o.read(B(e,n));f&&(c=await cC({gitdir:a,type:"blob",object:f}),l===c&&(u=await o.lstat(B(e,n)))),await Ct.acquire({fs:o,gitdir:a,cache:s},async function(d){d.delete({filepath:n}),l&&d.insert({filepath:n,stats:u,oid:l})})}catch(o){throw o.caller="git.reset",o}}async function L3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,depth:i}){try{I("fs",r),I("gitdir",t),I("ref",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await q.resolve({fs:s,gitdir:o,ref:n,depth:i})}catch(s){throw s.caller="git.resolveRef",s}}async function N3({fs:r,dir:e,gitdir:t=B(e,".git"),path:n,value:i,append:s=!1}){try{I("fs",r),I("gitdir",t),I("path",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l=await Tt.get({fs:o,gitdir:a});s?await l.append(n,i):await l.set(n,i),await Tt.save({fs:o,gitdir:a,config:l})}catch(o){throw o.caller="git.setConfig",o}}async function uC({fs:r,gitdir:e,commit:t}){let n=Qr.from(t).toObject();return await Jr({fs:r,gitdir:e,type:"commit",object:n,format:"content"})}var hh=class r{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${t.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,t,n){let i=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),a=r.timezoneOffsetForRefLogEntry;return`${s} ${t} ${i} ${e.email} ${o} ${a} ${n}
`}static getStashReflogEntry(e,t=!1){return e.split(`
`).filter(s=>s).reverse().map((s,o)=>t?`stash@{${o}}: ${s.split(" ")[1]}`:s)}},ca=class r{constructor({fs:e,dir:t,gitdir:n=B(t,".git")}){Object.assign(this,{fs:e,dir:t,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return B(this.gitdir,r.refStash)}get refLogsStashPath(){return B(this.gitdir,r.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await fo({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new gr("author");return this._author}async getStashSHA(e,t){return await this.fs.exists(this.refStashPath)?(t||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:t,parent:n}){return uC({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:t,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let t=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>t.length-1))throw new _n(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,t);return n?Yi({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:r.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:t}){let n=await this.getAuthor(),i=hh.createStashReflogEntry(n,e,t),s=this.refLogsStashPath;await ir(s,async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let t=await this.fs.read(this.refLogsStashPath,"utf8");return hh.getStashReflogEntry(t,e)}};async function fC({fs:r,dir:e,gitdir:t,message:n=""}){let i=new ca({fs:r,dir:e,gitdir:t});await i.getAuthor();let s=await po({fs:r,gitdir:t,fullname:!1}),o=await q.resolve({fs:r,gitdir:t,ref:"HEAD"}),l=(await lC({fs:r,dir:e,gitdir:t,oid:o})).commit.message,c=[o],u=null,f=mr({ref:"HEAD"}),d=await fA({fs:r,dir:e,gitdir:t,treePair:[mr({ref:"HEAD"}),"stage"]});if(d){let w=await i.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(w),u=d,f=lo()}let h=await fA({fs:r,dir:e,gitdir:t,treePair:[f,"workdir"]});if(h){let w=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(w),u=h}if(!u||!d&&!h)throw new Be("changes, nothing to stash");let p=(n.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${l}`;return{stashCommit:await i.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:i}}async function B3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i,stashMsg:s,branch:o,stashMgr:a}=await fC({fs:r,dir:e,gitdir:t,message:n});return await a.writeStashRef(i),await a.writeStashReflogEntry({stashCommit:i,message:s}),await VA({fs:r,dir:e,gitdir:t,ref:o,track:!1,force:!0}),i}async function H3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i}=await fC({fs:r,dir:e,gitdir:t,message:n});return i}async function dC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let s=await new ca({fs:r,dir:e,gitdir:t}).readStashCommit(n),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let a=0;a<o.length-1;a++){let c=(await Yi({fs:r,cache:{},gitdir:t,oid:o[a+1]})).commit.message.startsWith("stash-Index");await qA({fs:r,dir:e,gitdir:t,stashCommit:o[a+1],parentCommit:o[a],wasStaged:c})}}async function hC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let i=new ca({fs:r,dir:e,gitdir:t});if(!(await i.readStashCommit(n)).commit)return;let o=i.refStashPath;await ir(o,async()=>{await r.exists(o)&&await r.rm(o)});let a=await i.readStashReflogs({parsed:!1});if(!a.length)return;a.splice(n,1);let l=i.refLogsStashPath;await ir(l,async()=>{if(a.length){await r.write(l,a.reverse().join(`
`)+`
`,"utf8");let c=a[a.length-1].split(" ")[1];await i.writeStashRef(c)}else await r.rm(l)})}async function G3({fs:r,dir:e,gitdir:t}){return new ca({fs:r,dir:e,gitdir:t}).readStashReflogs({parsed:!0})}async function U3({fs:r,dir:e,gitdir:t}){let n=new ca({fs:r,dir:e,gitdir:t}),i=[n.refStashPath,n.refLogsStashPath];await ir(i,async()=>{await Promise.all(i.map(async s=>{if(await r.exists(s))return r.rm(s)}))})}async function j3({fs:r,dir:e,gitdir:t,refIdx:n=0}){await dC({fs:r,dir:e,gitdir:t,refIdx:n}),await hC({fs:r,dir:e,gitdir:t,refIdx:n})}async function z3({fs:r,dir:e,gitdir:t=B(e,".git"),op:n="push",message:i="",refIdx:s=0}){I("fs",r),I("dir",e),I("gitdir",t),I("op",n);let o={push:B3,apply:dC,drop:hC,list:G3,clear:U3,pop:j3,create:H3},a=["apply","drop","pop"];try{let l=new re(r),c=await le({fsp:l,dotgit:t});["refs","logs","logs/refs"].map(d=>B(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=o[n];if(f){if(a.includes(n)&&s<0)throw new _n(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:i,refIdx:s})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function V3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={},refresh:s=!0}){try{I("fs",r),I("gitdir",t),I("filepath",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l=await q3({fs:o,cache:i,gitdir:a}),c=await pC({fs:o,cache:i,gitdir:a,tree:l,path:n}),u=await Ct.acquire({fs:o,gitdir:a,cache:i},async function(w){for(let y of w)if(y.path===n)return y;return null});if(c===null&&u===null&&await uo.isIgnored({fs:o,gitdir:a,dir:e,filepath:n}))return"ignored";let f=await o.lstat(B(e,n)),d=c!==null,h=u!==null,p=f!==null&&(d||h||await W3({fs:o,dir:e,filepath:n})),m=async()=>{if(h&&!nh(u,f))return u.oid;{let y=await(await Tt.get({fs:o,gitdir:a})).get("core.autocrlf"),v=await o.read(B(e,n),{autocrlf:y}),A=await cC({gitdir:a,type:"blob",object:v});return s&&h&&!u.flags.intentToAdd&&u.oid===A&&f.size!==-1&&await Ct.acquire({fs:o,gitdir:a,cache:i},async function(C){C.insert({filepath:n,stats:f,oid:A})}),A}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await m()===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 m()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let w=await m();return w===c?w===u.oid?"unmodified":"*unmodified":w===u.oid?"modified":"*modified"}}catch(o){throw o.caller="git.status",o}}async function W3({fs:r,dir:e,filepath:t}){let n=t.replace(/\\/g,"/").split("/").filter(s=>s!==""&&s!=="."),i=e;for(let s of n){let o;try{o=await r._readdir(i)}catch(a){if(a.code==="ENOENT"||a.code==="ENOTDIR")return!1;throw a}if(!o.some(a=>a.normalize()===s.normalize()))return!1;i=B(i,s)}return!0}async function pC({fs:r,cache:e,gitdir:t,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let s=i.shift();for(let o of n)if(o.path===s){if(i.length===0)return o.oid;let{type:a,object:l}=await pt({fs:r,cache:e,gitdir:t,oid:o.oid});if(a==="tree"){let c=Zr.from(l);return pC({fs:r,cache:e,gitdir:t,tree:c,path:i})}if(a==="blob")throw new sr(o.oid,a,"blob",i.join("/"))}return null}async function q3({fs:r,cache:e,gitdir:t}){let n;try{n=await q.resolve({fs:r,gitdir:t,ref:"HEAD"})}catch(s){if(s instanceof Be)return[];throw s}let{tree:i}=await Ll({fs:r,cache:e,gitdir:t,oid:n});return i}async function Y3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:s,cache:o={},ignored:a=!1,refresh:l=!0}){try{I("fs",r),I("gitdir",t),I("ref",n);let c=new re(r),u=await le({fsp:c,dotgit:t});return await vi({fs:c,cache:o,dir:e,gitdir:u,trees:[mr({ref:n}),Dl({refresh:l}),lo()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!a&&await uo.isIgnored({fs:c,dir:e,filepath:f})||!i.some(x=>xv(f,x)))return null;if(s&&!s(f))return;let[m,w,y]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),v=[m,w,y].includes("blob");if((m==="tree"||m==="special")&&!v)return;if(m==="commit")return null;if((w==="tree"||w==="special")&&!v)return;if(y==="commit")return null;if((y==="tree"||y==="special")&&!v)return;let A=m==="blob"?await d.oid():void 0,C=y==="blob"?await p.oid():void 0,S;m!=="blob"&&w==="blob"&&y!=="blob"?S="42":w==="blob"&&(S=await h.oid());let T=[void 0,A,S,C],b=T.map(x=>T.indexOf(x));return b.shift(),[f,...b]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function K3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,object:i,force:s=!1}){try{I("fs",r),I("gitdir",t),I("ref",n);let o=new re(r);if(n===void 0)throw new Kr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let a=await le({fsp:o,dotgit:t}),l=await q.resolve({fs:o,gitdir:a,ref:i||"HEAD"});if(!s&&await q.exists({fs:o,gitdir:a,ref:n}))throw new wi("tag",n);await q.writeRef({fs:o,gitdir:a,ref:n,value:l})}catch(o){throw o.caller="git.tag",o}}async function Z3({fs:r,dir:e,gitdir:t=B(e,".git"),cache:n={},filepath:i,oid:s,mode:o,add:a,remove:l,force:c}){try{I("fs",r),I("gitdir",t),I("filepath",i) Line truncated
if ! command -v curl >/dev/null 2>&1; then
echo "Obsidian Git authentication requires curl" >&2
exit 1
fi
printf '%s\\n%s' "$OBSIDIAN_GIT_ASKPASS_TOKEN" "$1" | curl -q \\
--silent --show-error --fail --noproxy '*' --proto '=http' \\
--max-time 600 --data-binary @- \\
--header 'Content-Type: application/octet-stream' \\
"http://127.0.0.1:$OBSIDIAN_GIT_ASKPASS_PORT/askpass"
`,wC=["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"];g();g();g();var Vu=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let o=v=>{if(v=this.postProcess(v,n),i){setTimeout(function(){i(v)},0);return}else return v},a=t.length,l=e.length,c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,w=1/0,y=()=>{for(let v=Math.max(m,-c);v<=Math.min(w,c);v+=2){let A,C=h[v-1],S=h[v+1];C&&(h[v-1]=void 0);let T=!1;if(S){let x=S.oldPos-v;T=S&&0<=x&&x<a}let b=C&&C.oldPos+1<l;if(!T&&!b){h[v]=void 0;continue}if(!b||T&&C.oldPos<S.oldPos?A=this.addToPath(S,!0,!1,0,n):A=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(A,t,e,v,n),A.oldPos+1>=l&&p+1>=a)return o(this.buildValues(A.lastComponent,t,e))||!0;h[v]=A,A.oldPos+1>=l&&(w=Math.min(w,v-1)),p+1>=a&&(m=Math.max(m,v+1))}c++};if(i)(function v(){setTimeout(function(){if(c>u||Date.now()>d)return i(void 0);y()||v()},0)})();else for(;c<=u&&Date.now()<=d;){let v=y();if(v)return v}}addToPath(e,t,n,i,s){let o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,s){let o=t.length,a=n.length,l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],t[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,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i=[],s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();let o=i.length,a=0,l=0,c=0;for(;a<o;a++){let u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=t.slice(l,l+u.count);f=f.map(function(d,h){let p=n[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(t.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};g();var Rv=class extends Vu{constructor(){super(...arguments),this.tokenize=l8}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),t.endsWith(`
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},a8=new Rv;function $v(r,e,t){return a8.diff(r,e,t)}function l8(r,e){e.stripTrailingCr&&(r=r.replace(/\r\n/g,`
`));let t=[],n=r.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let s=n[i];i%2&&!e.newlineIsToken?t[t.length-1]+=s:t.push(s)}return t}g();function c8(r){for(let e=0;e<r.length;e++)if(r[e]<" "||r[e]>"~"||r[e]==='"'||r[e]==="\\")return!0;return!1}function vo(r){if(!c8(r))return r;let e='"',t=new TextEncoder().encode(r),n=0;for(;n<t.length;){let i=t[n];i===7?e+="\\a":i===8?e+="\\b":i===9?e+="\\t":i===10?e+="\\n":i===11?e+="\\v":i===12?e+="\\f":i===13?e+="\\r":i===34?e+='\\"':i===92?e+="\\\\":i>=32&&i<=126?e+=String.fromCharCode(i):e+="\\"+i.toString(8).padStart(3,"0"),n++}return e+='"',e}var Pv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Iv(r,e,t,n,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context=="undefined"&&(a.context=4);let l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){let{callback:u}=a;$v(t,n,Object.assign(Object.assign({},a),{callback:f=>{let d=c(f);u(d)}}))}else return c($v(t,n,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(v){return v.map(function(A){return" "+A})}let d=[],h=0,p=0,m=[],w=1,y=1;for(let v=0;v<u.length;v++){let A=u[v],C=A.lines||u8(A.value);if(A.lines=C,A.added||A.removed){if(!h){let S=u[v-1];h=w,p=y,S&&(m=l>0?f(S.lines.slice(-l)):[],h-=m.length,p-=m.length)}for(let S of C)m.push((A.added?"+":"-")+S);A.added?y+=C.length:w+=C.length}else{if(h)if(C.length<=l*2&&v<u.length-2)for(let S of f(C))m.push(S);else{let S=Math.min(C.length,l);for(let b of f(C.slice(0,S)))m.push(b);let T={oldStart:h,oldLines:w-h+S,newStart:p,newLines:y-p+S,lines:m};d.push(T),h=0,p=0,m=[]}w+=C.length,y+=C.length}}for(let v of d)for(let A=0;A<v.lines.length;A++)v.lines[A].endsWith(`
`)?v.lines[A]=v.lines[A].slice(0,-1):(v.lines.splice(A+1,0,"\\ No newline at end of file"),A++);return{oldFileName:r,newFileName:e,oldHeader:i,newHeader:s,hunks:d}}}function Eh(r,e){var t,n,i,s,o,a;if(e||(e=Pv),Array.isArray(r)){if(r.length>1&&!e.includeFileHeaders&&!r.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 r.map(u=>Eh(u,e)).join(`
`)}let l=[];if(r.isGit){if(e=Pv,!r.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!r.newFileName)throw new Error("newFileName must be specified for Git patches");let u=r.oldFileName,f=r.newFileName;r.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):r.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+vo(u)+" "+vo(f)),r.isDelete&&l.push("deleted file mode "+((t=r.oldMode)!==null&&t!==void 0?t:"100644")),r.isCreate&&l.push("new file mode "+((n=r.newMode)!==null&&n!==void 0?n:"100644")),r.oldMode&&r.newMode&&!r.isDelete&&!r.isCreate&&(l.push("old mode "+r.oldMode),l.push("new mode "+r.newMode)),r.isRename&&(l.push("rename from "+vo(((i=r.oldFileName)!==null&&i!==void 0?i:"").replace(/^a\//,""))),l.push("rename to "+vo(((s=r.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),r.isCopy&&(l.push("copy from "+vo(((o=r.oldFileName)!==null&&o!==void 0?o:"").replace(/^a\//,""))),l.push("copy to "+vo(((a=r.newFileName)!==null&&a!==void 0?a:"").replace(/^b\//,""))))}else e.includeIndex&&r.oldFileName==r.newFileName&&r.oldFileName!==void 0&&l.push("Index: "+r.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=r.hunks.length>0;e.includeFileHeaders&&r.oldFileName!==void 0&&r.newFileName!==void 0&&(!r.isGit||c)&&(l.push("--- "+vo(r.oldFileName)+(r.oldHeader?" "+r.oldHeader:"")),l.push("+++ "+vo(r.newFileName)+(r.newHeader?" "+r.newHeader:"")));for(let u=0;u<r.hunks.length;u++){let f=r.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 vC(r,e,t,n,i,s,o){if(typeof o=="function"&&(o={callback:o}),o!=null&&o.callback){let{callback:a}=o;Iv(r,e,t,n,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?Eh(l,o.headerOptions):void 0)}}))}else{let a=Iv(r,e,t,n,i,s,o);return a?Eh(a,o==null?void 0:o.headerOptions):void 0}}function Wu(r,e,t,n,i,s){return vC(r,r,e,t,n,i,s)}function u8(r){let e=r.endsWith(`
`),t=r.split(`
`).map(n=>n+`
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}g();var f8=nt(Vw(),1),EC=nt(Qg(),1),SC=nt(Jg(),1),d8=nt(ew(),1),h8=nt(rw(),1),p8=nt(Lw(),1);var De=class r extends Error{constructor(e){super(e),this.caller=""}toJSON(){let e=this;return{code:e.code,data:e.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let t=new r(e.message),n=t;return n.code=e.code,n.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}},Sh=class r extends De{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=r.code,this.data={filepaths:e}}};Sh.code="UnmergedPathsError";var Zn=class r extends De{constructor(e){super(`An internal error caused this command to fail.
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
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=r.code,this.data={message:e}}};Zn.code="InternalError";var kh=class r extends De{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};kh.code="UnsafeFilepathError";var qu=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}},bC=/[\ud800-￿]/;function yC(r,e,t){if(t<55296||t>57343)return!1;if(t<56320){let i=e+1<r.length?r.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?r.charCodeAt(e-1):0;return n<55296||n>56319}function m8(r,e){if(!bC.test(r)&&!bC.test(e))return-(r<e)||+(r>e);let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=r.charCodeAt(n),s=e.charCodeAt(n);if(i!==s){if(yC(r,n,i)&&(i=65533),yC(e,n,s)&&(s=65533),i===s)continue;return i>=55296&&s>=55296&&(i+=i>=57344?-2048:8192,s+=s>=57344?-2048:8192),i<s?-1:1}}return r.length<e.length?-1:r.length>e.length?1:0}function g8(r,e){return m8(r.path,e.path)}function w8(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var Ki=2**32;function _C(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=Math.floor((t-i*1e3)*1e6);return[i,s]}function Bl(r){let[e,t]=_C(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=_C(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%Ki,ctimeNanoseconds:t%Ki,mtimeSeconds:n%Ki,mtimeNanoseconds:i%Ki,dev:r.dev%Ki,ino:r.ino%Ki,mode:w8(r.mode%Ki),uid:r.uid%Ki,gid:r.gid%Ki,size:r.size>-1?r.size%Ki:0}}function v8(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var Ov=null;async function xC(r){return Ov===null&&(Ov=await y8()),Ov?kC(r):b8(r)}function b8(r){return new EC.default().update(r).digest("hex")}async function kC(r){let e=await crypto.subtle.digest("SHA-1",r);return v8(e)}async function y8(){try{return await kC(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function _8(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095,skipWorktree:!1,intentToAdd:!1}}var Dv=16384,Lv=8192;function Nv(r){return!!(r.flags.skipWorktree||r.flags.intentToAdd)}function x8(r){let e=r.flags;return e.extended=Nv(r),e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}function E8(r){return(r.flags.skipWorktree?Dv:0)+(r.flags.intentToAdd?Lv:0)}var Bv=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(null);throw new Zn("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new Zn("Index file is empty (.git/index)");let t=new r,n=new qu(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new Zn(`Invalid dircache magic file number: ${i}`);let s=await xC(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new Zn(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=n.readUInt32BE();if(a!==2&&a!==3)throw new Zn(`Unsupported dircache version: ${a}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();if(u.flags=_8(f),u Line truncated
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=Nv(e),i=Math.ceil((62+(n?2:0)+t.length+1)/8)*8,s=_.alloc(i),o=new qu(s),a=Bl(e);return o.writeUInt32BE(a.ctimeSeconds),o.writeUInt32BE(a.ctimeNanoseconds),o.writeUInt32BE(a.mtimeSeconds),o.writeUInt32BE(a.mtimeNanoseconds),o.writeUInt32BE(a.dev),o.writeUInt32BE(a.ino),o.writeUInt32BE(a.mode),o.writeUInt32BE(a.uid),o.writeUInt32BE(a.gid),o.writeUInt32BE(a.size),o.write(e.oid,20,"hex"),o.writeUInt16BE(x8(e)),n&&o.writeUInt16BE(E8(e)),o.write(e.path,t.length,"utf8"),s}async toObject(){let e=_.alloc(12),t=new qu(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(this.entriesFlat.some(Nv)?3:2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let a of this.entries)if(n.push(r._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),o=await xC(s);return _.concat([s,_.from(o,"hex")])}};function S8(r,e,t=!0,n=!0){let i=Bl(r),s=Bl(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.mtimeNanoseconds!==s.mtimeNanoseconds||i.ctimeSeconds!==s.ctimeSeconds||i.ctimeNanoseconds!==s.ctimeNanoseconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var Fv;function k8(){return Fv===void 0&&(Fv=new SC.default({maxPending:1/0})),Fv}function A8(r,e){return k8().acquire(r,e)}var Mv=Symbol("IndexCache");function C8(){return{map:new Map,stats:new Map}}async function T8(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await Bv.from(i);t.map.set(e,s),t.stats.set(e,n)}async function R8(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);if(i===null)return!1;if(S8(n,i))return!0;let s=Bl(n),o=Bl(i);return s.mtimeNanoseconds!==o.mtimeNanoseconds||s.ctimeNanoseconds!==o.ctimeNanoseconds}var Ah=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[Mv]||(n[Mv]=C8());let o=`${t}/index`,a,l=[];return await A8(o,async()=>{let c=n[Mv];await R8(e,o,c)&&await T8(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new Sh(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}},Hv=class r extends De{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=r.code,this.data={value:e}}};Hv.code="InvalidOidError";var Gv=class r extends De{constructor(e,t){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${t}".)`),this.code=this.name=r.code,this.data={ref:e,suggestion:t}}};Gv.code="InvalidRefNameError";var Uv=class r extends De{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=r.code,this.data={remote:e}}};Uv.code="NoRefspecError";var jv=class r extends De{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};jv.code="NotFoundError";var zv=class r extends De{constructor(e,t,n){super(`HTTP Error: ${e} ${t}`),this.code=this.name=r.code,this.data={statusCode:e,statusMessage:t,response:n}}};zv.code="HttpError";var Vv=class r extends De{constructor(e,t){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=r.code,this.data={preview:e,response:t}}};Vv.code="SmartHttpError";var Wv=class r extends De{constructor(){super("The operation was canceled."),this.code=this.name=r.code,this.data={}}};Wv.code="UserCanceledError";var qv=class r extends De{constructor(){super("Empty response from git server."),this.code=this.name=r.code,this.data={}}};qv.code="EmptyServerResponseError";var Yv=class r extends De{constructor(e,t){super(`Expected "${e}" but received "${t}".`),this.code=this.name=r.code,this.data={expected:e,actual:t}}};Yv.code="ParseError";var Kv=class r extends De{constructor(e,t,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${t}"`),this.code=this.name=r.code,this.data={url:e,transport:t,suggestion:n}}};Kv.code="UnknownTransportError";var Zv=class r extends De{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=r.code,this.data={url:e}}};Zv.code="UrlParseError";var Xv=class r extends De{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};Xv.code="ObjectTypeError";var Qv=class r extends De{constructor(e){super(`Invalid compressed buffer: ${e}`),this.code=this.name=r.code,this.data={message:e}}};Qv.code="DecompressionError";var vY=32*1024*1024;var Jv=class r extends De{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=r.code,this.data={role:e}}};Jv.code="MissingNameError";var e0=class r extends De{constructor(e,t,n=!0){super(`Failed to create ${e} at ${t} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=r.code,this.data={noun:e,where:t,canForce:n}}};e0.code="AlreadyExistsError";var t0=class r extends De{constructor(e,t,n){super(`Found multiple ${e} matching "${t}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=r.code,this.data={nouns:e,short:t,matches:n}}};t0.code="AmbiguousError";var r0=class r extends De{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};r0.code="CheckoutConflictError";var n0=class r extends De{constructor(e){super(`Your local changes to the following files would be overwritten by cherry-pick: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};n0.code="CherryPickLocalChangesError";var i0=class r extends De{constructor(e,t){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${t} parents and require specifying which parent to use as the base.`),this.code=this.name=r.code,this.data={oid:e,parentCount:t}}};i0.code="CherryPickMergeCommitError";var s0=class r extends De{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=r.code,this.data={oid:e}}};s0.code="CherryPickRootCommitError";var o0=class r extends De{constructor(e,t){super(`Failed to checkout "${e}" because commit ${t} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=r.code,this.data={ref:e,oid:t}}};o0.code="CommitNotFetchedError";var a0=class r extends De{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=r.code,this.data={}}};a0.code="EmptyCommitError";var l0=class r extends De{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=r.code,this.data={}}};l0.code="FastForwardError";var c0=class r extends De{constructor(e,t){super(`One or more branches were not updated: ${e}`),this.code=this.name=r.code,this.data={prettyDetails:e,result:t}}};c0.code="GitPushError";var u0=class r extends De{constructor(e){let t="invalid filepath";e==="leading-slash"||e==="trailing-slash"?t='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(t='"filepath" should not be a directory.'),super(t),this.code=this.name=r.code,this.data={reason:e}}};u0.code="InvalidFilepathError";var f0=class r extends De{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=r.code,this.data={depth:e}}};f0.code="MaxDepthError";var d0=class r extends De{constructor(){super("Merges Line truncated
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(IC(e)),await this._writeFile(e,t,n)}}async mkdir(e){await OC(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let t;try{t=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(Yu(n))return[];throw n}return t.sort($8),t}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(Yu(t))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(Yu(n))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};var bi=require("obsidian");g();function FC(r,e){let{autoCommitOnlyStaged:t,...n}=e,i=Object.assign({},r.lineAuthor,e.lineAuthor),s=Object.assign({},r,n,{lineAuthor:i});return t&&(s.autoCommitGlobMode="include",s.autoCommitGlobs=""),s}var Hl=class extends Error{constructor(t){super("No network connection available");this.originalError=t}},Xn=class extends Error{constructor(t,n){super("Git operation stopped because of merge conflicts");this.files=t;this.cause=n;this.name="GitConflictError"}};g();var MC=require("obsidian"),L8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},_t=class extends MC.SuggestModal{constructor(e,t){if(super(e.app),this.config={...L8,...t},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button git-show-password"});i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.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,t){this.config.obscure?t.hide():t.setText(e)}onChooseSuggestion(e,t){if(this.resolve){let n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};g();var oT=nt(sT(),1);function aT(r){return r.split(`
`).map(e=>e.trim()).filter(e=>e.length>0)}function bG(r){return r.replace(/\\.|[()]/g,e=>e.length===1?`\\${e}`:e)}function yG(r){let e=r.map(t=>({matches:(0,oT.default)(bG(t.replace(/\/+$/,"")||t),{dot:!0,nobrace:!0,noext:!0,nonegate:!0,posix:!0}),directoryOnly:t.endsWith("/"),literalDirectory:!t.includes("*")&&!t.includes("?")&&!t.includes("[")}));return t=>{let n=t.split("/");return e.some(({matches:i,directoryOnly:s,literalDirectory:o})=>{if(!s&&i(t))return!0;if(!o)return!1;for(let a=1;a<n.length;a++)if(i(n.slice(0,a).join("/")))return!0;return!1})}}function P0(r){if(r.mode==="include"&&r.globs.length===0)return()=>!1;let e=yG(r.globs);return t=>r.mode==="include"?e(t):!e(t)}g();var AT=nt(kT(),1),CT=require("child_process"),Cs=require("obsidian");function ef(r,e,t){return r===1?`${r} ${e}`:`${r} ${t!=null?t:e+"s"}`}var F0=(r,e)=>r==="."||e==null||e.length===0||e==="."?!0:e.length>=r.length?e.startsWith(r):r.startsWith(e);function En(r,e){let t;if(e){if(e.button===0||e.button===1){let n=Cs.Keymap.isModEvent(e);t=r.workspace.getLeaf(n)}}else t=r.workspace.getLeaf(!1);return t}function Ar(r){return r.getRoot().side==="left"?"right":"left"}function Zi(r,e,t,n,i){if(e.button==2){let s=r.vault.getAbstractFileByPath(t);if(s!=null){let o=new Cs.Menu;r.workspace.trigger("file-menu",o,s,i,n),o.showAtPosition({x:e.pageX,y:e.pageY})}else{let o=new Cs.Menu;r.workspace.trigger("obsidian-git:menu",o,t,i,n),o.showAtPosition({x:e.pageX,y:e.pageY})}}}function bo(r){throw new Error(`Impossible branch: ${String(r)}`)}function M0(r){return`rgb(${r.r},${r.g},${r.b})`}function TT(r){var s;let e=(s=AT.fromString(r))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[t,n,i]=e;return{r:t,g:n,b:i}}function RT(r){return r.diff(Cs.moment.unix(0),"seconds")}function $T(r){if(r.length!==0)return r.slice().sort()[Math.floor(r.length/2)]}function tf(r,e){return new Proxy(r,{get(t,n){return n==="length"?Math.min(e,t.length):t[n]}})}function PT(r,e,t){return r.length<=e?new Array(e-r.length).fill(t).join("")+r:r.substring(r.length-e)}function IT(r,e){if(e<=0)return r;let t=new Array(e).fill(" ").join(""),n=r.substring(e,r.length);return t+n}function D0(r,e,t){return r<=e&&e<=t}function yo(r){let[e,...t]=r.split("/");return[e!=null?e:"",t.length===0?void 0:t.join("/")]}function Qn(r){return r.endsWith("/")?r:r.split("/").last().replace(/\.md$/,"")}function MG(r){let e=r.lastIndexOf(".");return r.substring(e+1)}function ua(r){if(r.endsWith(".md"))return!1;let e=MG(r);return wC.includes(e)}function L0(r){return(r.startsWith("https://github.com/")||r.startsWith("https://gitlab.com/"))&&(r.endsWith(".git")||(r=r+".git")),r}function zl(r,e){let t=e.vault.getAbstractFileByPath(r);if(!(t instanceof Cs.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(t.extension)}catch(n){return!0}}function OT({isFolder:r,gitRelativePath:e}){let t="/";return t+=e,r&&(t+="/"),t.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function Vl(r,e,t,n){let i=e.target;r.workspace.trigger("hover-link",{event:e,source:t.getViewType(),hoverParent:t,targetEl:i,linktext:n})}function rf(r,e,t={}){return new Promise((n,i)=>{let s=(0,CT.spawn)(r,e,t),o="",a="";s.stdout.on("data",l=>{o+=l.toString()}),s.stderr.on("data",l=>{a+=l.toString()}),s.on("error",l=>{n({error:new Error(l.message),stdout:o,stderr:a,code:1})}),s.on("close",l=>{n({stdout:o,stderr:a,code:l!=null?l:1,error:void 0})})})}g();var FT=require("os"),Ih=require("obsidian");var Wl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,t){var n;this.plugin.setPluginState({operation:e});try{return await t()}finally{(n=this.plugin.statusBar)==null||n.clearProgress(!1),this.plugin.setPluginState({operation:0})}}getRelativeVaultPath(e){return this.plugin.settings.basePath?e===""||e==="."?this.plugin.settings.basePath:this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,t=!0){if(t){let n=this.plugin.settings.basePath;if(n&&n.length>0){if(e.startsWith(n+"/"))return e.substring(n.length+1);if(e===n)return""}}return e}getVaultPathspec(){}isPathInsideVault(e){let t=this.getVaultPathspec();return t==null||e===t||e.startsWith(t+"/")}unload(){}simplify(e){var t,n,i,s;for(let o of e){for(;;){let a=((t=o.children)==null?void 0:t.length)==1,l=((i=(n=o.children)==null?void 0:n.first())==null?void 0:i.data)==null;if(!(o.children!=null&&a&&l))break;let c=o.children.first();o.title+="/"+c.title,o.data=c.data,o.path=c.path,o.vaultPath=c.vaultPath,o.children=c.children}o.children!=null&&this.simplify(o.children),(s=o.children)==null||s.sort((a,l)=>{let c=(l.data==null?1:0)-(a.data==null?1:0);return c!=0?c:a.title.localeCompare(l.title)})}return e.sort((o,a)=>{let l=(a.data==null?1:0)-(o.data==null?1:0);return l!=0?l:o.title.localeCompare(a.title)})}getTreeStructure(e,t="repository"){let n=new Map;for(let a of e){let c=(t==="vault"?a.vaultPath:a.path).split("/"),u=n,f="";for(let d=0;d<c.length;d++){let h=c[d];f=f?f+"/"+h:h;let p=d===c.length-1,m=u.get(h);if(!m){let w= Line truncated
`),n.stagedOutsideVault>0&&(i+=`${i?`
`:""}${n.stagedOutsideVault} staged file${n.stagedOutsideVault===1?"":"s"} outside the vault`)):i="Too many files to list",e=e+`
Affected files:
`+i}return e}};g();var or=require("obsidian"),Oh={uid:0,gid:0,ino:0,dev:0},Fh=class extends Error{constructor(t){super(`File not found: ${t}`);this.code="ENOENT";this.name="FileNotFoundError"}},Mh=class{constructor(e,t){this.plugin=t;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,t){var i;if(e===void 0)return;if(e=(0,or.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(t)),(typeof t=="string"?t:t==null?void 0:t.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof or.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)):(i=this.index)!=null?i:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof or.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,t){var n;if(this.maybeLog("Write: "+e),e=(0,or.normalizePath)(e),typeof t=="string"){let i=this.vault.getAbstractFileByPath(e);if(i instanceof or.TFile)return this.vault.modify(i,t);if(!this.isHiddenPath(e))await this.vault.create(e,t);else return this.adapter.write(e,t)}else{let i=DG(t);if(this.isIndexPath(e)){this.index=i;let s=Date.now();(n=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof or.TFile)return this.vault.modifyBinary(s,i);if(!this.isHiddenPath(e))await this.vault.createBinary(e,i);else return this.adapter.writeBinary(e,i)}}}async readdir(e){e=(0,or.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let t=await this.adapter.list(e),n=[...t.files,...t.folders],i;return e!=="/"?i=n.map(s=>(0,or.normalizePath)(s.substring(e.length))):i=n,i}async mkdir(e){if(e=(0,or.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,t){var n,i;if(e=(0,or.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(t)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof or.TFolder){await this.vault.delete(s,(t==null?void 0:t.recursive)===!0||((n=t==null?void 0:t.options)==null?void 0:n.recursive)===!0);return}}return this.adapter.rmdir(e,(t==null?void 0:t.recursive)===!0||((i=t==null?void 0:t.options)==null?void 0:i.recursive)===!0)}async stat(e){if(e=(0,or.normalizePath)(e),this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{...Oh,isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);if(n==null)throw new Fh(e);return this.indexctime=n.ctime,this.indexmtime=n.mtime,{...Oh,ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let t=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),t instanceof or.TFile)return this.maybeLog("Reuse stat"),{...Oh,ctimeMs:t.stat.ctime,mtimeMs:t.stat.mtime,size:t.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(e);if(n)return{...Oh,ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw new Fh(e)}}async unlink(e){if(e=(0,or.normalizePath)(e),!this.isHiddenPath(e)){let t=this.vault.getAbstractFileByPath(e);if(t instanceof or.TFile)return this.vault.delete(t)}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(t=>t.startsWith(".")&&t!==".")}maybeLog(e){}};function DG(r){return r instanceof ArrayBuffer?r:r.buffer instanceof ArrayBuffer&&r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8 Line truncated
`);l.push({message:(c=f[0])!=null?c:"",author:{name:u.commit.author.name,email:u.commit.author.email},body:f.slice(1).join(`
`),date:new Date(u.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChanges(u.commit.parent.first(),u.oid,o)).map(d=>({path:d.path,status:d.type,vaultPath:this.getRelativeVaultPath(d.path),hash:u.oid}))},hash:u.oid,refs:[]})}return l}updateBasePath(t){return this.getRepo().dir=t,Promise.resolve()}getGitDirPath(){return(0,bi.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async getConflictedFiles(){let t=Ah.acquire({fs:new Ch(this.fs),gitdir:this.getGitDirPath(),cache:{}},i=>i.unmergedPaths),n=await this.wrapFS(t);if(!Array.isArray(n)||!n.every(i=>typeof i=="string"))throw new TypeError("isomorphic-git returned invalid unmerged paths");return n}getMergeStatePath(t){return(0,bi.normalizePath)(`${this.getGitDirPath()}/${t}`)}async isMergeInProgress(){return this.app.vault.adapter.exists(this.getMergeStatePath(Dr.MERGE_HEAD))}async getMergeHeads(){let t=this.getMergeStatePath(Dr.MERGE_HEAD);return await this.app.vault.adapter.exists(t)?(await this.app.vault.adapter.read(t)).split(/\r?\n/).map(n=>n.trim()).filter(n=>n.length>0):[]}async writeMergeState({ours:t,theirs:n,message:i}){let s=this.app.vault.adapter;await s.write(this.getMergeStatePath(Dr.ORIGINAL_HEAD),`${t}
`),await s.write(this.getMergeStatePath(Dr.MERGE_MESSAGE),`${i}
`),await s.write(this.getMergeStatePath(Dr.MERGE_MODE),""),await s.write(this.getMergeStatePath(Dr.MERGE_HEAD),`${n}
`)}async clearMergeState(){let t=this.app.vault.adapter;for(let n of[Dr.MERGE_HEAD,Dr.MERGE_MESSAGE,Dr.MERGE_MODE]){let i=this.getMergeStatePath(n);await t.exists(i)&&await t.remove(i)}}async updateUpstreamBranch(t){let[n,i]=yo(t),s=await this.branchInfo();await this.wrapFS(ge.push({...this.getRepo(),remote:n,remoteRef:i})),this.app.workspace.trigger("obsidian-git:refs-changed"),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${i}`)}updateGitPath(t){return Promise.resolve()}async getCommittedFilesCount(t){let{commit:n}=await this.wrapFS(ge.readCommit({...this.getRepo(),oid:t})),i=n.parent[0];return i?await this.getFileChangesCount(i,t):(await this.wrapFS(ge.listFiles({...this.getRepo(),ref:t}))).length}async getFileChangesCount(t,n,i){return(await this.getFileChanges(t,n,i)).length}async getFileChanges(t,n,i){return this.walkDifference({cache:i,walkers:[ge.TREE({ref:t}),ge.TREE({ref:n})]})}async walkDifference({walkers:t,dir:n,cache:i}){return this.wrapFS(N0({...this.getRepo(),trees:t,cache:i,map:async(s,[o,a])=>{if(!F0(s,n))return null;let l=await(o==null?void 0:o.type()),c=await(a==null?void 0:a.type());if(l==="tree"||c==="tree"){if(s!=="."&&l===c){let m=await(o==null?void 0:o.oid());if(m!==void 0&&m===await(a==null?void 0:a.oid()))return null}return}let[u,f,d,h]=await Promise.all([o==null?void 0:o.oid(),a==null?void 0:a.oid(),o==null?void 0:o.mode(),a==null?void 0:a.mode()]),p="equal";if((u!==f||d!==h)&&(p="M"),u===void 0&&(p="A"),f===void 0&&(p="D"),u===void 0&&f===void 0&&this.plugin.warn("Missing object IDs in both Git trees while comparing file:",s),p!=="equal")return{path:s,type:p}}}))}async getStagedForMessage(){try{await this.resolveRef("HEAD")}catch(n){if(n instanceof Fr.NotFoundError)return super.getStagedForMessage();throw n}return{staged:(await this.getStagedFiles()).map(({path:n,vaultPath:i,type:s})=>({path:n,vaultPath:i,index:s,workingDir:" "})),stagedOutsideVault:0}}async getStagedFiles(t="."){return(await this.walkDifference({walkers:[ge.TREE({ref:"HEAD"}),ge.STAGE()],dir:t})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path,type:i.type}))}async getUnstagedFiles(t="."){let n,i=window.setTimeout(()=>{n=new bi.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),o=await this.wrapFS(N0({...s,trees:[ge.WORKDIR(),ge.STAGE()],map:async function(a,[l,c]){if(!c&&l&&await ge.isIgnored({...s,filepath:a})||!F0(a,t))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:a,type:"M"}:null:{path:a,type:"A"}:{path:a,type:"D"}}}));return window.clearTimeout(i),n==null||n.hide(),o}catch(s){throw window.clearTimeout(i),n==null||n.hide(),s}}async getDiffString(t,n=!1,i){let s=this.getRelativeVaultPath(t),o=async(c,[u])=>{if(t==c){let f=await u.oid();return(await ge.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await Nl({...this.getRepo(),filepath:t,oid:i}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ge.Errors.NotFoundError))throw p}),f=(await ge.readCommit({...this.getRepo(),oid:i})).commit.parent.first(),d;return f&&(d=await Nl({...this.getRepo(),filepath:t,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ge.Errors.NotFoundError))throw p})),Wu(s,d!=null?d:"",c!=null?c:"")}let a=(await N0({...this.getRepo(),trees:[ge.STAGE()],map:o})).first(),l=new TextDecoder().decode(a);if(n){let c=await this.resolveRef("HEAD").then(f=>Nl({...this.getRepo(),filepath:t,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ge.Errors.NotFoundError))throw f});return Wu(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="",Wu(s,l,c)}}async show(t,n,i=!0){let s=this.getRelativeRepoPath(n,i),{blob:o}=await Nl({...this.getRepo(),oid:t,filepath:s});return new TextDecoder().decode(o)}async getLastCommitTime(){let t=this.getRepo(),n=await this.resolveRef("HEAD"),s=(await ge.readCommit({...t,oid:n})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(t){var s,o;let n=`${t[this.HEAD]}${t[this.WORKDIR]}${t[this.STAGE]}`,i=this.status_mapping[n];if(i===void 0)throw new Error(`Unsupported status matrix row: ${n}`);return{index:i[0]=="?"?"U":(s=i[0])!=null?s:" ",workingDir:i[1]=="?"?"U":(o=i[1])!=null?o:" ",path:t[this.FILE],vaultPath:this.getRelativeVaultPath(t[this.FILE])}}async checkAuthorInfo(){let t=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!t||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(t,n=!0){if(!this.plugin.settings.disablePopups)return new bi.Notice(t,n?this.noticeLength:void 0)}};Dr.MERGE_HEAD="MERGE_HEAD",Dr.MERGE_MESSAGE="MERGE_ Line truncated
`){return r.split(t).reduce((n,i)=>{let s=e?i.trim():i;return s&&n.push(s),n},[])}function hb(r,e){return tp(r,!0).map(t=>e(t))}function _R(r){return(0,Qh.exists)(r,Qh.FOLDER)}function yi(r,e){return Array.isArray(r)?r.includes(e)||r.push(e):r.add(e),e}function HU(r,e){return Array.isArray(r)&&!r.includes(e)&&r.push(e),r}function pb(r,e){if(Array.isArray(r)){let t=r.indexOf(e);t>=0&&r.splice(t,1)}else r.delete(e);return e}var mb=Object.prototype.toString.call.bind(Object.prototype.toString);function An(r){return Array.isArray(r)?r:[r]}function xR(r){return r.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function lf(r){return An(r).map(e=>e instanceof String?e:String(e))}function mt(r,e=0){if(r==null)return e;let t=parseInt(r,10);return Number.isNaN(t)?e:t}function Vh(r,e){let t=[];for(let n=0,i=r.length;n<i;n++)t.push(e,r[n]);return t}function Wh(r){return(Array.isArray(r)?_.concat(r):r).toString("utf-8")}function GU(r){return r?_.isBuffer(r)?r.length:_.byteLength(r):0}function UU(r,e){let t={};return e.forEach(n=>{r[n]!==void 0&&(t[n]=r[n])}),t}function eR(r=0){return new Promise(e=>setTimeout(e,r))}function tR(r){if(r!==!1)return r}function xt(r,e,t){return e(r)?r:arguments.length>2?t:void 0}var rp=r=>Array.isArray(r);function Y0(r,e){let t=Xi(r)?"string":typeof r;return/number|string|boolean/.test(t)&&(!e||!e.includes(t))}var it=r=>typeof r=="string"||Xi(r),jU=r=>it(r)||_.isBuffer(r),qh=r=>it(r)||Array.isArray(r)&&r.every(it);function gb(r){return!!r&&mb(r)==="[object Object]"}function zU(r){return typeof r=="function"}var ER=r=>r==null||"number|boolean|function".includes(typeof r)?!1:typeof r.length=="number",np=(r=>(r[r.SUCCESS=0]="SUCCESS",r[r.ERROR=1]="ERROR",r[r.NOT_FOUND=-2]="NOT_FOUND",r[r.UNCLEAN=128]="UNCLEAN",r))(np||{}),Yh=class r{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new r(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}};function VU(){throw new Error("LineParser:useMatches not implemented")}var ke=class{constructor(e,t){this.matches=[],this.useMatches=VU,this.parse=(n,i)=>(this.resetMatches(),this._regExp.every((s,o)=>this.addMatch(s,o,n(o)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let i=n&&e.exec(n);return i&&this.pushMatch(t,i),!!i}pushMatch(e,t){this.matches.push(...t.slice(1))}},xo=class extends ke{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}},WU={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1};function qU(...r){let e=process.cwd(),t=Object.assign({baseDir:e,...WU},...r.filter(n=>typeof n=="object"&&n));return t.baseDir=t.baseDir||e,t.trimmed=t.trimmed===!0,t}function SR(r,e=[]){return gb(r)?Object.keys(r).reduce((t,n)=>{let i=r[n];if(Xi(i))t.push(i);else if(Y0(i,["boolean"]))t.push(n+"="+i);else if(Array.isArray(i))for(let s of i)Y0(s,["string","number"])||t.push(n+"="+s);else t.push(n);return t},e):e}function ze(r,e=0,t=!1){let n=[];for(let i=0,s=e<0?r.length:e;i<s;i++)"string|number".includes(typeof r[i])&&n.push(String(r[i]));return SR(wb(r),n),t||n.push(...YU(r)),n}function YU(r){let e=typeof Jl(r)=="function";return lf(xt(Jl(r,e?1:0),rp,[]))}function wb(r){let e=zU(Jl(r));return xt(Jl(r,e?1:0),gb)}function ce(r,e=!0){let t=DU(Jl(r));return e||LU(t)?t:void 0}function rR(r,e){return r(e.stdOut,e.stdErr)}function Cn(r,e,t,n=!0){return An(t).forEach(i=>{for(let s=tp(i,n),o=0,a=s.length;o<a;o++){let l=(c=0)=>{if(!(o+c>=a))return s[o+c]};e.some(({parse:c})=>c(l,r))}}),r}var vb=({exitCode:r},e,t,n)=>{if(r===np.UNCLEAN&&QU(e))return t(_.from("false"));n(e)},kR=r=>r.trim()==="true";function KU(r){switch(r){case"bare":return XU();case"root":return ZU()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:vb,parser:kR}}function ZU(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:vb,parser(r){return/^\.(git)?$/.test(r.trim())}}}function XU(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:vb,parser:kR}}function QU(r){return/(Not a git repository|Kein Git-Repository)/i.test(String(r))}var K0=class{constructor(e){this.paths=[],this.files=[],this.folders=[],this.dryRun=e}},JU=/^[a-z]+\s*/i,e4=/^[a-z]+\s+[a-z]+\s*/i,t4=/\/$/;function r4(r,e){let t=new K0(r),n=r?e4:JU;return tp(e).forEach(i=>{let s=i.replace(n,"");t.paths.push(s),(t4.test(s)?t.folders:t.files).push(s)}),t}var AR=[];function n4(r){return{commands:AR,format:"empty",parser:r}}function Gt(r){return{commands:AR,format:"empty",parser(){throw typeof r=="string"?new q0(r):r}}}function Et(r,e=!1){return{commands:r,format:"utf-8",parser(t){return e?String(t).trim():t}}}function CR(r){return{commands:r,format:"buffer",parser(e){return e}}}function i4(r){return r.format==="buffer"}function nR(r){return r.format==="empty"||!r.commands.length}var s4="Git clean interactive mode is not suppo Line truncated
`)){let l=NU(o,`
`);a=l[0],o=l[1]}yield{file:s,key:a,value:o}}}var $R=(r=>(r.system="system",r.global="global",r.local="local",r.worktree="worktree",r))($R||{});function G0(r,e){return typeof r=="string"&&Object.hasOwn($R,r)?r:e}function v4(r,e,t,n){let i=["config",`--${n}`];return t&&i.push("--add"),i.push(r,e),{commands:i,format:"utf-8",parser(s){return s}}}function b4(r,e){let t=["config","--null","--show-origin","--get-all",r];return e&&t.splice(1,0,`--${e}`),{commands:t,format:"utf-8",parser(n){return g4(n,r)}}}function y4(r){let e=["config","--list","--show-origin","--null"];return r&&e.push(`--${r}`),{commands:e,format:"utf-8",parser(t){return m4(t)}}}function _4(){return{addConfig(r,e,...t){return this._runTask(v4(r,e,t[0]===!0,G0(t[1],"local")),ce(arguments))},getConfig(r,e){return this._runTask(b4(r,G0(e,void 0)),ce(arguments))},listConfig(...r){return this._runTask(y4(G0(r[0],void 0)),ce(arguments))}}}var PR=(r=>(r.ADDED="A",r.COPIED="C",r.DELETED="D",r.MODIFIED="M",r.RENAMED="R",r.CHANGED="T",r.UNMERGED="U",r.UNKNOWN="X",r.BROKEN="B",r))(PR||{}),x4=new Set(Object.values(PR));function E4(r){return x4.has(r)}var iR,S4=["-h"],Uh=Symbol("grepQuery"),X0=class{constructor(){this[iR]=[]}*[(iR=Uh,Symbol.iterator)](){for(let e of this[Uh])yield e}and(...e){return e.length&&this[Uh].push("--and","(",...Vh(e,"-e"),")"),this}param(...e){return this[Uh].push(...Vh(e,"-e")),this}};function k4(...r){return new X0().param(...r)}function A4(r){let e=new Set,t={};return hb(r,n=>{let[i,s,o]=n.split(zh);e.add(i),(t[i]=t[i]||[]).push({line:mt(s),path:i,preview:o})}),{paths:e,results:t}}function C4(){return{grep(r){let e=ce(arguments),t=ze(arguments);for(let i of S4)if(t.includes(i))return this._runTask(Gt(`git.grep: use of "${i}" is not supported.`),e);typeof r=="string"&&(r=k4().param(r));let n=["grep","--null","-n","--full-name",...t,...r];return this._runTask({commands:n,format:"utf-8",parser(i){return A4(i)}},e)}}}var IR=(r=>(r.MIXED="mixed",r.SOFT="soft",r.HARD="hard",r.MERGE="merge",r.KEEP="keep",r))(IR||{}),T4=lf(Object.values(IR));function R4(r,e){let t=["reset"];return OR(r)&&t.push(`--${r}`),t.push(...e),Et(t)}function $4(r){if(OR(r))return r;switch(typeof r){case"string":case"undefined":return"soft"}}function OR(r){return typeof r=="string"&&T4.includes(r)}Jh.default.formatters.L=r=>String(ER(r)?r.length:"-");Jh.default.formatters.B=r=>_.isBuffer(r)?r.toString("utf8"):mb(r);function P4(){return(0,Jh.default)("simple-git")}function sR(r,e,t){return!e||!String(e).replace(/\s*/,"")?t?(n,...i)=>{r(n,...i),t(n,...i)}:r:(n,...i)=>{r(`%s ${n}`,e,...i),t&&t(n,...i)}}function I4(r,e,{namespace:t}){if(typeof r=="string")return r;let n=e&&e.namespace||"";return n.startsWith(t)?n.substr(t.length+1):n||t}function ec(r,e,t,n=P4()){let i=r&&`[${r}]`||"",s=[],o=typeof e=="string"?n.extend(e):e,a=I4(xt(e,it),o,n);return c(t);function l(u,f){return yi(s,ec(r,a.replace(/^[^:]+/,u),f,n))}function c(u){let f=u&&`[${u}]`||"",d=o&&sR(o,f)||ep,h=sR(n,`${i} ${f}`,d);return Object.assign(o?d:h,{label:r,sibling:l,info:h,step:c})}}var FR=class Q0{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let t=Q0.getName(e.commands[0]),n=ec(this.logLabel,t);return{task:e,logger:n,name:t}}push(e){let t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info("Failed %o",e),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",e.message),this.complete(t);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new vr(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++Q0.counter}`}};FR.counter=0;var O4=FR,J0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new O4}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:i}=this._queue.attempt(e);return await(nR(e)?this.attemptEmptyTask(e,i):this.attemptRemoteTask(e,i))}catch(i){throw this.onFatalException(e,i)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof vr?Object.assign(t,{task:e}):new vr(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec("spawn.binary","",t Line truncated
`).map(S5).filter(Boolean);e||t.sort(function(i,s){let o=i.split("."),a=s.split(".");if(o.length===1||a.length===1)return E5(jh(o[0]),jh(a[0]));for(let l=0,c=Math.max(o.length,a.length);l<c;l++){let u=e$(jh(o[l]),jh(a[l]));if(u)return u}return 0});let n=e?t[0]:[...t].reverse().find(i=>i.indexOf(".")>=0);return new ub(t,n)};function E5(r,e){let t=Number.isNaN(r),n=Number.isNaN(e);return t!==n?t?1:-1:t?e$(r,e):0}function e$(r,e){return r===e?0:r>e?1:-1}function S5(r){return r.trim()}function jh(r){return typeof r=="string"&&parseInt(r.replace(/^\D+/g,""),10)||0}function k5(r=[]){let e=r.some(t=>/^--sort=/.test(t));return{format:"utf-8",commands:["tag","-l",...r],parser(t){return x5(t,e)}}}function A5(r){return{format:"utf-8",commands:["tag",r],parser(){return{name:r}}}}function C5(r,e){return{format:"utf-8",commands:["tag","-a","-m",e,r],parser(){return{name:r}}}}function xe(r,e){this._plugins=e,this._executor=new eb(r.baseDir,new ab(r.maxConcurrentProcesses),e),this._trimmed=r.trimmed}(xe.prototype=Object.create(Xh.prototype)).constructor=xe;xe.prototype.customBinary=function(r){return this._plugins.reconfigure("binary",r),this};xe.prototype.env=function(r,e){return arguments.length===1&&typeof r=="object"?this._executor.env=r:(this._executor.env=this._executor.env||{})[r]=e,this};xe.prototype.stashList=function(r){return this._runTask(v5(wb(arguments)||{},rp(r)&&r||[]),ce(arguments))};xe.prototype.mv=function(r,e){return this._runTask(c5(r,e),ce(arguments))};xe.prototype.checkoutLatestTag=function(r){var e=this;return this.pull(function(){e.tags(function(t,n){e.checkout(n.latest,r)})})};xe.prototype.pull=function(r,e,t,n){return this._runTask(u5(xt(r,it),xt(e,it),ze(arguments)),ce(arguments))};xe.prototype.fetch=function(r,e){return this._runTask(o5(xt(r,it),xt(e,it),ze(arguments)),ce(arguments))};xe.prototype.tags=function(r,e){return this._runTask(k5(ze(arguments)),ce(arguments))};xe.prototype.rebase=function(){return this._runTask(Et(["rebase",...ze(arguments)]),ce(arguments))};xe.prototype.reset=function(r){return this._runTask(R4($4(r),ze(arguments)),ce(arguments))};xe.prototype.revert=function(r){let e=ce(arguments);return typeof r!="string"?this._runTask(Gt("Commit must be a string"),e):this._runTask(Et(["revert",...ze(arguments,0,!0),r]),e)};xe.prototype.addTag=function(r){let e=typeof r=="string"?A5(r):Gt("Git.addTag requires a tag name");return this._runTask(e,ce(arguments))};xe.prototype.addAnnotatedTag=function(r,e){return this._runTask(C5(r,e),ce(arguments))};xe.prototype.deleteLocalBranch=function(r,e,t){return this._runTask(J6(r,typeof e=="boolean"?e:!1),ce(arguments))};xe.prototype.deleteLocalBranches=function(r,e,t){return this._runTask(Q6(r,typeof e=="boolean"?e:!1),ce(arguments))};xe.prototype.branch=function(r,e){return this._runTask(Z6(ze(arguments)),ce(arguments))};xe.prototype.branchLocal=function(r){return this._runTask(X6(),ce(arguments))};xe.prototype.raw=function(r){let e=!Array.isArray(r),t=[].slice.call(e?arguments:r,0);for(let i=0;i<t.length&&e;i++)if(!Y0(t[i])){t.splice(i,t.length-i);break}t.push(...ze(arguments,0,!0));var n=ce(arguments);return t.length?this._runTask(Et(t,this._trimmed),n):this._runTask(Gt("Raw: must supply one or more command to execute"),n)};xe.prototype.submoduleAdd=function(r,e,t){return this._runTask(b5(r,e),ce(arguments))};xe.prototype.submoduleUpdate=function(r,e){return this._runTask(_5(ze(arguments,!0)),ce(arguments))};xe.prototype.submoduleInit=function(r,e){return this._runTask(y5(ze(arguments,!0)),ce(arguments))};xe.prototype.subModule=function(r,e){return this._runTask(ip(ze(arguments)),ce(arguments))};xe.prototype.listRemote=function(){return this._runTask(m5(ze(arguments)),ce(arguments))};xe.prototype.addRemote=function(r,e,t){return this._runTask(h5(r,e,ze(arguments)),ce(arguments))};xe.prototype.removeRemote=function(r,e){return this._runTask(w5(r),ce(arguments))};xe.prototype.getRemotes=function(r,e){return this._runTask(p5(r===!0),ce(arguments))};xe.prototype.remote=function(r,e){return this._runTask(g5(ze(arguments)),ce(arguments))};xe.prototype.tag=function(r,e){let t=ze(arguments);return t[0]!=="tag"&&t.unshift("tag"),this._runTask(Et(t),ce(arguments))};xe.prototype.updateServerInfo=function(r){return this._runTask(Et(["update-server-info"]),ce(arguments))};xe.prototype.pushTags=function(r,e){let t=R6({remote:xt(r,it)},ze(arguments));return this._runTask(t,ce(arguments))};xe.prototype.rm=function(r){return this._runTask(Et(["rm","-f",...An(r)]),ce(arguments))};xe.prototype.rmKeepLocal=function(r){return this._runTask(Et(["rm","--cached",...An(r)]),ce(arguments))};xe.prototype.catFile=function(r,e){return this._catFile("utf-8",arguments)};xe.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)};xe.prototype._catFile=function(r,e){var t=ce(e),n=["cat-file"],i=e[0];if(typeof i=="string")return this._runTask(Gt("Git.catFile: options must be supplied as an array of strings"),t);Array.isArray(i)&&n.push.apply(n,i);let s Line truncated
`),a=s.slice(0,o);if(o<0||!/^[0-9a-f]{64}$/.test(a)||!(0,op.timingSafeEqual)(_.from(a),_.from(this.token))){this.respond(t,403);return}let l=s.slice(o+1),c=this.promptQueue,u;this.promptQueue=new Promise(f=>{u=f});try{await c,!this.stopped&&!t.destroyed&&await this.showPrompt(l,t)}finally{u()}}async showPrompt(e,t){let n=e.length>60?new s$.Notice(e,999999):null,i=new _t(this.plugin,{allowEmpty:!0,obscure:!e.includes("Username for"),placeholder:e.length>60?"Enter a response to the message.":e});this.activeModal=i;let s=()=>{t.writableEnded||i.close()};t.once("close",s);try{let o=await i.openAndGetResult();if(this.stopped||t.destroyed)return;o===void 0?this.respond(t,409):this.respond(t,200,`${o}
`)}finally{t.off("close",s),n==null||n.hide(),this.activeModal===i&&(this.activeModal=void 0)}}respond(e,t,n=""){e.destroyed||e.writableEnded||(e.writeHead(t,{"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8","X-Content-Type-Options":"nosniff"}),e.end(n))}};var Ze=class extends Wl{constructor(t){super(t);this.unloaded=!1;this.useDefaultWindowsGitPath=!1}async setGitInstance(t=!1){var i,s;if(this.unloaded)return;(i=this.askpassServer)==null||i.stop(),this.askpassServer=void 0;let n=await this.isGitInstalled();if(!this.unloaded&&n){let o=this.app.vault.adapter,a=o.getBasePath(),l=a;this.plugin.settings.basePath&&(await o.exists((0,Eo.normalizePath)(this.plugin.settings.basePath))?l=Fe.join(a,this.plugin.settings.basePath):t||new Eo.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=l;let c=this.plugin.localStorage.getPATHPaths(),u=this.plugin.localStorage.getEnvVars(),f=this.plugin.settings.gitDir,d={...process.env};if(c.length>0){let C=c.join(Fe.delimiter)+Fe.delimiter+d.PATH;d.PATH=C}f&&(d.GIT_DIR=f,d.GIT_WORK_TREE=l);for(let C of u){let[S,T]=C.split("=");S!==void 0&&(d[S]=T)}this.git=n$({baseDir:l,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?xh:void 0),config:["core.quotepath=off"],allowEnvironment:[...Object.keys(d),"GIT_ASKPASS","SSH_ASKPASS","SSH_ASKPASS_REQUIRE","OBSIDIAN_GIT_ASKPASS_PORT","OBSIDIAN_GIT_ASKPASS_TOKEN","OBSIDIAN_GIT"],progress:C=>{var S;(S=this.plugin.statusBar)==null||S.displayProgress(this.toGitProgress(C))},unsafe:{allowAbbreviatedOptions:!0,allowUnsafeCustomBinary:!0,allowUnsafeEditor:!0,allowUnsafeAskPass:!0,allowUnsafeConfigEnvCount:!0,allowUnsafeConfigPaths:!0,allowUnsafeCredentialHelper:!0,allowUnsafeGitProxy:!0,allowUnsafeGpgProgram:!0,allowUnsafeHooksPath:!0,allowUnsafeMergeDriver:!0,allowUnsafeSshCommand:!0,allowUnsafePager:!0,allowUnsafeDiffTextConv:!0,allowUnsafeCommandBinaries:!0,allowUnsafeExec:!0,allowUnsafeInclude:!0,allowUnsafeSubmodule:!0,allowUnsafeUrlRewrite:!0}});let h="simple-git",p=",",w=((s=localStorage.debug)!=null?s:"").split(p);if(!w.includes(h)&&!w.includes(`-${h}`)&&(w.push(h),l$.default.enable(w.join(p))),await this.git.env(d).checkIsRepo()){let C=await this.git.revparse("--show-cdup"),S=(0,uf.resolve)(l+uf.sep+C);this.absoluteRepoPath=S,await this.git.cwd(S)}if(this.unloaded)return;let y=Fe.join(a,this.app.vault.configDir,"plugins","obsidian-git"),v=Fe.join(y,Tv),A=Fe.join(y,".git_credentials_input");if(await Tn.rm(A,{force:!0}),await Tn.rm(`${A}.response`,{force:!0}),this.unloaded)return;if(d.SSH_ASKPASS==null){if(!await this.startAskpass(v,d))return;d.SSH_ASKPASS=v,d.GIT_ASKPASS==null&&(d.GIT_ASKPASS=v),d.SSH_ASKPASS_REQUIRE="force"}if(this.unloaded)return;d.OBSIDIAN_GIT="1",this.git=this.git.env(d)}}toGitProgress(t){return{action:this.getProgressAction(t.method),stage:t.stage,progress:t.progress,processed:t.processed,total:t.total}}getProgressAction(t){switch(t){case"fetch":return"Fetching";case"push":return"Pushing";case"pull":return"Pulling";case"checkout":return"Checking out";default:return t?t.charAt(0).toUpperCase()+t.slice(1):"Working"}}getRelativeVaultPath(t){let i=this.app.vault.adapter.getBasePath(),s=Fe.join(this.absoluteRepoPath,t),o=Fe.relative(i,s);return Eo.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}getRelativeRepoPath(t,n=!0){if(n){let s=this.plugin.app.vault.adapter.getBasePath(),o=this.absoluteRepoPath,a=Fe.join(s,t),l=Fe.relative(o,a);return Eo.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return t}getVaultPathspec(){if(!this.plugin.settings.limitToVault)return;let t=this.app.vault.adapter,n=Fe.resolve(t.getBasePath()),i=Fe.resolve(this.absoluteRepoPath),s=Fe.relative(i,n);if(!(s===""||s===".."||s.startsWith(".."+Fe.sep)||Fe.isAbsolute(s)))return s.split(Fe.sep).join("/")}async countPathsOutsideVault(t){return(await this.git.raw([...t,"-z"])).split("\0").filter(i=>i&&!this.isPathInsideVault(i)).length}get relPluginConfigPath(){return Fe.join(this.app.vault.configDir,"plugins","obsidian-git")}async startAskpass(t,n){var a;if(await this.addAskPassScriptToExclude(),this.unloaded||(await Tn.writeFile(t,gC),await Tn.chmod(t,493),this.unloaded))return!1;let i=new sp(this.plugin);(a=this.askpassServer)==null||a.stop(),this.askpassServer=i;let s,o;try{({port:s,token:o}=await i.start())}catch(l){if(this.unloaded||this.askpassServer!==i)return!1;throw l}return this.unloaded||this.askpassServer!==i?(i.stop(),!1):(n.OBSIDIAN_GIT_ASKPASS_PORT=`${s}`,n.OBSIDIAN_GIT_ASKPASS_TOKEN=o,!0)}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let t=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=Fe.join(this.app.vault.configDir,"plugins","obsidian-git",Tv),i=this.getRelativeRepoPath(n,!0);(await Tn.readFile(t,"utf-8")).split(`
`).some(l=>l.contains(i))||await Tn.appendFile(t,i+`
`)}catch(t){console.error("Error while adding askpass script to exclude file:",t)}}unload(){var t;this.unloaded=!0,(t=this.askpassServer)==null||t.stop(),this.askpassServer=void 0}async status(t){var u;let n=(u=t==null?void 0:t.path)!=null?u:this.getVaultPathspec(),[i,s,o]=await Promise.all([this.git.status(n!=null?["--",n]:[]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--cached","--name-only","--diff-filter=ACDMRT"]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--name-only","--diff-filter=U"])]),a=i.files.map(f=>{let d=this.formatPath(f);return{path:d.path,from:d.from,index:f.index==="?"?"U":f.index,workingDir:f.working_dir==="?"?"U":f.working_dir,vaultPath:this.getRelativeVaultPath(d.path)}}),l=i.conflicted.map(f=>this.formatPath({path:f}).path),c=new Set(l);return{all:a,changed:a.filter(f=>f.workingDir!==" "&&!c.has(f.path)),staged:a.filter(f=>f.index!==" "&&f.index!="U"),conflicted:l,stagedOutsideVault:s,conflictedOutsideVault:o}}async selectAutoCommitFiles(t,n){if(n.mode==="exclude"&&n.globs.length===0)return{files:t.changed,selection:n};if(n.mode==="include"&&n.globs.length===0)return{files:[],selection:n};let i=async a=>{let l=await this.git.status(["--untracked-files=all","--",...a]),c=new Set(l.conflicted.map(u=>this.formatPath({path:u}).path));return l.files.map(u=>{let f=this.formatPath(u);return{path:f.path,from:f.from,vaultPath:this.getRelativeVaultPath(f.path),index:u.index==="?"?"U":u.index,workingDir:u.working_dir==="?"?"U":u.working_dir}}).filter(u=>u.workingDir!==" "&&!c.has(u.path))};if(n.mode==="exclude")return{files:await i([".",...n.globs.map(l=>`:(exclude,glob)${l}`)]),selection:n};let s=new Map,o=[];for(let a of n.globs){let l=await i([`:(glob)${a}`]);if(l.length!==0){o.push(a);for(let c of l)s.set(c.path,c)}}return{files:[...s.values()],selection:{mode:"include",globs:o}}}async isMergeInProgress(){let t=await this.git.revparse(["--git-path","MERGE_HEAD"]),n=Fe.resolve(this.absoluteRepoPath,t.trim());try{return await Tn.access(n),!0}catch(i){if(i instanceof Error&&"code"in i&&i.code==="ENOENT")return!1;throw i}}async submoduleAwareHeadRevisonInContainingDirectory(t){let n=this.getRelativeRepoPath(t),s=["-C",Fe.dirname(n),"rev-parse","HEAD"],o=this.git.raw(s);return o.catch(a=>console.warn("obsidian-git: rev-parse error:",a)),(await o).trim()}async getSubmodulePaths(){return new Promise(t=>{this.git.outputHandler((n,i,s,o)=>{if(!(o.contains("submodule")&&o.contains("foreach")))return;let a="",l=this.absoluteRepoPath;i.on("data",c=>{a+=c.toString("utf8")}),i.on("end",()=>{let u=a.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+uf.sep}).filter(f=>!!f).filter(f=>{if(this.getVaultPathspec()==null)return!0;let d=this.app.vault.adapter,h=Fe.relative(Fe.resolve(d.getBasePath()),Fe.resolve(f));return!(h===".."||h.startsWith(".."+Fe.sep)||Fe.isAbsolute(h))});u.reverse(),t(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(t){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return t.from!=null?{from:n(t.from),path:n(t.path)}:{path:n(t.path)}}async blame(t,n,i){if(t=this.getRelativeRepoPath(t),!await this.isTracked(t))return"untracked";let s=await this.getSubmoduleOfFile(t),o=s?["-C",s.submodule]:[],a=s?s.relativeFilepath:t;o.push("blame","--porcelain"),i&&o.push("-w");let l=`-C${_h}`;switch(n){case"inactive":break;case"same-commit":o.push("-C",l);break;case"all-commits":o.push("-C","-C",l);break;default:bo(n)}o.push("--",a);let c=await this.git.raw(o);return X5(c)}async isTracked(t){let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("ls-files","--",s),this.git.raw(i).then(o=>o.trim()!=="")}async commitAll({message:t,status:n,unstagedFiles:i,selection:s,amend:o}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let l=await this.getSubmodulePaths();for(let c of l)await this.git.cwd({path:c,root:!1}).add("-A"),await this.git.cwd({path:c,root:!1}).commit(await this.formatCommitMessage(t))}if((s==null?void 0:s.mode)==="include")i==null&&(s=(await this.selectAutoCommitFiles(n!=null?n:await this.status(),s)).selection),s.globs.length>0&&await this.git.add(["-A","--",...s.globs.map(l=>`:(glob)${l}`)]);else if(s!=null&&s.globs.length)await this.git.add(["-A","--",".",...s.globs.map(l=>`:(exclude,glob)${l}`)]);else{let l=this.getVaultPathspec();await this.git.add(l==null?"-A":["-A","--",l])}let a=await this.git.commit(await this.formatCommitMessage(t),o?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed"),this.getCommittedFilesCount(a.summary.changes)})}async commit({message:t,amend:n}){return this.withGitOperation(2,async()=>{try{let i=await this.git.commit(await this.formatCommitMessage(t),n?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed"),this.getCommittedFilesCount(i.summary.changes)}catch(i){return this.throwConflictError(i)}})}async getCommittedFilesCount(t){return t!==0?t:(await this.git.diffSummary(["HEAD^1","HEAD"])).changed}async stage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.add(["--",t])}async stageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.add(n==null?"-A":["-A","--",n])}async unstageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.reset(n!=null?["--",n]:[])}async unstage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.reset(["--",t])}async discard(t){await this.isTracked(t)&&await this.git.checkout(["--progress","--",t])}async applyPatch(t){let n=Fe.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,t),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(t){var o;let n=(o=t==null?void 0:t.path)!=null?o:this.getVaultPathspec(),i=[];return n!=null&&i.push("--",n),(await this.git.clean(cf.RECURSIVE+cf.DRY_RUN,i)).paths}async hashObject(t){t=this.getRelativeRepoPath(t);let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("hash-object","--",s),this.git.raw(i)}async discardAll({dir:t}){var n;return this.discard((n=t!=null?t:this.getVaultPathspec())!=null?n:".")}async pull(){return this.withGitOperation(1,async()=>{try{if(this.plugin.settings.updateSubmodules){let s=["update","--remote","--merge","--recursive"],o=this.getVaultPathspec();o!=null&&s.push("--",o),await this.git.subModule(s)}let t=await this.branchInfo();if(!t.current)throw new Error("No current branch found. Cannot pull.");let n=await this.git.revparse([t.current]);if(!t.tracking)return this.plugin.log(this.plugin.settings.updateSubmodules?"No tracking branch found. Ignoring pull of main repo and updated submodules only.":"No tracking branch found. Ignoring pull."),{status:"skipped",reason:"no-upstream"};await this.git.fetch(),this.app.workspace.trigger("obsidian-git:refs-changed");let i=await this.git.revparse([t.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let c=[t.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&c.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(c);break;case"rebase":{this.plugin.settings.rebaseAutoStash==="enabled Line truncated
`)){let[a,l]=o.split("\0");if(!(a!=null&&a.startsWith("refs/heads/")))continue;let c=a.slice(11);s.push(c),c===t&&(i=l||void 0)}return{current:t,tracking:i,branches:s}}async getRemoteUrl(t){try{return await this.git.remote(["get-url",t])||void 0}catch(n){if(String(n).contains(t))return;throw n}}async log(t,n=!0,i,s){let o;t&&(o=this.getRelativeRepoPath(t,n));let a={file:o,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return s&&(a[s]=null),(await this.git.log(a)).all.map(c=>{var u,f,d,h;return{...c,author:{name:c.author_name,email:c.author_email},refs:c.refs.split(", ").filter(p=>p.length>0),diff:{...c.diff,files:(f=(u=c.diff)==null?void 0:u.files.map(p=>{let m="from"in p?p.from:void 0;return{...p,status:"status"in p?p.status:"M",path:p.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(p.file),fromPath:m,fromVaultPath:m!=null?this.getRelativeVaultPath(m):void 0,binary:p.binary}}))!=null?f:[]},fileName:(h=(d=c.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(t,n,i=!0){let s=this.getRelativeRepoPath(n,i);return this.git.show(["--textconv",t+":"+s])}async getLocalBranchUpstream(t){try{let i=(await this.git.raw(["rev-parse","--abbrev-ref",`${t}@{upstream}`])).trim();return i.length>0?i:void 0}catch(n){return}}getAvailableLocalBranchName(t,n,i){let s=t;if(!i.includes(s))return s;let o=`${t}-${n}`,a=o,l=0;for(;i.includes(a);)l+=1,a=`${o}-${l}`;return a}async checkout(t,n){return this.withGitOperation(5,async()=>{if(n){let i=`${n}/${t}`,s=await this.branchInfo();if(s.branches.includes(t)&&await this.getLocalBranchUpstream(t)===i)await this.git.checkout(t);else{let l=this.getAvailableLocalBranchName(t,n,s.branches);await this.git.checkout(["-b",l,i])}}else await this.git.checkout(t);if(this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let s of i){let o=await this.git.cwd({path:s,root:!1}).branch();Object.keys(o.branches).includes(t)&&await this.git.cwd({path:s,root:!1}).checkout(t)}}this.app.workspace.trigger("obsidian-git:refs-changed")})}async createBranch(t){await this.git.checkout(["-b",t]),this.app.workspace.trigger("obsidian-git:refs-changed")}async deleteBranch(t,n){await this.git.branch([n?"-D":"-d",t]),this.app.workspace.trigger("obsidian-git:refs-changed")}async branchIsMerged(t){return!(await this.git.branch(["--no-merged"])).all.contains(t)}async init(){await this.git.init(!1)}async clone(t,n,i){await this.git.clone(t,Fe.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[]),await this.setGitInstance()}async setConfig(t,n){n==null?await this.getConfig(t,"local")!==void 0&&await this.git.raw(["config","--local","--unset-all",t]):await this.git.addConfig(t,n,!1,"local")}async getConfig(t,n="local"){var s;return(s=(await this.git.getConfig(t.toLowerCase(),n=="all"?void 0:n)).value)!=null?s:void 0}async fetch(t){return this.withGitOperation(4,async()=>{await this.git.fetch(t!=null?[t]:[]),this.app.workspace.trigger("obsidian-git:refs-changed")})}async setRemote(t,n){(await this.getRemotes()).includes(t)?await this.git.remote(["set-url",t,n]):await this.git.remote(["add",t,n])}async getRemoteBranches(t){let n=await this.git.branch(["-r","--list",`${t}*`]),i=[];for(let s in n.branches)i.push(n.branches[s].name);return i}async getRemotes(){let t=await this.git.remote([]);return t?t.trim().split(`
`):[]}async removeRemote(t){await this.git.removeRemote(t),this.app.workspace.trigger("obsidian-git:refs-changed")}async updateUpstreamBranch(t){try{await this.git.branch(["--set-upstream-to",t])}catch(n){try{await this.git.branch(["--set-upstream",t])}catch(i){let[s,o]=yo(t),a=await this.branchInfo();await this.git.push(["--set-upstream",s,`${a.current}:${o}`]),this.app.workspace.trigger("obsidian-git:refs-changed")}}}updateGitPath(t){return this.setGitInstance()}updateBasePath(t){return this.setGitInstance(!0)}async getDiffString(t,n=!1,i){return n?await this.git.diff(["--cached","--",t]):i?await this.git.show([`${i}`,"--",t]):await this.git.diff(["--",t])}async diff(t,n,i){return await this.git.diff([`${n}..${i}`,"--",t])}async rawCommand(t){let n=t.split(" "),i=n[0];if(i===void 0)return"";let s=await this.git.raw(i,...n.slice(1));return this.app.workspace.trigger("obsidian-git:refs-changed"),s}async getSubmoduleOfFile(t){if(!await this.app.vault.adapter.exists(Fe.dirname(t)))return;let n=await this.git.raw(["-C",Fe.dirname(t),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",Fe.dirname(t),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let o=this.app.vault.adapter.getFullPath(Fe.normalize(t)),a=Fe.relative(n,o);return{submodule:n,relativeFilepath:a}}async getLastCommitTime(){try{let t=await this.git.log({n:1});if(t!=null&&t.latest!=null)return new Date(t.latest.date)}catch(t){if(t instanceof vr){if(t.message.contains("does not have any commits yet"))return}else throw t}}async isGitInstalled(){let t=this.plugin.localStorage.getGitPath(),n=await rf(t||"git",["--version"],{});if(n.error)if(Eo.Platform.isWin&&!t){this.plugin.log(`Git not found in PATH. Checking standard installation path(${xh}) of Git for Windows.`);let i=await rf(xh,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(t){if(t instanceof vr){let n=String(t.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Hl(n)}throw t}async isFileTrackedByLFS(t){try{return(await this.git.raw(["check-attr","filter",t])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`Error checking LFS status: ${i}`)}}},c$={hash:"000000",isZeroCommit:!0,summary:""};function X5(r){let t=r.replaceAll(`\r
`,`
`).split(`
`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let s=0;s<t.length;){let o=t[s];if(o$(o)){let a=o.split(" "),l=Q5(a,i,n);for(s++;o$(t[s]);s++){let c=t[s].split(" ");J5(c,n,i)}ej(n.commits.get(l)),i+=1}else if(!(o===""&&s===t.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${o}`);s++}return n}function Q5(r,e,t){let n=r[0],i=r[1],s=r[2];if(n===void 0||i===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${r.join(" ")}`);if(t.hashPerLine.push(n),t.originalFileLineNrPerLine.push(parseInt(i)),t.finalFileLineNrPerLine.push(parseInt(s)),r.length>=4&&t.groupSizePerStartingLine.set(e,parseInt(r[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return n}function J5(r,e,t){let n=r[0],i=r.slice(1).join(" "),s=e.hashPerLine[t];if(s===void 0)throw Error(`No commit hash found for git-blame line ${t}`);let o=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(n){case"summary":o.summary=i;break;case"author":o.author.name=i;break;case"author-mail":o.author.email=a$(i);break;case"author-time":o.author.epochSeconds=parseInt(i);break;case"author-tz":o.author.tz=i;break;case"committer":o.committer.name=i;break;case"committer-mail":o.committer.email=a$(i);break;case"committer-time":o.committer.epochSeconds=parseInt(i);break;case"committer-tz":o.committer.tz=i;break;case"previous":o.previous.commitHash=i;break;case"filename":o.previous.filename=i;break;case void 0:break}e.commits.set(s,o)}function ej(r){if(r.summary===void 0)throw Error(`Summary not provided for commit: ${r.hash}`);xb(r.author)&&(r.author=void 0),xb(r.committer)&&(r.committer=void 0),xb(r.previous)&&(r.previous=void 0),r.isZeroCommit=!!r.hash.match(/^0*$/)}function xb(r){return!r||Object.keys(r).length===0}function o$(r){return r===void 0?!1:r.length>0&&r[0].trim()===r[0]}function a$(r){let e=r.startsWith("<")?r.substring(1):r;return e.endsWith(">")?e.substring(0,e.length-1):e}g();var N$=require("@codemirror/state");g();var Eb=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,t){if(e)return this.ensureInitialized(e),t(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(t=>t.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()}},Jn=new Eb;g();var fp=require("@codemirror/state");g();g();g();var tj="input is invalid type",u$="finalize already called",rj=typeof ArrayBuffer!="undefined",Sb=function(r){var e=typeof r;if(e==="string")return[r,!0];if(Array.isArray(r))return[r,!1];if(rj&&r){if(r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(ArrayBuffer.isView(r))return[r,!1]}throw new Error(tj)};var ne="0123456789abcdef".split(""),nj=[-2147483648,8388608,32768,128],_i=[24,16,8,0],ap=[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],lp=["hex","array","digest","arrayBuffer"],ar=[],f$=function(r,e){return function(t){return new lr(e,!0).update(t)[r]()}},h$=function(r){var e=f$("hex",r);e.create=function(){return new lr(r)},e.update=function(i){return e.create().update(i)};for(var t=0;t<lp.length;++t){var n=lp[t];e[n]=f$(n,r)}return e},d$=function(r,e){return function(t,n){return new cp(t,e,!0).update(n)[r]()}},p$=function(r){var e=d$("hex",r);e.create=function(i){return new cp(i,r)},e.update=function(i,s){return e.create(i).update(s)};for(var t=0;t<lp.length;++t){var n=lp[t];e[n]=d$(n,r)}return e};function lr(r,e){e?(ar[0]=ar[16]=ar[1]=ar[2]=ar[3]=ar[4]=ar[5]=ar[6]=ar[7]=ar[8]=ar[9]=ar[10]=ar[11]=ar[12]=ar[13]=ar[14]=ar[15]=0,this.blocks=ar):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=31441 Line truncated
**/*.tmp`}},this.toggle(`Specify custom commit message on auto ${s}`,"customMessageOnAutoBackup","Shows a prompt to specify your message."),{name:`Commit message on auto ${s}`,desc:"Placeholders: {{date}}, {{hostname}}, {{numFiles}}, and {{files}}.",control:{type:"textarea",key:"autoCommitMessage",defaultValue:en.autoCommitMessage,disabled:()=>this.settings.customMessageOnAutoBackup}}]},{type:"page",name:"Commit",desc:"Commit messages and placeholders.",visible:t,items:[this.toggle("Stage all changes when nothing is staged","autoStageOnEmptyIndex","When using Commit with nothing staged, stage and commit all changes. Commit all changes and Commit-and-sync are unaffected."),{name:"Commit message on manual commit",desc:"Placeholders: {{date}}, {{hostname}}, {{numFiles}}, and {{files}}. Leave empty to require manual input.",render:o=>{o.addTextArea(a=>{a.setValue(this.settings.commitMessage),a.onChange(async l=>{this.settings.commitMessage=l,await this.plugin.saveSettings()}),o.addButton(l=>l.setIcon("reset").setTooltip(`Set to default: "${en.commitMessage}"`).onClick(()=>{a.setValue(en.commitMessage),a.onChanged()}))})}},{name:"Commit message script",desc:"Run with 'sh -c' to generate a commit message. Placeholders: {{hostname}}, {{date}}.",visible:()=>Ve.Platform.isDesktopApp,control:{type:"text",key:"commitMessageScript"}},{name:"{{date}} placeholder format",render:o=>{o.addMomentFormat(a=>a.setDefaultFormat(this.settings.commitDateFormat).setValue(this.settings.commitDateFormat).onChange(async l=>{await this.setControlValue("commitDateFormat",l)})),o.descEl.createSpan({text:`Example: ${Cv}. See `}),o.descEl.createEl("a",{text:"Moment.js documentation",href:H$,attr:{target:"_blank"}}),o.descEl.createSpan({text:" for more formats."})}},{name:"{{hostname}} placeholder replacement",desc:"Set a hostname for this device. Defaults to the OS hostname on desktop.",render:o=>{o.addText(a=>{var l;return a.setValue((l=this.plugin.localStorage.getHostname())!=null?l:"").onChange(c=>this.plugin.localStorage.setHostname(c))})}},{name:"Preview commit message",render:o=>{o.addButton(a=>a.setButtonText("Preview").onClick(async()=>{let l=await this.plugin.gitManager.formatCommitMessage(this.settings.commitMessage);new Ve.Notice(l)}))}},this.toggle("List filenames affected by commit in the commit body","listChangedFilesInMessageBody")]},{type:"page",name:"Sync",desc:"Pull, merge, and commit-and-sync behavior.",visible:t,items:[{type:"group",heading:"Pull",items:[{...this.dropdown("Merge strategy","syncMethod",{merge:"Merge",rebase:"Rebase",reset:"Other sync service (update HEAD only)"},"How to integrate remote commits."),visible:n},{...this.dropdown("Auto-stash changes when rebasing","rebaseAutoStash",{enabled:"Enabled",disabled:"Disabled","git-config":"Use Git configuration"},"Stash local changes before rebasing and restore them afterward. Restoring may produce conflicts."),visible:()=>n()&&this.settings.syncMethod==="rebase"},this.dropdown("Merge strategy on conflicts","mergeStrategy",{none:"None (Git default)",ours:"Our changes",theirs:"Their changes"},"Choose which side to favor when pulling remote changes."),this.toggle("Pull on startup","autoPullOnBoot","Automatically pull commits when Obsidian starts.")]},{type:"group",heading:"Commit-and-sync",items:[{name:"Push on commit-and-sync",desc:"Push after committing. Disabling turns commit-and-sync into a local commit, with an optional pull.",render:o=>{o.addToggle(a=>a.setValue(!this.settings.disablePush).onChange(async l=>{this.settings.disablePush=!l,await this.plugin.saveSettings(),this.refreshDomState()}))}},this.toggle("Pull on commit-and-sync","pullBeforePush","Pull commits as part of commit-and-sync."),{...this.toggle("Squash commits before push","squashCommitsBeforePush","Combine local unpushed commits into one before pushing. No force-push is needed."),visible:n}]}]},{type:"page",name:"Editor",desc:"Merge conflict resolution, hunk controls, and line author information.",visible:t,items:[this.dropdown("Show merge conflict resolution","conflictResolutionMode",{both:"Both editing modes","live-preview":"Live Preview only",source:"Source mode only",disabled:"Disabled"},"Choose where conflict highlights and resolution buttons appear."),{type:"group",heading:"Hunk management",visible:n,items:[this.toggle("Signs","hunks.showSigns","Show colored change markers in the editor and stage, reset, or preview hunks."),this.toggle("Hunk commands","hunks.hunkCommands","Commands to stage and reset hunks and navigate between them."),this.dropdown("Show line changes in the status bar","hunks.statusBar",{disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"})]},{type:"page",name:"Line author information",desc:"Commit hash, author, date, and age coloring next to each line.",visible:n,page:()=>new Mb(this)}]},{type:"page",name:"Views",desc:"History, source control, and diff views.",items:[{type:"group",heading:"Source control view",items:[this.toggle("Automatically refresh source Line truncated
`)).onChange(l=>this.plugin.localStorage.setEnvVars(l.split(`
`))))}},{name:"Additional PATH environment variable paths",desc:"One path per line.",visible:n,render:o=>{o.addTextArea(a=>a.setValue(this.plugin.localStorage.getPATHPaths().join(`
`)).onChange(l=>this.plugin.localStorage.setPATHPaths(l.split(`
`))))}},{name:"Reload with new environment variables",desc:"Removing previous variables requires an Obsidian restart.",visible:n,render:o=>{o.addButton(a=>a.setButtonText("Reload").setCta().onClick(async()=>this.plugin.reloadGitManager()))}},{name:"Repository folder within the vault",desc:"Choose the folder containing the Git repository. Leave empty when the repository is at the root.",control:{type:"folder",key:"basePath",includeRoot:!1,validate:o=>{if(o!==""){if(o=="/")return"Leave empty when the repository is at the root.";if(!this.app.vault.getFolderByPath(o))return"Choose an existing folder in this vault."}}}},{name:"Custom Git directory path (instead of .git)",desc:"Resolved from the custom base path or vault root. Restart Obsidian to apply. Use backslashes on Windows.",control:{type:"text",key:"gitDir",placeholder:".git"}},{name:"Disable on this device",desc:"This setting is not synced.",render:o=>{o.addToggle(a=>a.setValue(this.plugin.localStorage.getPluginDisabled()).onChange(l=>{this.plugin.localStorage.setPluginDisabled(l),l?this.plugin.unloadPlugin():this.plugin.init({fromReload:!0}).catch(c=>this.plugin.displayError(c)),new Ve.Notice("Obsidian must be restarted for the change to take effect.")}))}},{type:"group",heading:"Debugging",items:[{name:"Copy debug information",desc:"May contain sensitive settings.",render:o=>{o.addButton(a=>a.setButtonText("Copy").onClick(async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.settings,pluginVersion:this.plugin.manifest.version},null,4)),new Ve.Notice("Debug information copied to clipboard. May contain sensitive information!")}))}},{name:"Debugging and logging",desc:Ve.Platform.isDesktopApp?`Open the developer console with ${Ve.Platform.isMacOS?"CMD (\u2318) + OPTION (\u2325) + I":"CTRL + SHIFT + I"}.`:"",visible:()=>Ve.Platform.isDesktopApp}]}]},{heading:"Support",type:"group",items:[{name:"Donate",desc:"Support continued development of the plugin.",render:o=>{o.addButton(a=>{var c;let l=(c=a.buttonEl.parentElement)==null?void 0:c.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});l==null||l.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"}}),a.buttonEl.remove()})}}]}]}configureLineAuthorShowStatus(t){this.settings.lineAuthor.show=t,this.plugin.saveSettings(),t?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(t,n){this.settings.lineAuthor[t]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let t=this.settings.lineAuthor;t.authorDisplay!=="hide"&&(t.lastShownAuthorDisplay=t.authorDisplay),t.dateTimeFormatOptions!=="hide"&&(t.lastShownDateTimeFormatOptions=t.dateTimeFormatOptions)}renderLineAuthorSettings(t){t.empty(),this.lineAuthorColorSettings.clear();let n=new Ve.Setting(t).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.createEl("a",{href:yj,text:"Feature guide and quick examples",attr:{target:"_blank"}}),n.descEl.createEl("br"),n.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),n.descEl.createEl("br"),n.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),n.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(s=>{this.configureLineAuthorShowStatus(s),this.refreshLineAuthorPage(t)})),this.settings.lineAuthor.show){let i=new Ve.Setting(t).setName("Follow movement and copies across files and commits").addDropdown(c=>{c.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),c.setValue(this.settings.lineAuthor.followMovement),c.onChange(u=>this.lineAuthorSettingHandler("followMovement",u))});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 ${_h} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"th Line truncated
Either your local time-zone (default),
the author's time-zone during commit creation or
`}),s.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),s.descEl.createSpan({text:"."});let o=new Ve.Setting(t).setName("Oldest age in coloring");this.setOldestAgeDescription(o.descEl,this.settings.lineAuthor.coloringMaxAge),o.addText(c=>{c.setPlaceholder("1y"),c.setValue(this.settings.lineAuthor.coloringMaxAge),c.onChange(async u=>{let d=ff(u)!==void 0;this.setOldestAgeDescription(o.descEl,u),d&&(await this.lineAuthorSettingHandler("coloringMaxAge",u),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest",t),this.createColorSetting("oldest",t);let a=new Ve.Setting(t).setName("Text color").addText(c=>{c.setValue(this.settings.lineAuthor.textColorCss),c.onChange(async u=>{await this.lineAuthorSettingHandler("textColorCss",u)})});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 l=new Ve.Setting(t).setName("Ignore whitespace and newlines in changes").addToggle(c=>{c.setValue(this.settings.lineAuthor.ignoreWhitespace),c.onChange(u=>this.lineAuthorSettingHandler("ignoreWhitespace",u))});l.descEl.empty(),l.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."}),l.descEl.createEl("br"),l.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(t,n){let i=new Ve.Setting(n).setName("").addText(s=>{let o=Fb(t,this.settings.lineAuthor),a=Fb(t,en.lineAuthor);s.setPlaceholder(M0(a)),s.setValue(M0(o)),s.onChange(async l=>{let c=TT(l);if(c!==void 0){let u=t==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,c)}this.refreshColorSettingsDesc(t,c)})});this.lineAuthorColorSettings.set(t,i),this.refreshColorSettingsName(t),this.refreshColorSettingsDesc(t,Fb(t,this.settings.lineAuthor))}refreshColorSettingsName(t){let n=this.lineAuthorColorSettings.get(t);if(n){let i=t==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.setText(`Color for ${i} commits`)}}refreshColorSettingsDesc(t,n){let i=this.lineAuthorColorSettings.get(t);i&&this.colorSettingPreviewDesc(i.descEl,t,this.settings.lineAuthor,n!==void 0)}colorSettingPreviewDesc(t,n,i,s){t.empty(),t.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let o=s?yp(n,i):"rgba(127,127,127,0.3)",a=Ve.moment.unix(Ve.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${a}`:"invalid color";t.createDiv({text:l,cls:"line-author-settings-preview",attr:{style:`background-color: ${o}; width: 30ch;`}})}setCustomDateTimeDescription(t,n){t.empty(),t.createEl("a",{text:"Format string",href:H$}),t.createSpan({text:" to display the authoring date."}),t.createEl("br");let i=(0,Ve.moment)().format(n);t.createSpan({text:`Currently: ${i}`})}setOldestAgeDescription(t,n){let i=ff(n),s=i!==void 0?`${i.asDays()} days`:"invalid!";t.empty(),t.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}refreshLineAuthorPage(t){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=window.setTimeout(()=>{this.lineAuthorRefreshTimer=void 0,t.isConnected&&this.renderLineAuthorSettings(t)},80)}cancelLineAuthorRefresh(){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=void 0,this.lineAuthorColorSettings.clear()}},Mb=class extends Ve.SettingPage{constructor(t){super();this.tab=t;this.title="Line author information"}display(){this.tab.renderLineAuthorSettings(this.containerEl)}hide(){this.tab.cancelLineAuthorRefresh(),super.hide()}};function Fb(r,e){return r==="oldest"?e.colorOld:e.colorNew}function ff(r){let e=Ve.moment.duration("P"+r.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}g();var Lr=require("obsidian");var Ep=class{constructor(e,t){this.statusBarEl=e;this.plugin=t;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),t.registerEvent(t.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,t){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:t}),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({cls:this.base+"conflict-indicator"}),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.setAttribute("role","button"),this.conflictEl.onclick=()=>this.plugin.openMergeConflictHelp(),this.conflictEl.onkeydown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.plugin.openMergeConflictHelp())},this.pausedEl=this.statusBarEl.createDiv({cls:this.base+"paused-indicator"}),this.pausedEl.setAttribute("data-tooltip-position","top"),this.iconEl=this.statusBarEl.createDiv({cls:this.base+"icon"}),this.textEl=this.statusBarEl.createDiv({cls:this.base+"text"})),this.plugin.state.mergeInProgress?((0,Lr.setIcon)(this.conflictEl,"git-merge"),this.conflictEl.ariaLabel="Merge in progress. Select for help resolving and finishing the merge.",this.conflictEl.tabIndex=0,this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.tabIndex=-1,this.conflictEl.removeClass(this.base+"conflict")),this.plugin.localStorage.getPausedAutomatics()?((0,Lr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.removeClass(this.base+"paused")),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,Lr.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress"),this.addMergeHelpToTooltip();return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,Lr.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,Lr.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,Lr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,Lr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,Lr.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}this.addMergeHelpToTooltip()}addMergeHelpToTooltip(){if(!this.plugin.state.mergeInProgress)return;let e="Merge in progress. Select the merge icon for help resolving and finishing it.",t=this.statusBarEl.ariaLabel;this.statusBarEl.ariaLabel=t?`${e}
${t}`:e}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let t=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 n=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${t}${Math.round(this.progress.progress)}%${n}`}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)==null?void 0:e.action){case"Fetching":case"Pulling":return"download";case"Pushing":return"upload";case"Checking out":return"git-branch";default:return"git-pull-request"}}displayFromNow(){var n;if(!this.plugin.gitReady){this.statusBarEl.ariaLabel="Git is not ready",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");return}let e=this.lastCommitTimestamp,t=this.plugin.state.offlineMode;if(e){let i=(0,Lr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${t?"Offline: ":""}Last Commit: ${i}`,((n=this.unPushedCommits)!=null?n:0)>0&&(this.statusBarEl.ariaLabel+=`
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=t?"Git is offline":"Git is ready";t?(0,Lr.setIcon)(this.iconEl,"globe"):(0,Lr.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.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};g();var G$=require("obsidian"),hf=class{constructor(e){this.plugin=e}saveLastAuto(e,t){t==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):t==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):t==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,t,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((t=this.plugin.localStorage.getLastAutoPull())!=null?t:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let t=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(t)}if(this.plugin.settings.autoPullInterval>0){let t=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(t)}}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 t=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(t)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){var t,n;if(!this.isAutomaticsDisabled)if(this.plugin.settings.autoBackupAfterFileChange)e===0?this.doAutoCommitAndSync():(n=(t=this.plugin).autoCommitDebouncer)!=null||(t.autoCommitDebouncer=(0,G$.debounce)(()=>this.doAutoCommitAndSync(),this.plugin.settings.autoSaveInterval*6e4,!0));else{let i=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;i>2147483647&&(i=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),i)}}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let e=await this.plugin.gitManager.getLastCommitTime();if(e){this.saveLastAuto(e,"backup");let t=this.diff(this.plugin.settings.autoSaveInterval,e);if(t>0)return this.startAutoCommitAndSync(t),!1}}return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.gitActions.commit({fromAuto:!0,mode:"all"}):await this.plugin.gitActions.commitAndSync({fromAutoBackup:!0,mode:"all"}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),t)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),t)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var t;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((t=this.plugin.autoCommitDebouncer)==null||t.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this Line truncated
`)}static newName(){let e=q$[W$]||1;return q$[W$]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let i=e[Db],s=n&&n.nonce;i?s&&i.setNonce(s):i=new Lb(e,s),i.mount(Array.isArray(t)?t:[t],e)}},Y$=new Map,Lb=class{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Y$.get(n);if(s)return e[Db]=s;this.sheet=new i.CSSStyleSheet,Y$.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Db]=this}mount(e,t){let n=this.sheet,i=0,s=0,o=!1;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<s&&c>-1&&(this.modules.splice(c,1),o=!0,s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),o=!0,n)for(let u=0;u<l.rules.length;u++)n.insertRule(l.rules[u],i++)}else{for(;s<c;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let l="";for(let c=0;c<this.modules.length;c++)l+=this.modules[c].getRules()+`
`;this.styleTag.textContent=l}let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var dP=require("@codemirror/language"),Ej=require("@lezer/highlight"),Ut=class r{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}offset(e,t=e){return new r(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}};function ma(r,e,t,n,i,s){if(r==n)return[];let o=Vb(r,e,t,n,i,s),a=Wb(r,e+o,t,n,i+o,s);e+=o,t-=a,i+=o,s-=a;let l=t-e,c=s-i;if(!l||!c)return[new Ut(e,t,i,s)];if(l>c){let f=r.slice(e,t).indexOf(n.slice(i,s));if(f>-1)return[new Ut(e,e+f,i,i),new Ut(e+f+c,t,s,s)]}else if(c>l){let f=n.slice(i,s).indexOf(r.slice(e,t));if(f>-1)return[new Ut(e,e,i,i+f),new Ut(t,t,i+f+l,s)]}if(l==1||c==1)return[new Ut(e,t,i,s)];let u=pP(r,e,t,n,i,s);if(u){let[f,d,h]=u;return ma(r,e,f,n,i,d).concat(ma(r,f+h,t,n,d+h,s))}return Sj(r,e,t,n,i,s)}var mf=1e9,gf=0,zb=!1;function Sj(r,e,t,n,i,s){let o=t-e,a=s-i;if(mf<1e9&&Math.min(o,a)>mf*16||gf>0&&Date.now()>gf)return Math.min(o,a)>mf*64?[new Ut(e,t,i,s)]:K$(r,e,t,n,i,s);let l=Math.ceil((o+a)/2);Nb.reset(l),Bb.reset(l);let c=(h,p)=>r.charCodeAt(e+h)==n.charCodeAt(i+p),u=(h,p)=>r.charCodeAt(t-h-1)==n.charCodeAt(s-p-1),f=(o-a)%2!=0?Bb:null,d=f?null:Nb;for(let h=0;h<l;h++){if(h>mf||gf>0&&!(h&63)&&Date.now()>gf)return K$(r,e,t,n,i,s);let p=Nb.advance(h,o,a,l,f,!1,c)||Bb.advance(h,o,a,l,d,!0,u);if(p)return kj(r,e,t,e+p[0],n,i,s,i+p[1])}return[new Ut(e,t,i,s)]}var $p=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,i,s,o,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=i+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<t&&f<n&&a(u,f);)u++,f++;if(this.vec[c]=u,u>t)this.end+=2;else if(f>n)this.start+=2;else if(s){let d=i+(t-n)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(o){let h=s.vec[d];if(h>=t-u)return[h,i+h-d]}else{let h=t-s.vec[d];if(u>=h)return[u,f]}}}return null}},Nb=new $p,Bb=new $p;function kj(r,e,t,n,i,s,o,a){let l=!1;return!ac(r,n)&&++n==t&&(l=!0),!ac(i,a)&&++a==o&&(l=!0),l?[new Ut(e,t,s,o)]:ma(r,e,n,i,s,a).concat(ma(r,n,t,i,a,o))}function hP(r,e){let t=1,n=Math.min(r,e);for(;t<n;)t=t<<1;return t}function Vb(r,e,t,n,i,s){if(e==t||e==s||r.charCodeAt(e)!=n.charCodeAt(i))return 0;let o=hP(t-e,s-i);for(let a=e,l=i;;){let c=a+o,u=l+o;if(c>t||u>s||r.slice(a,c)!=n.slice(l,u)){if(o==1)return a-e-(ac(r,a)?0:1);o=o>>1}else{if(c==t||u==s)return c-e;a=c,l=u}}}function Wb(r,e,t,n,i,s){if(e==t||i==s||r.charCodeAt(t-1)!=n.charCodeAt(s-1))return 0;let o=hP(t-e,s-i);for(let a=t,l=s;;){let c=a-o,u=l-o;if(c<e||u<i||r.slice(c,a)!=n.slice(u,l)){if(o==1)return t-a-(ac(r,a)?0:1);o=o>>1}else{if(c==e||u==i)return t-c;a=c,l=u}}}function Hb(r,e,t,n,i,s,o,a){let l=n.slice(i,s),c=null;for(;;){if(c||o<a)return c;for(let u=e+o;;){ac(r,u)||u++;let f=u+o;if(ac(r,f)||(f+=f==u+1?1:-1),f>=t)break;let d=r.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Vb(r,f,t,n,i+h+d.length,s),m=Wb(r,e,u,n,i,i+h),w=d.length+p+m;(!c||c[2]<w)&&(c=[u-m,i+h-m,w])}u=f}if(a<0)return c;o=o>>1}}function pP(r,e,t,n,i,s){let o=t-e,a=s-i;if(o<a){let l=pP(n,i,s,r,e,t);return l&&[l[1],l[0],l[2]]}return o<4||a*2<o?null:Hb(r,e,t,n,i,s,Math.floor(o/4),-1)}function K$(r,e,t,n,i,s){zb=!0;let o=t-e,a=s-i,l;if(o<a){let d=Hb(n,i,s,r,e,t,Math.floor(o/6),50);l=d&&[d[1],d[0],d[2]]}else l=Hb(r,e,t,n,i,s,Math.floor(a/6),50);if(!l)return[new Ut(e,t,i,s)];let[c,u,f]=l;return ma(r,e,c,n,i,u).concat(ma(r,c+f,t,n,u+f,s))}function mP(r,e){for(let t=1;t<r.length;t++){let n=r[t-1],i=r[t];n.toA>i.fromA-e&&n.toB>i.fromB-e&&(r[t-1]=new Ut(n.fromA,i.toA,n.fromB,i.toB),r.splice(t--,1))}}function Aj(r,e,t){for(;;){mP(t,1);let n=!1;for(let i=0;i<t.length;i++){let s=t[i],o,a;(o=Vb(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Ut(s.fromA+o,s.toA,s.fromB+o,s.toB)),(a=Wb(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Ut(s.fromA,s.toA-a,s.fromB,s.toB-a));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(i?t[i-1].toA:0),f=(i<t.length-1?t[i+1].fromA:r.length)-s.toA;if(!u||!f)continue;let d=l?r.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&r.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(t[i]=new Ut(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):f<=d.length&&r.slice(s.toA,s.toA+f)==d.slice(0,f)&&(t[i]=new Ut(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),n=!0)}if(!n)break}return t}function Cj(r,e,t){for(let n=0,i=0;i<r.length;i++){let s=r[i],o=s.toA-s.fromA,a=s.toB-s.fromB;if(o&&a||o>3||a>3){let l=i==r.length-1?e.length:r[i+1].fromA,c=s.fromA-n,u=l-s.toA,f=X$(e,s.fromA,c),d=Z$(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!o||!a)&&h&&p){let m=Math.max(o,a),[w,y,v]=o?[e,s.fromA,s.toA]:[t,s.fromB,s.toB];m>h&&e.slice(f,s.fromA)==w.slice(v-h,v)?(s=r[i]=new Ut(f,f+o,s.fromB-h,s.toB-h),f=s.fromA,d=Z$(e,s.toA,l-s.toA)):m>p&&e.slice(s.toA,d)==w.slice(y,y+p)&&(s=r[i]=new Ut(d-o,d,s.fromB+p,s.toB+p),d=s. Line truncated
`),s=e.split(`
`);for(let o of t){let{oldStart:a,oldLines:l,newStart:c,newLines:u}=o,f=cr.createHunk(a,l,c,u);if(o.oldLines>0){for(let d=a;d<a+l;d++)f.removed.lines.push(i[d-1]);a+l>i.length&&i.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(o.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)}n.push(f)}return n}function Zb(r,e,t){let n=e.lineAt(r.fromA).number,i=r.fromA==r.toA?0:Op(e,r.endA)-n+1,s=t.lineAt(r.fromB).number,o=r.fromB==r.toB?0:Op(t,r.endB)-s+1,a={oldStart:n,oldLines:i,newStart:s,newLines:o};return a.oldLines==0&&(a.oldStart-=1),a.newLines==0&&(a.newStart-=1),a}var AP={scanLimit:1e3,timeout:200};function jj(r,e,t,n){let i=Yb.Text.of(r.split(`
`)),s=Yb.Text.of(e.split(`
`)),o=t&&n?Ps.updateB(t,i,s,n,AP):Ps.build(i,s,AP),a=[];for(let l=0;l<o.length;l++){let c=o[l],u=Zb(c,i,s);a.push(u)}return{hunks:Kb(r,e,a),chunks:o}}function CP(r,e,t,n){return jj(r,e,t,n)}var Is=require("obsidian"),xi=class{static hasHunksData(e){let t=e.field(on,!1);return!!t&&!t.isDirty}static getHunks(e,t){let n=e.field(on);return n?t?n.stagedHunks:n.hunks:[]}static getHunkAtPos(e,t,n){if(!e.field(on))return;let s=e.doc.lineAt(t).number,o=this.getHunks(e,n);return cr.findHunk(s,o)[0]}static getCursorHunk(e,t){if(!e.field(on))return;let i=e.selection.main.head;return this.getHunkAtPos(e,i,t)}static getHunk(e,t,n){if(n!=null)return this.getHunkAtPos(e,n,t);if(e.selection.main.empty)return this.getCursorHunk(e,t);let i=e.selection.main.from,s=e.selection.main.to,o=e.doc.lineAt(i).number,a=Op(e.doc,s),l=this.getHunks(e,t),c=cr.createPartialHunk(l,o,a);if(!c)return;let u=e.field(on);if(t){let f=o,d=a;for(let h of u.hunks)o>h.vend&&(f=f-(h.added.count-h.removed.count)),a>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(o-1,a),a===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}},on=lc.StateField.define({create:r=>{},update:(r,e)=>{var i,s,o,a;let t=r?{...r}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let l of e.effects)if(l.is(cc)&&(t.compareText=l.value.compareText,t.compareTextHead=l.value.compareTextHead,n=(r==null?void 0:r.compareText)!==l.value.compareText,n&&(t.chunks=void 0,t.changeDesc=void 0)),l.is(Fp)){let c=(i=e.startState.field(vf,!1))==null?void 0:i.revision;if(l.value.revision!==c)continue;TP(t,l.value.result,e.state),t.changeDesc=void 0}if(e.docChanged&&(!t.changeDesc||t.changeDesc.newLength===e.changes.length||((s=Pt.plugin)==null||s.warn("Hunk changes belong to different document histories. Recomputing the full diff."),t.chunks=void 0),t.changeDesc=zj(t.changeDesc,e.changes)),t.compareText!==void 0){if(n||e.docChanged){t.isDirty=!0;let l=Vj(e,t.compareText,t.chunks,t.changeDesc,t.maxDiffTimeMs);l&&(TP(t,l,e.state),t.changeDesc=void 0)}}else{t.compareText=void 0,t.compareTextHead=void 0,t.chunks=void 0,t.hunks=[],t.stagedHunks=[],t.isDirty=!1;let l=e.state.field(Is.editorInfoField).file;(a=(o=Pt.plugin)==null?void 0:o.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,l)}return t}});function TP(r,e,t){var i,s;r.hunks=e.hunks,r.chunks=e.chunks,r.isDirty=!1,r.maxDiffTimeMs=Math.max(.95*r.maxDiffTimeMs,e.diffDuration);let n=t.field(Is.editorInfoField).file;(s=(i=Pt.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||s.display(r.hunks,n)}var vf=lc.StateField.define({create:r=>{var e,t;return{debouncer:(0,Is.debounce)(n=>{let{state:i,compareText:s,previousChunks:o,changeDesc:a,revision:l}=n,c=i.field(Is.editorEditorField,!1);if(!c)return;let u=c.state.field(vf,!1);if((u==null?void 0:u.revision)!==l)return;let f=RP(i,s,o,a);c.dispatch({effects:Fp.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(t=(e=r.field(Is.editorInfoField,!1))==null?void 0:e.file)==null?void 0:t.path}},update:(r,e)=>{var n,i;let t=(i=(n=e.state.field(Is.editorInfoField,!1))==null?void 0:n.file)==null?void 0:i.path;return e.docChanged||t!==r.filePath?{...r,revision:{},filePath:t}:r}});function zj(r,e){return!r||r.newLength!==e.length?e:r.composeDesc(e)}function RP(r,e,t,n){let i=r.doc.toString(),s=performance.now(),{hunks:o,chunks:a}=CP(e,i,t,n),l=performance.now()-s;return{hunks:o,chunks:a,diffDuration:l}}function Vj(r,e,t,n,i){let s=r.state,o=Math.abs(r.changes.length-r.changes.newLength),a=s.field(vf);if(o>1e3||i>16){a.debouncer({state:s,compareText:e,previousChunks:t,changeDesc:n,revision:a.revision});return}else return RP(s,e,t,n)}var cc=lc.StateEffect.define(),Fp=lc.StateEffect.define();function $P(r,e){return e.update({effects:cc.of(r)})}g();g();g();var St;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(St||(St={}));var PP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},IP={LINES:"lines",WORDS:"words",NONE:"none"},OP={WORD:"word",CHAR:"char"},ga;(function(r){r.AUTO="auto",r.DARK="dark",r.LIGHT="light"})(ga||(ga={}));g();var Wj=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],qj=RegExp("["+Wj.join("\\")+"]","g");function FP(r){return r.replace(qj,"\\$&")}function Xb(r){return r&&r.replace(/\\/g,"/")}function MP(r){let e,t,n,i=0;for(e=0,n=r.length;e<n;e++)t=r.charCodeAt(e),i=(i<<5)-i+t,i|=0;return i}function Mp(r){let e=r.length,t=-1/0;for(let n=0;n<e;n++)t=Math.max(t,r[n]);return t}function DP(r,e){let t=r.split(".");return t.length>1?t[t.length-1]:e}function LP(r,e){return e.reduce((t,n)=>t||r.startsWith(n),!1)}var NP=["a/","b/","i/","w/","c/","o/"];function So(r,e,t){let n=t!==void 0?[...NP,t]:NP,i=e?new RegExp(`^${FP(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=i.exec(r)||[],o=n.find(l=>s.indexOf(l)===0);return(o?s.slice(o.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Yj(r,e){return So(r,"---",e)}function Kj(r,e){return So(r,"+++",e)}function BP(r,e={}){let t=[],n=null,i=null,s=null,o=null,a=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,w=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,v=/^copy to "?(.+)"?/,A=/^rename from "?(.+)"?/,C=/^rename to "?(.+)"?/,S=/^similarity index (\d+)%/,T=/^dissimilarity index (\d+)%/,b=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,E=/^GIT binary patch/,k=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,$=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,D=/^deleted file mode (\d{6}),(\d{6})/,P=r.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`).split(`
`);function F(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function _e(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&c!==null&&(n.newName=c),n.newName&&(t.push(n),n=null)),l=null,c=null}function Q(){F(),_e(),n={blocks:[],deletedLines:0,addedLines:0}}function oe(Y){F();let J;n!==null&&((J=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(Y))?(n.isCombined=!1,s=parseInt(J[1],10),a=parseInt(J[2],10)):(J=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(Y))?(n.isCombined=!0,s=parseInt(J[1],10),o=parseInt(J[2],10),a=parseInt(J[3],10)):(Y.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,a=0,n.isCombined=!1)),i={lines:[],oldStartLine:s,oldStartLine2:o,newStartLine:a,header:Y}}function fe(Y){if(n===null||i===null||s===null||a===null)return;let J={content:Y},U=n.isCombined?["+ "," +","++"]:["+"],et=n.isCombined?["- "," -","--"]:["-"];LP(Y,U)?(n.addedLines++,J.type=St.INSERT,J.oldNumber=void 0,J.newNumber=a++):LP(Y,et)?(n.deletedLines++,J.type=St.DELETE,J.oldNumber=s++,J.newNumber=void 0):(J.type=St.CONTEXT,J.oldNumber=s++,J.newNumber=a++),i.lines.push(J)}function Z(Y,J){let U=J;for(;U<P.length-3;){if(Y.startsWith("diff"))return!1;if(P[U].startsWith(u)&&P[U+1].startsWith(f)&&P[U+2].startsWith(d))return!0;U++}return!1}return P.forEach((Y,J)=>{if(!Y||Y.startsWith("*"))return;let U,et=P[J-1],se=P[J+1],vt=P[J+2];if(Y.startsWith("diff --git")||Y.startsWith("diff --combined")){if(Q(),(U=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(Y))&&(l=So(U[1],void 0,e.dstPrefix),c=So(U[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(Y.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(Q(),(U=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(Y))&&(l=So(U[1],void 0,e.dstPrefix),c=So(U[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&Y.startsWith(u)&&se.startsWith(f)&&vt.startsWith(d))&&Q(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&Y.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let j=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(t.length):"Diff too big to be displayed";oe(j);return}if(Y.startsWith(u)&&se.startsWith(f)||Y.startsWith(f)&&et.startsWith(u)){if(n&&!n.oldName&&Y.startsWith("--- ")&&(U=Yj(Y,e.srcPrefix))){n.oldName=U,n.language=DP(n.oldName,n.language);return}if(n&&!n.newName&&Y.startsWith("+++ ")&&(U=Kj(Y,e.dstPrefix))){n.newName=U,n.language=DP(n.newName,n.language);return}}if(n&&(Y.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){oe(Y);return}if(i&&(Y.startsWith("+")||Y.startsWith("-")||Y.startsWith(" "))){fe(Y);return}let tt=!Z(Y,J);if(n===null)throw new Error("Where is my file !!!");(U=h.exec(Y))?n.oldMode=U[1]:(U=p.exec(Y))?n.newMode=U[1]:(U=m.exec(Y))?(n.deletedFileMode=U[1],n.isDeleted=!0):(U=w.exec(Y))?(n.newFileMode=U[1],n.isNew=!0):(U=y.exec(Y))?(tt&&(n.oldName=U[1]),n.isCopy=!0):(U=v.exec(Y))?(tt&&(n.newName=U[1]),n.isCopy=!0):(U=A.exec(Y))?(tt&&(n.oldName=U[1]),n.isRename=!0):(U=C.exec(Y))?(tt&&(n.newName=U[1]),n.isRename=!0):(U=x.exec(Y))?(n.isBinary=!0,n.oldName=So(U[1],void 0,e.srcPrefix),n.newName=So(U[2],void 0,e.dstPrefix),oe("Binary file")):E.test(Y)?(n.isBinary=!0,oe(Y)):(U=S.exec(Y))?n.unchangedPercentage=parseInt(U[1],10):(U=T.exec(Y))?n.changedPercentage=parseInt(U[1],10):(U=b.exec(Y))?(n.checksumBefore=U[1],n.checksumAfter=U[2],U[3]&&(n.mode=U[3])):(U=k.exec(Y))?(n.checksumBefore=[U[2],U[3]],n.checksumAfter=U[1]):(U=$.exec(Y))?(n.oldMode=[U[2],U[3]],n.newMode=U[1]):(U=M.exec(Y))?(n.newFileMode=U[1],n.isNew=!0):(U=D.exec(Y))&&(n.deletedFileMode=U[1],n.isDeleted=!0)}),F(),_e(),t}g();g();g();g();var ko=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let o=v=>{if(v=this.postProcess(v,n),i){setTimeout(function(){i(v)},0);return}else return v},a=t.length,l=e.length,c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,w=1/0,y=()=>{for(let v=Math.max(m,-c);v<=Math.min(w,c);v+=2){let A,C=h[v-1],S=h[v+1];C&&(h[v-1]=void 0);let T=!1;if(S){let x=S.oldPos-v;T=S&&0<=x&&x<a}let b=C&&C.oldPos+1<l;if(!T&&!b){h[v]=void 0;continue}if(!b||T&&C.oldPos<S.oldPos?A=this.addToPath(S,!0,!1,0,n):A=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(A,t,e,v,n),A.oldPos+1>=l&&p+1>=a)return o(this.buildValues(A.lastComponent,t,e))||!0;h[v]=A,A.oldPos+1>=l&&(w=Math.min(w,v-1)),p+1>= Line truncated
`);return this.hoganUtils.render(zP,"wrapper",{colorScheme:mc(this.config.colorScheme),filesNumber:e.length,files:t})}};g();var uy=Object.assign(Object.assign({},va),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),yf="generic",VP="line-by-line",l9="icon",c9="tag",_f=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},uy),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(yf,"wrapper",{colorScheme:mc(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(VP,"file-diff"),i=this.hoganUtils.template(yf,"file-path"),s=this.hoganUtils.template(l9,"file"),o=this.hoganUtils.template(c9,wc(e));return n.render({file:e,fileHtmlId:gc(e),diffs:t,filePath:i.render({fileDiffName:ba(e)},{fileIcon:s,fileTag:o})})}generateEmptyDiff(){return this.hoganUtils.render(yf,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:br})}generateFileHtml(e){let t=hc(dc(n=>ti(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(yf,"block-header",{CSSLineClass:br,blockHeader:e.isTooBig?n.header:Ao(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([s,o,a])=>{if(o.length&&a.length&&!s.length)this.applyRematchMatching(o,a,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ti(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:br.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(o.length||a.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,o,a);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",s,o,a)}),i}).join(`
`)}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let o=e.lines[s];(o.type!==St.INSERT&&i.length||o.type===St.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),o.type===St.CONTEXT?t.push([[o],[],[]]):o.type===St.INSERT&&n.length===0?t.push([[],[],[o]]):o.type===St.INSERT&&n.length>0?i.push(o):o.type===St.DELETE&&n.push(o)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=Mp(e.concat(t).map(a=>a.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}processChangedLines(e,t,n,i){let s={right:"",left:""},o=Math.max(n.length,i.length);for(let a=0;a<o;a++){let l=n[a],c=i[a],u=l!==void 0&&c!==void 0?Hp(l.content,c.content,t,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:br.DELETE_CHANGES}:Object.assign(Object.assign({},ti(l.content,t)),{type:pc(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:br.INSERT_CHANGES}:Object.assign(Object.assign({},ti(c.content,t)),{type:pc(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,t,n){return{left:this.generateSingleLineHtml(e,t),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,t){if(t===void 0)return"";let n=this.hoganUtils.render(VP,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(yf,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:t.prefix===" "?"&nbsp;":t.prefix,content:t.content,lineNumber:n,line:t,file:e})}};g();var fy=Object.assign(Object.assign({},va),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),xf="generic",u9="side-by-side",f9="icon",d9="tag",Ef=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},fy),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(xf,"wrapper",{colorScheme:mc(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(u9,"file-diff"),i=this.hoganUtils.template(xf,"file-path"),s=this.hoganUtils.template(f9,"file"),o=this.hoganUtils.template(d9,wc(e));return n.render({file:e,fileHtmlId:gc(e),diffs:t,filePath:i.render({fileDiffName:ba(e)},{fileIcon:s,fileTag:o})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(xf,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:br})}}generateFileHtml(e){let t=hc(dc(n=>ti(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([s,o,a])=>{if(o.length&&a.length&&!s.length)this.applyRematchMatching(o,a,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ti(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:br.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:br.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(o.length||a.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,o,a);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",s,o,a)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let o=e.lines[s];(o.type!==St.INSERT&&i.length||o.type===St.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),o.type===St.CONTEXT?t.push([[o],[],[]]):o.type===St.INSERT&&n.length===0?t.push([[],[],[o]]):o.type===St.INSERT&&n.length>0?i.push(o):o.type===St.DELETE&&n.push(o)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=Mp(e.concat(t).map(a=>a.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}makeHeaderHtml(e,t){return this.hoganUtils.render(xf,"block-header",{CSSLineClass:br,blockHeader:t!=null&&t.isTooBig?e:Ao(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,t,n){let i={right:"",left:""},s=Math.max(t.length,n.length);for(let o=0;o<s;o++){let a=t[o],l=n[o],c=a!==void 0&&l!==void 0?Hp(a.content,l.content,e,this.config):void 0,u=a!==void 0&&a.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:br.DELETE_CHANGES}:Object.assign(Object.assign({},ti(a.content,e)),{type:pc(a.type)})),{number:a.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:br.INSERT_CHANGES}:Object.assign(Object.assign({},ti(l.content,e)),{type:pc(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);i.left+=d,i.right+=h}return i}generateLineHtml(e,t){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(t)}}generateSingleHtml(e){let t="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(xf,"line",{type:(e==null?void 0:e.type)||`${br.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?n:`${n} 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})}};g();var my=nt(py());g();var jt=nt(py()),Lt={};Lt["file-summary-line"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<li class="d2h-file-list-line">'),n.b(`
`+t),n.b(' <span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <a href="#'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-name">'),n.b(n.v(n.f("fileName",r,e,0))),n.b("</a>"),n.b(`
`+t),n.b(' <span class="d2h-file-stats">'),n.b(`
`+t),n.b(' <span class="d2h-lines-added">'),n.b(n.v(n.f("addedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(' <span class="d2h-lines-deleted">'),n.b(n.v(n.f("deletedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b("</li>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});Lt["file-summary-wrapper"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-list-header">'),n.b(`
`+t),n.b(' <span class="d2h-file-list-title">Files changed ('),n.b(n.v(n.f("filesNumber",r,e,0))),n.b(")</span>"),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-show">show</a>'),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <ol class="d2h-file-list">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("files",r,e,0))),n.b(`
`+t),n.b(" </ol>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["generic-block-header"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('"></td>'),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.s(n.f("blockHeader",r,e,1),r,e,0,156,173,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(o.t(o.f("blockHeader",i,s,0)))}),r.pop()),n.s(n.f("blockHeader",r,e,1),r,e,1,0,0,"")||n.b("&nbsp;"),n.b("</div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-empty-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" File without changes"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-file-path"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <span class="d2h-file-name">'),n.b(n.v(n.f("fileDiffName",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(n.rp("<fileTag1",r,e," ")),n.b("</span>"),n.b(`
`+t),n.b('<label class="d2h-file-collapse">'),n.b(`
`+t),n.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),n.b(`
`+t),n.b(" Viewed"),n.b(`
`+t),n.b("</label>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});Lt["generic-line"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("lineNumber",r,e,0))),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.s(n.f("prefix",r,e,1),r,e,0,162,238,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(' <span class="d2h-code-line-prefix">'),o.b(o.t(o.f("prefix",i,s,0))),o.b("</span>"),o.b(`
`+t)}),r.pop()),n.s(n.f("prefix",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),n.b(`
`+t)),n.s(n.f("content",r,e,1),r,e,0,371,445,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(' <span class="d2h-code-line-ctn">'),o.b(o.t(o.f("content",i,s,0))),o.b("</span>"),o.b(`
`+t)}),r.pop()),n.s(n.f("content",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-ctn"><br></span>'),n.b(`
`+t)),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-wrapper"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("content",r,e,0))),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["icon-file-added"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),n.b(`
`+t),n.b(' width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-changed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-deleted"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-renamed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),n.b(`
`+t),n.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>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["line-by-line-file-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("diffs",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["line-by-line-numbers"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",r,e,0))),n.b("</div>"),n.b(`
`+t),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",r,e,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["side-by-side-file-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-files-diff">'),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.left",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.right",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["tag-file-added"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-changed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-deleted"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-renamed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),n.fl()},partials:{},subs:{}});var Sf=class{constructor({compiledTemplates:e={},rawTemplates:t={}}){let n=Object.entries(t).reduce((i,[s,o])=>{let a=my.compile(o,{asString:!1});return Object.assign(Object.assign({},i),{[s]:a})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Lt),e),n)}static compile(e){return my.compile(e,{asString:!1})}render(e,t,n,i,s){let o=this.templateKey(e,t);try{return this.preCompiledTemplates[o].render(n,i,s)}catch(a){throw new Error(`Could not find template to render '${o}'`)}}template(e,t){return this.preCompiledTemplates[this.templateKey(e,t)]}templateKey(e,t){return`${e}-${t}`}};var p9=Object.assign(Object.assign(Object.assign({},uy),fy),{outputFormat:PP.LINE_BY_LINE,drawFileList:!0});function jp(r,e={}){let t=Object.assign(Object.assign({},p9),e),n=typeof r=="string"?BP(r,t):r,i=new Sf(t),{colorScheme:s}=t,o={colorScheme:s},a=t.drawFileList?new Gp(i,o).render(n):"",l=t.outputFormat==="side-by-side"?new Ef(i,t).render(n):new _f(i,t).render(n);return a+l}var JP=nt(XP(),1);var ya=require("obsidian"),gy=kf.StateEffect.define();function Co(r,e){let t=r.state,n=t.field(Vp),i=t.field(on),s=t.doc.lineAt(e!=null?e:t.selection.main.head).number,o=cr.findHunk(s,i==null?void 0:i.hunks)[0];if(!o)return;let a=t.doc.line(Math.max(1,o.added.start)).from,l=n.has(a);return t.field(ya.editorEditorField).dispatch({effects:gy.of({pos:a,add:!l})})}var Vp=kf.StateField.define({create:()=>new Set,update(r,e){let t=new Set;for(let n of e.effects)n.is(gy)&&(n.value.add?r.add(n.value.pos):r.delete(n.value.pos));for(let n of r)t.add(e.changes.mapPos(n));return t}}),e2=kf.StateField.define({create:r=>QP(r),update(r,e){return e.docChanged||e.effects.some(t=>t.is(cc)||t.is(gy))?QP(e.state):r},provide:r=>zp.showTooltip.computeN([r],e=>e.field(r))}),t2=zp.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 QP(r){let e=r.field(on);return e?[...r.field(Vp)].map(n=>{let i=r.doc.lineAt(n),s=cr.findHunk(i.number,e.hunks)[0];if(s)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>m9(s,r,n)}}).filter(n=>n!==void 0):[]}function m9(r,e,t){var m,w;let n=cr.createPatch("file",[r],"10064",!1).join(`
`)+`
`,i=jp(n,{colorScheme:JP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),o=createDiv();o.addClass("tooltip-toolbar");let a=(y,v)=>{let A=createDiv();return(0,ya.setIcon)(A,y),A.setAttr("aria-label",v),A.addClass("clickable-icon"),A},l=a("x","Close hunk"),c=a("plus","Stage hunk"),u=a("undo","Reset hunk");o.appendChild(l),o.appendChild(c),o.appendChild(u);let f=createDiv();f.appendChild(o),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(ya.editorEditorField);l.onclick=()=>{Co(d,t)},c.onclick=()=>{let y=Pt.plugin;y&&(y.promiseQueue.addTask(()=>y.hunkActions.stageHunk(t)),Co(d,t))},u.onclick=()=>{let y=Pt.plugin;y&&(y.hunkActions.resetHunk(t),Co(d,t))};let h=(w=(m=Pt.plugin)==null?void 0:m.app.workspace.getActiveViewOfType(ya.MarkdownView))==null?void 0:w.scope,p=h==null?void 0:h.register(null,"Escape",(y,v)=>{Co(d,t)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:y=>{t=y.changes.mapPos(t)}}}function r2(r){let e=r.app;r.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let t=r.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(t)||await e.vault.adapter.write(t,"");let n=await e.vault.adapter.read(t),s=await new Sp(e,n).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(t,s),await r.refresh())}}),r.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(wr.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:wr.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(tn.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:tn.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:t=>{let n=e.workspace.getActiveFile();if(t)return n!==null;{let i=r.gitManager.getRelativeRepoPath(n.path,!0);return r.tools.openDiff({aFile:i,aRef:""}),!0}}}),r.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(t,{file:n})=>{if(n)return U$(t,n,r.gitManager)}}),r.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(t,{file:n})=>{if(n)return j$(n,r.gitManager)}}),r.addCommand({id:"pull",name:"Pull",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.pullChangesFromRemote())}),r.addCommand({id:"fetch",name:"Fetch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.fetch())}),r.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.switchRemoteBranch())}),r.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:t=>{let n=e.workspace.getActiveFile();return t?n!==null:(r.promiseQueue.addTask(()=>r.gitActions.addFileToGitignore(n.path,n instanceof Af.TFolder)),!0)}}),r.addCommand({id:"push",name:"Commit-and-sync",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1}))}),r.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>r.promiseQueue.addTask(async()=>{await r.gitActions.commitAndSync({fromAutoBackup:!1}),window.close()})}),r.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),r.addCommand({id:"commit",name:"Commit all changes",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,mode:"all"}))}),r.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),r.addCommand({id:"commit-smart",name:"Commit",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),r.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),r.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),r.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),r.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCusto Line truncated
- ${s.map(a=>a.vaultPath).join(`
- `)}
Please remove them or add to .gitignore.`),!0}return!1}openDiff({aFile:e,bFile:t,aRef:n,bRef:i,event:s}){var l,c;let o=this.plugin.settings.diffStyle;Yp.Platform.isMobileApp&&(o="git_unified");let a={aFile:e,bFile:t!=null?t:e,aRef:n,bRef:i};o=="split"?(l=En(this.plugin.app,s))==null||l.setViewState({type:go.type,active:!0,state:a}):o=="git_unified"&&((c=En(this.plugin.app,s))==null||c.setViewState({type:wo.type,active:!0,state:a}))}async openFileAtCommit(e,t){let n={file:e,ref:t};await this.plugin.app.workspace.getLeaf("tab").setViewState({type:mo.type,active:!0,state:n})}async runRawCommand(){if(!(this.plugin.gitManager instanceof Ze))return;let t=await new _t(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();t!==void 0&&this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.runRawCommand(t))}};g();var Kp=require("obsidian");var _a=class extends Kp.ItemView{constructor(t,n){super(t);this.plugin=n;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 wo.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return wo.name}getIcon(){return wo.icon}async setState(t,n){this.state=t,Kp.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 t;if((t=this.state)!=null&&t.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof Ze&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
`);else if(await this.app.vault.adapter.exists(i)){let s=await this.app.vault.adapter.read(i);n=[...`--- /dev/null
+++ ${this.state.bFile}
@@ -0,0 +1,${s.split(`
`).length} @@`.split(`
`),...s.split(`
`).map(a=>`+${a}`)].join(`
`)}}if(n){let s=this.parser.parseFromString(jp(n),"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}}}};g();var Os=require("obsidian");var bc=require("@codemirror/commands");var Xp=require("@codemirror/search"),vc=require("@codemirror/state"),Ei=require("@codemirror/view");g();var Zp=require("obsidian"),wy=require("@codemirror/view");function g9(r){return r.selection.ranges.filter(e=>!e.empty).map(e=>r.sliceDoc(e.from,e.to)).join(r.lineBreak)}function w9(r){r.dispatch({...r.state.replaceSelection(""),userEvent:"delete.cut"})}function i2(r,e){r.dispatch({...r.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function s2(r){if(!r&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html")){let n=await(await t.getType("text/html")).text();return(0,Zp.htmlToMarkdown)(n)}}return navigator.clipboard.readText()}var o2=wy.EditorView.domEventHandlers({contextmenu(r,e){r.preventDefault();let t=g9(e.state),n=!e.state.readOnly&&e.state.facet(wy.EditorView.editable),i=Zp.Menu.forEvent(r);return i.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!n||t.length===0).onClick(async()=>{await navigator.clipboard.writeText(t),w9(e)})),i.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(t.length===0).onClick(()=>navigator.clipboard.writeText(t))),i.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!n).onClick(async()=>i2(e,await s2(!1)))),i.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!n).onClick(async()=>i2(e,await s2(!0)))),i.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),i.showAtMouseEvent(r),!0}});var a2=Ei.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),v9=10;function b9(r,e){let t=Number.isInteger(r)&&r>0?r:en.diffTimeout;return e?t:t*v9}var xa=class extends Os.ItemView{constructor(t,n){super(t);this.plugin=n;this.refreshing=!1;this.indexUnmerged=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{!this.mergeView||this.indexUnmerged?this.createMergeView().catch(console.error):this.updateRefEditors().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.isWorkingTreeBFile(i.path)&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,s)=>{(this.isWorkingTreeBFile(i.path)||this.isWorkingTreeBFile(s))&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Os.debounce)(i=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),i).catch(o=>this.plugin.displayError(o)))},1e3,!1)}isWorkingTreeBFile(t){var n;return((n=this.state)==null?void 0:n.bFile)==null||this.state.bRef!=null||!this.plugin.gitManager?!1:t===this.plugin.gitManager.getRelativeVaultPath(this.state.bFile)}getViewType(){return go.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return go.name}getIcon(){return go.icon}async setState(t,n){this.state=t,Os.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(t,n),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(t,n){try{return await this.plugin.gitManager.show(t,n,!1)}catch(i){if(i instanceof vr){if(t===""&&i.message.includes("is in the index, but not at stage 0")){this.indexUnmerged=!0;try{return await this.plugin.gitManager.show(":2",n,!1)}catch(s){if(s instanceof vr&&s.message.includes("is in the index, but not at stage 2"))return"";throw s}}if(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: Line truncated
`)+`
`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=n.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,Os.setIcon)(s,"undo"),s.onmousedown=o=>{var d;let a=this.mergeView.a,l=this.mergeView.b,c=qb(l.state),u=(d=n.parentElement)==null?void 0:d.indexOf(n),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,m=f.fromB,w=f.toB,y=a.state.sliceDoc(h,Math.max(h,p-1));h!=p&&w<=l.state.doc.length&&(y+=a.state.lineBreak),l.dispatch({changes:{from:m,to:Math.min(l.state.doc.length,w),insert:y},userEvent:"revert"})}}}return n.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},n}async createMergeView(){var t,n,i;if((t=this.state)!=null&&t.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0;try{(i=this.mergeView)==null||i.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable(),this.indexUnmerged=!1;let o=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null)a=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)?a=await this.app.vault.adapter.read(p):a=""}let l=[(0,Ei.lineNumbers)(),(0,Xp.highlightSelectionMatches)(),(0,Ei.drawSelection)(),Ei.keymap.of([...bc.standardKeymap,bc.indentWithTab]),(0,bc.history)(),(0,Xp.search)(),Ei.EditorView.lineWrapping,o2],c=Ei.ViewPlugin.define(p=>({update:m=>{if(m.docChanged&&!m.transactions.some(w=>w.annotation(vc.Transaction.remote))){let w=p.state.doc.toString();this.fileSaveDebouncer(w)}}})),u={doc:o,extensions:[...l,vc.EditorState.readOnly.of(!0),a2]},f=[...l];this.bIsEditable?f.push(c):f.push(vc.EditorState.readOnly.of(!0),a2);let d={doc:a,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof Ze&&!this.indexUnmerged&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Ip({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:b9(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s})}finally{this.refreshing=!1}}}};g();var ZI=require("obsidian");g();g();g();var l2,c2,u2;typeof window!="undefined"&&((u2=(c2=(l2=window.__svelte)!=null?l2:window.__svelte={}).v)!=null?u2:c2.v=new Set).add("5");g();g();g();var Rn={};var lt=Symbol("uninitialized"),ni=Symbol("filename");var Qp="http://www.w3.org/1999/xhtml";g();g();g();g();var Jp=!0;g();var N=!1;g();var Fs=Array.isArray,f2=Array.prototype.indexOf,Ms=Array.prototype.includes,yc=Array.from,vy=Object.keys,ur=Object.defineProperty,an=Object.getOwnPropertyDescriptor,by=Object.getOwnPropertyDescriptors,yy=Object.prototype,d2=Array.prototype,_c=Object.getPrototypeOf,_y=Object.isExtensible;function xy(r){return typeof r=="function"}var Cr=()=>{};function em(r){for(var e=0;e<r.length;e++)r[e]()}function tm(){var r,e,t=new Promise((n,i)=>{r=n,e=i});return{promise:t,resolve:r,reject:e}}g();g();var Nr=Symbol("$state"),rm=Symbol("component"),Tf=Symbol("legacy props"),p2=Symbol(""),nm=Symbol("proxy path"),im=Symbol("attributes"),Rf=Symbol("class"),Ey=Symbol("style"),$f=Symbol("text"),Ea=Symbol("form reset"),Sy=Symbol("hmr anchor"),Ds=new class extends Error{constructor(){super(...arguments);Xe(this,"name","StaleReactionError");Xe(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},h2,ky=!!((h2=globalThis.document)!=null&&h2.contentType)&&globalThis.document.contentType.includes("xml");var xc=3,ii=8;g();g();g();g();var Ls="font-weight: bold",Ns="font-weight: normal";function m2(r){N?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${r}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,Ls,Ns):console.warn("https://svelte.dev/e/await_reactivity_loss")}function g2(r,e){N?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${r}\` (${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`,Ls,Ns):console.warn("https://svelte.dev/e/await_waterfall")}function w2(){N?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`,Ls,Ns):console.warn("https://svelte.dev/e/derived_inert")}function v2(r,e,t){N?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${r}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${t}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Ls,Ns):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Sa(r){N?console.warn(`%c[svelte] hydration_mismatch
%c${r?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${r}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Ls,Ns):console.warn("https://svelte.dev/e/hydration_mismatch")}function b2(){N?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Ls,Ns):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function sm(r){N?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${r}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Ls,Ns):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function y2(){N?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",Ls,Ns):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function _2(r){N?console.warn(`%c[svelte] transition_slide_display
%cThe \`slide\` transition does not work correctly for elements with \`display: ${r}\`
https://svelte.dev/e/transition_slide_display`,Ls,Ns):console.warn("https://svelte.dev/e/transition_slide_display")}var ue=!1;function Zt(r){ue=r}var Ee;function st(r){if(r===null)throw Sa(),Rn;return Ee=r}function Tr(){return st(yr(Ee))}function V(r){if(ue){if(yr(Ee)!==null)throw Sa(),Rn;Ee=r}}function ka(r=1){if(ue){for(var e=r,t=Ee;e--;)t=yr(t);Ee=t}}function rs(r=!0){for(var e=0,t=Ee;;){if(t.nodeType===ii){var n=t.data;if(n==="]"){if(e===0)return t;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=yr(t);r&&t.remove(),t=i}}function Aa(r){if(!r||r.nodeType!==ii)throw Sa(),Rn;return r.data}g();g();g();g();function om(r){return r===this.v}function Ay(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function am(r){return!Ay(r,this.v)}g();g();function x2(r){if(N){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: "${r}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function lm(r){if(N){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` 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 S2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function Cy(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function k2(){if(N){let r=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/derived_references_self")}function Ty(r,e,t){if(N){let n=new Error(`each_key_duplicate
${t?`Keyed each block has duplicate key \`${t}\` at indexes ${r} and ${e}`:`Keyed each block has duplicate key at indexes ${r} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function A2(r,e,t){if(N){let n=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${r} was \`${e}\` but is now \`${t}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_volatile")}function C2(r){if(N){let e=new Error(`effect_in_teardown
\`${r}\` 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 T2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function R2(r){if(N){let e=new Error(`effect_orphan
\`${r}\` 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 $2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function P2(){if(N){let r=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/hydration_failed")}function I2(r){if(N){let e=new Error(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` 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 O2(r){if(N){let e=new Error(`rune_outside_svelte
The \`${r}\` 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 F2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function M2(){if(N){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function D2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function L2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}g();var Xt=!1,Bs=!1,Si=!1;g();g();g();var If=null;function Rr(r,e){return r.label=e,um(r.v,e),r}function um(r,e){var t;return(t=r==null?void 0:r[nm])==null||t.call(r,e),r}g();function ki(r){let e=new Error,t=_9();return t.length===0?null:(t.unshift(`
`),ur(e,"stack",{value:t.join(`
`)}),ur(e,"name",{value:r}),e)}function _9(){let r=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=r,!e)return[];let t=e.split(`
`),n=[];for(let i=0;i<t.length;i++){let s=t[i],o=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];o.includes("svelte/src/internal")||o.includes("node_modules/.vite")||n.push(s)}}return n}function B2(r,e){if(!N)throw new Error("invariant(...) was not guarded by if (DEV)");r||x2(e)}g();g();var Pe=null;function Hs(r){Pe=r}var Ai=null;function kc(r){Ai=r}var Ci=null;function fm(r){Ci=r}function gt(r,e=!1,t){Pe={p:Pe,i:!1,c:null,e:null,s:r,x:null,r:ie,l:Bs&&!e?{s:null,u:null,$:[]}:null},N&&(Pe.function=t,Ci=t)}function wt(r){var i;var e=Pe,t=e.e;if(t!==null){e.e=null;for(var n of t)Ry(n)}return r!==void 0&&(e.x=r),e.i=!0,Pe=e.p,N&&(Ci=(i=Pe==null?void 0:Pe.function)!=null?i:null),Of(r)}function Of(r={}){return ur(r,rm,{value:!0}),r}function ns(){return!Bs||Pe!==null&&Pe.l===null}g();g();var Ca=[];function H2(){var r=Ca;Ca=[],em(r)}function Nt(r){if(Ca.length===0&&!Ta){var e=Ca;queueMicrotask(()=>{e===Ca&&H2()})}Ca.push(r)}function G2(){for(;Ca.length>0;)H2()}g();g();var x9=-7169;function ot(r,e){r.f=r.f&x9|e}function Ac(r){(r.f&512)!==0||r.deps===null?ot(r,1024):ot(r,4096)}function dm(r,e){(r.f&2048)!==0?e.set(r,2048):(r.f&4096)!==0&&e.get(r)!==2048&&e.set(r,4096),ot(r,1024)}g();function U2(r){return`{${r.toString().replace(/^async \(\) => /,"").replace(/^\(/,"").replace(/\$\.get\((.+?)\)/g,(e,t)=>t).replace(/\$\.track_reactivity_loss\((.+?)\)\(\)/g,(e,t)=>t).replace(/\)$/,"")}}`}g();g();g();function $y(r){ue&&dr(r)!==null&&Cc(r)}var j2=!1;function Py(){j2||(j2=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var e;if(!r.defaultPrevented)for(let t of r.target.elements)(e=t[Ea])==null||e.call(t)})},{capture:!0}))}function Br(r){var e=he,t=ie;Jt(null),er(null);try{return r()}finally{Jt(e),er(t)}}function Iy(r,e,t,n=t){r.addEventListener(e,()=>Br(t));let i=r[Ea];i?r[Ea]=()=>{i(),n(!0)}:r[Ea]=()=>n(!0),Py()}g();function hm(r,e,t,n){let i=ns()?Ro:Pa;var s=r.filter(h=>!h.settled),o=e.map(i);if(N&&o.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(m,w)=>w)}),t.length===0&&s.length===0){n(o);return}var a=ie,l=z2(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function u(h){if((a.f&16384)===0){l();try{n([...o,...h])}catch(p){cn(p,a)}Tc()}}var f=Oy();if(t.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(t.map(h=>My(h))).then(u).catch(h=>cn(h,a)).finally(f)}c?c.then(()=>{if((a.f&16384)!==0){f();return}l(),d(),Tc()}):d()}function z2(){var r=ie,e=he,t=Pe,n=ve;if(N)var i=Ai;return function(o=!0){er(r),Jt(e),Hs(t),o&&(r.f&16384)===0&&(n==null||n.activate(),n==null||n.apply()),N&&(Fy(null),kc(i))}}var E9=!1;function Tc(r=!0){var e;E9=!1,er(null),Jt(null),Hs(null),r&&((e=ve)==null||e.deactivate()),N&&(Fy(null),kc(null))}function Oy(){var r=ie,e=r.b,t=ve,n=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(n,r),()=>{e==null||e.update_pending_count(-1,t),t.decrement(n,r)}}var un=null;function Fy(r){un=r}var Mf=new Set;function Ro(r){var e=2050;ie!==null&&(ie.f|=524288);let t={ctx:Pe,deps:null,effects:null,equals:om,f:e,fn:r,reactions:null,rv:0,v:lt,wv:0,parent:ie,ac:null};return N&&Si&&(t.created=ki("created at")),t}var Rc=Symbol("obsolete");function My(r,e,t){let n=ie;n===null&&S2();var i=void 0,s=$r(lt);N&&(s.label=e!=null?e:U2(r));var o=!he,a=new Set;return q2(()=>{var h,p;var l=ie;N&&(un={effect:l,effect_deps:new Set,warned:!1});var c=tm();i=c.promise;try{Promise.resolve(r()).then(c.resolve,m=>{m!==Ds&&c.reject(m)}).finally(Tc)}catch(m){c.reject(m),Tc()}if(N){if(un){if(l.deps!==null)for(let m=0;m<Gr;m+=1)un.effect_deps.add(l.deps[m]);if(hr!==null)for(let m=0;m<hr.length;m+=1)un.effect_deps.add(hr[m])}un=null}var u=ve;if(o){if((l.f&32768)!==0)var f=Oy();if((h=n.b)!=null&&h.is_rendered())(p=u.async_deriveds.get(l))==null||p.reject(Rc);else for(let m of a.values())m.reject(Rc);a.add(c),u.async_deriveds.set(l,c)}let d=(m,w=void 0)=>{N&&(un=null),f==null||f(),a.delete(c),w!==Rc&&(u.activate(),w?(s.f|=8388608,Ri(s,w)):((s.f&8388608)!==0&&(s.f^=8388608),N&&t!==void 0&&!s.equals(m)&&(Mf.add(s),setTimeout(()=>{Mf.has(s)&&(l.f&16384)===0&&(g2(s.label,t),Mf.delete(s))})),Ri(s,m)),u.deactivate())};c.promise.then(d,m=>d(null,m||"unknown"))}),Sr(()=>{for(let l of a)l.reject(Rc)}),N&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function He(r){let e=Ro(r);return Xt||gm(e),e}function Pa(r){let e=Ro(r);return e.equals=am,e}function V2(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Rt(e[t])}}var Dy=[];function Df(r){var e,t=ie,n=r.parent;if(!Pn&&n!==null&&r.v!==lt&&(n.f&24576)!==0)return w2(),r.v;if(er(n),N){let i=Ia;pm(new Set);try{Ms.call(Dy,r)&&k2(),Dy.push(r),V2(r),e=mm(r)}finally{er(t),pm(i),Dy.pop()}}else try{V2(r),e=mm(r)}finally{er(t)}return e}function Ly(r){var t,n,i;var e=Df(r);if(!r.equals(e)&&(r.wv=$c(),(!((t=ve)!=null&&t.is_ Line truncated
${n}in ${((o=e.fn)==null?void 0:o.name)||"<unknown>"}`,s=e.ctx;s!==null;)i+=`
${n}in ${(a=s.function)==null?void 0:a[ni].split("/").pop()}`,s=s.p;return{message:r.message+`
${i}
`,stack:(l=r.stack)==null?void 0:l.split(`
`).filter(c=>!c.includes("svelte/src/internal")).join(`
`)}}}function dI(r){let e=Qy.get(r);e&&(ur(r,"message",{value:e.message}),ur(r,"stack",{value:e.stack}))}function pI(r){ie===null&&(he===null&&R2(r),T2()),Pn&&C2(r)}function F9(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Pi(r,e){var o,a;var t=ie;if(N)for(;t!==null&&(t.f&131072)!==0;)t=t.parent;t!==null&&(t.f&8192)!==0&&(r|=8192);var n={ctx:Pe,deps:null,nodes:null,f:r|2048|512,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};N&&(n.component_function=Ci),(o=ve)==null||o.register_created_effect(n);var i=n;if((r&4)!==0)Oc!==null?Oc.push(n):In.ensure().schedule(n);else if(e!==null){try{is(n)}catch(l){throw Rt(n),l}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&524288)===0&&(i=i.first,(r&16)!==0&&(r&65536)!==0&&i!==null&&(i.f|=65536))}if(i!==null&&(i.parent=t,t!==null&&F9(i,t),he!==null&&(he.f&2)!==0&&(r&64)===0)){var s=he;((a=s.effects)!=null?a:s.effects=[]).push(i)}return n}function To(){return he!==null&&!Ur}function Sr(r){let e=Pi(8,null);return ot(e,1024),e.teardown=r,e}function tr(r){var i;pI("$effect"),N&&ur(r,"name",{value:"$effect"});var e=ie.f,t=!he&&(e&32)!==0&&Pe!==null&&!Pe.i;if(t){var n=Pe;((i=n.e)!=null?i:n.e=[]).push(r)}else return Ry(r)}function Ry(r){return Pi(1048580,r)}function t_(r){In.ensure();let e=Pi(524352,r);return()=>{Rt(e)}}function mI(r){In.ensure();let e=Pi(524352,r);return(t={})=>new Promise(n=>{t.outro?ls(e,()=>{Rt(e),n(void 0)}):(Rt(e),n(void 0))})}function jr(r){return Pi(4,r)}function q2(r){return Pi(4718592,r)}function kr(r,e=0){return Pi(8|e,r)}function Ue(r,e=[],t=[],n=[]){hm(n,e,t,i=>{Pi(8,()=>{r(...i.map(R))})})}function Mn(r,e=0){var t=Pi(16|e,r);return N&&(t.dev_stack=Ai),t}function r_(r,e=0){var t=Pi(16777216|e,r);return N&&(t.dev_stack=Ai),t}function Wt(r){return Pi(524320,r)}function n_(r){var e=r.teardown;if(e!==null){let t=Pn,n=he;Jy(!0),Jt(null);try{e.call(null)}catch(i){cn(i,r.parent)}finally{Jy(t),Jt(n)}}}function Lf(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){let i=t.ac;i!==null&&Br(()=>{i.abort(Ds)});var n=t.next;(t.f&64)!==0?t.parent=null:Rt(t,e),t=n}}function gI(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&Rt(e),e=t}}function Rt(r,e=!0){var t=!1;(e||(r.f&262144)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(wI(r.nodes.start,r.nodes.end),t=!0),r.f|=33554432,Lf(r,e&&!t),Oa(r,0);var n=r.nodes&&r.nodes.t;if(n!==null)for(let s of n)s.stop();n_(r),r.f^=33554432,r.f|=16384;var i=r.parent;i!==null&&i.first!==null&&qy(r),N&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function wI(r,e){for(;r!==null;){var t=r===e?null:yr(r);r.remove(),r=t}}function qy(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function ls(r,e,t=!0){var n=[];r.f|=256,vI(r,n,!0);var i=()=>{t&&Rt(r),e&&e()},s=n.length;if(s>0){var o=()=>--s||i();for(var a of n)a.out(o)}else i()}function vI(r,e,t){if((r.f&8192)===0){r.f^=8192;var n=r.nodes&&r.nodes.t;if(n!==null)for(let a of n)(a.is_global||t)&&e.push(a);for(var i=r.first;i!==null;){var s=i.next;if((i.f&64)===0){var o=(i.f&65536)!==0||(i.f&32)!==0&&(r.f&16)!==0;vI(i,e,o?t:!1)}i=s}}}function Bc(r){r.f&=-257,bI(r,!0)}function bI(r,e){if((r.f&256)===0&&(r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(ot(r,2048),In.ensure().schedule(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;bI(t,i?e:!1),t=n}var s=r.nodes&&r.nodes.t;if(s!==null)for(let o of s)(o.is_global||e)&&o.in()}}function Hc(r,e){if(r.nodes)for(var t=r.nodes.start,n=r.nodes.end;t!==null;){var i=t===n?null:yr(t);e.append(t),t=i}}g();var yI=null;var Pn=!1;function Jy(r){Pn=r}var he=null,Ur=!1;function Jt(r){he=r}var ie=null;function er(r){ie=r}var dn=null;function gm(r){he!==null&&(!Xt&&(he.f&2097152)!==0||(he.f&2)!==0)&&(dn!=null?dn:dn=new Set).add(r)}var hr=null,Gr=0,On=null;function oI(r){On=r}var xI=1,Ba=0,Oo=Ba;function Zy(r){Oo=r}function $c(){return++xI}function Io(r){var e=r.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var t=r.deps,n=t.length,i=0;i<n;i++){var s=t[i];if(Io(s)&&Ly(s),s.wv>r.wv)return!0}(e&512)!==0&&zt===null&&ot(r,1024)}return!1}function EI(r,e,t=!0){var n=r.reactions;if(n!==null&&!(!Xt&&dn!==null&&dn.has(r)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&2)!==0?EI(s,e,!1):e===s&&(t?ot(s,2048):(s.f&1024)!==0&&ot(s,4096),Uf(s))}}function mm(r){var e=hr,t=Gr,n=On,i=he,s=dn,o=Pe,a=Ur,l=Oo,c=r.f;hr=null,Gr=0,On=null,he=(c&96)===0?r:null,dn=null,Hs(r.ctx),Ur=!1,Oo=++Ba,r.ac!==null&&(Br(()=>{r.ac.abort(Ds)}),r.ac=null);try{r.f|=2097152;var u=r.fn,f=u();r.f|=32768;var d=_I(r);if(ns()&&On!==null&&!Ur&&d!==null&&(r.f&6146)===0)for(var h=0;h<On.length;h++)EI(On[h],r);if(i!==null&&i!==r){if(Ba++,i.deps!==null)for(let p=0;p<t;p+=1)i.deps[p].rv=Ba;if(e!==null)for(let p of e)p.rv=Ba;On!==null&&(n===null?n=On:n.push(...On))}return(r.f&8388608)!==0&&(r.f^=8388608),f}catch(p){return _I(r),fI(p)}finally{r. Line truncated
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==Rn&&console.warn("Failed to hydrate: ",a),e.recover===!1&&P2(),_m(),Cc(t),Zt(!1),Do(r,e)}finally{Zt(n),st(i)}}var Rm=new Map;function MI(r,{target:e,anchor:t,props:n={},events:i,context:s,intro:o=!0,transformError:a}){_m();var l=void 0,c=mI(()=>{var u=t!=null?t:e.appendChild(Vt());m_(u,{pending:()=>{}},h=>{gt({});var p=Pe;if(s&&(p.c=s),i&&(n.$$events=i),ue&&Ii(h,null),$m=o,l=r(h,n)||Of(),$m=!0,ue&&(ie.nodes.end=Ee,Ee===null||Ee.nodeType!==ii||Ee.data!=="]"))throw Sa(),Rn;wt()},a);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var m=h[p];if(!f.has(m)){f.add(m);var w=RI(m);for(let A of[e,document]){var y=Rm.get(A);y===void 0&&(y=new Map,Rm.set(A,y));var v=y.get(m);v===void 0?(A.addEventListener(m,Am,{passive:w}),y.set(m,1)):y.set(m,v+1)}}}};return d(yc(o_)),km.add(d),()=>{var w;for(var h of f)for(let y of[e,document]){var p=Rm.get(y),m=p.get(h);--m==0?(y.removeEventListener(h,Am),p.delete(h),p.size===0&&Rm.delete(y)):p.set(h,m)}km.delete(d),u!==t&&((w=u.parentNode)==null||w.removeChild(u))}});return g_.set(l,c),l}var g_=new WeakMap;function Ws(r,e){let t=g_.get(r);return t?(g_.delete(r),t(e)):(N&&b2(),Promise.resolve())}g();g();g();var Oi,fs,Bn,ja,Yf,Kf,Pm,qs=class{constructor(e,t=!0){Xe(this,"anchor");Re(this,Oi,new Map);Re(this,fs,new Map);Re(this,Bn,new Map);Re(this,ja,new Set);Re(this,Yf,!0);Re(this,Kf,e=>{if(O(this,Oi).has(e)){var t=O(this,Oi).get(e),n=O(this,fs).get(t);if(n)Bc(n),O(this,ja).delete(t);else{var i=O(this,Bn).get(t);i&&(Bc(i.effect),O(this,fs).set(t,i.effect),O(this,Bn).delete(t),N&&(i.fragment.lastChild[Sy]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[s,o]of O(this,Oi)){if(O(this,Oi).delete(s),s===e)break;let a=O(this,Bn).get(o);a&&(Rt(a.effect),O(this,Bn).delete(o))}for(let[s,o]of O(this,fs)){if(s===t||O(this,ja).has(s))continue;let a=()=>{if(Array.from(O(this,Oi).values()).includes(s)){var c=document.createDocumentFragment();Hc(o,c),c.append(Vt()),O(this,Bn).set(s,{effect:o,fragment:c})}else Rt(o);O(this,ja).delete(s),O(this,fs).delete(s)};O(this,Yf)||!n?(O(this,ja).add(s),ls(o,a,!1)):a()}}});Re(this,Pm,e=>{O(this,Oi).delete(e);let t=Array.from(O(this,Oi).values());for(let[n,i]of O(this,Bn))t.includes(n)||(Rt(i.effect),O(this,Bn).delete(n))});this.anchor=e,Se(this,Yf,t)}ensure(e,t){var n=ve,i=xm();if(t&&!O(this,fs).has(e)&&!O(this,Bn).has(e))if(i){var s=document.createDocumentFragment(),o=Vt();s.append(o),O(this,Bn).set(e,{effect:Wt(()=>t(o)),fragment:s})}else O(this,fs).set(e,Wt(()=>t(this.anchor)));if(O(this,Oi).set(n,e),i){for(let[a,l]of O(this,fs))a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]of O(this,Bn))a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(O(this,Kf)),n.ondiscard(O(this,Pm))}else ue&&(this.anchor=Ee),O(this,Kf).call(this,n)}};Oi=new WeakMap,fs=new WeakMap,Bn=new WeakMap,ja=new WeakMap,Yf=new WeakMap,Kf=new WeakMap,Pm=new WeakMap;if(N){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;O2(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function za(r){Pe===null&&lm("onMount"),Bs&&Pe.l!==null?q9(Pe).m.push(r):tr(()=>{let e=ct(r);if(typeof e=="function")return e})}function q9(r){var t;var e=r.l;return(t=e.u)!=null?t:e.u={a:[],b:[],m:[]}}g();g();var NI=new Map;function BI(r,e){var t=NI.get(r);t||(t=new Set,NI.set(r,t)),t.add(e)}g();g();g();g();g();g();g();g();g();function Ae(r,e,t=!1){var n;ue&&(n=Ee,Tr());var i=new qs(r),s=t?65536:0;function o(a,l){if(ue){var c=Aa(n);if(a!==parseInt(c.substring(1))){var u=rs();st(u),i.anchor=u,Zt(!1),i.ensure(a,l),Zt(!0);return}}i.ensure(a,l)}Mn(()=>{var a=!1;e((l,c=0)=>{a=!0,o(c,l)}),a||o(-1,null)},s)}g();g();g();function mn(r,e){return e}function tz(r,e,t){var f;for(var n=[],i=e.length,s,o=e.length,a=0;a<i;a++){let d=e[a];ls(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=r.outrogroups;v_(r,yc(s.done)),h.delete(s),h.size===0&&(r.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=n.length===0&&t!==null&&r.pending.size===0;if(l){var c=t,u=c.parentNode;Cc(u),u.append(c),r.items.clear()}v_(r,e,!l)}else s={pending:new Set(e),done:new Set},((f=r.outrogroups)!=null?f:r.outrogroups=new Set).add(s)}function v_(r,e,t=!0){var n;if(r.pending.size>0){n=new Set;for(let o of r.pending.values())for(let a of o)n.add(r.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(n!=null&&n.has(s)){s.f|=33554432;let o=document.createDocumentFragment();Hc(s,o)}else Rt(e[i],t)}}var Lo;function gn(r,e,t,n,i,s=null){var o=r,a=new Map,l=(e&4)!==0;if(l){var c=r;o=ue?st(dr(c)):c.appendChild(Vt())}ue&&Tr();var u=null,f=Pa(()=>{var v=t();return Fs(v)?v:v==null?[]:yc(v)});N&&Rr(f,"{#each ...}");var d=new Map,h=!0;function p(v){if((y.effect.f&16384)===0){y.pending.delete(v);var A=R(f);y.fallback=u,rz(y,A,o,e,n),u!==null&&(A.length===0?(u.f&33554432)===0?Bc(u):(u.f^=3355 Line truncated
\r\f\xA0\v\uFEFF`];function WI(r,e,t){var n=r==null?"":""+r;if(e&&(n=n?n+" "+e:e),t){for(var i of Object.keys(t))if(t[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,o=0;(o=n.indexOf(i,o))>=0;){var a=o+s;(o===0||VI.includes(n[o-1]))&&(a===n.length||VI.includes(n[a]))?n=(o===0?"":n.substring(0,o))+n.substring(a+1):o=a}}return n===""?null:n}g();function dt(r,e,t,n,i,s){var o=r[Rf];if(ue||o!==t||o===void 0){var a=WI(t,n,s);(!ue||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r[Rf]=t}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&r.classList.toggle(l,c)}return s}g();g();var bz=Symbol("is custom element"),yz=Symbol("is html"),_z=ky?"link":"LINK";function ye(r,e,t,n){var i=xz(r);if(ue&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===_z)){n||Sz(r,e,t!=null?t:"");return}var s=i[e];s!==(i[e]=t)&&(e==="loading"&&(r[p2]=t),t==null?r.removeAttribute(e):typeof t!="string"&&Ez(r).has(e)?r[e]=t:ue&&(typeof t=="number"||typeof t=="boolean")&&s===String(t)||r.setAttribute(e,t))}function xz(r){var e,t;return(t=r[e=im])!=null?t:r[e]={[bz]:r.nodeName.includes("-"),[yz]:r.namespaceURI===Qp}}var qI=new Map;function Ez(r){var e=r.getAttribute("is")||r.nodeName,t=qI.get(e);if(t)return t;qI.set(e,t=new Set);for(var n,i=r,s=Element.prototype;s!==i;){n=by(i);for(var o in n)n[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&t.add(o);i=_c(i)}return t}function Sz(r,e,t){var n;N&&(e==="srcset"&&kz(r,t)||y_((n=r.getAttribute(e))!=null?n:"",t)||v2(e,r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t)))}function y_(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function YI(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function kz(r,e){var t=YI(r.srcset),n=YI(e);return n.length===t.length&&n.every(([i,s],o)=>s===t[o][1]&&(y_(t[o][0],i)||y_(i,t[o][0])))}g();g();g();function E_(r,e,t=e){var n=new WeakSet;Iy(r,"input",async i=>{N&&r.type==="checkbox"&&Cy();var s=i?r.defaultValue:r.value;if(s=__(r)?x_(s):s,t(s),ve!==null&&n.add(ve),await Sm(),s!==(s=e())){var o=r.selectionStart,a=r.selectionEnd,l=r.value.length;if(r.value=s!=null?s:"",a!==null){var c=r.value.length;o===a&&a===l&&c>l?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=o,r.selectionEnd=Math.min(a,c))}}}),(ue&&r.defaultValue!==r.value||ct(e)==null&&r.value)&&(t(__(r)?x_(r.value):r.value),ve!==null&&n.add(ve)),kr(()=>{N&&r.type==="checkbox"&&Cy();var i=e();if(r===document.activeElement){var s=Xt?oi:ve;if(n.has(s))return}__(r)&&i===x_(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i!=null?i:"")})}function __(r){var e=r.type;return e==="number"||e==="range"}function x_(r){return r===""?null:+r}g();g();g();g();g();function S_(r,e){return r===e||(r==null?void 0:r[Nr])===e}function rt(r=Of(),e,t,n){var i=Pe.r,s=ie;return jr(()=>{var o,a;return kr(()=>{o=a,a=(n==null?void 0:n())||[],ct(()=>{S_(t(...a),r)||(e(r,...a),o&&S_(t(...o),r)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{a&&S_(t(...a),r)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),r}g();g();g();g();g();g();g();g();g();var Fm=!1;function A_(r){var e=Fm;try{return Fm=!1,[r(),Fm]}finally{Fm=e}}function Gn(r,e,t,n){var C,S;var i=!Bs||(t&2)!==0,s=(t&8)!==0,o=(t&16)!==0,a=n,l=!0,c=void 0,u=()=>o&&i?(c!=null||(c=Ro(n)),R(c)):(l&&(l=!1,a=o?ct(n):n),a);let f;if(s){var d=Nr in r||Tf in r;f=(S=(C=an(r,e))==null?void 0:C.set)!=null?S:d&&e in r?T=>r[e]=T:void 0}var h,p=!1;s?[h,p]=A_(()=>r[e]):h=r[e],h===void 0&&n!==void 0&&(h=u(),f&&(i&&I2(e),f(h)));var m;if(i?m=()=>{var T=r[e];return T===void 0?u():(l=!0,T)}:m=()=>{var T=r[e];return T!==void 0&&(a=void 0),T===void 0?a:T},i&&(t&4)===0)return m;if(f){var w=r.$$legacy;return(function(T,b){return arguments.length>0?((!i||!b||w||p)&&f(b?m():T),T):m()})}var y=!1,v=((t&1)!==0?Ro:Pa)(()=>(y=!1,m()));N&&(v.label=e),s&&R(v);var A=ie;return(function(T,b){if(arguments.length>0){let x=b?R(v):i&&s?at(T):T;return X(v,x),y=!0,a!==void 0&&(a=x),T}return Pn&&y||(A.f&16384)!==0?v.v:R(v)})}g();g();g();function KI(r){return new C_(r)}var Ys,ui,C_=class{constructor(e){Re(this,Ys);Re(this,ui);var s,o;var t=new Map,n=(a,l)=>{var c=Da(l,!1,!1);return t.set(a,c),c};let i=new Proxy({...e.props||{},$$events:{}},{get(a,l){var c;return R((c=t.get(l))!=null?c:n(l,Reflect.get(a,l)))},has(a,l){var c;return l===Tf?!0:(R((c=t.get(l))!=null?c:n(l,Reflect.get(a,l))),Reflect.has(a,l))},set(a,l,c){var u;return X((u=t.get(l))!=null?u:n(l,c),c),Reflect.set(a,l,c)}});Se(this,ui,(e.hydrate?w_:Do)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Xt&&(!((o=e==null?void 0:e.props)!=null&&o.$$host)||e.sync===!1)&&Po(),Se(this,Ys,i.$$events);for(let a of Object.keys(O(this,ui)))a==="$set"||a==="$destroy"||a==="$on"||ur(this,a,{get(){return O(t Line truncated
${(0,td.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}
${e.log.body?`
`+e.log.body:""}`}),s=Ie(!0),o=Ie(at({}));function a(E){let k=E.author.name;return e.plugin.settings.authorInHistoryView=="full"?k:e.plugin.settings.authorInHistoryView=="initials"?k.split(" ").filter(M=>M.length>0).map(M=>M[0].toUpperCase()).join(""):""}var l=tV(),c=W(l);let u;var f=W(c),d=W(f);let h;var p=K(d,2),m=W(p);{var w=E=>{var k=Xz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>e.log.refs.join(", ")]),te(E,k)};Ae(m,E=>{e.log.refs.length>0&&E(w)})}var y=K(m,2);{var v=E=>{var k=Qz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>a(e.log)]),te(E,k)};Ae(y,E=>{var k;e.plugin.settings.authorInHistoryView!="hide"&&((k=e.log.author)!=null&&k.name)&&E(v)})}var A=K(y,2);{var C=E=>{var k=Jz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>(0,td.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),te(E,k)};Ae(A,E=>{e.plugin.settings.dateInHistoryView&&E(C)})}var S=K(A,2),T=Ye(S,!0);V(p),V(f),Qf(f,()=>E=>{(0,td.setTooltip)(E,R(i),{placement:R(n),classes:["obsidian-git-commit-tooltip"]})});var b=K(f,2);{var x=E=>{var k=eV(),$=W(k);{var M=P=>{ed(P,{get hierarchy(){return R(t)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return R(o)},set closed(F){X(o,F,!0)}})},D=P=>{var F=Vs(),_e=Fn(F);gn(_e,17,()=>e.log.diff.files,mn,(Q,oe)=>{Jf(Q,{get view(){return e.view},get diff(){return R(oe)}})}),te(P,F)};Ae($,P=>{e.showTree?P(M):P(D,-1)})}V(k),ci(3,k,()=>Di,()=>({duration:150})),te(E,k)};Ae(b,E=>{R(s)||E(x)})}V(c),V(l),Ue(()=>{u=dt(c,1,"tree-item nav-folder",null,u,{"is-collapsed":R(s)}),ye(f,"aria-label",R(i)),h=dt(d,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,h,{"is-collapsed":R(s)}),Ke(T,e.log.message)}),de("click",f,()=>X(s,!R(s))),te(r,l),wt()}Ot(["click"]);var nV=pe('<div class="tree-item nav-folder mod-root"></div>'),iV=pe('<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>'),sV={hash:"svelte-12n6twc",code:""};function I_(r,e){gt(e,!0),Hn(r,sV);let t=Gn(e,"plugin",15),n=Ie(!1),i=at([]),s=Ie(void 0),o=Ie(at(t().settings.treeStructure)),a,l=Mm(u);tr(()=>{a&&a.empty()}),za(()=>{let S=e.view.app.workspace.on("obsidian-git:refs-changed",()=>{l().catch(console.error)});return()=>e.view.app.workspace.offref(S)}),tr(()=>{i.forEach(S=>(0,P_.setIcon)(S,S.getAttr("data-icon")))}),za(()=>{let S=new IntersectionObserver(b=>{var x;(x=b[0])!=null&&x.isIntersecting&&!R(n)&&f().catch(console.error)}),T=activeDocument.querySelector("#sentinel");return T&&S.observe(T),()=>{S.disconnect()}}),l().catch(console.error);function c(){l().catch(console.error)}async function u(){var b,x;if(!t().gitReady){X(s,void 0);return}X(n,!0);let S=t().gitManager instanceof Ze,T;((x=(b=R(s))==null?void 0:b.length)!=null?x:0)==0?T=S?50:10:T=R(s).length;try{X(s,await t().gitManager.log(void 0,!1,T),!0)}finally{X(n,!1)}}async function f(){var x;if(!t().gitReady||R(s)===void 0)return;X(n,!0);let T=t().gitManager instanceof Ze?50:10,b=await t().gitManager.log(void 0,!1,T,(x=R(s).last())==null?void 0:x.hash);R(s).push(...b.slice(1)),X(n,!1)}var d=iV(),h=W(d),p=W(h),m=W(p);rt(m,S=>i[0]=S,()=>i==null?void 0:i[0]);var w=K(m,2);let y;rt(w,S=>i[1]=S,()=>i==null?void 0:i[1]),V(p),V(h);var v=K(h,2),A=W(v);{var C=S=>{var T=nV();gn(T,21,()=>R(s),mn,(b,x)=>{$_(b,{get view(){return e.view},get showTree(){return R(o)},get log(){return R(x)},get plugin(){return t()}})}),V(T),te(S,T)};Ae(A,S=>{R(s)&&S(C)})}ka(4),V(v),V(d),Ue(()=>{ye(m,"data-icon",R(o)?"list":"folder"),y=dt(w,1,"clickable-icon nav-action-button",null,y,{loading:R(n)})}),de("click",m,()=>{X(o,!R(o)),(0,P_.setIcon)(i[0],R(o)?"list":"folder"),t(t().settings.treeStructure=R(o),!0),t().saveSettings()}),de("click",w,c),te(r,d),wt()}Ot(["click"]);var rd=class extends ZI.ItemView{constructor(e,t){super(e),this.plugin=t,this.hoverPopover=null}getViewType(){return tn.type}getDisplayText(){return tn.name}getIcon(){return tn.icon}async onClose(){return this._view&&await Ws(this._view),super.onClose()}async reload(){this._view&&await Ws(this._view),this._view=Do(I_,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};g();var XI=require("@codemirror/commands"),QI=require("@codemirror/search"),O_=require("@codemirror/state"),hs=require("@codemirror/view"),JI=require("obsidian");var oV=hs.EditorView.theme({"&":{height:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),nd=class extends JI.ItemView{constructor(t,n){super(t);this.plugin=n;this.navigation=!0,this.contentEl.addClass("git-read-only-file-view","cm-s-obsidian","mod-cm6","markdown-source-view"),this.registerEvenLine truncated
.repository-missing.svelte-5wq9p > .git-commit-msg:where(.svelte-5wq9p),
.repository-missing.svelte-5wq9p > .nav-files-container:where(.svelte-5wq9p) {display:none;}.repository-notice.svelte-5wq9p {flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-4-3);padding:var(--size-4-6);text-align:center;}.repository-notice.svelte-5wq9p p:where(.svelte-5wq9p) {margin:0;color:var(--text-muted);}.repository-actions.svelte-5wq9p {display:flex;flex-wrap:wrap;justify-content:center;gap:var(--size-4-2);}.commit-action-group.svelte-5wq9p {display:inline-flex;flex:0 0 auto;gap:0;overflow:hidden;border:1px solid var(--background-modifier-border);border-radius:var(--radius-s);}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) {margin:0;border-radius:0;}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) + .nav-action-button:where(.svelte-5wq9p) {border-left:1px solid var(--background-modifier-border);}.commit-action-group.svelte-5wq9p #commit-menu:where(.svelte-5wq9p) {width:var(--size-4-5);padding-right:0;padding-left:0;}.merge-status.svelte-5wq9p {color:var(--text-warning);}.commit-msg-input.svelte-5wq9p {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-5wq9p {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}.conflicts.svelte-5wq9p {--nav-indentation-guide-color: var(--text-warning);--collapse-icon-color: var(--text-warning);--collapse-icon-color-collapsed: var(--text-warning);}.conflicts.svelte-5wq9p > .nav-folder-title:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) svg:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator svg {color:var(--text-warning);}.conflicts.svelte-5wq9p .tree-item-children:where(.svelte-5wq9p) {border-inline-start-color:var(--text-warning);}main.svelte-5wq9p .git-tools:where(.svelte-5wq9p) .files-count:where(.svelte-5wq9p) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-5wq9p {align-items:center;}.git-commit-msg-clear-button.svelte-5wq9p {position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out;}.git-commit-msg-clear-button.svelte-5wq9p:after {content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");-webkit-mask-repeat:no-repeat;}`};function D_(r,e){gt(e,!0),Hn(r,MV);let t=Gn(e,"plugin",7),n=Gn(e,"view",7),i=Ie(!1),s=Ie(!1),o=Ie(!1),a=Ie(!1),l=Ie(void 0),c=Ie(at([])),u=He(()=>t().settings.commitMessage),f=at([]),d=Ie(void 0),h=Ie(void 0),p=Ie(void 0),m=Ie(void 0),w=Ie(!0),y=Ie(!0),v=Ie(!0),A=Ie(!0),C=Ie(at({})),S=Promise.resolve(),T=He(()=>{var H,ae;return[...(ae=(H=R(l))==null?void 0:H.conflicted)!=null?ae:[]].sort(($e,ht)=>{let qt=R(C)[$e]===0?0:1,jn=R(C)[ht]===0?0:1;return qt!==jn?qt-jn:$e.localeCompare(ht)})}),b=Ie(0),x=Ie(at({})),E=Ie(at({})),k=Ie(at({})),$=Ie(at({})),M=He(()=>{var H,ae,$e,ht;return((ae=(H=R(l))==null?void 0:H.staged.length)!=null?ae:0)+((ht=($e=R(l))==null?void 0:$e.stagedOutsideVault)!=null?ht:0)}),D=He(()=>{var H,ae;return(ae=(H=R(l))==null?void 0:H.changed.length)!=null?ae:0}),P=He(()=>{var H,ae,$e,ht;return((ae=(H=R(l))==null?void 0:H.conflicted.length)!=null?ae:0)+((ht=($e=R(l))==null?void 0:$e.conflictedOutsideVault)!=null?ht:0)>0}),F=He(()=>R(M)+R(D)>0),_e=He(()=>!J("smart")),Q=H Line truncated
`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(c+=`
`),n.replaceRange(c,n.offsetToPos(a),n.offsetToPos(l)),n.setSelection(n.offsetToPos(a))}}async stageHunk(e){if(!this.editor)return;let{editor:t}=this.editor,n=xi.getHunk(t.state,!1,e),i=!1;if(n||(n=xi.getHunk(t.state,!0,e),i=!0),!n)return;let s=t.state.field(nO.editorInfoField).file.path,o=cr.createPatch(s,[n],"100644",i).join(`
`)+`
`;await this.plugin.gitActions.applyPatch(o)}goToHunk(e){if(!this.editor)return;let{editor:t,obEditor:n}=this.editor,i=xi.getHunks(t.state,!1),s=n.getCursor().line+1,o=cr.findNearestHunk(s,i,e,!0);if(o==null)return;let a=i[o];if(a){let l=a.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};g();g();var qa=require("obsidian");var Um=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){this.plg.warn("undefined lineAuthorInfoProvider. Unexpected situation.");return}let t=e==null?void 0:e.view;!(t instanceof qa.MarkdownView)||t.file==null||(t==null?void 0:t.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(t.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),v$(()=>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;T$(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new _p(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions()}catch(e){this.plg.warn("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}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&qa.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ze?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(B$),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(),E$(),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 t;e&&((t=this.lineAuthorInfoProvider)==null||t.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,t)=>{var n;return e instanceof qa.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var t;return e instanceof qa.TFile&&((t=this.lineAuthorInfoProvider)==null?void 0:t.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",A$)}};g();var Uc=require("obsidian");g();g();var Ya=require("@codemirror/state"),zm=require("@codemirror/view");var jm=class extends zm.GutterMarker{constructor(t,n){super();this.type=t;this.staged=n}toDOM(t){let n=createDiv();return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},L_=Ya.StateField.define({create:()=>Ya.RangeSet.empty,update:(r,e)=>{let t=e.state.field(on,!1);if(!t)return Ya.RangeSet.empty;let n=e.effects.some(s=>s.is(Fp)),i=e.effects.some(s=>s.is(cc));if(n||i||(e.docChanged||r.size==0)&&t.isDirty==!1){let s=new Set,o=iO(e,t.hunks,!1,s),a=iO(e,t.stagedHunks,!0,s);return r=Ya.RangeSet.of([...o,...a],!0),r}else e.docChanged&&(r=r.map(e.changes));retur Line truncated
`,t),i=n===-1?r.length:n;if(e.push({from:t,to:i,text:r.slice(t,i)}),n===-1)break;t=n+1}return e}function Km(r){let e=BV(r),t=[];for(let n=0;n<e.length;n++){let i=e[n];if(!lO.test(i.text))continue;let s=-1,o=-1;for(let d=n+1;d<e.length;d++){let h=e[d];if(LV.test(h.text)){o=d;break}s===-1&&DV.test(h.text)&&(s=d)}if(o===-1)continue;let a=-1;for(let d=o+1;d<e.length;d++){let h=e[d];if(NV.test(h.text)){a=d;break}if(lO.test(h.text))break}if(a===-1)continue;let l=e[o],c=e[a],u=s!==-1?e[s]:void 0,f=[{from:i.from,to:i.to}];u!==void 0&&f.push({from:u.from,to:u.to}),f.push({from:l.from,to:l.to},{from:c.from,to:c.to}),t.push({from:i.from,to:c.to<r.length?c.to+1:c.to,ours:r.slice(i.to+1,u!==void 0?u.from:l.from),theirs:r.slice(l.to+1,c.from),base:u!==void 0?r.slice(u.to+1,l.from):void 0,markers:f,oursRange:{from:i.to+1,to:u!==void 0?u.from:l.from},baseRange:u!==void 0?{from:u.to+1,to:l.from}:void 0,theirsRange:{from:l.to+1,to:c.from}}),n=a}return t}function N_(r,e){switch(e){case"ours":return r.ours;case"theirs":return r.theirs;case"base":if(r.base===void 0)throw new Error("Cannot keep the base of a two-way conflict");return r.base;case"both":return r.ours+r.theirs}}function cO(r,e,t){r.dispatch({changes:{from:e.from,to:e.to,insert:N_(e,t)}}),r.focus()}function uO(r,e){let t=Km(r.state.doc.toString());r.dispatch({changes:t.map(n=>({from:n.from,to:n.to,insert:N_(n,e)}))}),r.focus()}var HV=["ours","base","theirs","both"],j_=ud.Facet.define({combine:r=>{var e;return(e=r[0])!=null?e:"both"}});function fO(r){var i;let e=r.facet(j_),t=(i=r.field(Zs.editorLivePreviewField,!1))!=null?i:!1;if(e==="disabled"||e==="source"&&t||e==="live-preview"&&!t)return[];let n=r.doc.toString();return n.includes("<<<<<<<")?Km(n):[]}var ps=ud.StateField.define({create:fO,update:(r,e)=>e.docChanged||e.reconfigured||e.startState.field(Zs.editorLivePreviewField,!1)!==e.state.field(Zs.editorLivePreviewField,!1)?fO(e.state):r});function hO(r,e,t){for(let n of HV){let i=e[n];if(i===void 0)continue;new Zs.ButtonComponent(r).setButtonText(i).onClick(o=>{o.preventDefault(),t(n)}).buttonEl.addClass("clickable-icon","nav-action-button",`git-conflict-choose-${n}`)}}var H_=class extends wn.WidgetType{constructor(t){super();this.block=t}eq(t){return t.block.from===this.block.from&&t.block.to===this.block.to&&t.block.ours===this.block.ours&&t.block.theirs===this.block.theirs&&t.block.base===this.block.base}toDOM(t){let n=createDiv({cls:"git-conflict-actions-group git-conflict-actions-widget"}),i={ours:"Keep ours",theirs:"Keep theirs",both:"Keep both"};return this.block.base!==void 0&&(i.base="Keep base"),hO(n,i,s=>cO(t,this.block,s)),n}};function pO(r,e){var i;let t=(i=e.state.field(ps,!1))!=null?i:[];r.createSpan({cls:"git-conflict-panel-label",text:`${t.length} conflict${t.length===1?"":"s"} in file`});let n={ours:"Keep all ours",theirs:"Keep all theirs",both:"Keep both"};t.every(s=>s.base!==void 0)&&(n.base="Keep all base"),hO(r.createDiv({cls:"git-conflict-actions-group"}),n,s=>uO(e,s))}var G_=class extends wn.WidgetType{constructor(t,n){super();this.count=t;this.hasBase=n}eq(t){return t.count===this.count&&t.hasBase===this.hasBase}toDOM(t){let n=createDiv({cls:"git-conflict-panel"});return pO(n,t),n}};function B_(r,e,t,n){if(t.from>=t.to)return;let i=e.doc.lineAt(t.from).number,s=e.doc.lineAt(t.to-1).number;for(let o=i;o<=s;o++)r.push(wn.Decoration.line({class:n}).range(e.doc.line(o).from))}function dO(r){var n;let e=(n=r.field(ps,!1))!=null?n:[],t=[];Zs.Platform.isMobile&&e.length>0&&t.push(wn.Decoration.widget({widget:new G_(e.length,e.every(i=>i.base!==void 0)),block:!0,side:-1}).range(0));for(let i of e){let s=i.markers[0];for(let[o,a]of i.markers.entries()){let l=o===0?" git-conflict-marker-ours":o===i.markers.length-1?" git-conflict-marker-theirs":"";t.push(wn.Decoration.line({class:`git-conflict-marker-line${l}`}).range(a.from),wn.Decoration.mark({class:`git-conflict-marker${l}`}).range(a.from,a.to))}t.push(wn.Decoration.widget({widget:new H_(i),side:1}).range(s.to)),B_(t,r,i.oursRange,"git-conflict-ours-line"),i.baseRange!==void 0&&B_(t,r,i.baseRange,"git-conflict-base-line"),B_(t,r,i.theirsRange,"git-conflict-theirs-line")}return wn.Decoration.set(t,!0)}var GV=ud.StateField.define({create:r=>dO(r),update:(r,e)=>e.docChanged||e.reconfigured||e.startState.field(ps)!==e.state.field(ps)?dO(e.state):r,provide:r=>wn.EditorView.decorations.from(r)}),U_=class{constructor(e){this.view=e;this.dom=createDiv({cls:"git-conflict-panel"});this.top=!0;this.render()}update(e){(e.docChanged||e.transactions.some(t=>t.reconfigured)||e.startState.field(ps)!==e.state.field(ps))&&this.render()}render(){var t;this.dom.empty(),((t=this.view.state.field(ps,!1))!=null?t:[]).length!==0&&pO(this.dom,this.view)}},UV=r=>new U_(r),jV=wn.showPanel.compute([ps],r=>!Zs.Platform.isMobile&&r.field(ps).length>0?UV:null),mO=[ps,GV,jV];g();var gO=require("@codemirror/state"),Zm=require("obsidian");var z_=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,t){if( Line truncated
`+i)})}async createNewRepo(){let e=await Li(this.plugin,async()=>(await this.plugin.gitManager.init(),await this.plugin.init({fromReload:!0}),{status:"initialized"}));return e.status==="success"&&this.reportInitRepositoryResult(e.value),e}reportInitRepositoryResult(e){if(e.status==="initialized"){this.plugin.displayMessage("Initialized new repo");return}}async deleteRepository(){let e=await Li(this.plugin,async()=>{let t=this.plugin.settings.basePath?`${this.plugin.settings.basePath}/.git`:".git";return await this.plugin.app.vault.adapter.exists(t)?await new _t(this.plugin,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? This action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"?(await this.plugin.app.vault.adapter.rmdir(t,!0),{status:"deleted"}):{status:"cancelled"}:{status:"not-found"}});return e.status==="success"&&(this.reportDeleteRepositoryResult(e.value),e.value.status==="deleted"&&(this.plugin.unloadPlugin(),await this.plugin.init({fromReload:!0}))),e}reportDeleteRepositoryResult(e){switch(e.status){case"deleted":this.plugin.displayMessage("Successfully deleted repository. Reloading plugin...");return;case"not-found":this.plugin.displayMessage("No repository found");return;case"cancelled":return}}async cloneNewRepo(){let e=await Li(this.plugin,()=>this.performCloneNewRepo());return e.status==="success"&&this.reportCloneRepositoryResult(e.value),e}async performCloneNewRepo(){let e=await new _t(this.plugin,{placeholder:"Enter remote URL"}).openAndGetResult();if(!e)return{status:"cancelled",reason:"no-url"};let t="Vault Root",n=await new _t(this.plugin,{options:this.plugin.gitManager instanceof Ts?[t]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.plugin.gitManager instanceof Ts}).openAndGetResult();if(n===void 0)return{status:"cancelled",reason:"no-directory"};if(n===t&&(n="."),n=(0,Un.normalizePath)(n),n==="/"&&(n="."),n==="."){let l=await new _t(this.plugin,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.plugin.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(l===void 0)return{status:"cancelled",reason:"safety-declined"};if(l==="YES"){let c="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(!(await new _t(this.plugin,{options:["Abort clone",c],placeholder:`To avoid conflicts, the local ${this.plugin.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===c))return{status:"cancelled",reason:"safety-declined"};await this.plugin.app.vault.adapter.rmdir(this.plugin.app.vault.configDir,!0)}}let i=await new _t(this.plugin,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult();if(i===void 0)return{status:"cancelled",reason:"no-depth"};let s;if(i!==""&&(s=parseInt(i),isNaN(s)))return{status:"invalid",reason:"depth"};new Un.Notice(`Cloning new repo into "${n}"`);let o=this.plugin.settings.basePath,a=n!==".";a&&(this.plugin.settings.basePath=n);try{return await this.plugin.gitManager.clone(L0(e),n,s),a&&await this.plugin.saveSettings(),{status:"cloned"}}catch(l){throw this.plugin.settings.basePath=o,await this.plugin.saveSettings(),l}}reportCloneRepositoryResult(e){switch(e.status){case"cloned":this.plugin.displayMessage("Cloned new repo."),this.plugin.displayMessage("Please restart Obsidian");return;case"cancelled":{switch(e.reason){case"safety-declined":case"no-depth":this.plugin.displayMessage("Aborted clone");return;case"no-url":case"no-directory":return}return}case"invalid":if(e.reason==="depth"){this.plugin.displayMessage("Invalid depth. Aborting clone.");return}}}runReadyGitAction(e){return Li(this.plugin,async()=>await this.plugin.isAllInitialized()?e():{status:"skipped",reason:"not-ready"})}async listChangedFiles(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.updateCachedStatus(),n=t.changed.length+t.staged.length;return n>500?{status:"blocked",reason:"too-many-changes",files:n}:(new tg(this.plugin,t.all).open(),{status:"displayed"})});return e.status==="success"&&this.reportListChangedFilesResult(e.value),e}reportListChangedFilesResult(e){switch(e.status){case"displayed":case"skipped":return;case"blocked":if(e.reason==="too-many-changes"){this.plugin.displayError("Too many changes to display");return}}}async pullChangesFromRemote(){let e=await this.pull();if(e.status!=="success")return;let t=e.value;t.status!=="skipped"&&(this.reportPullResult(t),this.plugin.app.workspace.trigger("obsidian-git:refresh"))}reportPullResult(e){switch(e.status){case"updated":{let t=e.files.length+e.outsideVault,n=e.outsideVault>0?` (${e.files.length} in the vault, ${e.outsideVault} outside)`:"";this.plugin.displayMessage(`Pulled ${t} ${t==1?"file":"files"} from remote${n}`),this.plugin.lastPulledFiles=e.files;return}case"up-to-date":this.plugin.displayMessage("Pull: Everything is up-to-date");return;case"skipped":switch(e.reason){case"not-re Line truncated
Use set upstream branch command to set it manually if desired.`),!1;new Un.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}async isPushRemoteSet(){if(this.plugin.settings.updateSubmodules||await this.canAutoSetupPushRemote())return!0;if(!(await this.plugin.gitManager.branchInfo()).tracking){new Un.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}return!0}async setUpstreamBranch(){let e=await this.runReadyGitAction(async()=>this.performSetUpstreamBranch());return e.status==="success"&&this.reportSetUpstreamResult(e.value),e}async performSetUpstreamBranch(){let e=await this.selectRemoteBranch();return e==null?{status:"cancelled"}:(await this.plugin.gitManager.updateUpstreamBranch(e),{status:"updated",branch:e})}reportSetUpstreamResult(e){switch(e.status){case"updated":this.plugin.displayMessage(`Set upstream branch to ${e.branch}`);return;case"cancelled":this.plugin.displayError("Aborted. No upstream-branch is set!",1e4);return;case"skipped":return}}async discardFile(e){let t=await this.runReadyGitAction(async()=>{let n=e.workingDir==="U",i=await new fd({app:this.plugin.app,filesToDeleteCount:n?1:0,filesToDiscardCount:n?0:1,path:e.vaultPath}).openAndGetResult();if(i===!1)return{status:"cancelled"};if(i==="delete"){let s=this.plugin.app.vault.getAbstractFileByPath(e.vaultPath);s?await this.plugin.app.fileManager.trashFile(s):await this.plugin.app.vault.adapter.remove(e.vaultPath)}else await this.plugin.gitManager.discard(e.path);return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:"file"}});return t.status==="success"&&this.reportDiscardResult(t.value,!1),t}async discardAll(e){let t=await this.runReadyGitAction(async()=>{let n=await this.plugin.gitManager.status({path:e}),i=0,s=0;for(let a of n.changed)a.workingDir=="U"?i++:s++;if(i+s==0)return{status:"skipped",reason:"no-changes"};let o=await new fd({app:this.plugin.app,filesToDeleteCount:i,filesToDiscardCount:s,path:e!=null?e:""}).openAndGetResult();if(o===!1)return{status:"cancelled"};if(await this.plugin.gitManager.discardAll({dir:e,status:n}),o==="delete"){let a=await this.plugin.gitManager.getUntrackedPaths({path:e,status:n});for(let l of a){let c=this.plugin.gitManager.getRelativeVaultPath(l),u=this.plugin.app.vault.getAbstractFileByPath(c);u?await this.plugin.app.fileManager.trashFile(u):l.endsWith("/")?await this.plugin.app.vault.adapter.rmdir(c,!0):await this.plugin.app.vault.adapter.remove(c)}}return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:o==="delete"?"all":"tracked"}});return t.status==="success"&&this.reportDiscardResult(t.value,e===void 0),t}reportDiscardResult(e,t){switch(e.status){case"discarded":if(!t||e.target==="file")return;this.plugin.displayMessage(e.target==="all"?"Discarded all files.":"Discarded all changes in tracked files.");return;case"cancelled":case"skipped":return}}async editRemotes(){let e=await this.runReadyGitAction(async()=>this.performEditRemotes());return e.status==="success"&&this.reportEditRemoteResult(e.value),e}async performEditRemotes(){let e=await this.plugin.gitManager.getRemotes(),t=await new _t(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(!t)return{status:"cancelled"};let n=await this.plugin.gitManager.getRemoteUrl(t),i=await new _t(this.plugin,{initialValue:n,placeholder:"Enter remote URL"}).openAndGetResult();return i?(await this.plugin.gitManager.setRemote(t,L0(i)),{status:"updated",remote:t}):{status:"cancelled"}}reportEditRemoteResult(e){switch(e.status){case"updated":case"cancelled":case"skipped":return}}async selectRemoteBranch(){let e=await this.plugin.gitManager.getRemotes(),t;if(e.length===0){let s=await this.performEditRemotes();s.status==="updated"&&(t=s.remote),t==null&&(e=await this.plugin.gitManager.getRemotes())}let n=new _t(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}),i=t!=null?t:await n.openAndGetResult();if(i){this.plugin.displayMessage("Fetching remote branches"),await this.plugin.gitManager.fetch(i);let s=await this.plugin.gitManager.getRemoteBranches(i),a=await new _t(this.plugin,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return a==null?void 0:a.startsWith(i+"/")?a:`${i}/${a}`}}async removeRemote(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.gitManager.getRemotes(),n=await new _t(this.plugin,{options:t,placeholder:"Select a remote"}).openAndGetResult();return n?(await this.plugin.gitManager.removeRemote(n),{status:"removed",remote:n}):{status:"cancelled"}});return e.status==="success"&&this.reportRemoveRemoteResult(e.value),e}reportRemoveRemoteResult(e Line truncated
/*! Bundled license information:
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
isomorphic-git/index.js:
isomorphic-git/managers/index.js:
isomorphic-git/models/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.
*)
*/
/* nosourcemap */
+11
View File
@@ -0,0 +1,11 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.43.0",
"minAppVersion": "1.13.0"
}
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
if ! command -v curl >/dev/null 2>&1; then
echo "Obsidian Git authentication requires curl" >&2
exit 1
fi
printf '%s\n%s' "$OBSIDIAN_GIT_ASKPASS_TOKEN" "$1" | curl -q \
--silent --show-error --fail --noproxy '*' --proto '=http' \
--max-time 600 --data-binary @- \
--header 'Content-Type: application/octet-stream' \
"http://127.0.0.1:$OBSIDIAN_GIT_ASKPASS_PORT/askpass"
+937
View File
@@ -0,0 +1,937 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.loading {
overflow: hidden;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-disabled {
opacity: 0.5;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
.tooltip.obsidian-git-commit-tooltip {
text-align: start;
white-space: pre-wrap;
max-width: min(480px, 90vw);
}
.obsidian-git-statusbar-conflict-indicator,
.obsidian-git-statusbar-paused-indicator,
.obsidian-git-statusbar-icon {
float: left;
}
.obsidian-git-statusbar-text {
float: right;
margin-left: 5px;
}
.obsidian-git-statusbar-conflict {
cursor: pointer;
margin-right: 5px;
}
.obsidian-git-statusbar-paused {
margin-right: 5px;
}
/* Limits the scrollbar to the view body */
.git-view {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}
/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/
.workspace-drawer .git-view .nav-buttons-container {
flex-wrap: wrap;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0;
height: auto;
}
.workspace-leaf-content[data-type="git-view"] .tree-item-self,
.workspace-leaf-content[data-type="git-history-view"] .tree-item-self {
align-items: center;
}
.workspace-leaf-content[data-type="git-view"]
.tree-item-self:hover
.clickable-icon,
.workspace-leaf-content[data-type="git-history-view"]
.tree-item-self:hover
.clickable-icon {
color: var(--icon-color-hover);
}
/* Highlight an item as active if it's diff is currently opened */
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
.obsidian-git-merge-help ol {
padding-inline-start: var(--size-4-6);
}
.obsidian-git-merge-help-resolved {
padding: var(--size-4-3);
border-inline-start: 2px solid var(--color-green);
background-color: var(--background-secondary);
}
/* ====== diff2html ======
The following styles are adapted from the obsidian-version-history plugin by
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
which itself is adapted from the diff2html library with the following original license:
https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md
Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.theme-dark,
.theme-light {
--git-delete-bg: #ff475040;
--git-delete-hl: #96050a75;
--git-insert-bg: #68d36840;
--git-insert-hl: #23c02350;
--git-change-bg: #ffd55840;
--git-selected: #3572b0;
--git-delete: #cc3333;
--git-insert: #399839;
--git-change: #d0b44c;
--git-move: #3572b0;
--git-conflict-ours: var(--color-cyan);
--git-conflict-theirs: var(--color-blue);
--git-conflict-ours-bg: color-mix(
in oklch,
var(--git-conflict-ours) 10%,
transparent
);
--git-conflict-theirs-bg: color-mix(
in oklch,
var(--git-conflict-theirs) 10%,
transparent
);
--git-conflict-ours-header-bg: color-mix(
in oklch,
var(--git-conflict-ours) 25%,
transparent
);
--git-conflict-theirs-header-bg: color-mix(
in oklch,
var(--git-conflict-theirs) 25%,
transparent
);
--git-conflict-ours-button-bg: color-mix(
in oklab,
var(--git-conflict-ours) 25%,
var(--interactive-normal)
);
--git-conflict-theirs-button-bg: color-mix(
in oklab,
var(--git-conflict-theirs) 25%,
var(--interactive-normal)
);
--git-conflict-base-button-bg: color-mix(
in oklab,
var(--color-purple) 15%,
var(--interactive-normal)
);
--git-conflict-base-bg: color-mix(
in oklch,
var(--color-purple) 4%,
transparent
);
}
.git-diff {
.d2h-d-none {
display: none;
}
.d2h-wrapper {
text-align: left;
border-radius: 0.25em;
overflow: auto;
}
.d2h-file-header.d2h-file-header {
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
font-family:
Source Sans Pro,
Helvetica Neue,
Helvetica,
Arial,
sans-serif;
height: 35px;
padding: 5px 10px;
}
.d2h-file-header,
.d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.d2h-file-header {
display: none;
}
.d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.d2h-lines-added {
border: 1px solid var(--color-green);
border-radius: 5px 0 0 5px;
color: var(--color-green);
padding: 2px;
text-align: right;
vertical-align: middle;
}
.d2h-lines-deleted {
border: 1px solid var(--color-red);
border-radius: 0 5px 5px 0;
color: var(--color-red);
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.d2h-file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-normal);
font-size: var(--h5-size);
}
.d2h-file-wrapper {
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
margin-bottom: 1em;
max-height: 100%;
}
.d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.d2h-file-collapse.d2h-selected {
background-color: var(--git-selected);
}
.d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.d2h-diff-table {
border-collapse: collapse;
font-family: var(--font-monospace);
font-size: var(--code-size);
width: 100%;
}
.d2h-files-diff {
width: 100%;
}
.d2h-file-diff {
/*
overflow-y: scroll;
*/
border-radius: 5px;
font-size: var(--font-text-size);
line-height: var(--line-height-normal);
}
.d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.d2h-code-line {
padding-left: 6em;
padding-right: 1.5em;
}
.d2h-code-line,
.d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.d2h-code-side-line {
/* needed to be changed */
padding-left: 0.5em;
padding-right: 0.5em;
}
.d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
width: 100%;
/* only works for line-by-line */
white-space: pre-wrap;
}
.d2h-code-line del,
.d2h-code-side-line del {
background-color: var(--git-delete-hl);
color: var(--text-normal);
}
.d2h-code-line del,
.d2h-code-line ins,
.d2h-code-side-line del,
.d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.d2h-code-line ins,
.d2h-code-side-line ins {
background-color: var(--git-insert-hl);
text-align: left;
}
.d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.line-num1 {
float: left;
}
.line-num1,
.line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
/*
padding: 0 0.5em;
*/
text-overflow: ellipsis;
width: 2.5em;
padding-left: 0;
}
.line-num2 {
float: right;
}
.d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 5.5em;
}
.d2h-code-linenumber:after {
content: "\200b";
}
.d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
overflow: hidden;
padding: 0 0.5em;
text-align: right;
text-overflow: ellipsis;
width: 4em;
/* needed to be changed */
display: table-cell;
position: relative;
}
.d2h-code-side-linenumber:after {
content: "\200b";
}
.d2h-code-side-emptyplaceholder,
.d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.d2h-code-line-prefix,
.d2h-code-linenumber,
.d2h-code-side-linenumber,
.d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.d2h-code-linenumber,
.d2h-code-side-linenumber {
direction: rtl;
}
.d2h-del {
background-color: var(--git-delete-bg);
border-color: var(--git-delete-hl);
}
.d2h-ins {
background-color: var(--git-insert-bg);
border-color: var(--git-insert-hl);
}
.d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-faint);
}
.d2h-del,
.d2h-ins,
.d2h-file-diff .d2h-change {
color: var(--text-normal);
}
.d2h-file-diff .d2h-del.d2h-change {
background-color: var(--git-change-bg);
}
.d2h-file-diff .d2h-ins.d2h-change {
background-color: var(--git-insert-bg);
}
.d2h-file-list-wrapper {
a {
text-decoration: none;
cursor: default;
-webkit-user-drag: none;
}
svg {
display: none;
}
}
.d2h-file-list-header {
text-align: left;
}
.d2h-file-list-title {
display: none;
}
.d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.d2h-file-list {
}
.d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.d2h-file-list > li:last-child {
border-bottom: none;
}
.d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.d2h-deleted {
color: var(--git-delete);
}
.d2h-added {
color: var(--git-insert);
}
.d2h-changed {
color: var(--git-change);
}
.d2h-moved {
color: var(--git-move);
}
.d2h-tag {
background-color: var(--background-secondary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.d2h-deleted-tag {
border: 1px solid var(--git-delete);
}
.d2h-added-tag {
border: 1px solid var(--git-insert);
}
.d2h-changed-tag {
border: 1px solid var(--git-change);
}
.d2h-moved-tag {
border: 1px solid var(--git-move);
}
/* needed for line-by-line*/
.d2h-diff-tbody {
position: relative;
}
/* My additions */
.cm-merge-revert {
width: 4em;
}
/* Ensure that merge revert markers are positioned correctly */
.cm-merge-revert > * {
position: absolute;
background-color: var(--background-secondary);
display: flex;
}
}
/* ====================== Line Authoring Information ====================== */
.markdown-source-view.mod-cm6 .cm-gutters.obsidian-git-line-author-gutters {
margin-left: unset;
}
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}
.git-unified-diff-view,
.git-split-diff-view .cm-deletedLine .cm-changedText {
background-color: #ee443330;
}
.git-unified-diff-view,
.git-split-diff-view .cm-insertedLine .cm-changedText {
background-color: #22bb2230;
}
.git-obscure-prompt .git-show-password {
margin-right: 32px;
}
.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></svg>');
}
.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye-off"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20"></path></svg>');
}
/* Override styling of Codemirror merge view "collapsed lines" indicator */
.git-split-diff-view .ͼ2 .cm-collapsedLines {
background: var(--interactive-normal);
border-radius: var(--radius-m);
color: var(--text-accent);
font-size: var(--font-small);
padding: var(--size-4-1) var(--size-4-1);
}
.git-split-diff-view .ͼ2 .cm-collapsedLines:hover {
background: var(--interactive-hover);
color: var(--text-accent-hover);
}
.git-signs-gutter {
.cm-gutterElement {
display: grid;
/* Needed to align the sign properly for different line heigts. Such as
* when having a heading or list item.
*/
padding-top: 0 !important;
}
}
.git-gutter-marker:hover {
border-radius: 2px;
}
.git-gutter-marker.git-add {
background-color: var(--color-green);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-change {
background-color: var(--color-yellow);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-changedelete {
color: var(--color-yellow);
font-weight: var(--font-bold);
font-size: 1rem;
justify-self: center;
height: inherit;
}
.git-gutter-marker.git-delete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: end;
}
.git-gutter-marker.git-topdelete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: start;
}
div:hover > .git-gutter-marker.git-change {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-add {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-delete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-topdelete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-changedelete {
font-weight: var(--font-bold);
}
.git-gutter-marker.staged {
opacity: 0.5;
}
/* Prevent shifting of the editor when git signs gutter is the only gutter present */
.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) {
margin-inline-end: 0;
.git-signs-gutter {
margin-inline-start: -1rem;
}
}
.git-changes-status-bar-colored {
.git-add {
color: var(--color-green);
}
.git-change {
color: var(--color-yellow);
}
.git-delete {
color: var(--color-red);
}
}
.git-changes-status-bar .git-add {
margin-right: 0.3em;
}
.git-changes-status-bar .git-change {
margin-right: 0.3em;
}
.cm-line.git-conflict-marker-line {
display: flex !important;
align-items: center;
background-color: var(--background-modifier-hover);
}
.cm-line.git-conflict-marker-line.HyperMD-quote {
/* The closing Git marker (`>>>>>>>`) is parsed by Live Preview as nested
* Markdown blockquotes. Obsidian marks these layout rules as important, so
* the conflict marker must use important as well to undo that styling. */
text-indent: 0 !important;
padding-inline-start: 0 !important;
border-inline-start: none !important;
}
.git-conflict-marker {
background-color: transparent;
}
.markdown-source-view.mod-cm6
.cm-line.git-conflict-marker-line.git-conflict-marker-ours {
background-color: var(--git-conflict-ours-header-bg);
}
.markdown-source-view.mod-cm6
.cm-line.git-conflict-marker-line.git-conflict-marker-theirs {
background-color: var(--git-conflict-theirs-header-bg);
}
.git-conflict-panel {
display: flex;
align-items: center;
gap: var(--size-2-2);
padding: var(--size-2-2) var(--size-4-2);
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
}
.git-conflict-panel-label {
color: var(--text-muted);
font-size: var(--font-ui-smaller);
margin-inline-end: auto;
}
.is-mobile .git-conflict-panel {
flex-direction: column;
align-items: stretch;
}
.is-mobile .git-conflict-panel .git-conflict-actions-group {
flex-wrap: wrap;
}
.is-mobile .git-conflict-panel .nav-action-button {
flex: 1 1 auto;
}
.git-conflict-actions-group {
display: inline-flex;
gap: 0;
overflow: hidden;
border: 1px solid var(--background-modifier-border);
border-radius: var(--radius-s);
.nav-action-button {
margin: 0;
border-radius: 0;
font-weight: bold;
padding: var(--size-2-3);
}
.nav-action-button + .nav-action-button {
border-left: 1px solid var(--background-modifier-border);
}
}
.git-conflict-actions-group .git-conflict-choose-ours {
background-color: var(--git-conflict-ours-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-theirs {
background-color: var(--git-conflict-theirs-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-base {
background-color: var(--git-conflict-base-button-bg);
color: var(--text-normal);
}
.git-conflict-actions-group .git-conflict-choose-both {
background-color: var(--interactive-normal);
color: var(--text-normal);
}
.git-conflict-actions-widget {
flex: none;
margin-left: var(--size-2-2);
border-radius: 0;
}
.cm-line.git-conflict-ours-line {
background-color: var(--git-conflict-ours-bg);
}
.cm-line.git-conflict-theirs-line {
background-color: var(--git-conflict-theirs-bg);
}
.cm-line.git-conflict-base-line {
background-color: var(--git-conflict-base-bg);
}
.cm-line.git-conflict-marker-line::after {
content: "";
flex: 1;
margin-left: var(--size-2-2);
}
.cm-line.git-conflict-marker-line .git-conflict-actions-widget {
order: 2;
}
.is-mobile .cm-line.git-conflict-marker-line {
flex-wrap: wrap;
}
.is-mobile .cm-line.git-conflict-marker-line::after {
display: none;
}
.is-mobile .cm-line.git-conflict-marker-line .git-conflict-actions-widget {
flex: 0 0 100%;
margin: var(--size-2-1) 0 0;
}
.is-mobile .git-conflict-actions-widget {
flex-wrap: wrap;
}
.is-mobile .git-conflict-actions-widget .nav-action-button {
flex: 1 1 auto;
}