414 lines
727 KiB
JavaScript
414 lines
727 KiB
JavaScript
|
/*
|
||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
|
if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git)
|
||
|
*/
|
||
|
|
||
|
var BP=Object.create;var Oo=Object.defineProperty;var HP=Object.getOwnPropertyDescriptor;var UP=Object.getOwnPropertyNames;var GP=Object.getPrototypeOf,zP=Object.prototype.hasOwnProperty;var jv=e=>{throw TypeError(e)};var VP=(e,t,r)=>t in e?Oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var WP=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qP=(e,t)=>{for(var r in t)Oo(e,r,{get:t[r],enumerable:!0})},Bv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of UP(t))!zP.call(e,i)&&i!==r&&Oo(e,i,{get:()=>t[i],enumerable:!(n=HP(t,i))||n.enumerable});return e};var Ze=(e,t,r)=>(r=e!=null?BP(GP(e)):{},Bv(t||!e||!e.__esModule?Oo(r,"default",{value:e,enumerable:!0}):r,e)),YP=e=>Bv(Oo({},"__esModule",{value:!0}),e);var Tr=(e,t,r)=>VP(e,typeof t!="symbol"?t+"":t,r),Hv=(e,t,r)=>t.has(e)||jv("Cannot "+r);var Bt=(e,t,r)=>(Hv(e,t,"read from private field"),r?r.call(e):t.get(e)),Rc=(e,t,r)=>t.has(e)?jv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Mc=(e,t,r,n)=>(Hv(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var zv=I(Oc=>{"use strict";g();Oc.byteLength=ZP;Oc.toByteArray=JP;Oc.fromByteArray=t5;var fn=[],Cr=[],XP=typeof Uint8Array!="undefined"?Uint8Array:Array,eh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Xi=0,Uv=eh.length;Xi<Uv;++Xi)fn[Xi]=eh[Xi],Cr[eh.charCodeAt(Xi)]=Xi;var Xi,Uv;Cr[45]=62;Cr[95]=63;function Gv(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function ZP(e){var t=Gv(e),r=t[0],n=t[1];return(r+n)*3/4-n}function KP(e,t,r){return(t+r)*3/4-r}function JP(e){var t,r=Gv(e),n=r[0],i=r[1],a=new XP(KP(e,n,i)),s=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)t=Cr[e.charCodeAt(c)]<<18|Cr[e.charCodeAt(c+1)]<<12|Cr[e.charCodeAt(c+2)]<<6|Cr[e.charCodeAt(c+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Cr[e.charCodeAt(c)]<<2|Cr[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Cr[e.charCodeAt(c)]<<10|Cr[e.charCodeAt(c+1)]<<4|Cr[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function QP(e){return fn[e>>18&63]+fn[e>>12&63]+fn[e>>6&63]+fn[e&63]}function e5(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(QP(n));return i.join("")}function t5(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(e5(e,s,s+a>o?o:s+a));return n===1?(t=e[r-1],i.push(fn[t>>2]+fn[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(fn[t>>10]+fn[t>>4&63]+fn[t<<2&63]+"=")),i.join("")}});var Vv=I(th=>{g();th.read=function(e,t,r,n,i){var a,s,o=i*8-n-1,c=(1<<o)-1,l=c>>1,u=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=a*256+e[t+f],f+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=s*256+e[t+f],f+=d,u-=8);if(a===0)a=1-l;else{if(a===c)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-l}return(h?-1:1)*s*Math.pow(2,a-n)};th.write=function(e,t,r,n,i,a){var s,o,c,l=a*8-i-1,u=(1<<l)-1,f=u>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?t+=d/c:t+=d*Math.pow(2,1-f),t*c>=2&&(s++,c/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(t*c-1)*Math.pow(2,i),s=s+f):(o=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=o&255,h+=p,o/=256,i-=8);for(s=s<<i|o,l+=i;l>0;e[r+h]=s&255,h+=p,s/=256,l-=8);e[r+h-p]|=m*128}});var uh=I(Za=>{"use strict";g();var rh=zv(),Ya=Vv(),Wv=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Za.Buffer=M;Za.SlowBuffer=o5;Za.INSPECT_MAX_BYTES=50;var Ic=2147483647;Za.kMaxLength=Ic;M.TYPED_ARRAY_SUPPORT=r5();!M.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 r5(){try{let e=new Uint8Array(1),t={foo:f
|
||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M$(e,t){if(e){if(typeof e=="string")return Mx(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mx(e,t)}}function Mx(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function O$(e,t){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,i=!1,a=void 0;try{for(var s=e[Symbol.iterator](),o;!(n=(o=s.next()).done)&&(r.push(o.value),!(t&&r.length===t));n=!0);}catch(c){i=!0,a=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(i)throw a}}return r}}function I$(e){if(Array.isArray(e))return e}var Ix=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,Fx=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,$x=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Lx=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Dx=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Nx=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,jx=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Ol(e,t){return e.indexOf(t)>-1}function F$(e,t,r){var n=e/255,i=t/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),c=s-o,l=(s+o)/2;if(c===0)return[0,0,l*100];var u=c/(1-Math.abs(2*l-1)),f=function(){switch(s){case n:return(i-a)/c%6;case i:return(a-n)/c+2;default:return(n-i)/c+4}}();return[f*60,u*100,l*100]}function $$(e,t,r){var n=e/60,i=t/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),c=a-s/2,l=function(){return n<1?[s,o,0]:n<2?[o,s,0]:n<3?[0,s,o]:n<4?[0,o,s]:n<5?[o,0,s]:[s,0,o]}(),u=Wt(l,3),f=u[0],d=u[1],h=u[2];return[(f+c)*255,(d+c)*255,(h+c)*255]}var L$=function(){function e(t){var r=Wt(t,4),n=r[0],i=r[1],a=r[2],s=r[3];C$(this,e),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(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return P$(e,[{key:"toRgbString",value:function(){var r=Wt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return s===1?"rgb(".concat(n,", ").concat(i,", ").concat(a,")"):"rgba(".concat(n,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),n=Wt(r,4),i=n[0],a=n[1],s=n[2],o=n[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=Wt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(n).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=Wt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=F$(n,i,a),c=Wt(o,3),l=c[0],u=c[1],f=c[2];return[l,u,f,s]}}]),e}();function Fs(e){var t=Wt(e,4),r=t[0],n=t[1],i=t[2],a=t[3];return new L$([r,n,i,a])}function Em(e){var t=Wt(e,3),r=t[0],n=t[1],i=t[2];return Fs([r,n,i,1])}function Yu(e){var t=Wt(e,4),r=t[0],n=t[1],i=t[2],a=t[3],s=$$(r,n,i),o=Wt(s,3),c=o[0],l=o[1],u=o[2];return Fs([c,l,u,a])}function Bx(e){var t=Wt(e,3),r=t[0],n=t[1],i=t[2];return Yu([r,n,i,1])}function D$(e){var t=Ix.exec(e)||Fx.exec(e),r=Wt(t,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,Fs([n,i,a,s])}function N$(e){var t=$x.exec(e)||Dx.exec(e)||Lx.exec(e)||Nx.exec(e),r=Wt(t,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=Ol(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ol(i,"%")?parseInt(i,10)*255/100:pa
|
||
|
`)>=0)return!1;return!0}function HD(e,t){var r;if(e.indent===" ")r=" ";else if(typeof e.indent=="number"&&e.indent>0)r=En.call(Array(e.indent+1)," ");else return null;return{base:r,prev:En.call(Array(t+1),r)}}function Zm(e,t){if(e.length===0)return"";var r=`
|
||
|
`+t.prev+t.base;return r+En.call(e,","+r)+`
|
||
|
`+t.prev}function df(e,t){var r=Xm(e),n=[];if(r){n.length=e.length;for(var i=0;i<e.length;i++)n[i]=Pi(e,i)?t(e[i],e):""}var a=typeof zm=="function"?zm(e):[],s;if(Bs){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var c in e)Pi(e,c)&&(r&&String(Number(c))===c&&c<e.length||Bs&&s["$"+c]instanceof Symbol||(UE.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if(typeof zm=="function")for(var l=0;l<a.length;l++)GE.call(e,a[l])&&n.push("["+t(a[l])+"]: "+t(e[a[l]],e));return n}});var tg=I((EV,KE)=>{"use strict";g();var ZE=Qr(),Hs=wr(),UD=XE(),GD=qn(),mf=ZE("%WeakMap%",!0),gf=ZE("%Map%",!0),zD=Hs("WeakMap.prototype.get",!0),VD=Hs("WeakMap.prototype.set",!0),WD=Hs("WeakMap.prototype.has",!0),qD=Hs("Map.prototype.get",!0),YD=Hs("Map.prototype.set",!0),XD=Hs("Map.prototype.has",!0),eg=function(e,t){for(var r=e,n;(n=r.next)!==null;r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n},ZD=function(e,t){var r=eg(e,t);return r&&r.value},KD=function(e,t,r){var n=eg(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}},JD=function(e,t){return!!eg(e,t)};KE.exports=function(){var t,r,n,i={assert:function(a){if(!i.has(a))throw new GD("Side channel does not contain "+UD(a))},get:function(a){if(mf&&a&&(typeof a=="object"||typeof a=="function")){if(t)return zD(t,a)}else if(gf){if(r)return qD(r,a)}else if(n)return ZD(n,a)},has:function(a){if(mf&&a&&(typeof a=="object"||typeof a=="function")){if(t)return WD(t,a)}else if(gf){if(r)return XD(r,a)}else if(n)return JD(n,a);return!1},set:function(a,s){mf&&a&&(typeof a=="object"||typeof a=="function")?(t||(t=new mf),VD(t,a,s)):gf?(r||(r=new gf),YD(r,a,s)):(n||(n={key:{},next:null}),KD(n,a,s))}};return i}});var QE=I((kV,JE)=>{"use strict";g();var QD=Rm(),Ul=tg()(),Yn=qn(),rg={assert:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Yn("`O` is not an object");if(typeof t!="string")throw new Yn("`slot` must be a string");if(Ul.assert(e),!rg.has(e,t))throw new Yn("`"+t+"` is not present on `O`")},get:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Yn("`O` is not an object");if(typeof t!="string")throw new Yn("`slot` must be a string");var r=Ul.get(e);return r&&r["$"+t]},has:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Yn("`O` is not an object");if(typeof t!="string")throw new Yn("`slot` must be a string");var r=Ul.get(e);return!!r&&QD(r,"$"+t)},set:function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Yn("`O` is not an object");if(typeof t!="string")throw new Yn("`slot` must be a string");var n=Ul.get(e);n||(n={},Ul.set(e,n)),n["$"+t]=r}};Object.freeze&&Object.freeze(rg);JE.exports=rg});var rA=I((CV,tA)=>{"use strict";g();var Gl=QE(),eN=SyntaxError,eA=typeof StopIteration=="object"?StopIteration:null;tA.exports=function(t){if(!eA)throw new eN("this environment lacks StopIteration");Gl.set(t,"[[Done]]",!1);var r={next:function(){var i=Gl.get(this,"[[Iterator]]"),a=Gl.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Gl.set(i,"[[Done]]",!0),s!==eA)throw s;return{done:!0,value:void 0}}}};return Gl.set(r,"[[Iterator]]",t),r}});var ng=I((RV,nA)=>{g();var tN={}.toString;nA.exports=Array.isArray||function(e){return tN.call(e)=="[object Array]"}});var ig=I((OV,iA)=>{"use strict";g();var rN=String.prototype.valueOf,nN=function(t){try{return rN.call(t),!0}catch(r){return!1}},iN=Object.prototype.toString,aN="[object String]",sN=Ci()();iA.exports=function(t){return typeof t=="string"?!0:typeof t!="object"?!1:sN?nN(t):iN.call(t)===aN}});var sg=I((FV,oA)=>{"use strict";g();var ag=typeof Map=="function"&&Map.prototype?Map:null,oN=typeof Set=="function"&&Set.prototype?Set:null,vf;ag||(vf=function(t){return!1});var sA=ag?Map.prototype.has:null,aA=oN?Set.prototype.has:null;!vf&&!sA&&(vf=function(t){return!1});oA.exports=vf||function(t){if(!t||typeof t!="object")return!1;try{if(sA.call(t),aA)try{aA.call(t)}catch(r){return!0}return t instanceof ag}catch(r){}return!1}});var lg=I((LV,uA)=>{"use strict";g();var lN=typeof Map=="function"&&Map.prototype?Map:null,og=typeof Set=="f
|
||
|
`});Ce=!1,F=J.length}function Ee(st,ot){var Ct="="+N,$e=st.indexOf(Ct,ot),G=l(st.substring(st.indexOf("=",ot)+1,$e)).split(" ");return z=G[0],N=G[G.length-1],$e+Ct.length-1}for(S&&(S=S.split(" "),z=S[0],N=S[1]),me=0;me<T;me++)D==P?u(z,A,me)?(--me,Re(),D=O):A.charAt(me)==`
|
||
|
`?_t(Ce):ee+=A.charAt(me):D==O?(me+=z.length-1,de=e.tags[A.charAt(me+1)],Q=de?A.charAt(me+1):"_v",Q=="="?(me=Ee(A,me),D=P):(de&&me++,D=j),Ce=me):u(N,A,me)?(J.push({tag:Q,n:l(ee),otag:z,ctag:N,i:Q=="/"?Ce-z.length:me+N.length}),ee="",me+=N.length-1,D=P,Q=="{"&&(N=="}}"?me++:c(J[J.length-1]))):ee+=A.charAt(me);return _t(Ce,!0),J};function c(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function l(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,A,S){if(A.charAt(S)!=w.charAt(0))return!1;for(var T=1,P=w.length;T<P;T++)if(A.charAt(S+T)!=w.charAt(T))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,A,S,T){var P=[],O=null,j=null,D=null;for(j=S[S.length-1];w.length>0;){if(D=w.shift(),j&&j.tag=="<"&&!(D.tag in f))throw new Error("Illegal content in < super tag.");if(e.tags[D.tag]<=e.tags.$||h(D,T))S.push(D),D.nodes=d(w,D.tag,S,T);else if(D.tag=="/"){if(S.length===0)throw new Error("Closing tag without opener: /"+D.n);if(O=S.pop(),D.n!=O.n&&!p(D.n,O.n,T))throw new Error("Nesting error: "+O.n+" vs. "+D.n);return O.end=D.i,P}else D.tag==`
|
||
|
`&&(D.last=w.length==0||w[0].tag==`
|
||
|
`);P.push(D)}if(S.length>0)throw new Error("missing closing tag: "+S.pop().n);return P}function h(w,A){for(var S=0,T=A.length;S<T;S++)if(A[S].o==w.n)return w.tag="#",!0}function p(w,A,S){for(var T=0,P=S.length;T<P;T++)if(S[T].c==w&&S[T].o==A)return!0}function m(w){var A=[];for(var S in w)A.push('"'+b(S)+'": function(c,p,t,i) {'+w[S]+"}");return"{ "+A.join(",")+" }"}function v(w){var A=[];for(var S in w.partials)A.push('"'+b(S)+'":{name:"'+b(w.partials[S].name)+'", '+v(w.partials[S])+"}");return"partials: {"+A.join(",")+"}, subs: "+m(w.subs)}e.stringify=function(w,A,S){return"{code: function (c,p,i) { "+e.wrapMain(w.code)+" },"+v(w)+"}"};var y=0;e.generate=function(w,A,S){y=0;var T={code:"",subs:{},partials:{}};return e.walk(w,T),S.asString?this.stringify(T,A,S):this.makeTemplate(T,A,S)},e.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(w,A,S){var T=this.makePartials(w);return T.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(T,A,this,S)},e.makePartials=function(w){var A,S={subs:{},partials:w.partials,name:w.name};for(A in S.partials)S.partials[A]=this.makePartials(S.partials[A]);for(A in w.subs)S.subs[A]=new Function("c","p","t","i",w.subs[A]);return S};function b(w){return w.replace(a,"\\\\").replace(r,'\\"').replace(n,"\\n").replace(i,"\\r").replace(s,"\\u2028").replace(o,"\\u2029")}function x(w){return~w.indexOf(".")?"d":"f"}function E(w,A){var S="<"+(A.prefix||""),T=S+w.n+y++;return A.partials[T]={name:w.n,partials:{}},A.code+='t.b(t.rp("'+b(T)+'",c,p,"'+(w.indent||"")+'"));',T}e.codegen={"#":function(w,A){A.code+="if(t.s(t."+x(w.n)+'("'+b(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(w.nodes,A),A.code+="});c.pop();}"},"^":function(w,A){A.code+="if(!t.s(t."+x(w.n)+'("'+b(w.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(w.nodes,A),A.code+="};"},">":E,"<":function(w,A){var S={partials:{},code:"",subs:{},inPartial:!0};e.walk(w.nodes,S);var T=A.partials[E(w,A)];T.subs=S.subs,T.partials=S.partials},$:function(w,A){var S={subs:{},code:"",partials:A.partials,prefix:w.n};e.walk(w.nodes,S),A.subs[w.n]=S.code,A.inPartial||(A.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,A){A.code+=k('"\\n"'+(w.last?"":" + i"))},_v:function(w,A){A.code+="t.b(t.v(t."+x(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,A){A.code+=k('"'+b(w.text)+'"')},"{":_,"&":_};function _(w,A){A.code+="t.b(t.t(t."+x(w.n)+'("'+b(w.n)+'",c,p,0)));'}function k(w){return"t.b("+w+");"}e.walk=function(w,A){for(var S,T=0,P=w.length;T<P;T++)S=e.codegen[w[T].tag],S&&S(w[T],A);return A},e.parse=function(w,A,S){return S=S||{},d(w,"",[],S.sectionTags||[])},e.cache={},e.cacheKey=function(w,A){return[w,!!A.asString,!!A.disableLambda,A.delimiters,!!A.modelGet].join("||")},e.compile=function(w,A){A=A||{};var S=e.cacheKey(w,A),T=this.cache[S];if(T){var P=T.partials;for(var O in P)delete P[O].instance;return T}return T=this.generate(this.parse(this.scan(w,A.delimiters),w,A),w,A),this.cache[S]=T}})(typeof E0!="undefined"?E0:Hogan)});var kC=I(A0=>{g();var BB={};(function(e){e.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=""},e.Template.prototype={r:function(d,h,p){return""},v:u,t:l,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=r(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 v=this.ep(d,p);return v?v.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);
|
||
|
`)}static async _entryToBuffer(t){let r=Buffer.from(t.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Or(i),s=us(t);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(t.oid,20,"hex"),a.writeUInt16BE(eM(t)),a.write(t.path,r.length,"utf8"),i}async toObject(){let t=Buffer.alloc(12),r=new Or(t);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(e._entryToBuffer(o)),o.stages.length>1)for(let c of o.stages)c&&c!==o&&n.push(e._entryToBuffer(c));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([t,i]),s=await Gn(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function nu(e,t,r=!0,n=!0){let i=us(e),a=us(t);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size}var np=null,os=Symbol("IndexCache");function tM(){return{map:new Map,stats:new Map}}async function rM(e,t,r){let n=await e.lstat(t),i=await e.read(t),a=await dp.from(i);r.map.set(t,a),r.stats.set(t,n)}async function nM(e,t,r){let n=r.stats.get(t);if(n===void 0)return!0;let i=await e.lstat(t);return n===null||i===null?!1:nu(n,i)}var mt=class{static async acquire({fs:t,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[os]||(n[os]=tM());let s=`${r}/index`;np===null&&(np=new Jo.default({maxPending:1/0}));let o,c=[];return await np.acquire(s,async()=>{await nM(t,s,n[os])&&await rM(t,s,n[os]);let l=n[os].map.get(s);if(c=l.unmergedPaths,c.length&&!i)throw new Qo(c);if(o=await a(l),l._dirty){let u=await l.toObject();await t.write(s,u),n[os].stats.set(s,await t.lstat(s)),l._dirty=!1}}),o}};function iu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>-1&&(e=e.slice(t+1)),e}function fs(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?".":t===0?"/":e.slice(0,t)}function i2(e){let t=new Map,r=function(i){if(!t.has(i)){let a={type:"tree",fullpath:i,basename:iu(i),metadata:{},children:[]};t.set(i,a),a.parent=r(fs(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return t.get(i)},n=function(i,a){if(!t.has(i)){let s={type:"blob",fullpath:i,basename:iu(i),metadata:a,parent:r(fs(i)),children:[]};s.parent&&s.parent.children.push(s),t.set(i,s)}return t.get(i)};r(".");for(let i of e)n(i.path,i);return t}function iM(e){switch(e){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new le(`Unexpected GitTree entry mode: ${e.toString(8)}`)}var hp=class{constructor({fs:t,gitdir:r,cache:n}){this.treePromise=mt.acquire({fs:t,gitdir:r,cache:n},async function(a){return i2(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,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(t){let r=t._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let a=i.children.map(s=>s.fullpath);return a.sort(pu),a}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){let n=(await this.treePromise).get(t._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let i=n.type==="tree"?{}:us(n.metadata);t._type=n.type==="tree"?"tree":iM(i.mode),t._mode=i.mode,n.type==="tree"?t._stat=void 0:t._stat=i}return t._stat}async content(t){}async oid(t){if(t._oid===!1){let n=(await this.treePromise).get(t._fullpath);t._oid=n.metadata.oid}return t._oid}},mu=Symbol("GitWalkSymbol");function gu(){let e=Object.create(null);return Object.definePr
|
||
|
[remote "${t}"]
|
||
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
||
|
`),this.code=this.name=e.code,this.data={remote:t}}};el.code="NoRefspecError";var au=class e{constructor(t){if(this.refs=new Map,this.parsedConfig=[],t){let r=null;this.parsedConfig=t.trim().split(`
|
||
|
`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{let a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(t){return new e(t)}delete(t){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==t),this.refs.delete(t)}toString(){return this.parsedConfig.map(({line:t})=>t).join(`
|
||
|
`)+`
|
||
|
`}},su=class e{constructor({remotePath:t,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:t,localPath:r,force:n,matchPrefix:i})}static from(t){let[r,n,i,a,s]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",c=i==="*";if(c!==(s==="*"))throw new le("Invalid refspec");return new e({remotePath:n,localPath:a,force:o,matchPrefix:c})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}},pp=class e{constructor(t=[]){this.rules=t}static from(t){let r=[];for(let n of t)r.push(su.from(n));return new e(r)}add(t){let r=su.from(t);this.rules.push(r)}translate(t){let r=[];for(let n of this.rules)for(let i of t){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(t){let r=null;for(let n of this.rules){let i=n.translate(t);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(t=>t.matchPrefix).map(t=>t.localPath.replace(/\/$/,""))}};function aM(e,t){let r=e.replace(/\^\{\}$/,""),n=t.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?e.endsWith("^{}")?1:-1:i}var Mw=new Map;function Ow(e){let t=Mw.get(e);return t||(t=sM(e),Mw.set(e,t)),t}function sM(e){return e=e.split("/./").join("/").replace(/\/{2,}/g,"/"),e==="/."?"/":e==="./"||(e.startsWith("./")&&(e=e.slice(2)),e.endsWith("/.")&&(e=e.slice(0,-2)),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e==="")?".":e}function $(...e){return Ow(e.map(Ow).join("/"))}var oM=e=>{e=e.toLowerCase();let t=parseInt(e);return e.endsWith("k")&&(t*=1024),e.endsWith("m")&&(t*=1024*1024),e.endsWith("g")&&(t*=1024*1024*1024),t},Ko=e=>{if(e=e.trim().toLowerCase(),e==="true"||e==="yes"||e==="on")return!0;if(e==="false"||e==="no"||e==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},Iw={core:{filemode:Ko,bare:Ko,logallrefupdates:Ko,symlinks:Ko,ignorecase:Ko,bigFileThreshold:oM}},lM=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,cM=/^[A-Za-z0-9-.]+$/,uM=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,fM=/^[A-Za-z][A-Za-z-]*$/,dM=/^(.*?)( *[#;].*)$/,hM=e=>{let t=lM.exec(e);if(t!=null){let[r,n]=t.slice(1);return[r,n]}return null},pM=e=>{let t=uM.exec(e);if(t!=null){let[r,n="true"]=t.slice(1),i=mM(n),a=gM(i);return[r,a]}return null},mM=e=>{let t=dM.exec(e);if(t==null)return e;let[r,n]=t.slice(1);return Fw(r)&&Fw(n)?`${r}${n}`:r},Fw=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!==0,gM=e=>e.split("").reduce((t,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?t:t+r},""),$w=e=>e!=null?e.toLowerCase():null,mp=(e,t,r)=>[$w(e),t,$w(r)].filter(n=>n!=null).join("."),Lw=e=>{let t=e.split("."),r=t.shift(),n=t.pop(),i=t.length?t.join("."):void 0;return{section:r,subsection:i,name:n,path:mp(r,i,n),sectionPath:mp(r,i,null)}},vM=(e,t)=>e.reduce((r,n,i)=>t(n)?i:r,-1),gp=class e{constructor(t){let r=null,n=null;this.parsedConfig=t?t.split(`
|
||
|
`).map(i=>{let a=null,s=null,o=i.trim(),c=hM(o),l=c!=null;if(l)[r,n]=c;else{let f=pM(o);f!=null&&([a,s]=f)}let u=mp(r,n,a);return{line:i,isSection:l,section:r,subsection:n,name:a,value:s,path:u}}):[]}static from(t){return new e(t)}async get(t,r=!1){let n=Lw(t).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let c=Iw[a]&&Iw[a][s];return c?c(o):o});return r?i:i.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter(r=>r.section===t&&r.isSection).map(r=>r.subsection)}async deleteSection(t,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===t&&n.subsection===r))}async append(t,r){return this.set(t,r,!0)}async set(t,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:c}=Lw(t),l=vM(this.parsedConfig,u=>u.path===o);if(r==null)l!==-1&&this.parsedConfig.splice(l,1);else if(l!==-1){let u=this.parsedConfig[l],f=Object.assign({},u,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(l+1,0,f):this.parsedConfig[l]=f}else{let u=this.parsedConfig.findIndex(d=>d.path===c),f={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(cM.test(i)&&fM.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let d={section:i,subsection:a,modified:!0,path:c};this.parsedConfig.push(d,f)}}}toString(){return this.parsedConfig.map(({line:t,section:r,subsection:n,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:t).join(`
|
||
|
`)}},Ve=class{static async get({fs:t,gitdir:r}){let n=await t.read(`${r}/config`,{encoding:"utf8"});return gp.from(n)}static async save({fs:t,gitdir:r,config:n}){await t.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},eu=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],yM=["config","description","index","shallow","commondir"],ip;async function vi(e,t){return ip===void 0&&(ip=new Jo.default),ip.acquire(e,t)}var q=class e{static async updateRemoteRefs({fs:t,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:c=!1,pruneTags:l=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new bi(v);let u=await Ve.get({fs:t,gitdir:r});if(!o){if(o=await u.getall(`remote.${n}.fetch`),o.length===0)throw new el(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=pp.from(o),d=new Map;if(l){let v=await e.listRefs({fs:t,gitdir:r,filepath:"refs/tags"});await e.deleteRefs({fs:t,gitdir:r,refs:v.map(y=>`refs/tags/${y}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await e.exists({fs:t,gitdir:r,ref:v})){let y=i.get(v);d.set(v,y)}}let h=f.translate([...i.keys()]);for(let[v,y]of h){let b=i.get(v);d.set(y,b)}let p=f.translate([...a.keys()]);for(let[v,y]of p){let b=a.get(v),x=f.translateOne(b);x&&d.set(y,`ref: ${x}`)}let m=[];if(c){for(let v of f.localNamespaces()){let y=(await e.listRefs({fs:t,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of y)d.has(b)||m.push(b)}m.length>0&&await e.deleteRefs({fs:t,gitdir:r,refs:m})}for(let[v,y]of d)await vi(v,async()=>t.write($(r,v),`${y.trim()}
|
||
|
`,"utf8"));return{pruned:m}}static async writeRef({fs:t,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new bi(i);await vi(n,async()=>t.write($(r,n),`${i.trim()}
|
||
|
`,"utf8"))}static async writeSymbolicRef({fs:t,gitdir:r,ref:n,value:i}){await vi(n,async()=>t.write($(r,n),`ref: ${i.trim()}
|
||
|
`,"utf8"))}static async deleteRef({fs:t,gitdir:r,ref:n}){return e.deleteRefs({fs:t,gitdir:r,refs:[n]})}static async deleteRefs({fs:t,gitdir:r,refs:n}){await Promise.all(n.map(o=>t.rm($(r,o))));let i=await vi("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"})),a=au.from(i),s=a.refs.size;for(let o of n)a.refs.has(o)&&a.delete(o);a.refs.size<s&&(i=a.toString(),await vi("packed-refs",async()=>t.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:t,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),e.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await e.packedRefs({fs:t,gitdir:r}),s=eu(n).filter(o=>!yM.includes(o));for(let o of s){let c=await vi(o,async()=>await t.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(c)return e.resolve({fs:t,gitdir:r,ref:c.trim(),depth:i})}throw new Ne(n)}static async exists({fs:t,gitdir:r,ref:n}){try{return await e.expand({fs:t,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:t,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await e.packedRefs({fs:t,gitdir:r}),a=eu(n);for(let s of a)if(await vi(s,async()=>t.exists(`${r}/${s}`))||i.has(s))return s;throw new Ne(n)}static async expandAgainstMap({ref:t,map:r}){let n=eu(t);for(let i of n)if(await r.has(i))return i;throw new Ne(t)}static resolveAgainstMap({ref:t,fullref:r=t,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),e.resolveAgainstMap({ref:t,fullref:r,depth:n,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:r,oid:t};let a=eu(t);for(let s of a){let o=i.get(s);if(o)return e.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new Ne(t)}static async packedRefs({fs:t,gitdir:r}){let n=await vi("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));return au.from(n).refs}static async listRefs({fs:t,gitdir:r,filepath:n}){let i=e.packedRefs({fs:t,gitdir:r}),a=null;try{a=await t.readdirDeep(`${r}/${n}`),a=a.map(s=>s.replace(`${r}/${n}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(n)&&(s=s.replace(n+"/",""),a.includes(s)||a.push(s));return a.sort(aM),a}static async listBranches({fs:t,gitdir:r,remote:n}){return n?e.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):e.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await e.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function wM(e,t){return pu(Dw(e),Dw(t))}function Dw(e){return e.mode==="040000"?e.path+"/":e.path}function a2(e){switch(e){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new le(`Unexpected GitTree entry mode: ${e}`)}function bM(e){let t=[],r=0;for(;r<e.length;){let n=e.indexOf(32,r);if(n===-1)throw new le(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let i=e.indexOf(0,r);if(i===-1)throw new le(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=e.slice(r,n).toString("utf8");a==="40000"&&(a="040000");let s=a2(a),o=e.slice(n+1,i).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new cs(o);let c=e.slice(i+1,i+21).toString("hex");r=i+21,t.push({mode:a,path:o,oid:c,type:s})}return t}function _M(e){if(typeof e=="number"&&(e=e.toString(8)),e.match(/^0?4.*/))return"040000";if(e.match(/^1006.*/))return"100644";if(e.match(/^1007.*/))return"100755";if(e.match(/^120.*/))return"120000";if(e.match(/^160.*/))return"160000";throw new le(`Could not understand file mode: ${e}`)}function xM(e){return!e.oid&&e.sha&&(e.oid=e.sha),e.mode=_M(e.mode),e.type||(e.type=a2(e.mode)),e}var er=class e{constructor(t){if(Buffer.isBuffer(t))this._entries=bM(t);else if(Array.isArray(t))this._entries=t.map(xM);else throw new le("invalid type passed to GitTree constructor");this._entries.sort(t2)}static from(t){return new e(t)}render(){
|
||
|
`)}toObject(){let t=[...this._entries];return t.sort(wM),Buffer.concat(t.map(r=>{let n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let t of this._entries)yield t}},_i=class{static wrap({type:t,object:r}){return Buffer.concat([Buffer.from(`${t} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(t){let r=t.indexOf(32),n=t.indexOf(0),i=t.slice(0,r).toString("utf8"),a=t.slice(r+1,n).toString("utf8"),s=t.length-(n+1);if(parseInt(a)!==s)throw new le(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(t.slice(n+1))}}};async function SM({fs:e,gitdir:t,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await e.read(`${t}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function EM(e,t){let r=new Or(e),n=Nw(r);if(n!==t.byteLength)throw new le(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);let i=Nw(r),a,s=Bw(r,t);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Or(a);for(o.copy(s);!r.eof();)o.copy(Bw(r,t));let c=o.tell();if(i!==c)throw new le(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${c} bytes`)}return a}function Nw(e){let t=0,r=0,n=null;do n=e.readUInt8(),t|=(n&127)<<r,r+=7;while(n&128);return t}function jw(e,t,r){let n=0,i=0;for(;r--;)t&1&&(n|=e.readUInt8()<<i),t>>=1,i+=8;return n}function Bw(e,t){let r=e.readUInt8(),n=128,i=15,a=112;if(r&n){let s=jw(e,r&i,4),o=jw(e,(r&a)>>4,3);return o===0&&(o=65536),t.slice(s,s+o)}else return e.slice(r)}function AM(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function s2(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:AM(e)}var ou=class{constructor(t){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=s2(t),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(t){if(!this.eof())return this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t),this.buffer.slice(this.undoCursor,this.cursor)}async skip(t){this.eof()||(this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:t,value:r}=await this.stream.next();return t&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(t){this.undoCursor=this.cursor,this.cursor+=t,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(t){if(this._ended)return;let r=[this.buffer];for(;this.cursor+t>kM(r);){let n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function kM(e){return e.reduce((t,r)=>t+r.length,0)}async function TM(e,t){let r=new ou(e),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new le(`Invalid PACK header '${n}'`);l
|
||
|
`,e}function lu(e){let[,t,r,n,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:r,timestamp:Number(n),timezoneOffset:NM(i)}}function NM(e){let[,t,r,n]=e.match(/(\+|-)(\d\d)(\d\d)/);return n=(t==="+"?1:-1)*(Number(r)*60+Number(n)),jM(n)}function jM(e){return e===0?e:-e}var hr=class e{constructor(t){if(typeof t=="string")this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else if(typeof t=="object")this._tag=e.render(t);else throw new le("invalid type passed to GitAnnotatedTag constructor")}static from(t){return new e(t)}static render(t){return`object ${t.object}
|
||
|
type ${t.type}
|
||
|
tag ${t.tag}
|
||
|
tagger ${vp(t.tagger)}
|
||
|
|
||
|
${t.message}
|
||
|
${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||
|
|
||
|
`))}message(){let t=this.withoutSignature();return t.slice(t.indexOf(`
|
||
|
|
||
|
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let t=this.justHeaders().split(`
|
||
|
`),r=[];for(let i of t)i[0]===" "?r[r.length-1]+=`
|
||
|
`+i.slice(1):r.push(i);let n={};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.tagger&&(n.tagger=lu(n.tagger)),n.committer&&(n.committer=lu(n.committer)),n}withoutSignature(){let t=Un(this._tag);return t.indexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`)===-1?t:t.slice(0,t.lastIndexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`)===-1)return;let t=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Un(t)}payload(){return this.withoutSignature()+`
|
||
|
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(t,r,n){let i=t.payload(),{signature:a}=await r({payload:i,secretKey:n});a=Un(a);let s=i+a;return e.from(s)}};function sp(e){return e.trim().split(`
|
||
|
`).map(t=>" "+t).join(`
|
||
|
`)+`
|
||
|
`}function BM(e){return e.split(`
|
||
|
`).map(t=>t.replace(/^ /,"")).join(`
|
||
|
`)}var tr=class e{constructor(t){if(typeof t=="string")this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString("utf8");else if(typeof t=="object")this._commit=e.render(t);else throw new le("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:t,signature:r}){let n=e.justHeaders(t),i=e.justMessage(t),a=Un(n+`
|
||
|
gpgsig`+sp(r)+`
|
||
|
`+i);return new e(a)}static from(t){return new e(t)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return e.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(t){return Un(t.slice(t.indexOf(`
|
||
|
|
||
|
`)+2))}static justHeaders(t){return t.slice(0,t.indexOf(`
|
||
|
|
||
|
`))}parseHeaders(){let t=e.justHeaders(this._commit).split(`
|
||
|
`),r=[];for(let i of t)i[0]===" "?r[r.length-1]+=`
|
||
|
`+i.slice(1):r.push(i);let n={parent:[]};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.author&&(n.author=lu(n.author)),n.committer&&(n.committer=lu(n.committer)),n}static renderHeaders(t){let r="";if(t.tree?r+=`tree ${t.tree}
|
||
|
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||
|
`,t.parent){if(t.parent.length===void 0)throw new le("commit 'parent' property should be an array");for(let a of t.parent)r+=`parent ${a}
|
||
|
`}let n=t.author;r+=`author ${vp(n)}
|
||
|
`;let i=t.committer||t.author;return r+=`committer ${vp(i)}
|
||
|
`,t.gpgsig&&(r+="gpgsig"+sp(t.gpgsig)),r}static render(t){return e.renderHeaders(t)+`
|
||
|
`+Un(t.message)}render(){return this._commit}withoutSignature(){let t=Un(this._commit);if(t.indexOf(`
|
||
|
gpgsig`)===-1)return t;let r=t.slice(0,t.indexOf(`
|
||
|
gpgsig`)),n=t.slice(t.indexOf(`-----END PGP SIGNATURE-----
|
||
|
`)+28);return Un(r+`
|
||
|
`+n)}isolateSignature(){let t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return BM(t)}static async sign(t,r,n){let i=t.withoutSignature(),a=e.justMessage(t._commit),{signature:s}=await r({payload:i,secretKey:n});s=Un(s);let c=e.justHeaders(t._commit)+`
|
||
|
gpgsig`+sp(s)+`
|
||
|
`+a;return e.from(c)}};async function vs({fs:e,cache:t,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:er.from([]),oid:n};let{type:i,object:a}=await We({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=hr.from(a).parse().object,vs({fs:e,cache:t,gitdir:r,oid:n});if(i==="commit")return n=tr.from(a).parse().tree,vs({fs:e,cache:t,gitdir:r,oid:n});if(i!=="tree")throw new Gt(n,i,"tree");return{tree:er.from(a),oid:n}}var yp=class{constructor({fs:t,gitdir:r,ref:n,cache:i}){this.fs=t,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await q.resolve({fs:t,gitdir:r,ref:n})}catch(l){l instanceof Ne&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let c=await vs({fs:t,cache:this.cache,gitdir:r,oid:o});return c.type="tree",c.mode="40000",s.set(".",c),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){let r=t._fullpath,{fs:n,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(r);if(!o)throw new Error(`No obj for ${r}`);let c=o.oid;if(!c)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:l,object:u}=await We({fs:n,cache:i,gitdir:a,oid:c});if(l!==o.type)throw new Gt(c,l,o.type);let f=er.from(u);for(let d of f)s.set($(r,d.path),d);return f.entries().map(d=>$(r,d.path))}async type(t){if(t._type===!1){let r=await this.mapPromise,{type:n}=r.get(t._fullpath);t._type=n}return t._type}async mode(t){if(t._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(t._fullpath);t._mode=r2(parseInt(n,8))}return t._mode}async stat(t){}async content(t){if(t._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(t._fullpath).oid,{type:c,object:l}=await We({fs:n,cache:i,gitdir:a,oid:o});c!=="blob"?t._content=void 0:t._content=new Uint8Array(l)}return t._content}async oid(t){if(t._oid===!1){let n=(await this.mapPromise).get(t._fullpath);t._oid=n.oid}return t._oid}};function wi({ref:e="HEAD"}={}){let t=Object.create(null);return Object.defineProperty(t,mu,{value:function({fs:r,gitdir:n,cache:i}){return new yp({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}var wp=class{constructor({fs:t,dir:r,gitdir:n,cache:i}){this.fs=t,this.cache=i,this.dir=r,this.gitdir=n;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){let r=t._fullpath,{fs:n,dir:i}=this,a=await n.readdir($(i,r));return a===null?null:a.map(s=>$(r,s))}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){let{fs:r,dir:n}=this,i=await r.lstat(`${n}/${t._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),t._type=a,i=us(i),t._mode=i.mode,i.size===-1&&t._actualSize&&(i.size=t._actualSize),t._stat=i}return t._stat}async content(t){if(t._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await t.type()==="tree")t._content=void 0;else{let s=await(await Ve.get({fs:r,gitdir:i})).get("core.autocrlf"),o=await r.read(`${n}/${t._fullpath}`,{autocrlf:s});t._actualSize=o.length,t._stat&&t._stat.size===-1&&(t._stat.size=t._actualSize),t._content=new Uint8Array(o)}}return t._content}async oid(t){if(t._oid===!1){let{fs:r,gitdir:n,cache:i}=this,a;await mt.acquire({fs:r,gitdir:n,cache:i},async function(s){let o=s.entriesMap.get(t._fullpath),c=await t.stat(),u=await(await Ve.get({fs:r,gitdir:n})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||nu(c,o,u,f)?await t.content()===void
|
||
|
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(t,r,n={}){try{await this._writeFile(t,r,n);return}catch(i){await this.mkdir(fs(t)),await this._writeFile(t,r,n)}}async mkdir(t,r=!1){try{await this._mkdir(t);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=fs(t);if(i==="."||i==="/"||i===t)throw n;await this.mkdir(i),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(t,r){try{r&&r.recursive?await this._rm(t,r):await this._rmdir(t)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(t){try{let r=await this._readdir(t);return r.sort(pu),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(t){let r=await this._readdir(t);return(await Promise.all(r.map(async i=>{let a=t+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(t){try{return await this._lstat(t)}catch(r){if(r.code==="ENOENT")return null;throw r}}async readlink(t,r={encoding:"buffer"}){try{let n=await this._readlink(t,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}async writelink(t,r){return this._symlink(r.toString("utf8"),t)}};function C(e,t){if(t===void 0)throw new Qt(e)}async function cu(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()==="tree"&&await t.type()==="tree"||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function VM({fs:e,dir:t,gitdir:r=$(t,".git"),commit:n="HEAD",cache:i={}}){try{C("fs",e),C("dir",t),C("gitdir",r);let a=new X(e),s=[wi({ref:n}),vu(),gu()],o=[];await mt.acquire({fs:a,gitdir:r,cache:i},async function(l){o=l.unmergedPaths});let c=await ys({fs:a,cache:i,dir:t,gitdir:r,trees:s,map:async function(l,[u,f,d]){let h=!await cu(f,d),p=o.includes(l),m=!await cu(d,u);if(h||p)return u?{path:l,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(m)return!1;throw new hl(l)}});await mt.acquire({fs:a,gitdir:r,cache:i},async function(l){for(let u of c)if(u!==!1){if(!u){await a.rmdir(`${t}/${u.path}`,{recursive:!0}),l.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${t}/${u.path}`,f,{mode:u.mode}),l.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var ws=class{static async isIgnored({fs:t,dir:r,gitdir:n=$(r,".git"),filepath:i}){if(iu(i)===".git")return!0;if(i===".")return!1;let a="",s=$(n,"info","exclude");await t.exists(s)&&(a=await t.read(s,"utf8"));let o=[{gitignore:$(r,".gitignore"),filepath:i}],c=i.split("/").filter(Boolean);for(let u=1;u<c.length;u++){let f=c.slice(0,u).join("/"),d=c.slice(u).join("/");o.push({gitignore:$(r,f,".gitignore"),filepath:d})}let l=!1;for(let u of o){let f;try{f=await t.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=(0,Qw.default)().add(a);d.add(f);let h=fs(u.filepath);if(h!=="."&&d.ignores(h))return!0;l?l=!d.test(u.filepath).unignored:l=d.test(u.filepath).ignored}return l}};async function WM({fs:e,gitdir:t,object:r,format:n,oid:i}){if(n!=="deflated")throw new le("GitObjectStoreLoose expects objects to write to be in deflated format");let a=`objects/${i.slice(0,2)}/${i.slice(2)}`,s=`${t}/${a}`;await e.exists(s)||await e.write(s,r)}var op=null;async function c2(e){return op===null&&(op=YM()),op?qM(e):hu.default.deflate(e)}async function qM(e){let t=new CompressionStream("deflate"),r=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(r).arrayBuffer())}function YM(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(e){return!1}}async function pr({fs:e,gitdir:t,type:r,object:n,format:i="content",oid:a=void 0,dryRun:s=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=_i.wrap({type:r,object:n})),a=await Gn(n),n=Buffer.from(await c2(n))),s||await WM({fs:e,gitdir:t,object:n,format:"deflated",oid:a}),a}function XM(e){let t;
|
||
|
`,author:c,committer:l,signingKey:u})}async function JM({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:c,committer:l,signingKey:u,cache:f={}}){try{C("fs",e),C("gitdir",n),C("oid",a),C("note",s),u&&C("onSign",t);let d=new X(e),h=await ca({fs:d,gitdir:n,author:c});if(!h)throw new zt("author");let p=await bs({fs:d,gitdir:n,author:h,committer:l});if(!p)throw new zt("committer");return await KM({fs:new X(d),cache:f,onSign:t,gitdir:n,ref:i,oid:a,note:s,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function p2({fs:e,gitdir:t,remote:r,url:n,force:i}){if(r!==Kr.default.clean(r))throw new zn(r,Kr.default.clean(r));let a=await Ve.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new Jr("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await Ve.save({fs:e,gitdir:t,config:a})}async function QM({fs:e,dir:t,gitdir:r=$(t,".git"),remote:n,url:i,force:a=!1}){try{return C("fs",e),C("gitdir",r),C("remote",n),C("url",i),await p2({fs:new X(e),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function eO({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:c,signingKey:l,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:e,gitdir:n,ref:i}))throw new Jr("tag",i);let f=await q.resolve({fs:e,gitdir:n,ref:c||"HEAD"}),{type:d}=await We({fs:e,cache:t,gitdir:n,oid:f}),h=hr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});l&&(h=await hr.sign(h,r,l));let p=await pr({fs:e,gitdir:n,type:"tag",object:h.toObject()});await q.writeRef({fs:e,gitdir:n,ref:i,value:p})}async function tO({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:c,signingKey:l,force:u=!1,cache:f={}}){try{C("fs",e),C("gitdir",n),C("ref",i),l&&C("onSign",t);let d=new X(e),h=await ca({fs:d,gitdir:n,author:a});if(!h)throw new zt("tagger");return await eO({fs:d,cache:f,onSign:t,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:c,signingKey:l,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function rO({fs:e,gitdir:t,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Kr.default.clean(r))throw new zn(r,Kr.default.clean(r));let s=`refs/heads/${r}`;if(!a&&await q.exists({fs:e,gitdir:t,ref:s}))throw new Jr("branch",r,!1);let o;try{o=await q.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch(c){}o&&await q.writeRef({fs:e,gitdir:t,ref:s,value:o}),i&&await q.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:s})}async function nO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return C("fs",e),C("gitdir",r),C("ref",n),await rO({fs:new X(e),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var m2=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function Tp({fs:e,cache:t,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:c,noCheckout:l,noUpdateHead:u,dryRun:f,force:d,track:h=!0}){let p;if(n)try{p=await q.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch(v){p="0000000000000000000000000000000000000000"}let m;try{m=await q.resolve({fs:e,gitdir:a,ref:o})}catch(v){if(o==="HEAD")throw v;let y=`${s}/${o}`;if(m=await q.resolve({fs:e,gitdir:a,ref:y}),h){let b=await Ve.get({fs:e,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await Ve.save({fs:e,gitdir:a,config:b})}await q.writeRef({fs:e,gitdir:a,ref:`refs/heads/${o}`,value:m})}if(!l){let v;try{v=await iO({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:c})}catch(_){throw _ instanceof Ne&&_.data.what===m?new il(o,m):_}let y=v.filter(([_])=>_==="conflict").map(([_,k])=>k);if(y.length>0)throw new nl(y);let b=v.filter(([_])=>_==="error").map(([_,k])=>k);if(b.length>0)throw new le(b.join(", "));if(f){n&&await n({previousHead:p,newHead:m,type:c!=null&&c.length>0?"file":"branch"});return}
|
||
|
`).map(s=>i.add(s))}),i}static async write({fs:t,gitdir:r,oids:n}){sa===null&&(sa=new Jo.default);let i=$(r,"shallow");if(n.size>0){let a=[...n].join(`
|
||
|
`)+`
|
||
|
`;await sa.acquire(i,async function(){await t.write(i,a,{encoding:"utf8"})})}else await sa.acquire(i,async function(){await t.rm(i)})}};async function cO({fs:e,gitdir:t,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function uO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await e.readdir($(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,c=await Ap({fs:e,cache:t,filename:o,getExternalRefDelta:i});if(c.error)throw new le(c.error);if(c.offsets.has(n))return!0}return!1}async function Zw({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){let a=o=>We({fs:e,cache:t,gitdir:r,oid:o}),s=await cO({fs:e,gitdir:r,oid:n});return s||(s=await uO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),s}function fO(e){let i="5041434b"+"00000002"+"00000000";return e.slice(0,12).toString("hex")===i}function v2(e,t){let r=e.map(n=>n.split("=",1)[0]);return t.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var wu={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},ls=class{constructor(){this._queue=[]}write(t){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:t})}else this._queue.push(t)}end(){if(this._ended=!0,this._waiting){let t=this._waiting;this._waiting=null,t({done:!0})}}destroy(t){this.error=t,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(t=>{this._waiting=t})}};function dO(e){let t=e.indexOf("\r"),r=e.indexOf(`
|
||
|
`);return t===-1&&r===-1?-1:t===-1?r+1:r===-1?t+1:r===t+1?r+1:Math.min(t,r)+1}function y2(e){let t=new ls,r="";return(async()=>(await yl(e,n=>{for(n=n.toString("utf8"),r+=n;;){let i=dO(r);if(i===-1)break;t.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&t.write(r),t.end()))(),t}var du=class{static demux(t){let r=ze.streamReader(t),n=new ls,i=new ls,a=new ls,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),t.error?i.destroy(t.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let c=o.slice(1);a.write(c),n.end(),a.end(),i.destroy(new Error(c.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function hO(e){let{packetlines:t,packfile:r,progress:n}=du.demux(e),i=[],a=[],s=[],o=!1,c=!1;return new Promise((l,u)=>{yl(t,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new bi(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new bi(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.push({oid:h,status:p}),p||(c=!0)}else d.startsWith("NAK")?(o=!0,c=!0):(c=!0,o=!0);c&&(e.error?u(e.error):l({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{c||(e.error?u(e.error):l({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function pO({capabilities:e=[],wants:t=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];t=[...new Set(t)];let c=` ${e.join(" ")}`;for(let l of t)o.push(ze.encode(`want ${l}${c}
|
||
|
`)),c="";for(let l of n)o.push(ze.encode(`shallow ${l}
|
||
|
`));i!==null&&o.push(ze.encode(`deepen ${i}
|
||
|
`)),a!==null&&o.push(ze.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
|
||
|
`));for(let l of s)o.push(ze.encode(`deepen-not ${l}
|
||
|
`));o.push(ze.flush());for(let l of r)o.push(ze.encode(`have ${l}
|
||
|
`));return o.push(ze.encode(`done
|
||
|
`)),o}async function Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:l,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:v=[],relative:y=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:k=!1}){let w=l||await fa({fs:e,gitdir:c,test:!0}),A=await Ve.get({fs:e,gitdir:c}),S=f||w&&await A.get(`branch.${w}.remote`)||"origin",T=d||await A.get(`remote.${S}.url`);if(typeof T=="undefined")throw new Qt("remote OR url");let P=u||w&&await A.get(`branch.${w}.merge`)||l||"HEAD";h===void 0&&(h=await A.get("http.corsProxy"));let O=xs.getRemoteHelperFor({url:T}),j=await O.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:E,protocolVersion:1}),D=j.auth,Q=j.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!j.capabilities.has("shallow"))throw new yi("shallow","depth");if(m!==null&&!j.capabilities.has("deepen-since"))throw new yi("deepen-since","since");if(v.length>0&&!j.capabilities.has("deepen-not"))throw new yi("deepen-not","exclude");if(y===!0&&!j.capabilities.has("deepen-relative"))throw new yi("deepen-relative","relative");let{oid:de,fullref:ee}=q.resolveAgainstMap({ref:P,map:Q});for(let G of Q.keys())G===ee||G==="HEAD"||G.startsWith("refs/heads/")||b&&G.startsWith("refs/tags/")||Q.delete(G);let J=v2([...j.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${wu.agent}`]);y&&J.push("deepen-relative");let Ce=x?[de]:Q.values(),me=x?[w]:await q.listRefs({fs:e,gitdir:c,filepath:"refs"}),F=[];for(let G of me)try{G=await q.expand({fs:e,gitdir:c,ref:G});let Le=await q.resolve({fs:e,gitdir:c,ref:G});await Zw({fs:e,cache:t,gitdir:c,oid:Le})&&F.push(Le)}catch(Le){}F=[...new Set(F)];let z=await ua.read({fs:e,gitdir:c}),N=j.capabilities.has("shallow")?[...z]:[],Re=pO({capabilities:J,wants:Ce,haves:F,shallows:N,depth:p,since:m,exclude:v}),Dt=Buffer.from(await fu(Re)),_t=await O.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:D,body:[Dt],headers:E}),Ee=await hO(_t.body);_t.headers&&(Ee.headers=_t.headers);for(let G of Ee.shallows)if(!z.has(G))try{let{object:Le}=await We({fs:e,cache:t,gitdir:c,oid:G}),L=new tr(Le),Y=await Promise.all(L.headers().parent.map(De=>Zw({fs:e,cache:t,gitdir:c,oid:De})));Y.length===0||Y.every(De=>De)||z.add(G)}catch(Le){z.add(G)}for(let G of Ee.unshallows)z.delete(G);if(await ua.write({fs:e,gitdir:c,oids:z}),x){let G=new Map([[ee,de]]),Le=new Map,L=10,Y=ee;for(;L--;){let vt=j.symrefs.get(Y);if(vt===void 0)break;Le.set(Y,vt),Y=vt}let ye=Q.get(Y);ye&&G.set(Y,ye);let{pruned:De}=await q.updateRemoteRefs({fs:e,gitdir:c,remote:S,refs:G,symrefs:Le,tags:b,prune:_});_&&(Ee.pruned=De)}else{let{pruned:G}=await q.updateRemoteRefs({fs:e,gitdir:c,remote:S,refs:Q,symrefs:j.symrefs,tags:b,prune:_,pruneTags:k});_&&(Ee.pruned=G)}if(Ee.HEAD=j.symrefs.get("HEAD"),Ee.HEAD===void 0){let{oid:G}=q.resolveAgainstMap({ref:"HEAD",map:Q});for(let[Le,L]of Q.entries())if(Le!=="HEAD"&&L===G){Ee.HEAD=Le;break}}let st=ee.startsWith("refs/tags")?"tag":"branch";if(Ee.FETCH_HEAD={oid:de,description:`${st} '${oa(ee)}' of ${T}`},n||i){let G=y2(Ee.progress);yl(G,async Le=>{if(i&&await i(Le),n){let L=Le.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);L&&await n({phase:L[1].trim(),loaded:parseInt(L[2],10),total:parseInt(L[3],10)})}})}let ot=Buffer.from(await fu(Ee.packfile));if(_t.body.error)throw _t.body.error;let Ct=ot.slice(-20).toString("hex"),$e={defaultBranch:Ee.HEAD,fetchHead:Ee.FETCH_HEAD.oid,fetchHeadDescription:Ee.FETCH_HEAD.description};if(Ee.headers&&($e.headers=Ee.headers),_&&($e.pruned=Ee.pruned),Ct!==""&&!fO(ot)){$e.packfile=`objects/pack/pack-${Ct}.pack`;let G=$(c,$e.packfile);await e.write(G,ot);let Le=Y=>We({fs:e,cache:t,gitdir:c,oid:Y}),L=await tl.fromPack({pack:ot,getExternalRefDelta:Le,onProgress:n});await e.write(G.replace(/\.pack$/,".idx"),await L.toBuffer())}return $e}async function w2({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:$(r,".git"),defaultBranch:i="master"}){if(await e.exists(n+"/config"))retur
|
||
|
repositoryformatversion = 0
|
||
|
filemode = false
|
||
|
bare = ${t}
|
||
|
`+(t?"":` logallrefupdates = true
|
||
|
`)+` symlinks = false
|
||
|
ignorecase = true
|
||
|
`),await e.write(n+"/HEAD",`ref: refs/heads/${i}
|
||
|
`)}async function mO({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:c,dir:l,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:v,exclude:y,relative:b,singleBranch:x,noCheckout:E,noTags:_,headers:k}){try{if(await w2({fs:e,gitdir:u}),await p2({fs:e,gitdir:u,remote:p,url:f,force:!1}),d){let S=await Ve.get({fs:e,gitdir:u});await S.set("http.corsProxy",d),await Ve.save({fs:e,gitdir:u,config:S})}let{defaultBranch:w,fetchHead:A}=await Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:v,exclude:y,relative:b,singleBranch:x,headers:k,tags:!_});if(A===null)return;h=h||w,h=h.replace("refs/heads/",""),await Tp({fs:e,cache:t,onProgress:n,onPostCheckout:c,dir:l,gitdir:u,ref:h,remote:p,noCheckout:E})}catch(w){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),w}}async function gO({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:l=$(c,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:v=[],relative:y=!1,singleBranch:b=!1,noCheckout:x=!1,noTags:E=!1,headers:_={},cache:k={}}){try{return C("fs",e),C("http",t),C("gitdir",l),x||C("dir",c),C("url",u),await mO({fs:new X(e),cache:k,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:c,gitdir:l,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:v,relative:y,singleBranch:b,noCheckout:x,noTags:E,headers:_})}catch(w){throw w.caller="git.clone",w}}async function vO({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:c=!1,dryRun:l=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{C("fs",e),c||C("message",i),o&&C("onSign",t);let m=new X(e);return await yu({fs:m,cache:p,onSign:t,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:c,dryRun:l,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(m){throw m.caller="git.commit",m}}async function yO({fs:e,dir:t,gitdir:r=$(t,".git"),fullname:n=!1,test:i=!1}){try{return C("fs",e),C("gitdir",r),await fa({fs:new X(e),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function wO({fs:e,gitdir:t,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:e,gitdir:t,ref:r}))throw new Ne(r);let i=await q.expand({fs:e,gitdir:t,ref:r}),a=await fa({fs:e,gitdir:t,fullname:!0});if(i===a){let c=await q.resolve({fs:e,gitdir:t,ref:i});await q.writeRef({fs:e,gitdir:t,ref:"HEAD",value:c})}await q.deleteRef({fs:e,gitdir:t,ref:i});let s=oa(r),o=await Ve.get({fs:e,gitdir:t});await o.deleteSection("branch",s),await Ve.save({fs:e,gitdir:t,config:o})}async function bO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("ref",n),await wO({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function _O({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{C("fs",e),C("ref",n),await q.deleteRef({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function xO({fs:e,gitdir:t,remote:r}){let n=await Ve.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await Ve.save({fs:e,gitdir:t,config:n})}async function SO({fs:e,dir:t,gitdir:r=$(t,".git"),remote:n}){try{return C("fs",e),C("remote",n),await xO({fs:new X(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function EO({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:e,gitdir:t,ref:r})}async function AO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("ref",n),await EO({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function kO({fs:e,gitdir:t,oid:r}){let n=r.slice(0,2);return(await e.readdir(`${t}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function TO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await e.readdir($(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let c=`${r}/objects/pac
|
||
|
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
|
||
|
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
|
||
|
`);return{cleanMerge:h,mergedText:d}}async function OO({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:c="ours",baseName:l="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=wi({ref:a}),m=wi({ref:s}),v=wi({ref:o}),y=[],b=[],x=[],E=[],_=await ys({fs:e,cache:t,dir:r,gitdir:n,trees:[p,m,v],map:async function(k,[w,A,S]){let T=iu(k),P=await cu(w,A),O=await cu(S,A);switch(`${P}-${O}`){case"false-false":return{mode:await A.mode(),path:T,oid:await A.oid(),type:await A.type()};case"false-true":return S?{mode:await S.mode(),path:T,oid:await S.oid(),type:await S.type()}:void 0;case"true-false":return w?{mode:await w.mode(),path:T,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&A&&S&&await w.type()==="blob"&&await A.type()==="blob"&&await S.type()==="blob")return IO({fs:e,gitdir:n,path:T,ours:w,base:A,theirs:S,ourName:c,baseName:l,theirName:u,mergeDriver:h}).then(async j=>{if(j.cleanMerge)d||i.insert({filepath:k,oid:j.mergeResult.oid,stage:0});else if(y.push(k),b.push(k),!d){let D=await A.oid(),Q=await w.oid(),de=await S.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:D,stage:1}),i.insert({filepath:k,oid:Q,stage:2}),i.insert({filepath:k,oid:de,stage:3})}return j.mergeResult});if(A&&!w&&S&&await A.type()==="blob"&&await S.type()==="blob"){if(y.push(k),x.push(k),!d){let j=await A.oid(),D=await S.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:j,stage:1}),i.insert({filepath:k,oid:D,stage:3})}return{mode:await S.mode(),oid:await S.oid(),type:"blob",path:T}}if(A&&w&&!S&&await A.type()==="blob"&&await w.type()==="blob"){if(y.push(k),E.push(k),!d){let j=await A.oid(),D=await w.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:j,stage:1}),i.insert({filepath:k,oid:D,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:T}}if(A&&!w&&!S&&await A.type()==="blob")return;throw new hs}}},reduce:y.length!==0&&(!r||d)?void 0:async(k,w)=>{let A=w.filter(Boolean);if(k&&!(k&&k.type==="tree"&&A.length===0)){if(A.length>0){let T=new er(A).toObject(),P=await pr({fs:e,gitdir:n,type:"tree",object:T,dryRun:f});k.oid=P}return k}}});return y.length!==0?(r&&!d&&await ys({fs:e,cache:t,dir:r,gitdir:n,trees:[wi({ref:_.oid})],map:async function(k,[w]){let A=`${r}/${k}`;if(await w.type()==="blob"){let S=await w.mode(),T=new TextDecoder().decode(await w.content());await e.write(A,T,{mode:S})}return!0}}),new ps(y,b,x,E)):_.oid}async function IO({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:c,dryRun:l,mergeDriver:u=MO}){let f="blob",d=await i.mode()===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await n.oid(),type:f}};if(await n.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await n.oid(),type:f}};let h=Buffer.from(await n.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),m=Buffer.from(await a.content()).toString("utf8"),{mergedText:v,cleanMerge:y}=await u({branches:[c,s,o],contents:[p,h,m],path:r}),b=await pr({fs:e,gitdir:t,type:"blob",object:Buffer.from(v,"utf8"),dryRun:l});return{cleanMerge:y,mergeResult:{mode:d,path:r,oid:b,type:f}}}async function b2({fs:e,cache:t,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:m,mergeDriver:v}){i===void 0&&(i=await fa({fs:e,gitdir:n,fullname:!0})),i=await q.expand({fs:e,gitdir:n,ref:i}),a=await q.expand({fs:e,gitdir:n,ref:a});let y=await q.resolve({fs:e,gitdir:n,ref:i}),b=await q.resolve({fs:e,gitdir:n,ref:a}),x=await Pp({fs:e,cache:t,gitdir:n,oids:[y,b]});if(x.length!==1)throw new hs;let E=x[0];if(E===b)return{oid:y,alreadyMerged:!0};if(s&&E===y)return!c&&!l&&await q.writeRef({fs:e,gitdir:n,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new sl;let _=await mt.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1}
|
||
|
`)),n.push(ze.encode(`agent=${wu.agent}
|
||
|
`)),(r||t||e)&&n.push(ze.delim()),r&&n.push(ze.encode("peel")),t&&n.push(ze.encode("symrefs")),e&&n.push(ze.encode(`ref-prefix ${e}`)),n.push(ze.flush()),n}async function a8({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:c=2,prefix:l,symrefs:u,peelTags:f}){try{C("http",e),C("url",a);let d=await _s.discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:c});if(d.protocolVersion===1)return S2(d,l,u,f);let h=await i8({prefix:l,symrefs:u,peelTags:f}),p=await _s.connect({http:e,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return n8(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function s8({fs:e,dir:t,gitdir:r=$(t,".git")}){try{return C("fs",e),C("gitdir",r),q.listTags({fs:new X(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function o8(e,t){return e.committer.timestamp-t.committer.timestamp}var l8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function Kw({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===l8)return;let a=n,s,o=await vs({fs:e,cache:t,gitdir:r,oid:n}),c=o.tree;return i===o.oid?s=o.path:(s=await k2({fs:e,cache:t,gitdir:r,tree:c,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function k2({fs:e,cache:t,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let c=n.entries().map(function(l){let u;return l.oid===i?(u=$(o,l.path),s.push(u)):l.type==="tree"&&(u=We({fs:e,cache:t,gitdir:r,oid:l.oid}).then(function({object:f}){return k2({fs:e,cache:t,gitdir:r,tree:er.from(f),fileId:i,oid:a,filepaths:s,parentPath:$(o,l.path)})})),u});return await Promise.all(c),s}async function c8({fs:e,cache:t,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:c}){let l=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await ua.read({fs:e,gitdir:r}),d=await q.resolve({fs:e,gitdir:r,ref:i}),h=[await uu({fs:e,cache:t,gitdir:r,oid:d})],p,m,v;function y(b){v&&n&&u.push(b)}for(;h.length>0;){let b=h.pop();if(l!==void 0&&b.commit.committer.timestamp<=l)break;if(n){let x;try{x=await vl({fs:e,cache:t,gitdir:r,oid:b.commit.tree,filepath:n}),m&&p!==x&&u.push(m),p=x,m=b,v=!0}catch(E){if(E instanceof Ne){let _=c&&p;if(_&&(_=await Kw({fs:e,cache:t,gitdir:r,oid:b.commit.tree,fileId:p}),_))if(Array.isArray(_)){if(m){let k=await Kw({fs:e,cache:t,gitdir:r,oid:m.commit.tree,fileId:p});if(Array.isArray(k))if(_=_.filter(w=>k.indexOf(w)===-1),_.length===1)_=_[0],n=_,m&&u.push(m);else{_=!1,m&&u.push(m);break}}}else n=_,m&&u.push(m);if(!_){if(v&&p&&(u.push(m),!o))break;if(!o&&!c)throw E}m=b,v=!1}else throw E}}else u.push(b);if(a!==void 0&&u.length===a){y(b);break}if(!f.has(b.oid))for(let x of b.commit.parent){let E=await uu({fs:e,cache:t,gitdir:r,oid:x});h.map(_=>_.oid).includes(E.oid)||h.push(E)}h.length===0&&y(b),h.sort((x,E)=>o8(x.commit,E.commit))}return u}async function u8({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:c,cache:l={}}){try{return C("fs",e),C("gitdir",r),C("ref",i),await c8({fs:new X(e),cache:l,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:c})}catch(u){throw u.caller="git.log",u}}async function f8({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:c=!1,noUpdateBranch:l=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:v}){try{C("fs",e),p&&C("onSign",t);let y=new X(e),b=await ca({fs:y,gitdir:n,author:d});if(!b&&(!o||!s))throw new zt("author");let x=await bs({fs:y,gitdir:n,author:b,committer:h});if(!x&&(!o||!s))throw new zt("committer");return await b2({fs:y,cache:m,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:c,noUpdateBranch:l,abortOnConflict:u,message:f,author:b,committer:x,signingKey:p,onSign:t,mergeDriver:v})}catch(y){throw y.caller="git.merge",y}}var d8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function T2({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),oid
|
||
|
`),i=await n();let a=r.toString("utf8").split(`
|
||
|
`);if(i=a.shift(),!i.startsWith("unpack "))throw new la('unpack ok" or "unpack [error message]',i);t.ok=i==="unpack ok",t.ok||(t.error=i.slice(7)),t.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),c=s.slice(3),l=c.indexOf(" ");l===-1&&(l=c.length);let u=c.slice(0,l),f=c.slice(l+1);t.refs[u]={ok:o==="ok",error:f}}return t}async function y8({capabilities:e=[],triplets:t=[]}){let r=[],n=`\0 ${e.join(" ")}`;for(let i of t)r.push(ze.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
|
||
|
`)),n="";return r.push(ze.flush()),r}async function w8({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:c,gitdir:l,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:v,headers:y={}}){let b=u||await fa({fs:e,gitdir:l});if(typeof b=="undefined")throw new Qt("ref");let x=await Ve.get({fs:e,gitdir:l});d=d||await x.get(`branch.${b}.pushRemote`)||await x.get("remote.pushDefault")||await x.get(`branch.${b}.remote`)||"origin";let E=h||await x.get(`remote.${d}.pushurl`)||await x.get(`remote.${d}.url`);if(typeof E=="undefined")throw new Qt("remote OR url");let _=f||await x.get(`branch.${b}.merge`);if(typeof E=="undefined")throw new Qt("remoteRef");v===void 0&&(v=await x.get("http.corsProxy"));let k=await q.expand({fs:e,gitdir:l,ref:b}),w=m?"0000000000000000000000000000000000000000":await q.resolve({fs:e,gitdir:l,ref:k}),A=xs.getRemoteHelperFor({url:E}),S=await A.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:E,headers:y,protocolVersion:1}),T=S.auth,P;if(!_)P=k;else try{P=await q.expandAgainstMap({ref:_,map:S.refs})}catch(z){if(z instanceof Ne)P=_.startsWith("refs/")?_:`refs/heads/${_}`;else throw z}let O=S.refs.get(P)||"0000000000000000000000000000000000000000";if(c&&!await c({remote:d,url:E,localRef:{ref:m?"(delete)":k,oid:w},remoteRef:{ref:P,oid:O}}))throw new gs;let j=!S.capabilities.has("no-thin"),D=new Set;if(!m){let z=[...S.refs.values()],N=new Set;if(O!=="0000000000000000000000000000000000000000"){let Re=await Pp({fs:e,cache:t,gitdir:l,oids:[w,O]});for(let Dt of Re)z.push(Dt);j&&(N=await fp({fs:e,cache:t,gitdir:l,oids:Re}))}if(!z.includes(w)){let Re=await g8({fs:e,cache:t,gitdir:l,start:[w],finish:z});D=await fp({fs:e,cache:t,gitdir:l,oids:Re})}if(j){try{let Re=await q.resolve({fs:e,gitdir:l,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Dt}=await q.resolveAgainstMap({ref:Re.replace(`refs/remotes/${d}/`,""),fullref:Re,map:S.refs}),_t=[Dt];for(let Ee of await fp({fs:e,cache:t,gitdir:l,oids:_t}))N.add(Ee)}catch(Re){}for(let Re of N)D.delete(Re)}if(w===O&&(p=!0),!p){if(k.startsWith("refs/tags")&&O!=="0000000000000000000000000000000000000000")throw new ms("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&O!=="0000000000000000000000000000000000000000"&&!await E2({fs:e,cache:t,gitdir:l,oid:w,ancestor:O,depth:-1}))throw new ms("not-fast-forward")}}let Q=v2([...S.capabilities],["report-status","side-band-64k",`agent=${wu.agent}`]),de=await y8({capabilities:Q,triplets:[{oldoid:O,oid:w,fullRef:P}]}),ee=m?[]:await T2({fs:e,cache:t,gitdir:l,oids:[...D]}),J=await A.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:E,auth:T,headers:y,body:[...de,...ee]}),{packfile:Ce,progress:me}=await du.demux(J.body);if(i){let z=y2(me);yl(z,async N=>{await i(N)})}let F=await v8(Ce);if(J.headers&&(F.headers=J.headers),d&&F.ok&&F.refs[P].ok&&!k.startsWith("refs/tags")){let z=`refs/remotes/${d}/${P.replace("refs/heads","")}`;m?await q.deleteRef({fs:e,gitdir:l,ref:z}):await q.writeRef({fs:e,gitdir:l,ref:z,value:w})}if(F.ok&&Object.values(F.refs).every(z=>z.ok))return F;{let z=Object.entries(F.refs).filter(([N,Re])=>!Re.ok).map(([N,Re])=>`
|
||
|
- ${N}: ${Re.error}`).join("");throw new ol(z,F)}}async function b8({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:c,gitdir:l=$(c,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:v,headers:y={},cache:b={}}){try{return C("fs",e),C("http",t),C("gitdir",l),await w8({fs:new X(e),cache:b,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:l,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:v,headers:y})}catch(x){throw x.caller="git.push",x}}async function C2({fs:e,cache:t,gitdir:r,oid:n}){let{type:i,object:a}=await We({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=hr.from(a).parse().object,C2({fs:e,cache:t,gitdir:r,oid:n});if(i!=="blob")throw new Gt(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function P2({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await vl({fs:e,cache:t,gitdir:r,oid:n,filepath:i})),await C2({fs:e,cache:t,gitdir:r,oid:n})}async function wl({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,filepath:i,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await P2({fs:new X(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function _8({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await uu({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function x8({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await q.resolve({gitdir:r,fs:e,ref:n}),{blob:s}=await P2({fs:e,cache:t,gitdir:r,oid:a,filepath:i});return s}async function S8({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("ref",n),C("oid",i),await x8({fs:new X(e),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function E8({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{C("fs",e),C("gitdir",r),C("oid",n);let c=new X(e);a!==void 0&&(n=await vl({fs:c,cache:o,gitdir:r,oid:n,filepath:a}));let u=await We({fs:c,cache:o,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(u.oid=n,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=tr.from(u.object).parse();break;case"tree":u.object=er.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=hr.from(u.object).parse();break;default:throw new Gt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(c){throw c.caller="git.readObject",c}}async function A8({fs:e,cache:t,gitdir:r,oid:n}){let{type:i,object:a}=await We({fs:e,cache:t,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new Gt(n,i,"tag");let s=hr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function k8({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await A8({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function T8({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await Ss({fs:new X(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function C8({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,cache:i={}}){try{C("fs",e),C("gitdir",r),C("filepath",n),await mt.acquire({fs:new X(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function P8({fs:e,cache:t,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:c}){let l;try{l=await q.resolve({gitdir:n,fs:e,ref:i})}catch(p){if(!(p instanceof Ne))throw p}let f=(await Ss({fs:e,gitdir:n,oid:l||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let d=await kp({fs:e,gitdir:n,tree:f});return await yu({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:d,parent:l&&[l],message:`Note removed
|
||
|
`,author:s,committer:o,signingKey:c})}async function R8({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:c,cache:l={}}){try{C("fs",e),C("gitdir",n),C("oid",a);let u=new X(e),f=await ca({fs:u,gitdir:n,author:s});if(!f)throw new zt("author");let d=await bs({fs:u,gitdir:n,author:f,committer:o});if(!d)throw new zt("committer");return await P8({fs:u,cache:l,onSign:t,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:c})}catch(u){throw u.caller="git.removeNote",u}}async function M8({fs:e,gitdir:t,oldref:r,ref:n,checkout:i=!1}){if(n!==Kr.default.clean(n))throw new zn(n,Kr.default.clean(n));if(r!==Kr.default.clean(r))throw new zn(r,Kr.default.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await q.exists({fs:e,gitdir:t,ref:s}))throw new Jr("branch",n,!1);let c=await q.resolve({fs:e,gitdir:t,ref:a,depth:1});await q.writeRef({fs:e,gitdir:t,ref:s,value:c}),await q.deleteRef({fs:e,gitdir:t,ref:a});let u=await fa({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await q.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:s})}async function O8({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return C("fs",e),C("gitdir",r),C("ref",n),C("oldref",i),await M8({fs:new X(e),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function R2({gitdir:e,type:t,object:r}){return Gn(_i.wrap({type:t,object:r}))}async function I8({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,ref:i,cache:a={}}){try{C("fs",e),C("gitdir",r),C("filepath",n);let s=new X(e),o,c;try{o=await q.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await vl({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let l={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=t&&await s.read($(t,n));u&&(c=await R2({gitdir:r,type:"blob",object:u}),o===c&&(l=await s.lstat($(t,n)))),await mt.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:l,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function F8({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,depth:i}){try{return C("fs",e),C("gitdir",r),C("ref",n),await q.resolve({fs:new X(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function $8({fs:e,dir:t,gitdir:r=$(t,".git"),path:n,value:i,append:a=!1}){try{C("fs",e),C("gitdir",r),C("path",n);let s=new X(e),o=await Ve.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await Ve.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function L8({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,cache:i={}}){try{C("fs",e),C("gitdir",r),C("filepath",n);let a=new X(e);if(await ws.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";let o=await D8({fs:a,cache:i,gitdir:r}),c=await M2({fs:a,cache:i,gitdir:r,tree:o,path:n}),l=await mt.acquire({fs:a,gitdir:r,cache:i},async function(m){for(let v of m)if(v.path===n)return v;return null}),u=await a.lstat($(t,n)),f=c!==null,d=l!==null,h=u!==null,p=async()=>{if(d&&!nu(l,u))return l.oid;{let m=await a.read($(t,n)),v=await R2({gitdir:r,type:"blob",object:m});return d&&l.oid===v&&u.size!==-1&&mt.acquire({fs:a,gitdir:r,cache:i},async function(y){y.insert({filepath:n,stats:u,oid:v})}),v}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await p()===l.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return c===l.oid,"*deleted";if(f&&h&&!d)return await p()===c?"*undeleted":"*undeletemodified";if(f&&h&&d){let m=await p();return m===c?m===l.oid?"unmodified":"*unmodified":m===l.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function M2({fs:e,cache:t,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of n)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:c}=await We({fs:e,cache:t,gitdir:r,oid:s.oid});if(o==="tree"){let l=er.from(c);return M2({fs:e,cache:t,gitdir:r,tree:l,path:i})}if(o==="blob")throw new Gt(s.oid,o,"blob",i.join("/"))}return null}async functi
|
||
|
`){return e.split(r).reduce((n,i)=>{let a=t?i.trim():i;return a&&n.push(a),n},[])}function Jp(e,t){return Cl(e,!0).map(r=>t(r))}function Qp(e){return(0,Lu.exists)(e,Lu.FOLDER)}function ke(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function Ab(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function Du(e,t){if(Array.isArray(e)){let r=e.indexOf(t);r>=0&&e.splice(r,1)}else e.delete(t);return t}function _n(e){return Array.isArray(e)?e:[e]}function kb(e){return e.replace(/[\s-]+(.)/g,(t,r)=>r.toUpperCase())}function Tb(e){return _n(e).map(String)}function Ie(e,t=0){if(e==null)return t;let r=parseInt(e,10);return isNaN(r)?t:r}function Sl(e,t){let r=[];for(let n=0,i=e.length;n<i;n++)r.push(t,e[n]);return r}function El(e){return(Array.isArray(e)?Buffer.concat(e):e).toString("utf-8")}function Cb(e,t){return Object.assign({},...t.map(r=>r in e?{[r]:e[r]}:{}))}function Np(e=0){return new Promise(t=>setTimeout(t,e))}function jp(e){if(e!==!1)return e}var Ps,ga,Pl,Nu=W({"src/lib/utils/util.ts"(){"use strict";Ps="\0",ga=()=>{},Pl=Object.prototype.toString.call.bind(Object.prototype.toString)}});function xn(e,t,r){return t(e)?e:arguments.length>2?r:void 0}function em(e,t){let r=Ru(e)?"string":typeof e;return/number|string|boolean/.test(r)&&(!t||!t.includes(r))}function tm(e){return!!e&&Pl(e)==="[object Object]"}function Pb(e){return typeof e=="function"}var Rl,Pt,Rb,Mu,rm,Mb=W({"src/lib/utils/argument-filters.ts"(){"use strict";Nu(),kl(),Rl=e=>Array.isArray(e),Pt=e=>typeof e=="string",Rb=e=>Array.isArray(e)&&e.every(Pt),Mu=e=>Pt(e)||Array.isArray(e)&&e.every(Pt),rm=e=>e==null||"number|boolean|function".includes(typeof e)?!1:Array.isArray(e)||typeof e=="string"||typeof e.length=="number"}}),Bp,SI=W({"src/lib/utils/exit-codes.ts"(){"use strict";Bp=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.NOT_FOUND=-2]="NOT_FOUND",e[e.UNCLEAN=128]="UNCLEAN",e))(Bp||{})}}),Al,EI=W({"src/lib/utils/git-output-streams.ts"(){"use strict";Al=class{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new Al(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),ce,Si,AI=W({"src/lib/utils/line-parser.ts"(){"use strict";ce=class{constructor(e,t){this.matches=[],this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,r(a)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}useMatches(e,t){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,r){let n=r&&e.exec(r);return n&&this.pushMatch(t,n),!!n}pushMatch(e,t){this.matches.push(...t.slice(1))}},Si=class extends ce{addMatch(e,t,r){return/^remote:\s/.test(String(r))&&super.addMatch(e,t,r)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Ob(...e){let t=process.cwd(),r=Object.assign(Ir({baseDir:t},Ib),...e.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||t,r.trimmed=r.trimmed===!0,r}var Ib,kI=W({"src/lib/utils/simple-git-options.ts"(){"use strict";Ib={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function nm(e,t=[]){return tm(e)?Object.keys(e).reduce((r,n)=>{let i=e[n];return Ru(i)?r.push(i):em(i,["boolean"])?r.push(n+"="+i):r.push(n),r},t):t}function rr(e,t=0,r=!1){let n=[];for(let i=0,a=t<0?e.length:t;i<a;i++)"string|number".includes(typeof e[i])&&n.push(String(e[i]));return nm(im(e),n),r||n.push(...TI(e)),n}function TI(e){let t=typeof ma(e)=="function";return xn(ma(e,t?1:0),Rl,[])}function im(e){let t=Pb(ma(e));return xn(ma(e,t?1:0),tm)}function Je(e,t=!0){let r=bb(ma(e));return t||_b(r)?r:void 0}var CI=W({"src/lib/utils/task-options.ts"(){"use strict";Mb(),Nu(),kl()}});function Hp(e,t){return e(t.stdOut,t.stdErr)}function ir(e,t,r,n=!0){return _n(r).forEach(i=>{for(let a=Cl(i,n),s=0,o=a.length;s<o;s++){let c=(l=0)=>{if(!(s+l>=o))return a[s+l]};t.some(({parse:l})=>l(c,e))}}),e}var PI=W({"src/lib/utils/task-parser.ts"(){"use strict";Nu()}}),Fb={};rt(Fb,{ExitCodes:()=>Bp,GitOutputStreams:()=>Al,LineParser:()=>ce,NOOP:()=>ga,NULL:(
|
||
|
`)){let c=xb(s,`
|
||
|
`);o=c[0],s=c[1]}yield{file:a,key:o,value:s}}}var Kb,GI=W({"src/lib/responses/ConfigList.ts"(){"use strict";oe(),Kb=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{})),this._all}addFile(e){if(!(e in this.values)){let t=ma(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,r){let n=this.addFile(e);n.hasOwnProperty(t)?Array.isArray(n[t])?n[t].push(r):n[t]=[n[t],r]:n[t]=r,this._all=void 0}}}});function Op(e,t){return typeof e=="string"&&zp.hasOwnProperty(e)?e:t}function zI(e,t,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(e,t),{commands:i,format:"utf-8",parser(a){return a}}}function VI(e,t){let r=["config","--null","--show-origin","--get-all",e];return t&&r.splice(1,0,`--${t}`),{commands:r,format:"utf-8",parser(n){return HI(n,e)}}}function WI(e){let t=["config","--list","--show-origin","--null"];return e&&t.push(`--${e}`),{commands:t,format:"utf-8",parser(r){return BI(r)}}}function qI(){return{addConfig(e,t,...r){return this._runTask(zI(e,t,r[0]===!0,Op(r[1],"local")),Je(arguments))},getConfig(e,t){return this._runTask(VI(e,Op(t,void 0)),Je(arguments))},listConfig(...e){return this._runTask(WI(Op(e[0],void 0)),Je(arguments))}}}var zp,Jb=W({"src/lib/tasks/config.ts"(){"use strict";GI(),oe(),zp=(e=>(e.system="system",e.global="global",e.local="local",e.worktree="worktree",e))(zp||{})}});function YI(e){return Qb.has(e)}var Ip,Qb,e_=W({"src/lib/tasks/diff-name-status.ts"(){"use strict";Ip=(e=>(e.ADDED="A",e.COPIED="C",e.DELETED="D",e.MODIFIED="M",e.RENAMED="R",e.CHANGED="T",e.UNMERGED="U",e.UNKNOWN="X",e.BROKEN="B",e))(Ip||{}),Qb=new Set(Object.values(Ip))}});function XI(...e){return new r_().param(...e)}function ZI(e){let t=new Set,r={};return Jp(e,n=>{let[i,a,s]=n.split(Ps);t.add(i),(r[i]=r[i]||[]).push({line:Ie(a),path:i,preview:s})}),{paths:t,results:r}}function KI(){return{grep(e){let t=Je(arguments),r=rr(arguments);for(let i of t_)if(r.includes(i))return this._runTask(nr(`git.grep: use of "${i}" is not supported.`),t);typeof e=="string"&&(e=XI().param(e));let n=["grep","--null","-n","--full-name",...r,...e];return this._runTask({commands:n,format:"utf-8",parser(i){return ZI(i)}},t)}}}var t_,bl,H2,r_,n_=W({"src/lib/tasks/grep.ts"(){"use strict";oe(),tt(),t_=["-h"],bl=Symbol("grepQuery"),r_=class{constructor(){this[H2]=[]}*[(H2=bl,Symbol.iterator)](){for(let e of this[bl])yield e}and(...e){return e.length&&this[bl].push("--and","(",...Sl(e,"-e"),")"),this}param(...e){return this[bl].push(...Sl(e,"-e")),this}}}}),i_={};rt(i_,{ResetMode:()=>Tu,getResetMode:()=>QI,resetTask:()=>JI});function JI(e,t){let r=["reset"];return a_(e)&&r.push(`--${e}`),r.push(...t),Vt(r)}function QI(e){if(a_(e))return e;switch(typeof e){case"string":case"undefined":return"soft"}}function a_(e){return s_.includes(e)}var Tu,s_,o_=W({"src/lib/tasks/reset.ts"(){"use strict";tt(),Tu=(e=>(e.MIXED="mixed",e.SOFT="soft",e.HARD="hard",e.MERGE="merge",e.KEEP="keep",e))(Tu||{}),s_=Array.from(Object.values(Tu))}});function eF(){return(0,Ou.default)("simple-git")}function U2(e,t,r){return!t||!String(t).replace(/\s*/,"")?r?(n,...i)=>{e(n,...i),r(n,...i)}:e:(n,...i)=>{e(`%s ${n}`,t,...i),r&&r(n,...i)}}function tF(e,t,{namespace:r}){if(typeof e=="string")return e;let n=t&&t.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function um(e,t,r,n=eF()){let i=e&&`[${e}]`||"",a=[],s=typeof t=="string"?n.extend(t):t,o=tF(xn(t,Pt),s,n);return l(r);function c(u,f){return ke(a,um(e,o.replace(/^[^:]+/,u),f,n))}function l(u){let f=u&&`[${u}]`||"",d=s&&U2(s,f)||ga,h=U2(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:e,sibling:c,info:h,step:l})}}var l_=W({"src/lib/git-logger.ts"(){"use strict";oe(),Ou.default.formatters.L=e=>String(rm(e)?e.length:"-"),Ou.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString("utf8"):Pl(e)}}),Eu,Vp,rF=W({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Ei(),l_(),Eu=class{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new
|
||
|
`).map(K4).filter(Boolean);t||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return Z4(Au(s[0]),Au(o[0]));for(let c=0,l=Math.max(s.length,o.length);c<l;c++){let u=mx(Au(s[c]),Au(o[c]));if(u)return u}return 0});let n=t?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new db(r,n)}}}),vx={};rt(vx,{addAnnotatedTagTask:()=>t$,addTagTask:()=>e$,tagListTask:()=>Q4});function Q4(e=[]){let t=e.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...e],parser(r){return gx(r,t)}}}function e$(e){return{format:"utf-8",commands:["tag",e],parser(){return{name:e}}}}function t$(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser(){return{name:e}}}}var r$=W({"src/lib/tasks/tag.ts"(){"use strict";J4()}}),n$=bI({"src/git.js"(e,t){"use strict";var{GitExecutor:r}=(aF(),Ke(u_)),{SimpleGitApi:n}=(n4(),Ke(z_)),{Scheduler:i}=(i4(),Ke(V_)),{configurationErrorTask:a}=(tt(),Ke(Gp)),{asArray:s,filterArray:o,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:p}=(oe(),Ke(Fb)),{applyPatchTask:m}=(s4(),Ke(Y_)),{branchTask:v,branchLocalTask:y,deleteBranchesTask:b,deleteBranchTask:x}=(v4(),Ke(ex)),{checkIgnoreTask:E}=(b4(),Ke(nx)),{checkIsRepoTask:_}=(Nb(),Ke($b)),{cloneTask:k,cloneMirrorTask:w}=(S4(),Ke(ix)),{cleanWithOptionsTask:A,isCleanOptionsArray:S}=(Xb(),Ke(qb)),{diffSummaryTask:T}=(vm(),Ke(S_)),{fetchTask:P}=(C4(),Ke(ox)),{moveTask:O}=(O4(),Ke(cx)),{pullTask:j}=(F4(),Ke(ux)),{pushTagsTask:D}=(N_(),Ke(D_)),{addRemoteTask:Q,getRemotesTask:de,listRemotesTask:ee,remoteTask:J,removeRemoteTask:Ce}=(G4(),Ke(dx)),{getResetMode:me,resetTask:F}=(o_(),Ke(i_)),{stashListTask:z}=(V4(),Ke(hx)),{addSubModuleTask:N,initSubModuleTask:Re,subModuleTask:Dt,updateSubModuleTask:_t}=(X4(),Ke(px)),{addAnnotatedTagTask:Ee,addTagTask:st,tagListTask:ot}=(r$(),Ke(vx)),{straightThroughBufferTask:Ct,straightThroughStringTask:$e}=(tt(),Ke(Gp));function G(L,Y){this._plugins=Y,this._executor=new r(L.baseDir,new i(L.maxConcurrentProcesses),Y),this._trimmed=L.trimmed}(G.prototype=Object.create(n.prototype)).constructor=G,G.prototype.customBinary=function(L){return this._plugins.reconfigure("binary",L),this},G.prototype.env=function(L,Y){return arguments.length===1&&typeof L=="object"?this._executor.env=L:(this._executor.env=this._executor.env||{})[L]=Y,this},G.prototype.stashList=function(L){return this._runTask(z(p(arguments)||{},o(L)&&L||[]),h(arguments))};function Le(L,Y,ye,De){return typeof ye!="string"?a(`git.${L}() requires a string 'repoPath'`):Y(ye,f(De,l),d(arguments))}G.prototype.clone=function(){return this._runTask(Le("clone",k,...arguments),h(arguments))},G.prototype.mirror=function(){return this._runTask(Le("mirror",w,...arguments),h(arguments))},G.prototype.mv=function(L,Y){return this._runTask(O(L,Y),h(arguments))},G.prototype.checkoutLatestTag=function(L){var Y=this;return this.pull(function(){Y.tags(function(ye,De){Y.checkout(De.latest,L)})})},G.prototype.pull=function(L,Y,ye,De){return this._runTask(j(f(L,l),f(Y,l),d(arguments)),h(arguments))},G.prototype.fetch=function(L,Y){return this._runTask(P(f(L,l),f(Y,l),d(arguments)),h(arguments))},G.prototype.silent=function(L){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},G.prototype.tags=function(L,Y){return this._runTask(ot(d(arguments)),h(arguments))},G.prototype.rebase=function(){return this._runTask($e(["rebase",...d(arguments)]),h(arguments))},G.prototype.reset=function(L){return this._runTask(F(me(L),d(arguments)),h(arguments))},G.prototype.revert=function(L){let Y=h(arguments);return typeof L!="string"?this._runTask(a("Commit must be a string"),Y):this._runTask($e(["revert",...d(arguments,0,!0),L]),Y)},G.prototype.addTag=function(L){let Y=typeof L=="string"?st(L):a("Git.addTag requires a tag name");return this._runTask(Y,h(arguments))},G.prototype.addAnnotatedTag=function(L,Y){return this._runTask(
|
||
|
|
||
|
PROMPT="$1"
|
||
|
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
|
||
|
|
||
|
cleanup() {
|
||
|
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
|
||
|
}
|
||
|
trap cleanup EXIT
|
||
|
|
||
|
echo "$PROMPT" > "$TEMP_FILE"
|
||
|
|
||
|
while [ ! -e "$TEMP_FILE.response" ]; do
|
||
|
if [ ! -e "$TEMP_FILE" ]; then
|
||
|
echo "Trigger file got removed: Abort" >&2
|
||
|
exit 1
|
||
|
fi
|
||
|
sleep 0.1
|
||
|
done
|
||
|
|
||
|
RESPONSE=$(cat "$TEMP_FILE.response")
|
||
|
|
||
|
echo "$RESPONSE"
|
||
|
`,xx=["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();var Sx=require("obsidian"),k$={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0},Fe=class extends Sx.SuggestModal{constructor(t,r){super(t.app),this.config={...k$,...r},this.setPlaceholder(this.config.placeholder)}openAndGetResult(){return new Promise(t=>{this.resolve=t,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(t=>setTimeout(t,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(t){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[t.length>0?t:" ",...this.config.options]:[t.length>0?t:"...",...this.config.options]}renderSuggestion(t,r){r.setText(t)}onChooseSuggestion(t,r){if(this.resolve){let n;this.config.allowEmpty&&t===" "?n="":t==="..."?n=void 0:n=t,this.resolve(n)}}};g();function Ex(e,t){let r=Object.assign({},e.lineAuthor,t.lineAuthor);return Object.assign({},e,t,{lineAuthor:r})}var Is=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};g();var sT=Ze(Ux()),oT=Ze(aT()),zs=require("obsidian");var Gg=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);function tn(e,t){let r;if(t){if(t.button===0||t.button===1){let n=zs.Keymap.isModEvent(t);r=e.workspace.getLeaf(n)}}else r=e.workspace.getLeaf(!1);return r}function kn(e,t,r,n,i){if(t.button==2){let a=e.vault.getAbstractFileByPath(r);if(a!=null){let s=new zs.Menu;e.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:t.pageX,y:t.pageY})}}}function Oi(e){throw new Error("Impossible branch: "+e)}function zg(e){return`rgb(${e.r},${e.g},${e.b})`}function lT(e){var a;let t=(a=sT.fromString(e))==null?void 0:a.toRgbaArray();if(t===void 0)return;let[r,n,i]=t;return{r,g:n,b:i}}function cT(e){return e.diff(zs.moment.unix(0),"seconds")}function uT(e){if(e.length!==0)return e.slice().sort()[Math.floor(e.length/2)]}function fT(e,t){return(0,oT.default)(e,t,{strict:!0})}function zl(e,t){return new Proxy(e,{get(r,n){return n==="length"?Math.min(t,r.length):r[n]}})}function dT(e,t,r){return e.length<=t?new Array(t-e.length).fill(r).join("")+e:e.substring(e.length-t)}function hT(e,t){if(t<=0)return e;let r=new Array(t).fill(" ").join(""),n=e.substring(t,e.length);return r+n}function Vg(e,t,r){return e<=t&&t<=r}function Ii(e){let[t,...r]=e.split("/");return
|
||
|
`):i="Too many files to list",t=t+`
|
||
|
|
||
|
Affected files:
|
||
|
`+i}return t}};var Te=class extends Ws{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,i=n.getBasePath(),a=i;this.plugin.settings.basePath&&(await n.exists((0,Xn.normalizePath)(this.plugin.settings.basePath))?a=Be.join(i,this.plugin.settings.basePath):r||new Xn.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=a,this.git=wx({baseDir:a,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Wu:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0}});let s=this.plugin.localStorage.getPATHPaths(),o=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir;if(s.length>0){let f=process.env.PATH+":"+s.join(":");process.env.PATH=f}c&&(process.env.GIT_DIR=c);for(let f of o){let[d,h]=f.split("=");process.env[d]=h}if(vT.default.enable("simple-git"),await this.git.checkIsRepo()){let f=await this.git.revparse("--show-cdup"),d=(0,Wl.resolve)(a+Wl.sep+f);this.absoluteRepoPath=d,await this.git.cwd(d)}let l=Be.join(i,this.app.vault.configDir,"plugins","obsidian-git"),u=Be.join(l,Os);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=u),process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=Be.join(l,qu),process.env.SSH_ASKPASS==u&&this.askpass().catch(f=>this.plugin.displayError(f))}}getRelativeVaultPath(r){let i=this.app.vault.adapter.getBasePath(),a=Be.join(this.absoluteRepoPath,r),s=Be.relative(i,a);return Xn.Platform.isWin&&(s=s.replace(/\\/g,"/")),s}getRelativeRepoPath(r,n=!0){if(n){let a=this.plugin.app.vault.adapter.getBasePath(),s=this.absoluteRepoPath,o=Be.join(a,r),c=Be.relative(s,o);return Xn.Platform.isWin&&(c=c.replace(/\\/g,"/")),c}return r}async askpass(){let r=this.app.vault.adapter,n=r.getBasePath(),i=Be.join(n,this.app.vault.configDir,"plugins","obsidian-git"),a=this.app.vault.configDir+"/plugins/obsidian-git/";await Zn.writeFile(Be.join(i,Os),_x),await Zn.chmod(Be.join(i,Os),493),this.watchAbortController=new AbortController;let{signal:s}=this.watchAbortController;try{let o=Zn.watch(i,{signal:s});for await(let c of o){if(c.filename!=qu)continue;let l=a+qu;if(!await r.exists(l))continue;let u=await r.read(l),f;u.length>60&&(f=new Xn.Notice(u,999999));let d=await new Fe(this.plugin,{allowEmpty:!0,placeholder:u.length>60?"Enter a response to the message.":u}).openAndGetResult();f==null||f.hide(),await r.exists(l)&&await r.write(`${l}.response`,d!=null?d:"")}}catch(o){this.plugin.displayError(o),await Zn.rm(Be.join(i,Os),{force:!0}),await Zn.rm(Be.join(i,`${Os}.response`),{force:!0}),await new Promise(c=>setTimeout(c,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(){this.plugin.setPluginState({gitAction:1});let r=await this.git.status();this.plugin.setPluginState({gitAction:0});let n=r.files.map(i=>{let a=this.formatPath(i);return{path:a.path,from:a.from,index:i.index==="?"?"U":i.index,workingDir:i.working_dir==="?"?"U":i.working_dir,vaultPath:this.getRelativeVaultPath(a.path)}});return{all:n,changed:n.filter(i=>i.workingDir!==" "),staged:n.filter(i=>i.index!==" "&&i.index!="U"),conflicted:r.conflicted.map(i=>this.formatPath({path:i}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",Be.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),s}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",c=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",l=>{o+=l.toString("utf8")}),i.on("end",()=>{let u=o.split(`
|
||
|
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return c+"/"+d[1]+Wl.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r,n=!1){function i(a){if(a!=null)return a.startsWith('"')&&a.endsWith('"')?a.substring(1,a.length-1):a}return n?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,n,i){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let a=await this.getSubmoduleOfFile(r),s=a?["-C",a.submodule]:[],o=a?a.relativeFilepath:r;s.push("blame","--porcelain"),i&&s.push("-w");let c=`-C${Vu}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",c);break;case"all-commits":s.push("-C","-C",c);break;default:Oi(n)}s.push("--",o);let l=await this.git.raw(s);return Pj(l)}async isTracked(r){let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("ls-files","--",a),this.git.raw(i).then(s=>s.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let i=await this.getSubmodulePaths();for(let a of i)await this.git.cwd({path:a,root:!1}).add("-A"),await this.git.cwd({path:a,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:r,amend:n}){this.plugin.setPluginState({gitAction:4});let i=(await this.git.commit(await this.formatCommitMessage(r),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),i}async stage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)?await this.git.checkout(["--",r]):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(r),!0),this.plugin.setPluginState({gitAction:0})}async hashObject(r){r=this.getRelativeRepoPath(r);let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("hash-object","--",a),this.git.raw(i)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),n=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let i=await this.git.revparse([r.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([r.tracking]);break;case"rebase":await this.git.rebase([r.tracking])}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,i]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-chan
|
||
|
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(n){try{await this.git.branch(["--set-upstream",r])}catch(i){await this.git.push(["--set-upstream",...Ii(r)])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,n=!1,i){return n?await this.git.diff(["--cached","--",r]):i?await this.git.show([`${i}`,"--",r]):await this.git.diff(["--",r])}async diff(r,n,i){return await this.git.diff([`${n}..${i}`,"--",r])}async rawCommand(r){let n=r.split(" ");return await this.git.raw(n[0],...n.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Be.dirname(r)))return;let n=await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-toplevel"],c=>c&&console.warn("get-submodule-of-file",c==null?void 0:c.message));if(n=n.trim(),(await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-superproject-working-tree"],c=>c&&console.warn("get-submodule-of-file",c==null?void 0:c.message))).trim()==="")return;let s=this.app.vault.adapter.getFullPath(Be.normalize(r)),o=Be.relative(n,s);return{submodule:n,relativeFilepath:o}}async getLastCommitTime(){let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),n=(0,qg.spawnSync)(r||"git",["--version"],{stdio:"ignore"});if(n.error)if(Xn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Wu}) of Git for Windows.`);let i=(0,qg.spawnSync)(Wu,["--version"],{stdio:"ignore"});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(r){if(r instanceof yr){let n=String(r.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||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 Is(n)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);return this.plugin.displayError(`Error checking LFS status: ${i}`),!1}}},yT={hash:"000000",isZeroCommit:!0,summary:""};function Pj(e){let r=e.replace(`\r
|
||
|
`,`
|
||
|
`).split(`
|
||
|
`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a<r.length;){if(mT(r[a])){let s=r[a].split(" "),o=Rj(s,i,n);for(a++;mT(r[a]);a++){let c=r[a].split(" ");Mj(c,n,i)}Oj(n.commits.get(o)),i+=1}else if(!(r[a]===""&&a===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${r[a]}`);a++}return n}function Rj(e,t,r){let n=e[0];if(r.hashPerLine.push(n),r.originalFileLineNrPerLine.push(parseInt(e[1])),r.finalFileLineNrPerLine.push(parseInt(e[2])),e.length>=4&&r.groupSizePerStartingLine.set(t,parseInt(e[3])),parseInt(e[2])!==t)throw Error(`git-blame output is out of order: ${t} vs ${e[2]}`);return n}function Mj(e,t,r){let n=e[0],i=e.slice(1).join(" "),a=t.hashPerLine[r],s=t.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(n){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=gT(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=gT(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}t.commits.set(a,s)}function Oj(e){if(e.summary===void 0)throw Error(`Summary not provided for commit: ${e.hash}`);Wg(e.author)&&(e.author=void 0),Wg(e.committer)&&(e.committer=void 0),Wg(e.previous)&&(e.previous=void 0),e.isZeroCommit=!!e.hash.match(/^0*$/)}function Wg(e){return!e||Object.keys(e).length===0}function mT(e){return e.length>0&&e[0].trim()===e[0]}function gT(e){let t=e.startsWith("<")?e.substring(1):e;return t.endsWith(">")?t.substring(0,t.length-1):t}g();var QT=require("@codemirror/state");g();var OT=require("@codemirror/state"),Zf=require("obsidian");g();var Yg=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(t,r){if(t)return this.ensureInitialized(t),r(this.eventsPerFilepath.get(t))}forEachSubscriber(t){this.eventsPerFilepath.forEach(r=>r.forEach(t))}ensureInitialized(t){this.eventsPerFilepath.get(t)||this.eventsPerFilepath.set(t,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(t=>t==null?void 0:t.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},qs=new Yg;g();var qf=require("@codemirror/state"),TT=Ze(Xg());g();var B=require("obsidian");g();g();function rn(){}rn.prototype={diff:function(t,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(E){return E=s.postProcess(E,i),a?(setTimeout(function(){a(E)},0),!0):E}t=this.castInput(t,i),r=this.castInput(r,i),t=this.removeEmpty(this.tokenize(t,i)),r=this.removeEmpty(this.tokenize(r,i));var c=r.length,l=t.length,u=1,f=c+l;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var d=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],r,t,0,i);if(p[0].oldPos+1>=l&&m+1>=c)return o(wT(s,p[0].lastComponent,r,t,s.useLongestToken));var v=-1/0,y=1/0;function b(){for(var E=Math.max(v,-u);E<=Math.min(y,u);E+=2){var _=void 0,k=p[E-1],w=p[E+1];k&&(p[E-1]=void 0);var A=!1;if(w){var S=w.oldPos-E;A=w&&0<=S&&S<c}var T=k&&k.oldPos+1<l;if(!A&&!T){p[E]=void 0;continue}if(!T||A&&k.oldPos<w.oldPos?_=s.addToPath(w,!0,!1,0,i):_=s.addToPath(k,!1,!0,1,i),m=s.extractCommon(_,r,t,E,i),_.oldPos+1>=l&&m+1>=c)return o(wT(s,_.lastComponent,r,t,s.useLongestToken));p[E]=_,_.oldPos+1>=l&&(y=Math.min(y,E-1)),m+1>=c&&(v=Math.max(v,E+1))}u++}if(a)(function E(){setTimeout(function(){if(u>f||Date.now()>h)return a();b()||E()},0)})();else for(;u<=f&&Date.now()<=h;){var x=b();if(x)return x}},addToPath:function(t,r,n,i,a){var s=t.lastComponent;return s&&!a.oneChangePerToken&
|
||
|
`));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i<n.length;i++){var a=n[i];i%2&&!t.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r};Uf.equals=function(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
|
||
|
`))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
|
||
|
`))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
|
||
|
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
||
|
`)&&(t=t.slice(0,-1))),rn.prototype.equals.call(this,e,t,r)};function ET(e,t,r){return Uf.diff(e,t,r)}var Lj=new rn;Lj.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Dj=new rn;Dj.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function AT(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Bf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AT(Object(r),!0).forEach(function(n){Bj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AT(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nj(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jj(e){var t=Nj(e,"string");return typeof t=="symbol"?t:t+""}function Qg(e){"@babel/helpers - typeof";return Qg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qg(e)}function Bj(e,t,r){return t=jj(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zg(e){return Hj(e)||Uj(e)||Gj(e)||zj()}function Hj(e){if(Array.isArray(e))return e0(e)}function Uj(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gj(e,t){if(e){if(typeof e=="string")return e0(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e0(e,t)}}function e0(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zj(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Yl=new rn;Yl.useLongestToken=!0;Yl.tokenize=Uf.tokenize;Yl.castInput=function(e,t){var r=t.undefinedReplacement,n=t.stringifyReplacer,i=n===void 0?function(a,s){return typeof s=="undefined"?r:s}:n;return typeof e=="string"?e:JSON.stringify(t0(e,null,null,i),i," ")};Yl.equals=function(e,t,r){return rn.prototype.equals.call(Yl,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),r)};function t0(e,t,r,n,i){t=t||[],r=r||[],n&&(e=n(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return r[a];var s;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),s=new Array(e.length),r.push(s),a=0;a<e.length;a+=1)s[a]=t0(e[a],t,r,n,i);return t.pop(),r.pop(),s}if(e&&e.toJSON&&(e=e.toJSON()),Qg(e)==="object"&&e!==null){t.push(e),s={},r.push(s);var o=[],c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&o.push(c);for(o.sort(),a=0;a<o.length;a+=1)c=o[a],s[c]=t0(e[c],t,r,n,c);t.pop(),r.pop()}else s=e;return s}var r0=new rn;r0.tokenize=function(e){return e.slice()};r0.join=r0.removeEmpty=function(e){return e};function kT(e,t,r,n,i,a,s){if(s||(s={}),typeof s=="function"&&(s={callback:s}),typeof s.context=="undefined"&&(s.context=4),s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){var o=s,c=o.callback;ET(r,n,Bf(Bf({},s),{},{callback:function(f){var d=l(f);c(d)}}))}else return l(ET(r,n,s));function l(u){if(!u)return;u.push({value:"",lines:[]});function f(A){return A.map(function(S){return" "+S})}for(var d=[],h=0,p=0,m=[],v=1,y=1,b=function(){var S=u[x],T=S.lines||Wj(S.value);if(S.lines=T,S.added||S.removed){var P;if(!h){var O=u[x-1];h=v,p=y,O&&(m=s.context>0?f(O.lines.slice(-s.context)):[],h-=m.length,p-=m.length)}(P=m).push.apply(P,Zg(T.map(function(ee){return(S.added?"+":"-")+ee}))),S.added?y+=T.length:v+=T.length}else{if(h)if(T.length<=s.context*2&&x<u.length-2){var j;(j=m).push.apply(j,Zg(f(T)))}else{var D,Q=Math.min(T.length,s.context);(D=m).push.apply(D,Zg(f(T.slice(0,Q))));var de={oldStart:h,oldLines:v-h+Q,newStart:p,newLines:y-p+Q,lines:m};d.push(de),h=0,p=0,m=[]}v+=T.length,y+=T.length}},x=0;x<u.length;x++)b();for(var E=0,_=d;E<_.length;E++)for(var k=_[E],w=0;w<k.lines.length;w++)k.lines[w].endsWith(`
|
||
|
`)?k.lines[w]=k.lines[w].slice(0,-1):(k.lines.splice(w+1,0,"\\ No newline at end of file"),w++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:d}}}function n0(e){if(Array.isArray(e))return e.map(n0).join(`
|
||
|
`);var t=[];e.oldFileName==e.newFileName&&t.push("Index: "+e.oldFileName),t.push("==================================================================="),t.push("--- "+e.oldFileName+(typeof e.oldHeader=="undefined"?"":" "+e.oldHeader)),t.push("+++ "+e.newFileName+(typeof e.newHeader=="undefined"?"":" "+e.newHeader));for(var r=0;r<e.hunks.length;r++){var n=e.hunks[r];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),t.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@"),t.push.apply(t,n.lines)}return t.join(`
|
||
|
`)+`
|
||
|
`}function Vj(e,t,r,n,i,a,s){var o;if(typeof s=="function"&&(s={callback:s}),(o=s)!==null&&o!==void 0&&o.callback){var l=s,u=l.callback;kT(e,t,r,n,i,a,Bf(Bf({},s),{},{callback:function(d){d?u(n0(d)):u()}}))}else{var c=kT(e,t,r,n,i,a,s);return c?n0(c):void 0}}function Gf(e,t,r,n,i,a){return Vj(e,e,t,r,n,i,a)}function Wj(e){var t=e.endsWith(`
|
||
|
`),r=e.split(`
|
||
|
`).map(function(n){return n+`
|
||
|
`});return t?r.pop():r.push(r.pop().slice(0,-1)),r}var ba=require("obsidian");g();var Fi=require("obsidian"),zf=class{constructor(t,r){this.plugin=r;this.promises={};this.adapter=t.adapter,this.vault=t,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(t,r){var n;if(this.maybeLog("Read: "+t+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(t);return i instanceof Fi.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(t)}else{if(t.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(t)):(n=this.index)!=null?n:this.adapter.readBinary(t);let i=this.vault.getAbstractFileByPath(t);return i instanceof Fi.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(t)}}async writeFile(t,r){if(this.maybeLog("Write: "+t),typeof r=="string"){let n=this.vault.getAbstractFileByPath(t);return n instanceof Fi.TFile?this.vault.modify(n,r):this.adapter.write(t,r)}else if(t.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(t);return n instanceof Fi.TFile?this.vault.modifyBinary(n,r):this.adapter.writeBinary(t,r)}}async readdir(t){t==="."&&(t="/");let r=await this.adapter.list(t),n=[...r.files,...r.folders],i;return t!=="/"?i=n.map(a=>(0,Fi.normalizePath)(a.substring(t.length))):i=n,i}async mkdir(t){return this.adapter.mkdir(t)}async rmdir(t,r){var n,i;return this.adapter.rmdir(t,(i=(n=r==null?void 0:r.options)==null?void 0:n.recursive)!=null?i:!1)}async stat(t){if(t.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(t);if(n==null)throw{code:"ENOENT"};return this.indexctime=n.ctime,this.indexmtime=n.mtime,{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}t==="."&&(t="/");let r=this.vault.getAbstractFileByPath(t);if(this.maybeLog("Stat: "+t),r instanceof Fi.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(t);if(n)return{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{code:"ENOENT"}}}async unlink(t){return this.adapter.remove(t)}async lstat(t){return this.stat(t)}async readlink(t){throw new Error(`readlink of (${t}) is not implemented.`)}async symlink(t){throw new Error(`symlink of (${t}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(t){}};var nn=class extends Ws{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new zf(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plug
|
||
|
|
||
|
`);return{message:c[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:c.slice(1).join(`
|
||
|
|
||
|
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(l=>({path:l.path,status:l.type,vaultPath:this.getRelativeVaultPath(l.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[n,i]=Ii(r),a=await this.branchInfo();await this.wrapFS(ie.push({...this.getRepo(),remote:n,remoteRef:i})),await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,n){return this.walkDifference({walkers:[ie.TREE({ref:r}),ie.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(ie.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!Gg(a,n))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let c=await(s==null?void 0:s.oid()),l=await(o==null?void 0:o.oid()),u="equal";if(c!==l&&(u="M"),c===void 0&&(u="A"),l===void 0&&(u="D"),c===void 0&&l===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[ie.TREE({ref:"HEAD"}),ie.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new ba.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ie.walk({...a,trees:[ie.WORKDIR(),ie.STAGE()],map:async function(o,[c,l]){if(!l&&c&&await ie.isIgnored({...a,filepath:o})||!Gg(o,r))return null;let[u,f]=await Promise.all([c&&c.type(),l&&l.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 l.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await c.oid()),p?p!==h?{path:o,deleted:!1}:null:{path:o,deleted:!0}}}));return window.clearTimeout(i),n==null||n.hide(),s}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async getDiffString(r,n=!1,i){let a=this.getRelativeVaultPath(r),s=async(l,[u])=>{if(r==l){let f=await u.oid();return(await ie.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let l=await wl({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h}),u=await ie.readCommit({...this.getRepo(),oid:i}),f=await wl({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h});return Gf(a,f!=null?f:"",l!=null?l:"")}let o=(await ie.walk({...this.getRepo(),trees:[ie.STAGE()],map:s})).first(),c=new TextDecoder().decode(o);if(n){let l=await this.resolveRef("HEAD").then(f=>wl({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ie.Errors.NotFoundError))throw f});return Gf(a,l!=null?l:"",c)}else{let l;return await this.app.vault.adapter.exists(a)?l=await this.app.vault.adapter.read(a):l="",Gf(a,c,l)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await ie.readCommit({...r,oid:n})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(r){let n=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:n[0]=="?"?"U":n[0],workingDir:n[1]=="?"?"U":n[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!r||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,n=!0){if(!this.plugin.settings.disablePopups)return new ba.Notice(r,n?this.noticeLength:void 0)}};function qj(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIt
|
||
|
If turned on, do auto ${i} every ${Vl(n.settings.autoSaveInterval)} after stopping file edits.
|
||
|
This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(n.settings.autoBackupAfterFileChange).onChange(async f=>{n.settings.autoBackupAfterFileChange=f,this.display(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new B.Setting(r).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(n.settings.setLastSaveToLastCommit).onChange(async f=>{n.settings.setLastSaveToLastCommit=f,await n.saveSettings(),n.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new B.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(n.settings.autoPushInterval)).onChange(async f=>{isNaN(Number(f))?new B.Notice("Please specify a valid number."):(n.settings.autoPushInterval=Number(f),await n.saveSettings(),n.automaticsManager.reload("push"),n.settings.autoPushInterval>0?new B.Notice(`Automatic push enabled! Every ${Vl(n.settings.autoPushInterval)}.`):n.settings.autoPushInterval<=0&&new B.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new B.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(n.settings.autoPullInterval)).onChange(async f=>{isNaN(Number(f))?new B.Notice("Please specify a valid number."):(n.settings.autoPullInterval=Number(f),await n.saveSettings(),n.automaticsManager.reload("pull"),n.settings.autoPullInterval>0?new B.Notice(`Automatic pull enabled! Every ${Vl(n.settings.autoPullInterval)}.`):n.settings.autoPullInterval<=0&&new B.Notice("Automatic pull disabled!"))})),new B.Setting(r).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(n.settings.customMessageOnAutoBackup).onChange(async f=>{n.settings.customMessageOnAutoBackup=f,await n.saveSettings(),this.display()})),s=new B.Setting(r).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(n.settings.autoCommitMessage).onChange(async f=>{n.settings.autoCommitMessage=f,await n.saveSettings()})),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new B.Setting(r).setName("Commit message").setHeading(),new B.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(n.settings.commitMessage?n.settings.commitMessage:"").onChange(async f=>{n.settings.commitMessage=f,await n.saveSettings()}));let l=new B.Setting(r).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(n.settings.commitDateFormat).setValue(n.settings.commitDateFormat).onChange(async f=>{n.settings.commitDateFormat=f,await n.saveSettings()}));l.descEl.innerHTML=`
|
||
|
Specify custom date format. E.g. "${xm}. See <a href="https://momentjs.com">Moment.js</a> for more formats.`,new B.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=n.localStorage.getHostname())!=null?f:"").onChange(d=>{n.localStorage.setHostname(d)})}),new B.Setting(r).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new B.Notice(`${f}`)})),new B.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(n.settings.listChangedFilesInMessageBody).onChange(async f=>{n.settings.listChangedFilesInMessageBody=f,await n.saveSettings()})),new B.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof Te&&new B.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(n.settings.syncMethod),u.onChange(async d=>{n.settings.syncMethod=d,await n.saveSettings()})}),new B.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(n.settings.autoPullOnBoot).onChange(async f=>{n.settings.autoPullOnBoot=f,await n.saveSettings()})),new B.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new B.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${n.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(u=>u.setValue(!n.settings.disablePush).onChange(async f=>{n.settings.disablePush=!f,this.display(),await n.saveSettings()})),new B.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${n.settings.disablePush?"":"and push "}only.`).addToggle(u=>u.setValue(n.settings.pullBeforePush).onChange(async f=>{n.settings.pullBeforePush=f,this.display(),await n.saveSettings()})),n.gitManager instanceof Te&&(new B.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new B.Setting(r).setName("History view").setHeading(),new B.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(l=>{let u={hide:"Hide",full:"Full",initials:"Initials"};l.addOptions(u),l.setValue(n.settings.authorInHistoryView),l.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new B.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(l=>l.setValue(n.settings.dateInHistoryView).onChange(async u=>{n.settings.dateInHistoryView=u,await n.saveSettings(),await n.refresh()})),new B.Setting(r).setName("Source control view").setHeading(),new B.Setting(r).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(l=>l.setValue(n.settings.refreshSourceControl).onChange(async u=>{n.settings.refreshSourceControl=u,await n.saveSettings()})),new B.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(l=>l.setValue(n.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(async u=>{n.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),await n.saveSettings(),n.setRefreshDebouncer(
|
||
|
`)),l.onChange(u=>{n.localStorage.setEnvVars(u.split(`
|
||
|
`))})}),n.gitManager instanceof Te&&new B.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(l=>{l.setValue(n.localStorage.getPATHPaths().join(`
|
||
|
`)),l.onChange(u=>{n.localStorage.setPATHPaths(u.split(`
|
||
|
`))})}),n.gitManager instanceof Te&&new B.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(l=>{l.setButtonText("Reload"),l.setCta(),l.onClick(async()=>{await n.gitManager.setGitInstance()})}),new B.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
|
||
|
Sets the relative path to the vault from which the Git binary should be executed.
|
||
|
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
|
||
|
`).addText(l=>{l.setValue(n.settings.basePath),l.setPlaceholder("directory/directory-with-git-repo"),l.onChange(async u=>{n.settings.basePath=u,await n.saveSettings(),n.gitManager.updateBasePath(u||"").catch(f=>n.displayError(f))})}),new B.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(l=>{l.setValue(n.settings.gitDir),l.setPlaceholder(".git"),l.onChange(async u=>{n.settings.gitDir=u,await n.saveSettings()})}),new B.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(l=>l.setValue(n.localStorage.getPluginDisabled()).onChange(u=>{n.localStorage.setPluginDisabled(u),u?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new B.Notice("Obsidian must be restarted for the changes to take affect.")})),new B.Setting(r).setName("Support").setHeading(),new B.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(l=>{l.buttonEl.outerHTML="<a href='https://ko-fi.com/F1F195IQ5' target='_blank'><img 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>"});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let c=o.createEl("button");if(c.setText("Copy Debug Information"),c.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new B.Notice("Debug information copied to clipboard. May contain sensitive information!")},B.Platform.isDesktopApp){let l=r.createDiv();l.setAttr("align","center"),l.setText(`Debugging and logging:
|
||
|
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),B.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,n){n&&(r.setDisabled(n),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}async lineAuthorSettingHandler(r,n){this.settings.lineAuthor[r]=n,await this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new B.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.innerHTML=`
|
||
|
<a href="${Jj}">Feature guide and quick examples</a></br>
|
||
|
The commit hash, author name and authoring date can all be individually toggled.</br>Hide everything, to only show the age-colored sidebar.`,r.addToggle(n=>n.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let n=new B.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(n.descEl.innerHTML=`
|
||
|
By default (deactivated), each line only shows the newest commit where it was changed.
|
||
|
<br/>
|
||
|
With <i>same commit</i>, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown.
|
||
|
<br/>
|
||
|
With <i>all commits</i>, cut-copy-paste-ing text inbetween multiple commits will be detected.
|
||
|
<br/>
|
||
|
It uses <a href="https://git-scm.com/docs/git-blame">git-blame</a> and
|
||
|
for matches (at least ${Vu} characters) within the same (or all) commit(s), <em>the originating</em> commit's information is shown.`,new B.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new B.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new B.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new B.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new B.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=`
|
||
|
The time-zone in which the authoring date should be shown.
|
||
|
Either your local time-zone (default),
|
||
|
the author's time-zone during commit creation or
|
||
|
<a href="https://en.wikipedia.org/wiki/UTC%C2%B100:00">UTC\xB100:00</a>.
|
||
|
`;let i=new B.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(async s=>{let[o,c]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,c&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new B.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(async s=>{await this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=`
|
||
|
The CSS color of the gutter text.<br/>
|
||
|
|
||
|
It is higly recommended to use
|
||
|
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">
|
||
|
CSS variables</a>
|
||
|
defined by themes
|
||
|
(e.g. <pre style="display:inline">var(--text-muted)</pre> or
|
||
|
<pre style="display:inline">var(--text-on-accent)</pre>,
|
||
|
because they automatically adapt to theme changes.<br/>
|
||
|
|
||
|
See: <a href="https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css">
|
||
|
List of available CSS variables in Obsidian
|
||
|
<a/>
|
||
|
`,new B.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=`
|
||
|
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.
|
||
|
<br>
|
||
|
If you don't care about purely-whitespace changes
|
||
|
(e.g. list nesting / quote indentation changes),
|
||
|
then activating this will provide more meaningful change detection.
|
||
|
`}}createColorSetting(r){let n=new B.Setting(this.containerEl).setName("").addText(i=>{let a=i0(r,this.settings.lineAuthor),s=i0(r,Sn.lineAuthor);i.setPlaceholder(zg(s)),i.setValue(zg(a)),i.onChange(async o=>{let c=lT(o);if(c!==void 0){let l=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(l,c)}this.refreshColorSettingsDesc(r,c)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,i0(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let n=this.lineAuthorColorSettings.get(r);if(n){let i=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(r,n){let i=this.lineAuthorColorSettings.get(r);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(r,this.settings.lineAuthor,n!==void 0))}colorSettingPreviewDescHtml(r,n,i){let a=i?a0(r,n):"rgba(127,127,127,0.3)",s=B.moment.unix(B.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and
|
||
|
named colors (e.g. 'black', 'purple'). Color preview: ${`<div
|
||
|
class="line-author-settings-preview"
|
||
|
style="background-color: ${a}; width: 30ch;"
|
||
|
>${o}</div>`}`}previewCustomDateTimeDescriptionHtml(r){let n=(0,B.moment)().format(r);return`<a href="${Kj}">Format string</a> to display the authoring date.</br>Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=Wf(r);return[`The oldest age in the line author coloring. Everything older will have the same color.
|
||
|
</br>Smallest valid age is "1d". Currently: ${n!==void 0?`${n.asDays()} days`:"invalid!"}`,n]}};function i0(e,t){return e==="oldest"?t.colorOld:t.colorNew}function Wf(e){let t=B.moment.duration("P"+e.toUpperCase());return t.isValid()&&t.asDays()&&t.asDays()>=1?t:void 0}function CT(e,t,r){if(!(e===void 0||t===void 0||r===void 0))return`head${e}-obj${t}-path${r}`}var PT=qf.Annotation.define();function RT(e,t,r){return r.update({annotations:PT.of({key:e,la:t,lineOffsetsFromUnsavedChanges:new Map})})}function Qj(e){return e.annotation(PT)}var Ys=qf.StateField.define({create:e=>{},update:(e,t)=>{var r;return(r=Qj(t))!=null?r:eB(t,e)},compare:(e,t)=>(e==null?void 0:e.key)===(t==null?void 0:t.key)});function Yf(e){var a;let t=TT.sha256.create();if(!e)return t;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=e;t.update(r==="untracked"?"t":"f"),t.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])t.update([s,o]);return t}var Lr={get:void 0,save:void 0};function MT(e,t){Lr.get=e,Lr.save=t}function Xf(e){var t,r;return(r=(t=Wf(e.coloringMaxAge))==null?void 0:t.asDays())!=null?r:Wf(Sn.lineAuthor.coloringMaxAge).asDays()}function eB(e,t){if(t)return e.changes.empty||e.changes.iterChanges((r,n,i,a)=>{var p;let s=e.startState.doc,{newDoc:o}=e,c=s.lineAt(r).number,l=s.lineAt(n).number,u=o.lineAt(i).number,f=o.lineAt(a).number,d=l-c+1,h=f-u+1;for(let m=u;m<=f;m++){let v=(p=t.lineOffsetsFromUnsavedChanges.get(m))!=null?p:0,y=f===m,b=h-d;y&&(v+=b),t.lineOffsetsFromUnsavedChanges.set(m,v)}}),t}var s0=class{constructor(t){this.state=t;this.subscribeMe()}notifyLineAuthoring(t,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${t}`);return}let n=this.view.state,i=RT(t,r,n);this.view.dispatch(i)}updateToNewState(t){let r=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=t,r&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(qs.ifFilepathDefinedTransformSubscribers(this.filepath,t=>t.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(t){qs.ifFilepathDefinedTransformSubscribers(t,r=>r.delete(this))}get filepath(){var t,r;return(r=(t=this.state.field(Zf.editorInfoField))==null?void 0:t.file)==null?void 0:r.path}get view(){return this.state.field(Zf.editorEditorField)}},IT=OT.StateField.define({create:e=>new s0(e),update:(e,t)=>e.updateToNewState(t.state),compare:(e,t)=>e===t});g();function FT(){Xs=void 0,o0=[],Kf=0,Qf.clear(),ed.clear(),Zs.clear()}var Xs,Jf=()=>Xs;function $T(e,t){var i;let r=t.length;if(r<((i=Xs==null?void 0:Xs.length)!=null?i:0))return;Xs={gutter:e,length:r,text:t};let n=Lr.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,Lr.save(n))}var o0=[],tB=15,Kf=0;function LT(e){o0[Kf]=e,Kf=(Kf+1)%tB}function DT(){return uT(o0)}var Qf=new Map,ed=new Map,Zs=new Set;g();var ZT=require("@codemirror/state"),KT=require("@codemirror/view");g();var f0=require("@codemirror/view"),WT=Ze(Xg()),nd=require("obsidian");g();g();var td={x:-10,y:-10};function NT(){td.x===-10&&window.addEventListener("mousedown",e=>{td.x=e.clientX,td.y=e.clientY})}function jT(){for(let e of Zs)if(rB(e,td))return e}function rB(e,t){let{x:r,y:n,width:i,height:a}=e.getBoundingClientRect();return r<=t.x&&t.x<=r+i&&n<=t.y&&t.y<=n+a}g();var Xl={};var BT="data-commit";function HT(e,t,r){if(t.hasFocus())return;let n=jT();if(!n)return;let i=iB(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&nB(i,e),l0("showCommitHash",e),l0("authorDisplay",e),l0("dateTimeFormatOptions",e))}function nB(e,t){t.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(e.hash)))}function l0(e,t){var c,l;let r,n,i=Xl.plugin.settings.lineAuthor,a=i[e],s=typeof a=="boolean"?a:a!=="hide",o=Sn.lineAuthor[e];if(e==="showCommitHash")r="Show commit hash",n=a;else if(e==="authorDisplay"){let u=(c=i.lastShownAuthorDisplay)!=null?c:o;r="Show author "+(s?a:u),n=s?"hide":u}else if(e==="dat
|
||
|
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Dr.setIcon)(this.iconEl,"globe"):(0,Dr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};g();var cd=require("obsidian"),ld=class extends cd.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let n=(0,cd.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${n}: ${r}`,`${r}: ${n}`]}renderSuggestion(r,n){n.innerText=r}onChooseSuggestion(r,n){this.resolve&&this.resolve(r)}};g();var tC=require("obsidian"),Zl=class{constructor(t){this.plugin=t}saveLastAuto(t,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(t.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(t.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(t.toString())}loadLastAuto(){var t,r,n;return{backup:new Date((t=this.plugin.localStorage.getLastAutoBackup())!=null?t:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let t=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=new Date,n=this.plugin.settings.autoPushInterval-Math.round((r.getTime()-t.push.getTime())/1e3/60);this.startAutoPush(n<=0?0:n)}if(this.plugin.settings.autoPullInterval>0){let r=new Date,n=this.plugin.settings.autoPullInterval-Math.round((r.getTime()-t.pull.getTime())/1e3/60);this.startAutoPull(n<=0?0:n)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...t){t.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),t.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),t.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 t=await this.plugin.gitManager.getLastCommitTime();t&&this.plugin.localStorage.setLastAutoBackup(t.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let t=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=new Date,n=this.plugin.settings.autoSaveInterval-Math.round((r.getTime()-t.backup.getTime())/1e3/60);this.startAutoCommitAndSync(n<=0?0:n)}}}startAutoCommitAndSync(t){let r=(t!=null?t:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?t===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,tC.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync()}startAutoPull(t){let r=(t!=null?t:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.
|
||
|
`).split(`
|
||
|
`);function Q(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function de(){n!==null&&(!n.oldName&&c!==null&&(n.oldName=c),!n.newName&&l!==null&&(n.newName=l),n.newName&&(r.push(n),n=null)),c=null,l=null}function ee(){Q(),de(),n={blocks:[],deletedLines:0,addedLines:0}}function J(F){Q();let z;n!==null&&((z=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(F))?(n.isCombined=!1,a=parseInt(z[1],10),o=parseInt(z[2],10)):(z=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(F))?(n.isCombined=!0,a=parseInt(z[1],10),s=parseInt(z[2],10),o=parseInt(z[3],10)):(F.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,n.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:F}}function Ce(F){if(n===null||i===null||a===null||o===null)return;let z={content:F},N=n.isCombined?["+ "," +","++"]:["+"],Re=n.isCombined?["- "," -","--"]:["-"];pC(F,N)?(n.addedLines++,z.type=He.INSERT,z.oldNumber=void 0,z.newNumber=o++):pC(F,Re)?(n.deletedLines++,z.type=He.DELETE,z.oldNumber=a++,z.newNumber=void 0):(z.type=He.CONTEXT,z.oldNumber=a++,z.newNumber=o++),i.lines.push(z)}function me(F,z){let N=z;for(;N<D.length-3;){if(F.startsWith("diff"))return!1;if(D[N].startsWith(u)&&D[N+1].startsWith(f)&&D[N+2].startsWith(d))return!0;N++}return!1}return D.forEach((F,z)=>{if(!F||F.startsWith("*"))return;let N,Re=D[z-1],Dt=D[z+1],_t=D[z+2];if(F.startsWith("diff --git")||F.startsWith("diff --combined")){if(ee(),(N=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(F))&&(c=$i(N[1],void 0,t.dstPrefix),l=$i(N[2],void 0,t.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(F.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(ee(),(N=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(F))&&(c=$i(N[1],void 0,t.dstPrefix),l=$i(N[2],void 0,t.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&F.startsWith(u)&&Dt.startsWith(f)&&_t.startsWith(d))&&ee(),n!=null&&n.isTooBig)return;if(n&&(typeof t.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>t.diffMaxChanges||typeof t.diffMaxLineLength=="number"&&F.length>t.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let st=typeof t.diffTooBigMessage=="function"?t.diffTooBigMessage(r.length):"Diff too big to be displayed";J(st);return}if(F.startsWith(u)&&Dt.startsWith(f)||F.startsWith(f)&&Re.startsWith(u)){if(n&&!n.oldName&&F.startsWith("--- ")&&(N=yB(F,t.srcPrefix))){n.oldName=N,n.language=hC(n.oldName,n.language);return}if(n&&!n.newName&&F.startsWith("+++ ")&&(N=wB(F,t.dstPrefix))){n.newName=N,n.language=hC(n.newName,n.language);return}}if(n&&(F.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){J(F);return}if(i&&(F.startsWith("+")||F.startsWith("-")||F.startsWith(" "))){Ce(F);return}let Ee=!me(F,z);if(n===null)throw new Error("Where is my file !!!");(N=h.exec(F))?n.oldMode=N[1]:(N=p.exec(F))?n.newMode=N[1]:(N=m.exec(F))?(n.deletedFileMode=N[1],n.isDeleted=!0):(N=v.exec(F))?(n.newFileMode=N[1],n.isNew=!0):(N=y.exec(F))?(Ee&&(n.oldName=N[1]),n.isCopy=!0):(N=b.exec(F))?(Ee&&(n.newName=N[1]),n.isCopy=!0):(N=x.exec(F))?(Ee&&(n.oldName=N[1]),n.isRename=!0):(N=E.exec(F))?(Ee&&(n.newName=N[1]),n.isRename=!0):(N=A.exec(F))?(n.isBinary=!0,n.oldName=$i(N[1],void 0,t.srcPrefix),n.newName=$i(N[2],void 0,t.dstPrefix),J("Binary file")):S.test(F)?(n.isBinary=!0,J(F)):(N=_.exec(F))?n.unchangedPercentage=parseInt(N[1],10):(N=k.exec(F))?n.changedPercentage=parseInt(N[1],10):(N=w.exec(F))?(n.checksumBefore=N[1],n.checksumAfter=N[2],N[3]&&(n.mode=N[3])):(N=T.exec(F))?(n.checksumBefore=[N[2],N[3]],n.checksumAfter=N[1]):(N=P.exec(F))?(n.oldMode=[N[2],N[3]],n.newMode=N[1]):(N=O.exec(F))?(n.newFileMode=N[1],n.isNew=!0):(N=j.exec(F))&&(n.deletedFileMode=N[1],n.isDeleted=!0)}),Q(),de(),r}g();g();g();function Kn(){}Kn.prototype={diff:function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.callback;typeof n=="function"&&(i=n,n={}),this.options=n;var a=this;function s(m){return i?(setTimeout(function(){i(void 0,m)}
|
||
|
`);return this.hoganUtils.render(SC,"wrapper",{colorScheme:to(this.config.colorScheme),filesNumber:t.length,files:r})}};g();var x0=Object.assign(Object.assign({},Ea),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),ec="generic",EC="line-by-line",$B="icon",LB="tag",tc=class{constructor(t,r={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},x0),r)}render(t){let r=t.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||
|
`);return this.hoganUtils.render(ec,"wrapper",{colorScheme:to(this.config.colorScheme),content:r})}makeFileDiffHtml(t,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";let n=this.hoganUtils.template(EC,"file-diff"),i=this.hoganUtils.template(ec,"file-path"),a=this.hoganUtils.template($B,"file"),s=this.hoganUtils.template(LB,no(t));return n.render({file:t,fileHtmlId:ro(t),diffs:r,filePath:i.render({fileDiffName:Aa(t)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(ec,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Et})}generateFileHtml(t){let r=Qs(Js(n=>Nr(n.content,t.isCombined).content));return t.blocks.map(n=>{let i=this.hoganUtils.render(ec,"block-header",{CSSLineClass:Et,blockHeader:t.isTooBig?n.header:Li(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([c,l])=>{let{left:u,right:f}=this.processChangedLines(t,t.isCombined,c,l);i+=u,i+=f});else if(a.length)a.forEach(c=>{let{prefix:l,content:u}=Nr(c.content,t.isCombined);i+=this.generateSingleLineHtml(t,{type:Et.CONTEXT,prefix:l,content:u,oldNumber:c.oldNumber,newNumber:c.newNumber})});else if(s.length||o.length){let{left:c,right:l}=this.processChangedLines(t,t.isCombined,s,o);i+=c,i+=l}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(`
|
||
|
`)}applyLineGroupping(t){let r=[],n=[],i=[];for(let a=0;a<t.lines.length;a++){let s=t.lines[a];(s.type!==He.INSERT&&i.length||s.type===He.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===He.CONTEXT?r.push([[s],[],[]]):s.type===He.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===He.INSERT&&n.length>0?i.push(s):s.type===He.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(t,r,n){let i=t.length*r.length,a=Math.max.apply(null,[0].concat(t.concat(r).map(o=>o.content.length)));return i<this.config.matchingMaxComparisons&&a<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(t,r):[[t,r]]}processChangedLines(t,r,n,i){let a={right:"",left:""},s=Math.max(n.length,i.length);for(let o=0;o<s;o++){let c=n[o],l=i[o],u=c!==void 0&&l!==void 0?pd(c.content,l.content,r,this.config):void 0,f=c!==void 0&&c.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Et.DELETE_CHANGES}:Object.assign(Object.assign({},Nr(c.content,r)),{type:eo(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,d=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Et.INSERT_CHANGES}:Object.assign(Object.assign({},Nr(l.content,r)),{type:eo(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(t,f,d);a.left+=h,a.right+=p}return a}generateLineHtml(t,r,n){return{left:this.generateSingleLineHtml(t,r),right:this.generateSingleLineHtml(t,n)}}generateSingleLineHtml(t,r){if(r===void 0)return"";let n=this.hoganUtils.render(EC,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(ec,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?" ":r.prefix,content:r.content,lineNumber:n,line:r,file:t})}};g();var S0=Object.assign(Object.assign({},Ea),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),rc="generic",DB="side-by-side",NB="icon",jB="tag",nc=class{constructor(t,r={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},S0),r)}render(t){let r=t.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||
|
`);return this.hoganUtils.render(rc,"wrapper",{colorScheme:to(this.config.colorScheme),content:r})}makeFileDiffHtml(t,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";let n=this.hoganUtils.template(DB,"file-diff"),i=this.hoganUtils.template(rc,"file-path"),a=this.hoganUtils.template(NB,"file"),s=this.hoganUtils.template(jB,no(t));return n.render({file:t,fileHtmlId:ro(t),diffs:r,filePath:i.render({fileDiffName:Aa(t)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(rc,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Et})}}generateFileHtml(t){let r=Qs(Js(n=>Nr(n.content,t.isCombined).content));return t.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,t),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([c,l])=>{let{left:u,right:f}=this.processChangedLines(t.isCombined,c,l);i.left+=u,i.right+=f});else if(a.length)a.forEach(c=>{let{prefix:l,content:u}=Nr(c.content,t.isCombined),{left:f,right:d}=this.generateLineHtml({type:Et.CONTEXT,prefix:l,content:u,number:c.oldNumber},{type:Et.CONTEXT,prefix:l,content:u,number:c.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:c,right:l}=this.processChangedLines(t.isCombined,s,o);i.left+=c,i.right+=l}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(t){let r=[],n=[],i=[];for(let a=0;a<t.lines.length;a++){let s=t.lines[a];(s.type!==He.INSERT&&i.length||s.type===He.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===He.CONTEXT?r.push([[s],[],[]]):s.type===He.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===He.INSERT&&n.length>0?i.push(s):s.type===He.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(t,r,n){let i=t.length*r.length,a=Math.max.apply(null,[0].concat(t.concat(r).map(o=>o.content.length)));return i<this.config.matchingMaxComparisons&&a<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(t,r):[[t,r]]}makeHeaderHtml(t,r){return this.hoganUtils.render(rc,"block-header",{CSSLineClass:Et,blockHeader:r!=null&&r.isTooBig?t:Li(t),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(t,r,n){let i={right:"",left:""},a=Math.max(r.length,n.length);for(let s=0;s<a;s++){let o=r[s],c=n[s],l=o!==void 0&&c!==void 0?pd(o.content,c.content,t,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},l!==void 0?{prefix:l.oldLine.prefix,content:l.oldLine.content,type:Et.DELETE_CHANGES}:Object.assign(Object.assign({},Nr(o.content,t)),{type:eo(o.type)})),{number:o.oldNumber}):void 0,f=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},l!==void 0?{prefix:l.newLine.prefix,content:l.newLine.content,type:Et.INSERT_CHANGES}:Object.assign(Object.assign({},Nr(c.content,t)),{type:eo(c.type)})),{number:c.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);i.left+=d,i.right+=h}return i}generateLineHtml(t,r){return{left:this.generateSingleHtml(t),right:this.generateSingleHtml(r)}}generateSingleHtml(t){let r="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(rc,"line",{type:(t==null?void 0:t.type)||`${Et.CONTEXT} d2h-emptyplaceholder`,lineClass:t!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:t!==void 0?n:`${n} d2h-code-side-emptyplaceholder`,prefix:(t==null?void 0:t.prefix)===" "?" ":t==null?void 0:t.prefix,content:t==null?void 0:t.content,lineNumber:t==null?void 0:t.number})}};g();var T0=Ze(k0());g();var lt=Ze(k0()),nt={};nt["file-summary-line"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<li class="d2h-file-list-line">'),n.b(`
|
||
|
`+r),n.b(' <span class="d2h-file-name-wrapper">'),n.b(`
|
||
|
`+r),n.b(n.rp("<fileIcon0",e,t," ")),n.b(' <a href="#'),n.b(n.v(n.f("fileHtmlId",e,t,0))),n.b('" class="d2h-file-name">'),n.b(n.v(n.f("fileName",e,t,0))),n.b("</a>"),n.b(`
|
||
|
`+r),n.b(' <span class="d2h-file-stats">'),n.b(`
|
||
|
`+r),n.b(' <span class="d2h-lines-added">'),n.b(n.v(n.f("addedLines",e,t,0))),n.b("</span>"),n.b(`
|
||
|
`+r),n.b(' <span class="d2h-lines-deleted">'),n.b(n.v(n.f("deletedLines",e,t,0))),n.b("</span>"),n.b(`
|
||
|
`+r),n.b(" </span>"),n.b(`
|
||
|
`+r),n.b(" </span>"),n.b(`
|
||
|
`+r),n.b("</li>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});nt["file-summary-wrapper"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-list-header">'),n.b(`
|
||
|
`+r),n.b(' <span class="d2h-file-list-title">Files changed ('),n.b(n.v(n.f("filesNumber",e,t,0))),n.b(")</span>"),n.b(`
|
||
|
`+r),n.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),n.b(`
|
||
|
`+r),n.b(' <a class="d2h-file-switch d2h-show">show</a>'),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(' <ol class="d2h-file-list">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("files",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </ol>"),n.b(`
|
||
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});nt["generic-block-header"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||
|
`+r),n.b(' <td class="'),n.b(n.v(n.f("lineClass",e,t,0))),n.b(" "),n.b(n.v(n.d("CSSLineClass.INFO",e,t,0))),n.b('"></td>'),n.b(`
|
||
|
`+r),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="'),n.b(n.v(n.f("contentClass",e,t,0))),n.b('">'),n.s(n.f("blockHeader",e,t,1),e,t,0,156,173,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),e.pop()),n.s(n.f("blockHeader",e,t,1),e,t,1,0,0,"")||n.b(" "),n.b("</div>"),n.b(`
|
||
|
`+r),n.b(" </td>"),n.b(`
|
||
|
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});nt["generic-empty-diff"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||
|
`+r),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="'),n.b(n.v(n.f("contentClass",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(" File without changes"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </td>"),n.b(`
|
||
|
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});nt["generic-file-path"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-file-name-wrapper">'),n.b(`
|
||
|
`+r),n.b(n.rp("<fileIcon0",e,t," ")),n.b(' <span class="d2h-file-name">'),n.b(n.v(n.f("fileDiffName",e,t,0))),n.b("</span>"),n.b(`
|
||
|
`+r),n.b(n.rp("<fileTag1",e,t," ")),n.b("</span>"),n.b(`
|
||
|
`+r),n.b('<label class="d2h-file-collapse">'),n.b(`
|
||
|
`+r),n.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),n.b(`
|
||
|
`+r),n.b(" Viewed"),n.b(`
|
||
|
`+r),n.b("</label>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});nt["generic-line"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||
|
`+r),n.b(' <td class="'),n.b(n.v(n.f("lineClass",e,t,0))),n.b(" "),n.b(n.v(n.f("type",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("lineNumber",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </td>"),n.b(`
|
||
|
`+r),n.b(' <td class="'),n.b(n.v(n.f("type",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="'),n.b(n.v(n.f("contentClass",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.s(n.f("prefix",e,t,1),e,t,0,162,238,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(' <span class="d2h-code-line-prefix">'),s.b(s.t(s.f("prefix",i,a,0))),s.b("</span>"),s.b(`
|
||
|
`+r)}),e.pop()),n.s(n.f("prefix",e,t,1),e,t,1,0,0,"")||(n.b(' <span class="d2h-code-line-prefix"> </span>'),n.b(`
|
||
|
`+r)),n.s(n.f("content",e,t,1),e,t,0,371,445,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(' <span class="d2h-code-line-ctn">'),s.b(s.t(s.f("content",i,a,0))),s.b("</span>"),s.b(`
|
||
|
`+r)}),e.pop()),n.s(n.f("content",e,t,1),e,t,1,0,0,"")||(n.b(' <span class="d2h-code-line-ctn"><br></span>'),n.b(`
|
||
|
`+r)),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </td>"),n.b(`
|
||
|
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});nt["generic-wrapper"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("content",e,t,0))),n.b(`
|
||
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});nt["icon-file-added"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),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(`
|
||
|
`+r),n.b(' width="14">'),n.b(`
|
||
|
`+r),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(`
|
||
|
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});nt["icon-file-changed"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),n.b(`
|
||
|
`+r),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
|
||
|
`+r),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(`
|
||
|
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});nt["icon-file-deleted"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),n.b(`
|
||
|
`+r),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
|
||
|
`+r),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(`
|
||
|
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});nt["icon-file-renamed"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),n.b(`
|
||
|
`+r),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
|
||
|
`+r),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(`
|
||
|
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});nt["icon-file"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),n.b(`
|
||
|
`+r),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(`
|
||
|
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});nt["line-by-line-file-diff"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",e,t,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-header">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("filePath",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-diff">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
||
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
||
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("diffs",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </tbody>"),n.b(`
|
||
|
`+r),n.b(" </table>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});nt["line-by-line-numbers"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",e,t,0))),n.b("</div>"),n.b(`
|
||
|
`+r),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",e,t,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});nt["side-by-side-file-diff"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",e,t,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",e,t,0))),n.b('">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-header">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.f("filePath",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-files-diff">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-side-diff">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
||
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
||
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.d("diffs.left",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </tbody>"),n.b(`
|
||
|
`+r),n.b(" </table>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-file-side-diff">'),n.b(`
|
||
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
||
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
||
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
||
|
`+r),n.b(" "),n.b(n.t(n.d("diffs.right",e,t,0))),n.b(`
|
||
|
`+r),n.b(" </tbody>"),n.b(`
|
||
|
`+r),n.b(" </table>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b(" </div>"),n.b(`
|
||
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});nt["tag-file-added"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),n.fl()},partials:{},subs:{}});nt["tag-file-changed"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),n.fl()},partials:{},subs:{}});nt["tag-file-deleted"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),n.fl()},partials:{},subs:{}});nt["tag-file-renamed"]=new lt.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),n.fl()},partials:{},subs:{}});var ic=class{constructor({compiledTemplates:t={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=T0.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},nt),t),n)}static compile(t){return T0.compile(t,{asString:!1})}render(t,r,n,i,a){let s=this.templateKey(t,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(t,r){return this.preCompiledTemplates[this.templateKey(t,r)]}templateKey(t,r){return`${t}-${r}`}};var HB=Object.assign(Object.assign(Object.assign({},x0),S0),{outputFormat:lC.LINE_BY_LINE,drawFileList:!0});function CC(e,t={}){let r=Object.assign(Object.assign({},HB),t),n=typeof e=="string"?gC(e,r):e,i=new ic(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new md(i,s).render(n):"",c=r.outputFormat==="side-by-side"?new nc(i,r).render(n):new tc(i,r).render(n);return o+c}var vd=require("obsidian");var ka=class extends vd.ItemView{constructor(r,n){super(r);this.plugin=n;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return ki.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return ki.name}getIcon(){return ki.icon}async setState(r,n){this.state=r,vd.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let 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 Te&&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 a=await this.app.vault.adapter.read(i);n=[...`--- /dev/null
|
||
|
+++ ${this.state.bFile}
|
||
|
@@ -0,0 +1,${a.split(`
|
||
|
`).length} @@`.split(`
|
||
|
`),...a.split(`
|
||
|
`).map(o=>`+${o}`)].join(`
|
||
|
`)}}if(n){let a=this.parser.parseFromString(CC(n),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};g();var V3=require("obsidian");g();g();g();var PC="5";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(PC);g();g();var io="[",Ta="[!",Ca="]",Di={};var ct=Symbol(),qt=Symbol("filename"),RC=Symbol("hmr");g();g();var UB=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory"];var aZ=[...UB,"formNoValidate","isMap","noModule","playsInline","readOnly","value","inert","volume","defaultValue","defaultChecked","srcObject"];var GB=["touchstart","touchmove"];function MC(e){return GB.includes(e)}g();g();g();var yd=!0;g();var V=!1;g();var an=Array.isArray,ac=Array.from,C0=Object.keys,Mt=Object.defineProperty,jr=Object.getOwnPropertyDescriptor,P0=Object.getOwnPropertyDescriptors,R0=Object.prototype,OC=Array.prototype,Pa=Object.getPrototypeOf;function M0(e){return typeof e=="function"}var br=()=>{};function wd(e){for(var t=0;t<e.length;t++)e[t]()}g();g();var _r=Symbol("$state"),Ra=Symbol("$state metadata"),bd=Symbol("legacy props"),IC=Symbol("");g();g();function _d(e){return e===this.v}function O0(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ao(e){return!O0(e,this.v)}g();function I0(){if(V){let e=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 e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function FC(){if(V){let e=new Error(`derived_references_self
|
||
|
A derived value cannot reference itself recursively
|
||
|
https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/derived_references_self")}function $C(e){if(V){let t=new Error(`effect_in_teardown
|
||
|
\`${e}\` cannot be used inside an effect cleanup function
|
||
|
https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function LC(){if(V){let e=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 e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function DC(e){if(V){let t=new Error(`effect_orphan
|
||
|
\`${e}\` can only be used inside an effect (e.g. during component initialisation)
|
||
|
https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_orphan")}function NC(){if(V){let e=new Error(`effect_update_depth_exceeded
|
||
|
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
|
||
|
https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function jC(){if(V){let e=new Error(`hydration_failed
|
||
|
Failed to hydrate the application
|
||
|
https://svelte.dev/e/hydration_failed`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/hydration_failed")}function BC(e){if(V){let t=new Error(`props_invalid_value
|
||
|
Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value
|
||
|
https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_invalid_value")}function HC(e){if(V){let t=new Error(`rune_outside_svelte
|
||
|
The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
|
||
|
https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function UC(){if(V){let e=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 e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function GC(){if(V){let e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function zC(){if(V){let e=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function VC(){if(V){let e=new Error("state_unsafe_mutation\nUpdating state inside a derived 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 e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}g();var Jn=!1,Qn=!1;g();g();g();var sc=null;function ei(e){let t=Error(),r=t.stack;if(r){let n=r.split(`
|
||
|
`),i=[`
|
||
|
`];for(let a=0;a<n.length;a++){let s=n[a];if(s!=="Error"){if(s.includes("validate_each_keys"))return null;s.includes("svelte/src/internal")||i.push(s)}}if(i.length===1)return null;Mt(t,"stack",{value:i.join(`
|
||
|
`)}),Mt(t,"name",{value:`${e}Error`})}return t}var Ma=new Set;function L0(e){Ma=e}function ut(e,t){var r={f:0,v:e,reactions:null,equals:_d,version:0};return V&&Qn&&(r.created=t!=null?t:ei("CreatedAt"),r.debug=null),r}function ft(e){return VB(ut(e))}function Ni(e,t=!1){var n,i;let r=ut(e);return t||(r.equals=ao),Jn&&he!==null&&he.l!==null&&((i=(n=he.l).s)!=null?i:n.s=[]).push(r),r}function VB(e){return fe!==null&&fe.f&2&&(sn===null?YC([e]):sn.push(e)),e}function re(e,t){return fe!==null&&ji()&&fe.f&18&&(sn===null||!sn.includes(e))&&VC(),oo(e,t)}function oo(e,t){if(!e.equals(t)&&(e.v=t,e.version=xd(),V&&Qn&&(e.updated=ei("UpdatedAt")),qC(e,2048),ji()&&te!==null&&te.f&1024&&!(te.f&32)&&(At!==null&&At.includes(e)?(Xt(te,2048),lo(te)):ti===null?XC([e]):ti.push(e)),V&&Ma.size>0)){let n=Array.from(Ma);var r=ri;so(!0);try{for(let i of n)i.f&1024&&Xt(i,4096),Bi(i)&&Ia(i)}finally{so(r)}Ma.clear()}return t}function qC(e,t){var r=e.reactions;if(r!==null)for(var n=ji(),i=r.length,a=0;a<i;a++){var s=r[a],o=s.f;if(!(o&2048)&&!(!n&&s===te)){if(V&&o&262144){Ma.add(s);continue}Xt(s,t),o&1280&&(o&2?qC(s,4096):lo(s))}}}g();g();g();var lc="font-weight: bold",cc="font-weight: normal";function ZC(e,t,r){V?console.warn(`%c[svelte] hydration_attribute_changed
|
||
|
%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
|
||
|
https://svelte.dev/e/hydration_attribute_changed`,lc,cc):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function co(e){V?console.warn(`%c[svelte] hydration_mismatch
|
||
|
%c${e?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${e}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
|
||
|
https://svelte.dev/e/hydration_mismatch`,lc,cc):console.warn("https://svelte.dev/e/hydration_mismatch")}function KC(){V?console.warn(`%c[svelte] lifecycle_double_unmount
|
||
|
%cTried to unmount a component that was not mounted
|
||
|
https://svelte.dev/e/lifecycle_double_unmount`,lc,cc):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function D0(e,t){V?console.warn(`%c[svelte] ownership_invalid_mutation
|
||
|
%c${e?`${e} mutated a value owned by ${t}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead`:"Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}
|
||
|
https://svelte.dev/e/ownership_invalid_mutation`,lc,cc):console.warn("https://svelte.dev/e/ownership_invalid_mutation")}function Sd(e){V?console.warn(`%c[svelte] state_proxy_equality_mismatch
|
||
|
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results
|
||
|
https://svelte.dev/e/state_proxy_equality_mismatch`,lc,cc):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var ae=!1;function sr(e){ae=e}var ue;function Qe(e){if(e===null)throw co(),Di;return ue=e}function Ot(){return Qe(It(ue))}function H(e){if(ae){if(It(ue)!==null)throw co(),Di;ue=e}}function uo(e=1){if(ae){for(var t=e,r=ue;t--;)r=It(r);ue=r}}function fo(){for(var e=0,t=ue;;){if(t.nodeType===8){var r=t.data;if(r===Ca){if(e===0)return t;e-=1}else(r===io||r===Ta)&&(e+=1)}var n=It(t);t.remove(),t=n}}g();g();g();var WB={},qB=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,YB=/@(.+):(\d+):(\d+)$/;function XB(){var r;let e=new Error().stack;if(!e)return null;let t=[];for(let n of e.split(`
|
||
|
`)){let i=(r=qB.exec(n))!=null?r:YB.exec(n);i&&t.push({file:i[1],line:+i[2],column:+i[3]})}return t}function JC(){var t;let e=(t=XB())==null?void 0:t.slice(4);if(!e)return null;for(let r=0;r<e.length;r++){let n=e[r],i=WB[n.file];if(!i){if(r===0)return null;continue}for(let a of i){if(a.end==null)return null;if(a.start.line<n.line&&a.end.line>n.line)return a.component}}return null}var ZB=Symbol("ADD_OWNER");function N0(e,t){if(t.owners!==null)for(;e;){if(e.owners===null){t.owners=null;break}for(let r of e.owners)t.owners.add(r);e=e.parent}}function QC(e,t){return e.owners===null?!0:e.owners.has(t)||e.parent!==null&&QC(e.parent,t)}function e3(e){var t,r;return(r=(t=e==null?void 0:e.owners)==null?void 0:t.values().next().value)!=null?r:e3(e.parent)}var KB=!1;function t3(e){if(KB)return;let t=JC();if(t&&!QC(e,t)){let r=e3(e);r[qt]!==t[qt]?D0(t[qt],r[qt]):D0()}}function be(e,t=null,r){var l,u;var n=null;if(V&&Qn&&(n=ei("CreatedAt")),typeof e!="object"||e===null||_r in e)return e;let i=Pa(e);if(i!==R0&&i!==OC)return e;var a=new Map,s=an(e),o=ut(0);s&&a.set("length",ut(e.length,n));var c;if(V)if(c={parent:t,owners:null},r){let f=(u=(l=r.v)==null?void 0:l[Ra])==null?void 0:u.owners;c.owners=f?new Set(f):null}else c.owners=t===null?he!==null?new Set([he.function]):null:new Set;return new Proxy(e,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&UC();var p=a.get(d);return p===void 0?(p=ut(h.value,n),a.set(d,p)):re(p,be(h.value,c)),!0},deleteProperty(f,d){var h=a.get(d);if(h===void 0)d in f&&a.set(d,ut(ct,n));else{if(s&&typeof d=="string"){var p=a.get("length"),m=Number(d);Number.isInteger(m)&&m<p.v&&re(p,m)}re(h,ct),r3(o)}return!0},get(f,d,h){var b;if(V&&d===Ra)return c;if(d===_r)return e;var p=a.get(d),m=d in f;if(p===void 0&&(!m||(b=jr(f,d))!=null&&b.writable)&&(p=ut(be(m?f[d]:ct,c),n),a.set(d,p)),p!==void 0){var v=R(p);if(V){var y=v==null?void 0:v[Ra];y&&(y==null?void 0:y.parent)!==c&&N0(c,y)}return v===ct?void 0:v}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var p=a.get(d);p&&(h.value=R(p))}else if(h===void 0){var m=a.get(d),v=m==null?void 0:m.v;if(m!==void 0&&v!==ct)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return h},has(f,d){var v;if(V&&d===Ra||d===_r)return!0;var h=a.get(d),p=h!==void 0&&h.v!==ct||Reflect.has(f,d);if(h!==void 0||te!==null&&(!p||(v=jr(f,d))!=null&&v.writable)){h===void 0&&(h=ut(p?be(f[d],c):ct,n),a.set(d,h));var m=R(h);if(m===ct)return!1}return p},set(f,d,h,p){var w;var m=a.get(d),v=d in f;if(s&&d==="length")for(var y=h;y<m.v;y+=1){var b=a.get(y+"");b!==void 0?re(b,ct):y in f&&(b=ut(ct,n),a.set(y+"",b))}if(m===void 0?(!v||(w=jr(f,d))!=null&&w.writable)&&(m=ut(void 0,n),re(m,be(h,c)),a.set(d,m)):(v=m.v!==ct,re(m,be(h,c))),V){var x=h==null?void 0:h[Ra];x&&(x==null?void 0:x.parent)!==c&&N0(c,x),t3(c)}var E=Reflect.getOwnPropertyDescriptor(f,d);if(E!=null&&E.set&&E.set.call(p,h),!v){if(s&&typeof d=="string"){var _=a.get("length"),k=Number(d);Number.isInteger(k)&&k>=_.v&&re(_,k+1)}r3(o)}return!0},ownKeys(f){R(o);var d=Reflect.ownKeys(f).filter(m=>{var v=a.get(m);return v===void 0||v.v!==ct});for(var[h,p]of a)p.v!==ct&&!(h in f)&&d.push(h);return d},setPrototypeOf(){GC()}})}function r3(e,t=1){re(e,e.v+t)}function Ad(e){return e!==null&&typeof e=="object"&&_r in e?e[_r]:e}function n3(){let e=Array.prototype,t=Array.__svelte_cleanup;t&&t();let{indexOf:r,lastIndexOf:n,includes:i}=e;e.indexOf=function(a,s){let o=r.call(this,a,s);if(o===-1){for(let c=s!=null?s:0;c<this.length;c+=1)if(Ad(this[c])===a){Sd("array.indexOf(...)");break}}return o},e.lastIndexOf=function(a,s){let o=n.call(this,a,s!=null?s:this.length-1);if(o===-1){for(let c=0;c<=(s!=null?s:this.length-1);c+=1)if(Ad(this[c])===a){Sd("array.lastIndexOf(...)");break}}return o},e.includes=function(a,s){let o=i.call(this,a,s);if(!o){for(let c=0;c<this.length;c+=1)if(Ad(this[c])===a){Sd("array.includes(...)");break}}return o},Array.__svelte_cleanup=()=>{e.indexOf=r,e.lastIndexOf=n,e.includes=i}}var j0,i3,a3,s3;function kd(){if(
|
||
|
\`${e}(...)\` can only be used during component initialisation
|
||
|
https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var _3=0,n7=1,g3=new WeakSet,Md=!1,Od=_3,dc=!1,mo=null,ri=!1,Pd=!1;function so(e){ri=e}function W0(e){Pd=e}var La=[],go=0,hc=[],fe=null;function Tt(e){fe=e}var te=null;function it(e){te=e}var sn=null;function YC(e){sn=e}var At=null,Sr=0,ti=null;function XC(e){ti=e}var x3=1,ni=!1,oc=null;var he=null;var Gr=null;function xd(){return++x3}function ji(){return!Jn||he!==null&&he.l===null}function Bi(e){var s,o,c,l;var t=e.f;if(t&2048)return!0;if(t&4096){var r=e.deps,n=(t&256)!==0;if(r!==null){var i;if(t&512){for(i=0;i<r.length;i++)((o=(s=r[i]).reactions)!=null?o:s.reactions=[]).push(e);e.f^=512}for(i=0;i<r.length;i++){var a=r[i];if(Bi(a)&&V0(a),n&&te!==null&&!ni&&!((c=a==null?void 0:a.reactions)!=null&&c.includes(e))&&((l=a.reactions)!=null?l:a.reactions=[]).push(e),a.version>e.version)return!0}}(!n||te!==null&&!ni)&&Xt(e,1024)}return!1}function v3(e,t){for(var r=t;r!==null;){if(r.f&128)try{r.fn(e);return}catch(n){r.f^=128}r=r.parent}throw Md=!1,e}function y3(e){return(e.f&16384)===0&&(e.parent===null||(e.parent.f&128)===0)}function vo(e,t,r,n){var u,f;if(Md){if(r===null&&(Md=!1),y3(t))throw e;return}if(r!==null&&(Md=!0),!V||n===null||!(e instanceof Error)||g3.has(e)){v3(e,t);return}g3.add(e);let i=[],a=(u=t.fn)==null?void 0:u.name;a&&i.push(a);let s=n;for(;s!==null;){if(V){var o=(f=s.function)==null?void 0:f[qt];if(o){let d=o.split("/").pop();i.push(d)}}s=s.p}let c=/Firefox/.test(navigator.userAgent)?" ":" ";Mt(e,"message",{value:e.message+`
|
||
|
${i.map(d=>`
|
||
|
${c}in ${d}`).join("")}
|
||
|
`}),Mt(e,"component_stack",{value:i});let l=e.stack;if(l){let d=l.split(`
|
||
|
`),h=[];for(let p=0;p<d.length;p++){let m=d[p];m.includes("svelte/src/internal")||h.push(m)}Mt(e,"stack",{value:h.join(`
|
||
|
`)})}if(v3(e,t),y3(t))throw e}function Td(e){var d,h;var t=At,r=Sr,n=ti,i=fe,a=ni,s=sn,o=he,c=e.f;At=null,Sr=0,ti=null,fe=c&96?null:e,ni=!ri&&(c&256)!==0,sn=null,he=e.ctx;try{var l=(0,e.fn)(),u=e.deps;if(At!==null){var f;if(Fa(e,Sr),u!==null&&Sr>0)for(u.length=Sr+At.length,f=0;f<At.length;f++)u[Sr+f]=At[f];else e.deps=u=At;if(!ni)for(f=Sr;f<u.length;f++)((h=(d=u[f]).reactions)!=null?h:d.reactions=[]).push(e)}else u!==null&&Sr<u.length&&(Fa(e,Sr),u.length=Sr);return l}finally{At=t,Sr=r,ti=n,fe=i,ni=a,sn=s,he=o}}function i7(e,t){let r=t.reactions;if(r!==null){var n=r.indexOf(e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&t.f&2&&(At===null||!At.includes(t))&&(Xt(t,4096),t.f&768||(t.f^=512),Fa(t,0))}function Fa(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)i7(e,r[n])}function Ia(e){var t=e.f;if(!(t&16384)){Xt(e,1024);var r=te,n=he;if(te=e,V){var i=Gr;Gr=e.component_function}try{t&16?u3(e):J0(e),K0(e),Z0(e);var a=Td(e);e.teardown=typeof a=="function"?a:null,e.version=x3,V&&hc.push(e)}catch(s){vo(s,e,r,n||e.ctx)}finally{te=r,V&&(Gr=i)}}}function w3(){console.error("Last ten effects were: ",hc.slice(-10).map(e=>e.fn)),hc=[]}function S3(){if(go>1e3){go=0;try{NC()}catch(e){if(V&&Mt(e,"stack",{value:""}),mo!==null)if(V)try{vo(e,mo,null,null)}catch(t){throw w3(),t}else vo(e,mo,null,null);else throw V&&w3(),e}}go++}function E3(e){var t=e.length;if(t!==0){S3();var r=ri;ri=!0;try{for(var n=0;n<t;n++){var i=e[n];i.f&1024||(i.f^=1024);var a=[];A3(i,a),a7(a)}}finally{ri=r}}}function a7(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];if(!(n.f&24576))try{Bi(n)&&(Ia(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Q0(n):n.fn=null))}catch(i){vo(i,n,null,n.ctx)}}}function s7(){if(dc=!1,go>1001)return;let e=La;La=[],E3(e),dc||(go=0,mo=null,V&&(hc=[]))}function lo(e){Od===_3&&(dc||(dc=!0,queueMicrotask(s7))),mo=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024))return;t.f^=1024}}La.push(t)}function A3(e,t){var r=e.first,n=[];e:for(;r!==null;){var i=r.f,a=(i&32)!==0,s=a&&(i&1024)!==0,o=r.next;if(!s&&!(i&8192))if(i&8){if(a)r.f^=1024;else try{Bi(r)&&Ia(r)}catch(f){vo(f,r,null,r.ctx)}var c=r.first;if(c!==null){r=c;continue}}else i&4&&n.push(r);if(o===null){let f=r.parent;for(;f!==null;){if(e===f)break e;var l=f.next;if(l!==null){r=l;continue e}f=f.parent}}r=o}for(var u=0;u<n.length;u++)c=n[u],t.push(c),A3(c,t)}function yo(e){var t=Od,r=La;try{S3();let i=[];Od=n7,La=i,dc=!1,E3(r);var n=e==null?void 0:e();return m3(),(La.length>0||i.length>0)&&yo(),go=0,mo=null,V&&(hc=[]),n}finally{Od=t,La=r}}function R(e){var f,d;var t=e.f,r=(t&2)!==0;if(r&&t&16384){var n=z0(e);return uc(e),n}if(oc!==null&&oc.add(e),fe!==null){sn!==null&&sn.includes(e)&&zC();var i=fe.deps;At===null&&i!==null&&i[Sr]===e?Sr++:At===null?At=[e]:At.push(e),ti!==null&&te!==null&&te.f&1024&&!(te.f&32)&&ti.includes(e)&&(Xt(te,2048),lo(te))}else if(r&&e.deps===null)for(var a=e,s=a.parent,o=a;s!==null;)if(s.f&2){var c=s;o=c,s=c.parent}else{var l=s;(f=l.deriveds)!=null&&f.includes(o)||((d=l.deriveds)!=null?d:l.deriveds=[]).push(o);break}if(r&&(a=e,Bi(a)&&V0(a)),V&&Qn&&sc!==null&&fe!==null&&sc.reaction===fe){if(e.debug)e.debug();else if(e.created){var u=sc.entries.get(e);u===void 0&&(u={read:[]},sc.entries.set(e,u)),u.read.push(ei("TracedAt"))}}return e.v}function Ue(e){let t=fe;try{return fe=null,e()}finally{fe=t}}var o7=-7169;function Xt(e,t){e.f=e.f&o7|t}function Ye(e,t=!1,r){he={p:he,c:null,e:null,m:!1,s:e,x:null,l:null},Jn&&!t&&(he.l={s:null,u:null,r1:[],r2:ut(!1)}),V&&(he.function=r,Gr=r)}function Xe(e){var s,o;let t=he;if(t!==null){e!==void 0&&(t.x=e);let c=t.e;if(c!==null){var r=te,n=fe;t.e=null;try{for(var i=0;i<c.length;i++){var a=c[i];it(a.effect),Tt(a.reaction),xr(a.fn)}}finally{it(r),Tt(n)}}he=t.p,V&&(Gr=(o=(s=t.p)==null?void 0:s.function)!=null?o:null),t.m=!0}return e||{}}if(V){let e=function(t){if(!(t in globalThis)){let r;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(r!==void 0)return r;HC(t)},set:n=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e
|
||
|
`:""}${(_=t.log.author)==null?void 0:_.name}
|
||
|
${(0,wv.moment)(t.log.date).format(t.plugin.settings.commitDateFormat)}
|
||
|
${t.log.message}`)}),c.__click=[u9,i];var l=U(c),u=Z(l,2),f=U(u);{var d=_=>{var k=f9(),w=U(k,!0);xe(()=>Oe(w,t.log.refs.join(", "))),H(k),ne(_,k)};ge(f,_=>{t.log.refs.length>0&&_(d)})}var h=Z(f,2);{var p=_=>{var k=d9(),w=U(k,!0);xe(()=>Oe(w,a(t.log))),H(k),ne(_,k)};ge(h,_=>{var k;t.plugin.settings.authorInHistoryView!="hide"&&((k=t.log.author)!=null&&k.name)&&_(p)})}var m=Z(h,2);{var v=_=>{var k=h9(),w=U(k,!0);xe(()=>Oe(w,(0,wv.moment)(t.log.date).format(t.plugin.settings.commitDateFormat))),H(k),ne(_,k)};ge(m,_=>{t.plugin.settings.dateInHistoryView&&_(v)})}var y=Z(m,2),b=U(y,!0);H(y),H(u),H(c);var x=Z(c,2);{var E=_=>{var k=p9(),w=U(k);{var A=T=>{vc(T,{get hierarchy(){return R(r)},get plugin(){return t.plugin},get view(){return t.view},topLevel:!0})},S=T=>{var P=ii(),O=lr(P);kr(O,17,()=>t.log.diff.files,Ar,(j,D)=>{gc(j,{get view(){return t.view},get diff(){return R(D)}})}),ne(T,P)};ge(w,T=>{t.showTree?T(A):T(S,!1)})}H(k),un(3,k,()=>In,()=>({duration:150})),ne(_,k)};ge(x,_=>{R(i)||_(E)})}H(o),H(s),xe(()=>{at(o,"is-collapsed",R(i)),pe(c,"data-tooltip-position",R(n)),at(l,"is-collapsed",R(i)),Oe(b,t.log.message)}),ne(e,s),Xe()}dt(["click"]);function v9(e,t){t().catch(console.error)}var y9=(e,t,r,n)=>{re(t,!R(t)),(0,_v.setIcon)(r[0],R(t)?"list":"folder"),n(n().settings.treeStructure=R(t),!0),n().saveSettings()},w9=se('<div class="tree-item nav-folder mod-root"></div>'),b9=se('<main><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" class="clickable-icon nav-action-button" data-icon="refresh-cw" aria-label="Refresh" style="margin: 1px;"></div></div></div> <div class="nav-files-container" style="position: relative;"><!></div> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></main>'),_9={hash:"svelte-45h",code:""};function xv(e,t){Ye(t,!0),gt(e,_9);let r=si(t,"plugin",15),n=ft(!1),i=be([]),a=ft(void 0),s=ft(be(r().settings.treeStructure)),o,c;$t(()=>{c&&c.empty()}),o=t.view.app.workspace.on("obsidian-git:head-change",()=>void l().catch(console.error)),$t(()=>{i.forEach(x=>(0,_v.setIcon)(x,x.getAttr("data-icon")))}),U3(()=>{t.view.app.workspace.offref(o)}),mv(()=>{let x=new IntersectionObserver(_=>{_[0].isIntersecting&&!R(n)&&u().catch(console.error)}),E=document.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),l().catch(console.error);function l(){return Da(this,void 0,void 0,function*(){var x;if(!r().gitReady){re(a,void 0);return}re(n,!0);let E=r().gitManager instanceof Te,_;((x=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&x!==void 0?x:0)==0?_=E?50:10:_=R(a).length,re(a,be(yield r().gitManager.log(void 0,!1,_))),re(n,!1)})}function u(){return Da(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(a)===void 0)return;re(n,!0);let _=r().gitManager instanceof Te?50:10,k=yield r().gitManager.log(void 0,!1,_,(x=R(a).last())===null||x===void 0?void 0:x.hash);R(a).push(...k.slice(1)),re(n,!1)})}var f=b9(),d=U(f),h=U(d),p=U(h);p.__click=[y9,s,i,r],Ge(p,x=>i[0]=x,()=>i==null?void 0:i[0]);var m=Z(p,2);m.__click=[v9,l],Ge(m,x=>i[1]=x,()=>i==null?void 0:i[1]),H(h),H(d);var v=Z(d,2),y=U(v);{var b=x=>{var E=w9();kr(E,21,()=>R(a),Ar,(_,k)=>{bv(_,{get view(){return t.view},get showTree(){return R(s)},get log(){return R(k)},get plugin(){return r()}})}),H(E),ne(x,E)};ge(y,x=>{R(a)&&x(b)})}H(v),uo(4),H(f),xe(()=>{pe(p,"data-icon",R(s)?"list":"folder"),at(m,"loading",R(n))}),ne(e,f),Xe()}dt(["click"]);var yc=class extends V3.ItemView{constructor(t,r){super(t),this.plugin=r,this.hoverPopover=null}getViewType(){return Fr.type}getDisplayText(){return Fr.name}getIcon(){return Fr.icon}onClose(){return this._view&&ai(this._view),super.onClose()}reload(){this._view&&ai(this._view),this._view=zi(xv,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};g();var W3=require("obsidian"),Ud=class extends W3.FuzzySuggestModal{constructor(r,n){super(r.app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){r
|
||
|
`)}. Please remove them.`),!0}return!1}async writeAndOpenFile(t){t!==void 0&&await this.plugin.app.vault.adapter.write(Ms,t);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&Ms.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(Ms,"/",!0)}openDiff({aFile:t,bFile:r,aRef:n,bRef:i,event:a}){var c,l;let s=this.plugin.settings.diffStyle;_o.Platform.isMobileApp&&(s="git_unified");let o={aFile:t,bFile:r!=null?r:t,aRef:n,bRef:i};s=="split"?(c=tn(this.plugin.app,a))==null||c.setViewState({type:Ai.type,active:!0,state:o}):s=="git_unified"&&((l=tn(this.plugin.app,a))==null||l.setViewState({type:ki.type,active:!0,state:o}))}async runRawCommand(){let t=this.plugin.gitManager;if(!(t instanceof Te))return;let n=await new Fe(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new _o.Notice(`Running '${n}'...`,999999);try{let a=await t.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};g();var To=require("obsidian");var Yr=require("@codemirror/view"),ko=require("@codemirror/state");g();var Pe=require("@codemirror/view"),Se=require("@codemirror/state");g();var Av="\u037C",Q3=typeof Symbol=="undefined"?"__"+Av:Symbol.for(Av),kv=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),eP=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},zd=class{constructor(t,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,o,c,l){let u=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&o==null)return c.push(s[0]+";");for(let h in o){let p=o[h];if(/&/.test(h))a(h.split(/,\s*/).map(m=>s.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),p,c);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");a(i(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||d)&&c.push((n&&!f&&!l?s.map(n):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in t)a(i(s),t[s],this.rules)}getRules(){return this.rules.join(`
|
||
|
`)}static newName(){let t=eP[Q3]||1;return eP[Q3]=t+1,Av+t.toString(36)}static mount(t,r,n){let i=t[kv],a=n&&n.nonce;i?a&&i.setNonce(a):i=new Tv(t,a),i.mount(Array.isArray(r)?r:[r],t)}},tP=new Map,Tv=class{constructor(t,r){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let a=tP.get(n);if(a)return t[kv]=a;this.sheet=new i.CSSStyleSheet,tP.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],t[kv]=this}mount(t,r){let n=this.sheet,i=0,a=0;for(let s=0;s<t.length;s++){let o=t[s],c=this.modules.indexOf(o);if(c<a&&c>-1&&(this.modules.splice(c,1),a--,c=-1),c==-1){if(this.modules.splice(a++,0,o),n)for(let l=0;l<o.rules.length;l++)n.insertRule(o.rules[l],i++)}else{for(;a<c;)i+=this.modules[a++].rules.length;i+=o.rules.length,a++}}if(n)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let s="";for(let c=0;c<this.modules.length;c++)s+=this.modules[c].getRules()+`
|
||
|
`;this.styleTag.textContent=s;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}};var wP=require("@codemirror/language"),yH=require("@lezer/highlight"),ht=class e{constructor(t,r,n,i){this.fromA=t,this.toA=r,this.fromB=n,this.toB=i}offset(t,r=t){return new e(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}};function Ua(e,t,r,n,i,a){if(e==n)return[];let s=Fv(e,t,r,n,i,a),o=$v(e,t+s,r,n,i+s,a);t+=s,r-=o,i+=s,a-=o;let c=r-t,l=a-i;if(!c||!l)return[new ht(t,r,i,a)];if(c>l){let f=e.slice(t,r).indexOf(n.slice(i,a));if(f>-1)return[new ht(t,t+f,i,i),new ht(t+f+l,r,a,a)]}else if(l>c){let f=n.slice(i,a).indexOf(e.slice(t,r));if(f>-1)return[new ht(t,t,i,i+f),new ht(r,r,i+f+c,a)]}if(c==1||l==1)return[new ht(t,r,i,a)];let u=_P(e,t,r,n,i,a);if(u){let[f,d,h]=u;return Ua(e,t,f,n,i,d).concat(Ua(e,f+h,r,n,d+h,a))}return wH(e,t,r,n,i,a)}var Cc=1e9;function wH(e,t,r,n,i,a){let s=r-t,o=a-i;if(Cc<1e9&&Math.min(s,o)>Cc*16)return Math.min(s,o)>Cc*64?[new ht(t,r,i,a)]:rP(e,t,r,n,i,a);let c=Math.ceil((s+o)/2);Cv.reset(c),Pv.reset(c);let l=(h,p)=>e.charCodeAt(t+h)==n.charCodeAt(i+p),u=(h,p)=>e.charCodeAt(r-h-1)==n.charCodeAt(a-p-1),f=(s-o)%2!=0?Pv:null,d=f?null:Cv;for(let h=0;h<c;h++){if(h>Cc)return rP(e,t,r,n,i,a);let p=Cv.advance(h,s,o,c,f,!1,l)||Pv.advance(h,s,o,c,d,!0,u);if(p)return bH(e,t,r,t+p[0],n,i,a,i+p[1])}return[new ht(t,r,i,a)]}var Xd=class{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,i,a,s,o){for(let c=-t+this.start;c<=t-this.end;c+=2){let l=i+c,u=c==-t||c!=t&&this.vec[l-1]<this.vec[l+1]?this.vec[l+1]:this.vec[l-1]+1,f=u-c;for(;u<r&&f<n&&o(u,f);)u++,f++;if(this.vec[l]=u,u>r)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-c;if(d>=0&&d<this.len&&a.vec[d]!=-1)if(s){let h=a.vec[d];if(h>=r-u)return[h,i+h-d]}else{let h=r-a.vec[d];if(u>=h)return[u,f]}}}return null}},Cv=new Xd,Pv=new Xd;function bH(e,t,r,n,i,a,s,o){let c=!1;return!Eo(e,n)&&++n==r&&(c=!0),!Eo(i,o)&&++o==s&&(c=!0),c?[new ht(t,r,a,s)]:Ua(e,t,n,i,a,o).concat(Ua(e,n,r,i,o,s))}function bP(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function Fv(e,t,r,n,i,a){if(t==r||t==a||e.charCodeAt(t)!=n.charCodeAt(i))return 0;let s=bP(r-t,a-i);for(let o=t,c=i;;){let l=o+s,u=c+s;if(l>r||u>a||e.slice(o,l)!=n.slice(c,u)){if(s==1)return o-t-(Eo(e,o)?0:1);s=s>>1}else{if(l==r||u==a)return l-t;o=l,c=u}}}function $v(e,t,r,n,i,a){if(t==r||i==a||e.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=bP(r-t,a-i);for(let o=r,c=a;;){let l=o-s,u=c-s;if(l<t||u<i||e.slice(l,o)!=n.slice(u,c)){if(s==1)return r-o-(Eo(e,o)?0:1);s=s>>1}else{if(l==t||u==i)return r-l;o=l,c=u}}}function Rv(e,t,r,n,i,a,s,o){let c=n.slice(i,a),l=null;for(;;){if(l||s<o)return l;for(let u=t+s;;){Eo(e,u)||u++;let f=u+s;if(Eo(e,f)||(f+=f==u+1?1:-1),f>=r)break;let d=e.slice(u,f),h=-1;for(;(h=c.indexOf(d,h+1))!=-1;){let p=Fv(e,f,r,n,i+h+d.length,a),m=$v(e,t,u,n,i,i+h),v=d.length+p+m;(!l||l[2]<v)&&(l=[u-m,i+h-m,v])}u=f}if(o<0)return l;s=s>>1}}function _P(e,t,r,n,i,a){let s=r-t,o=a-i;if(s<o){let c=_P(n,i,a,e,t,r);return c&&[c[1],c[0],c[2]]}return s<4||o*2<s?null:Rv(e,t,r,n,i,a,Math.floor(s/4),-1)}function rP(e,t,r,n,i,a){let s=r-t,o=a-i,c;if(s<o){let d=Rv(n,i,a,e,t,r,Math.floor(s/6),50);c=d&&[d[1],d[0],d[2]]}else c=Rv(e,t,r,n,i,a,Math.floor(o/6),50);if(!c)return[new ht(t,r,i,a)];let[l,u,f]=c;return Ua(e,t,l,n,i,u).concat(Ua(e,l+f,r,n,u+f,a))}function xP(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],i=e[r];n.toA>i.fromA-t&&n.toB>i.fromB-t&&(e[r-1]=new ht(n.fromA,i.toA,n.fromB,i.toB),e.splice(r--,1))}}function _H(e,t,r){for(;;){xP(r,1);let n=!1;for(let i=0;i<r.length;i++){let a=r[i],s,o;(s=Fv(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[i]=new ht(a.fromA+s,a.toA,a.fromB+s,a.toB)),(o=$v(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[i]=new ht(a.fromA,a.toA-o,a.fromB,a.toB-o));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?r[i-1].toA:0),f=(i<r.length-1?r[i+1].fromA:e.length)-a.
|
||
|
`+this.gitManager.getRelativeRepoPath(r.path,!0)),this.refresh()}handleFileMenu(r,n,i){this.gitReady&&this.settings.showFileMenu&&n&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(r.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{n instanceof Me.TFile?await this.gitManager.stage(n.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(n.path,!0)}),this.displayMessage(`Staged ${n.path}`)})})}),r.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{n instanceof Me.TFile?await this.gitManager.unstage(n.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(n.path,!0)}),this.displayMessage(`Unstaged ${n.path}`)})})}),r.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(n).catch(o=>this.displayError(o))})})),i=="git-source-control"&&r.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(n).catch(o=>this.displayError(o))})}))}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,n;this.gitReady=!1,this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(n=this.statusBar)==null||n.remove(),this.gitManager.unload(),this.promiseQueue.clear();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Ex(Sn,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Me.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar){let i=this.addStatusBarItem();this.statusBar=new od(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Te(this),await this.gitManager.setGitInstance()):this.gitManager=new nn(this);let i=await this.gitManager.checkRequirements();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Me.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),Me.Platform.isDesktop&&this.settings.showBranchStatusBar){let a=this.addStatusBarItem();this.branchBar=new Gd(a,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return void((s=this.branchBar)==null?void 0:s.display().catch(console.error))},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.lineAuthoringFeature.conditionallyActivateBySettings(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new Me.Notice("In
|
||
|
# Additional Instructions
|
||
|
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
|
||
|
|
||
|
\`\`\`diff
|
||
|
<<<<<<< HEAD
|
||
|
File changes in local repository
|
||
|
=======
|
||
|
File changes in remote repository
|
||
|
>>>>>>> origin/main
|
||
|
\`\`\``]),await this.tools.writeAndOpenFile(n==null?void 0:n.join(`
|
||
|
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new Fe(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new Fe(this,{initialValue:a}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),n;r.length===0&&(n=await this.editRemotes(),n==null&&(r=await this.gitManager.getRemotes()));let i=new Fe(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=n!=null?n:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new Fe(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult()}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new Fe(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}onActiveLeafChange(r){var s,o;let n=r==null?void 0:r.view;if(!(n!=null&&n.getState().file)&&!(n instanceof ka||n instanceof Ga))return;let i=this.app.workspace.getLeavesOfType(St.type).first(),a=this.app.workspace.getLeavesOfType(Fr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof ka||(r==null?void 0:r.view)instanceof Ga){let c=r.view.state.bFile;this.lastDiffViewState=r.view.getState();let l;i&&r.view.state.aRef=="HEAD"?l=i.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${c}']`):i&&r.view.state.aRef==""?l=i.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${c}']`):a&&(l=a.view.containerEl.querySelector(`div.nav-file-title[data-path='${c}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,n=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(r.toLowerCase(),n),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Me.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof gl.UserCanceledError){new Me.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),new Me.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),n)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
|
||
|
/*! 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 *)
|
||
|
|
||
|
js-sha256/src/sha256.js:
|
||
|
(**
|
||
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
||
|
*
|
||
|
* @version 0.9.0
|
||
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||
|
* @license MIT
|
||
|
*)
|
||
|
|
||
|
feather-icons/dist/feather.js:
|
||
|
(*!
|
||
|
Copyright (c) 2016 Jed Watson.
|
||
|
Licensed under the MIT License (MIT), see
|
||
|
http://jedwatson.github.io/classnames
|
||
|
*)
|
||
|
*/
|
||
|
|
||
|
/* nosourcemap */
|