vault backup: 2026-08-21 02:31:37
This commit is contained in:
1 parent
42c885757f
commit
19d5a510ae
22 files changed
+1958
-1197
No files matched your search
+335
-322
@@ -3,105 +3,106 @@ 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:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return!1}}Object.defineProperty(M.prototype,"parent",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.buffer}});Object.defineProperty(M.prototype,"offset",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.byteOffset}});function Ln(e){if(e>Ic)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,M.prototype),t}function M(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return sh(e)}return Zv(e,t,r)}M.poolSize=8192;function Zv(e,t,r){if(typeof e=="string")return i5(e,t);if(ArrayBuffer.isView(e))return a5(e);if(e==null)throw new TypeError("The first argument must be one of type string,
Line truncated
|
||||
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:parseInt(i,10),a=Ol(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Ol(s,"%")?100:1),Fs([n,i,a,s])}function j$(e){var t=jx.exec(e),r=Wt(t,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,T$.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Ol(o,"%")?100:1),Yu([n,a,s,o])}function Hx(e){return Px.default[e]?Em(Px.default[e]):Ix.test(e)||Fx.test(e)?D$(e):$x.test(e)||Dx.test(e)||Lx.test(e)||Nx.test(e)?N$(e):jx.test(e)?j$(e):null}var B$={fromString:Hx,fromRgb:Em,fromRgba:Fs,fromHsl:Bx,fromHsla:Yu};Wn.default=B$});var Am=I((QG,zx)=>{"use strict";g();var Gx=Object.prototype.toString;zx.exports=function(t){var r=Gx.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Gx.call(t.callee)==="[object Function]"),n}});var Qx=I((tz,Jx)=>{"
Line truncated
|
||||
`)>=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=="function"&&Set.prototype?Set:null,yf;og||(yf=function(t){return!1});var lA=lN?Map.prototype.has:null,cA=og?Set.prototype.has:null;!yf&&!cA&&(yf=function(t){return!1});uA.exports=yf||function(t){if(!t||typeof t!="object")return!1;try{if(cA.call(t),lA)try{lA.call(t)}catch(r){return!0}return t instanceof og}catch(r){}return!1}});var xA=I((NV,_f)=>{"use strict";g();var fA=Hm(),dA=rA();Ju()()||$l()()?(wf=Symbol.iterator,_f.exports=function(t){if(t!=null&&typeof t[wf]!="undefined")return t[wf]();if(fA(t))return Array.prototype[wf].call(t)}):(hA=ng(),pA=ig(),cg=Qr(),mA=cg("%Map%",!0),gA=cg("%Set%",!0),$r=wr(),ug=$r("Array.prototype.push"),fg=$r("String.prototype.charCodeAt"),vA=$r("String.prototype.slice"),yA=function(t,r){var n=t.length;if(r+1>=n)return r+1;var i=fg(t,r);if(i<55296||i>56319)return r+1;var a=fg(t,r+1);return a<56320||a>57343?r+1:r+2},bf=function(t){var r=0;return{next:function(){var
Line truncated
|
||||
`});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);return}for(var v=0;v<m.length;v++)d.push(m[v]),p(d,h,this),d.pop()},s:function(d,h,p,m,v,y,b){var x;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,m,v,y,b)),x=!!d,!m&&x&&h&&h.push(typeof d=="object"?d:h[h.length-1]),x)},d:function(d,h,p,m){var v,y=d.split("."),b=this.f(y[0],h,p,m),x=this.options.modelGet,E=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var _=1;_<y.length;_++)v=t(y[_],b,x),v!==void 0?(E=b,b=v):b="";return m&&!b?!1:(!m&&typeof b=="function"&&(h.push(E),b=this.mv(b,h,p),h.pop()),b)},f:function(d,h,p,m){for(var v=!1,y=null,b=!1,x=this.options.modelGet,E=h.length-1;E>=0;E--)if(y=h[E],v=t(d,y,x),v!==void 0){b=!0;break}return b?(!m&&typeof v=="function"&&(v=this.mv(v,h,p)),v):m?!1:""},ls:function(d,h,p,m,v){var y=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(l(d.call(h,m)),h,p)),this.options.delimiters=y,!1},ct:function(d,
Line truncated
|
||||
`)}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.defineProperty(e,mu,{value:function({fs:t,gitdir:r,cache:n}){return new hp({fs:t,gitdir:r,cache:n})}}),Object.freeze(e),e}var Ne=class e extends _e{constructor(t){super(`Could not find ${t}.`),this.code=this.name=e.code,this.data={what:t}}};Ne.code="NotFoundError";var Gt=class e extends _e{constructor(t,r,n,i){super(`Object ${t} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=e.code,this.data={oid:t,actual:r,expected:n,filepath:i}}};Gt.code="ObjectTypeError";var bi=class e extends _e{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=e.code,this.data={value:t}}};bi.code="InvalidOidError";var el=class e extends _e{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following:
|
||||
[remote "${t}"]
|
||||
"use strict";var E$=Object.create;var gc=Object.defineProperty;var S$=Object.getOwnPropertyDescriptor;var k$=Object.getOwnPropertyNames;var C$=Object.getPrototypeOf,A$=Object.prototype.hasOwnProperty;var Eb=t=>{throw TypeError(t)};var T$=(t,e,r)=>e in t?gc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var P$=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var U=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},R$=(t,e)=>{for(var r in e)gc(t,r,{get:e[r],enumerable:!0})},Sb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of k$(e))!A$.call(t,n)&&n!==r&&gc(t,n,{get:()=>e[n],enumerable:!(i=S$(e,n))||i.enumerable});return t};var ft=(t,e,r)=>(r=t!=null?E$(C$(t)):{},Sb(e||!t||!t.__esModule?gc(r,"default",{value:t,enumerable:!0}):r,t)),$$=t=>Sb(gc({},"__esModule",{value:!0}),t);var He=(t,e,r)=>T$(t,typeof e!="symbol"?e+"":e,r),tm=(t,e,r)=>e.has(t)||Eb("Cannot "+r);var $=(t,e,r)=>(tm(t,e,"read from private field"),r?r.call(t):e.get(t)),me=(t,e,r)=>e.has(t)?Eb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fe=(t,e,r,i)=>(tm(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Ee=(t,e,r)=>(tm(t,e,"access private method"),r);var Ab=U(Rf=>{"use strict";m();Rf.byteLength=I$;Rf.toByteArray=D$;Rf.fromByteArray=N$;var ln=[],pi=[],F$=typeof Uint8Array!="undefined"?Uint8Array:Array,rm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ia=0,kb=rm.length;ia<kb;++ia)ln[ia]=rm[ia],pi[rm.charCodeAt(ia)]=ia;var ia,kb;pi[45]=62;pi[95]=63;function Cb(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function I$(t){var e=Cb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function M$(t,e,r){return(e+r)*3/4-r}function D$(t){var e,r=Cb(t),i=r[0],n=r[1],s=new F$(M$(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l<o;l+=4)e=pi[t.charCodeAt(l)]<<18|pi[t.charCodeAt(l+1)]<<12|pi[t.charCodeAt(l+2)]<<6|pi[t.charCodeAt(l+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=pi[t.charCodeAt(l)]<<2|pi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=pi[t.charCodeAt(l)]<<10|pi[t.charCodeAt(l+1)]<<4|pi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function O$(t){return ln[t>>18&63]+ln[t>>12&63]+ln[t>>6&63]+ln[t&63]}function L$(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(O$(i));return n.join("")}function N$(t){for(var e,r=t.length,i=r%3,n=[],s=16383,a=0,o=r-i;a<o;a+=s)n.push(L$(t,a,a+s>o?o:a+s));return i===1?(e=t[r-1],n.push(ln[e>>2]+ln[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(ln[e>>10]+ln[e>>4&63]+ln[e<<2&63]+"=")),n.join("")}});var Tb=U(im=>{m();im.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};im.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<<c)-1,f=u>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<<n|o,c+=n;c>0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var dm=U(Eo=>{"use strict";m();var nm=Ab(),yo=Tb(),Pb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Eo.Buffer=M;Eo.SlowBuffer=V$;Eo.INSPECT_MAX_BYTES=50;var $f=2147483647;Eo.kMaxLength=$f;M.TYPED_ARRAY_SUPPORT=B$();!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 B$(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(M.prototype,"parent",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.buffer}});Object.defineProperty(M.prototype,"offset",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.byteOffset}});function Gn(t){if(t>$f)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,M.prototype),e}function M(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return lm(t)}return Ib(t,e,r)}M.poolSize=8192;function Ib(t,e,r){if(typeoLine truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VB(t,e){if(t){if(typeof t=="string")return jS(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jS(t,e)}}function jS(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function zB(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],i=!0,n=!1,s=void 0;try{for(var a=t[Symbol.iterator](),o;!(i=(o=a.next()).done)&&(r.push(o.value),!(e&&r.length===e));i=!0);}catch(l){n=!0,s=l}finally{try{!i&&a.return!=null&&a.return()}finally{if(n)throw s}}return r}}function WB(t){if(Array.isArray(t))return t}var zS=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,WS=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,qS=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,YS=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,ZS=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,KS=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,XS=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function vu(t,e){return t.indexOf(e)>-1}function qB(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}})();return[f*60,u*100,c*100]}function YB(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=(function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]})(),u=_r(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var ZB=(function(){function t(e){var r=_r(e,4),i=r[0],n=r[1],s=r[2],a=r[3];UB(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return GB(t,[{key:"toRgbString",value:function(){var r=_r(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=_r(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=_r(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=_r(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=qB(i,n,s),l=_r(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function sl(t){var e=_r(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new ZB([r,i,n,s])}function av(t){var e=_r(t,3),r=e[0],i=e[1],n=e[2];return sl([r,i,n,1])}function Ld(t){var e=_r(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=YB(r,i,n),o=_r(a,3),l=o[0],c=o[1],u=o[2];return sl([l,c,u,s])}function QS(t){var e=_r(t,3),r=e[0],i=e[1],n=e[2];return Ld([r,i,n,1])}function KB(t){var e=zS.exec(t)||WS.exec(t),r=_r(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,sl([i,n,s,a])}function XB(t){var e=qS.exec(t)||ZS.exec(t)||YS.exec(t)||KS.exec(t),r=_r(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=vu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=vu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=vu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(vu(a,"%")?100:1),sl([i,n,s,a])}function QB(t){var e=XS.exec(t),r=_r(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,HB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(vu(o,"%")?100:1),Ld([i,s,a,o])}function JS(t){return US.default[t]?av(US.default[t]):zS.test(t)||WS.test(t)?KB(t):qS.test(t)||ZS.test(t)||YS.test(t)||KS.test(t)?XB(t):XS.test(t)?QB(t):null}var JB={fromString:JS,fromRgb:av,fromRgba:sl,fromHsl:QS,fromHsla:Ld};Kn.default=JB});var dk=U((v9,fk)=>{m();fk.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,b,_,C){return{startX:g,startY:v,endX:b,endY:_,r:C}},p=function(g,v,b){var _,C,x,S,A;for(v>b?_=l[g-1+o]:_=l[g+1+o],A=x=Math
Line truncated
|
||||
`});ce=!1,W=K.length}function Ie(Rt,$t){var Xe="="+G,ee=Rt.indexOf(Xe,$t),N=c(Rt.substring(Rt.indexOf("=",$t)+1,ee)).split(" ");return X=N[0],G=N[N.length-1],ee+Xe.length-1}for(y&&(y=y.split(" "),X=y[0],G=y[1]),pe=0;pe<P;pe++)H==T?u(X,E,pe)?(--pe,Be(),H=I):E.charAt(pe)==`
|
||||
`?Ut(ce):Z+=E.charAt(pe):H==I?(pe+=X.length-1,xe=t.tags[E.charAt(pe+1)],te=xe?E.charAt(pe+1):"_v",te=="="?(pe=Ie(E,pe),H=T):(xe&&pe++,H=L),ce=pe):u(G,E,pe)?(K.push({tag:te,n:c(Z),otag:X,ctag:G,i:te=="/"?ce-X.length:pe+G.length}),Z="",pe+=G.length-1,H=T,te=="{"&&(G=="}}"?pe++:l(K[K.length-1]))):Z+=E.charAt(pe);return Ut(ce,!0),K};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,E,y){if(E.charAt(y)!=w.charAt(0))return!1;for(var P=1,T=w.length;P<T;P++)if(E.charAt(y+P)!=w.charAt(P))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,E,y,P){var T=[],I=null,L=null,H=null;for(L=y[y.length-1];w.length>0;){if(H=w.shift(),L&&L.tag=="<"&&!(H.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[H.tag]<=t.tags.$||h(H,P))y.push(H),H.nodes=d(w,H.tag,y,P);else if(H.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+H.n);if(I=y.pop(),H.n!=I.n&&!p(H.n,I.n,P))throw new Error("Nesting error: "+I.n+" vs. "+H.n);return I.end=H.i,T}else H.tag==`
|
||||
`&&(H.last=w.length==0||w[0].tag==`
|
||||
`);T.push(H)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return T}function h(w,E){for(var y=0,P=E.length;y<P;y++)if(E[y].o==w.n)return w.tag="#",!0}function p(w,E,y){for(var P=0,T=y.length;P<T;P++)if(y[P].c==w&&y[P].o==E)return!0}function g(w){var E=[];for(var y in w)E.push('"'+_(y)+'": function(c,p,t,i) {'+w[y]+"}");return"{ "+E.join(",")+" }"}function v(w){var E=[];for(var y in w.partials)E.push('"'+_(y)+'":{name:"'+_(w.partials[y].name)+'", '+v(w.partials[y])+"}");return"partials: {"+E.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,E,y){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var b=0;t.generate=function(w,E,y){b=0;var P={code:"",subs:{},partials:{}};return t.walk(w,P),y.asString?this.stringify(P,E,y):this.makeTemplate(P,E,y)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,E,y){var P=this.makePartials(w);return P.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(P,E,this,y)},t.makePartials=function(w){var E,y={subs:{},partials:w.partials,name:w.name};for(E in y.partials)y.partials[E]=this.makePartials(y.partials[E]);for(E in w.subs)y.subs[E]=new Function("c","p","t","i",w.subs[E]);return y};function _(w){return w.replace(s,"\\\\").replace(r,'\\"').replace(i,"\\n").replace(n,"\\r").replace(a,"\\u2028").replace(o,"\\u2029")}function C(w){return~w.indexOf(".")?"d":"f"}function x(w,E){var y="<"+(E.prefix||""),P=y+w.n+b++;return E.partials[P]={name:w.n,partials:{}},E.code+='t.b(t.rp("'+_(P)+'",c,p,"'+(w.indent||"")+'"));',P}t.codegen={"#":function(w,E){E.code+="if(t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,E),E.code+="});c.pop();}"},"^":function(w,E){E.code+="if(!t.s(t."+C(w.n)+'("'+_(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,E),E.code+="};"},">":x,"<":function(w,E){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var P=E.partials[x(w,E)];P.subs=y.subs,P.partials=y.partials},$:function(w,E){var y={subs:{},code:"",partials:E.partials,prefix:w.n};t.walk(w.nodes,y),E.subs[w.n]=y.code,E.inPartial||(E.code+='t.sub("'+_(w.n)+'",c,p,i);')},"\n":function(w,E){E.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,E){E.code+="t.b(t.v(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'},_t:function(w,E){E.code+=A('"'+_(w.text)+'"')},"{":S,"&":S};function S(w,E){E.code+="t.b(t.t(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,E){for(var y,P=0,T=w.length;P<T;P++)y=t.codegen[w[P].tag],y&&y(w[P],E);return E},t.parse=function(w,E,y){return y=y||{},d(w,"",[],y.sectionTags||[])},t.cache={},t.cacheKey=function(w,E){return[w,!!E.asString,!!E.disableLambda,E.delimiters,!!E.modelGet].join("||")},t.compile=function(w,E){E=E||{};var y=t.cacheKey(w,E),P=this.cache[y];if(P){var T=P.partials;for(var I in T)delete T[I].instance;return P}return P=this.generate(this.parse(this.scan(w,E.delimiters),w,E),w,E),this.cache[y]=P}})(typeof Vw!="undefined"?Vw:Hogan)});var Z2=U(zw=>{m();var b5={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),p(d,h,this),d.pop()},s:function(d,h,p,g,v,b,_){var C;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,b,_)),C=!!d,!g&&C&&h&&h.push(typeof d=="object"?d:h[h.length-1]),C)},d:function(d,h,p,g){var v,b=d.split("."),_=this.f(b[0],h,p,g),C=this.options.modelGet,x=null;if(d==="."&&f(h[h.length-2]))_=h[h.length-1];else for(var S=1;S<b.length;S++)v=e(b[S],_,C),v!==void 0?(x=_,_=v):_="";return g&&!_?!1:(!g&&typeof _=="function"&&(h.push(x),_=this.mv(_,h,p),h.pop()),_)},f:function(d,h,p,g){for(var v=!1,b=null,_=!1,C=this.options.modelGet,x=h.length-1;x>=0;x--)if(b=h[x],v=e(d,b,C),v!==void 0){_=!0;break}return _?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,b){var _=this.options.delimiters;return this.options.delimiters=b,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=_,!1},ct:functio
Line truncated
|
||||
|
||||
If you're using an application that depends on isomorphic-git, please report this error to that application's developers.
|
||||
|
||||
If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};he.code="InternalError";var va=class t extends Te{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};va.code="UnsafeFilepathError";var Ui=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Td(t,e){return-(t<e)||+(t>e)}function VE(t,e){return Td(t.path,e.path)}function zE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var vn=2**32;function wE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=wE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=wE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%vn,ctimeNanoseconds:r%vn,mtimeSeconds:i%vn,mtimeNanoseconds:n%vn,dev:t.dev%vn,ino:t.ino%vn,mode:zE(t.mode%vn),uid:t.uid%vn,gid:t.gid%vn,size:t.size>-1?t.size%vn:0}}function bO(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var Sg=null;async function bn(t){return Sg===null&&(Sg=await yO()),Sg?WE(t):_O(t)}function _O(t){return new Yg.default().update(t).digest("hex")}async function WE(t){let e=await crypto.subtle.digest("SHA-1",t);return bO(e)}async function yO(){try{return await WE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function xO(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function EO(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(k.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Og=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(k.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new he("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new he("Index file is empty (.git/index)");let r=new t,i=new Ui(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new he(`Invalid dircache magic file number: ${n}`);let s=await bn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new he(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new he(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&c<l;){let u={};u.ctimeSeconds=i.readUInt32BE(),u.ctimeNanoseconds=i.readUInt32BE(),u.mtimeSeconds=i.readUInt32BE(),u.mtimeNanoseconds=i.readUInt32BE(),u.dev=i.readUInt32BE(),u.ino=i.readUInt32BE(),u.mode=i.readUInt32BE(),u.uid=i.readUInt32BE(),u.gid=i.readUInt32BE(),u.size=i.readUInt32BE(),u.oid=i.slice(20).toString("hex");let f=i.readUInt16BE();u.flags=xO(f);let d=e.indexOf(0,i.tell()+1)-i.tell();if(d<1)throw new he(`Got a path length of: ${d}`);if(u.path=i.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new va(u.path);let h=8-(i.tell()-12)%8;for(h===0&&(h=8);h--;){let p=i.readUInt8();if(p!==0)throw new he(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(i.eof())throw new he("Unexpected end of file")}u.stages=[],r._addEntry(u),c++}return r}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(VE)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath
Line truncated
|
||||
`)}static async _entryToBuffer(e){let r=k.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=k.alloc(i),s=new Ui(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(EO(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=k.alloc(12),r=new Ui(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=k.concat(i),s=k.concat([e,n]),a=await bn(s);return k.concat([s,k.from(a,"hex")])}};function gd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var kg=null,Cg=Symbol("IndexCache");function SO(){return{map:new Map,stats:new Map}}async function kO(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Og.from(n);r.map.set(e,s),r.stats.set(e,i)}async function CO(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:gd(i,n)}var dt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Cg]||(i[Cg]=SO());let a=`${r}/index`;kg===null&&(kg=new Vo.default({maxPending:1/0}));let o,l=[];return await kg.acquire(a,async()=>{let c=i[Cg];await CO(e,a,c)&&await kO(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new Uc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function vd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function wa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function qE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:vd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(wa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:vd(n),metadata:s,parent:r(wa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function AO(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new he(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Lg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=dt.acquire({fs:e,gitdir:r,cache:i},async function(s){return qE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Td),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":AO(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},Pd=Symbol("GitWalkSymbol");function tl(){let t=Object.create(null);return Object.defineProperty(t,Pd,{value:function({fs:e,gitdir:r,cache:i}){return new Lg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var Ve=class t extends Te{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Ve.code="NotFoundError";var br=class t extends Te{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};br.code="ObjectTypeError";var Rs=class t extends Te{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Rs.code="InvalidOidError";var Gc=class t extends Te{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||||
[remote "${e}"]
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
`),this.code=this.name=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(`
|
||||
`),this.code=this.name=t.code,this.data={remote:e}}};Gc.code="NoRefspecError";var wd=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
||||
`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
||||
`)+`
|
||||
`}},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(){return this._entries.map(t=>`${t.mode} ${t.type} ${t.oid} ${t.path}`).join(`
|
||||
`)}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}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new le(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){let s=r.tell(),{type:o,length:c,ofs:l,reference:u}=await CM(r),f=new hu.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new le(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==c)throw new le("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await t({data:f.result,type:o,num:a,offset:s,end:h,reference:u,ofs:l})}}}}async function CM(e){let t=await e.byte(),r=t>>4&7,n=t&15;if(t&128){let s=4;do t=await e.byte(),n|=(t&127)<<s,s+=7;while(t&128)}let i,a;if(r===6){let s=0;i=0;let o=[];do t=await e.byte(),i|=(t&127)<<s,s+=7,o.push(t);while(t&128);a=Buffer.from(o)}return r===7&&(a=await e.read(2
Line truncated
|
||||
`,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)}
|
||||
`}},bd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new he("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Ng=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(bd.from(i));return new t(r)}add(e){let r=bd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function TO(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(r<i)||+(r>i);return n===0?t.endsWith("^{}")?1:-1:n}function PO(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o<t.length)a=t[o];else{if(a==="/")break;a="/"}if(a==="/"){if(!(n===o-1||s===1))if(s===2){if(r.length<2||i!==2||r.at(-1)!=="."||r.at(-2)!=="."){if(r.length>2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function RO(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function $O(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=RO(t),r=t[0]==="/"||e!==null&&t[2]==="/",i=t.at(-1)==="/",n=e?t.slice(2):t,s=PO(n,!r);if(!s.length){let a=e?r?e+"/":e:r?"/":".";return i&&!r?a+"/":a}return i&&(s+="/"),e?r?`${e}/${s}`:`${e}${s}`:r?`/${s}`:s}function B(...t){if(t.length===0)return".";let e;for(let r=0;r<t.length;++r){let i=t[r].replace(/\\/g,"/");i.length!==0&&(/^[a-zA-Z]:\//.test(i)||e===void 0?e=i:e+="/"+i)}return e===void 0?".":$O(e)}var FO=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Bc=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},bE={core:{filemode:Bc,bare:Bc,logallrefupdates:Bc,symlinks:Bc,ignorecase:Bc,bigFileThreshold:FO}},IO=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,MO=/^[A-Za-z0-9-.]+$/,DO=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,OO=/^[A-Za-z][A-Za-z-]*$/,LO=/^(.*?)( *[#;].*)$/,NO=t=>{let e=IO.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},BO=t=>{let e=DO.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=HO(i),s=UO(n);return[r,s]}return null},HO=t=>{let e=LO.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return _E(r)&&_E(i)?`${r}${i}`:r},_E=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,UO=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),yE=t=>t!=null?t.toLowerCase():null,Bg=(t,e,r)=>[yE(t),e,yE(r)].filter(i=>i!=null).join("."),xE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Bg(r,n,i),sectionPath:Bg(r,n,null),isSection:!!r}},GO=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Hg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(`
|
||||
`).map(n=>{let s=null,a=null,o=n.trim(),l=NO(o),c=l!=null;if(c)[r,i]=l;else{let f=BO(o);f!=null&&([s,a]=f)}let u=Bg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=xE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=bE[s]&&bE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=xE(e),u=GO(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(MO.test(n)&&OO.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(`
|
||||
`)}},ht=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Hg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},pd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],jO=["config","description","index","shallow","commondir"],Ag;async function Ts(t,e){return Ag===void 0&&(Ag=new Vo.default),Ag.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new Rs(v);let u=await ht.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Gc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=Ng.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(b=>`refs/tags/${b}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let b=n.get(v);d.set(v,b)}}let h=f.translate([...n.keys()]);for(let[v,b]of h){let _=n.get(v);d.set(b,_)}let p=f.translate([...s.keys()]);for(let[v,b]of p){let _=s.get(v),C=f.translateOne(_);C&&d.set(b,`ref: ${C}`)}let g=[];if(l){for(let v of f.localNamespaces()){let b=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(_=>`${v}/${_}`);for(let _ of b)d.has(_)||g.push(_)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,b]of d)await Ts(v,async()=>e.write(B(r,v),`${b.trim()}
|
||||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Rs(n);await Ts(i,async()=>e.write(B(r,i),`${n.trim()}
|
||||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ts(i,async()=>e.write(B(r,i),`ref: ${n.trim()}
|
||||
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(B(r,o))));let n=await Ts("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=wd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.size<a&&(n=s.toString(),await Ts("packed-refs",async()=>e.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0,visited:s=new Set}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n,visited:s});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let a=await t.packedRefs({fs:e,gitdir:r}),o=pd(i).filter(l=>!jO.includes(l));for(let l of o){let c=await Ts(l,async()=>await e.read(`${r}/${l}`,{encoding:"utf8"})||a.get(l));if(c){if(s.has(l))throw new he(`Circular reference detected while resolving ref "${l}"`);return s.add(l),t.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n,visited:s})}}throw new Ve(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=pd(i);for(let a of s)if(await Ts(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new Ve(i)}static async expandAgainstMap({ref:e,map:r}){let i=pd(e);for(let n of i)if(await r.has(n))return n;throw new Ve(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=pd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new Ve(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ts("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return wd.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(TO),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function VO(t,e){return Td(EE(t),EE(e))}function EE(t){return t.mode==="040000"?t.path+"/":t.path}function YE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new he(`Unexpected GitTree entry mode: ${t}`)}function zO(t){let e=[],r=0;for(;r<t.length;){let i=t.indexOf(32,r);if(i===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let n=t.indexOf(0,r);if(n===-1)throw new he(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let s=t.slice(r,i).toString("utf8");s==="40000"&&(s="040000");let a=YE(s),o=t.slice(i+1,n).toString("utf8"),l=o.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),u=l.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(o.includes("\\")||o.includes("/")||l==="."||l===".."||u===".git"||/^\.?git~[1-9]$/.test(u))throw new va(o);let f=t.slice(n+1,n+21).toString("hex");r=n+21,e.push({mode:s,path:o,oid:f,type:a})}return e}function WO(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new he(`Could not understand file mode: ${t}`)}function qO(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=WO(t.mode),t.type||(t.type=YE(t.mode)),t}var Mr=class t{constructor(e){if(k.isBuffer(e))this._entries=zO(e);else if(Array.isArray(e))this._entries=e.map(qO);else throw new he("invalid type passed to GitTree constructor");this._entries.sort(VE)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
||||
`)}toObject(){let e=[...this._entries];return e.sort(VO),k.concat(e.map(r=>{let i=k.from(r.mode.replace(/^0/,"")),n=k.from(" "),s=k.from(r.path,"utf8"),a=k.from([0]),o=k.from(r.oid,"hex");return k.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},$s=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o<n;o++)a[o]=i.charCodeAt(o);return a.set(r,n),a}static unwrap(e){let r=e.indexOf(32),i=e.indexOf(0),n=e.slice(0,r).toString("utf8"),s=e.slice(r+1,i).toString("utf8"),a=e.length-(i+1);if(parseInt(s)!==a)throw new he(`Length mismatch: expected ${s} bytes but got ${a} instead.`);return{type:n,object:k.from(e.slice(i+1))}}};async function ZE({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`,n=await t.read(`${e}/${i}`);return n?{object:n,format:"deflated",source:i}:null}function YO(t,e){let r=new Ui(t),i=SE(r);if(i!==e.byteLength)throw new he(`applyDelta expected source buffer to be ${i} bytes but the provided buffer was ${e.length} bytes`);let n=SE(r),s,a=CE(r,e);if(a.byteLength===n)s=a;else{let o=[a],l=a.byteLength;for(;!r.eof();){let c=CE(r,e);o.push(c),l+=c.byteLength}if(n!==l)throw new he(`applyDelta expected target buffer to be ${n} bytes but the resulting buffer was ${l} bytes`);s=k.concat(o,n)}return s}function SE(t){let e=0,r=0,i=null;do i=t.readUInt8(),e|=(i&127)<<r,r+=7;while(i&128);return e}function kE(t,e,r){let i=0,n=0;for(;r--;)e&1&&(i|=t.readUInt8()<<n),e>>=1,n+=8;return i}function CE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=kE(t,r&n,4),o=kE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function ZO(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function KE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:ZO(t)}var _d=class{constructor(e){if(typeof k=="undefined")throw new Error("Missing Buffer dependency");this.stream=KE(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?k.alloc(0):(r&&(r=k.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>KO(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=k.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function KO(t){return t.reduce((e,r)=>e+r.length,0)}async function XO(t,e){let r=new _d(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new he(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new he(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await QO(r),f=new Ad.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new he(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new he("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function QO(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<<a,a+=7;while(e&128)}let n,s;if(r===6){let a=0;n=0;let o=[];do e=await t.byte(),n|=(e&127)<<a,a+=7,o.push(e);while(e&128);s=k.from(o)}return r===7&&(s=await t.read(20)),{type:r,l
Line truncated
|
||||
`,t}function yd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:cL(n)}}function cL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),uL(i)}function uL(t){return t===0?t:-t}var Jr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(k.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new he("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||||
type ${e.type}
|
||||
tag ${e.tag}
|
||||
tagger ${Ug(e.tagger)}
|
||||
|
||||
${t.message}
|
||||
${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||||
${e.message}
|
||||
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||||
|
||||
`))}message(){let t=this.withoutSignature();return t.slice(t.indexOf(`
|
||||
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
||||
|
||||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let 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(`
|
||||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||||
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
||||
`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=yd(i.tagger)),i.committer&&(i.committer=yd(i.committer)),i}withoutSignature(){let e=Yn(this._tag);return e.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let 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(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Yn(e)}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return k.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Yn(s);let a=n+s;return t.from(a)}};function Pg(t){return t.trim().split(`
|
||||
`).map(e=>" "+e).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(`
|
||||
`}function fL(t){return t.split(`
|
||||
`).map(e=>e.replace(/^ /,"")).join(`
|
||||
`)}var Dr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(k.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new he("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Yn(i+`
|
||||
gpgsig`+Pg(r)+`
|
||||
`+n);return new t(s)}static from(e){return new t(e)}toObject(){return k.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Yn(e.slice(e.indexOf(`
|
||||
|
||||
`)+2))}static justHeaders(t){return t.slice(0,t.indexOf(`
|
||||
`)+2))}static justHeaders(e){return e.slice(0,e.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}
|
||||
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
|
||||
`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=`
|
||||
`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=yd(i.author)),i.committer&&(i.committer=yd(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.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 0?a=void 0:(a=await Gn(_i.wrap({type:"blob",object:await t.content()})),o&&a===o.oid&&(!u||c.mode===o.mode)&&nu(c,o,u,f)&&s.insert({filepath:t._fullpath,stats:c,oid:a})):a=o.oid}),t._oid=a}return t._oid}};function vu(){let e=Object.create(null);return Object.defineProperty(e,mu,{value:function({fs:t,dir:r,gitdir:n,cache:i}){return new wp({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function HM(e,t){let r=t-e;return Array.from({length:r},(n,i)=>e+i)}var l2=typeof Array.prototype.flat=="undefined"?e=>e.reduce((t,r)=>t.concat(r),[]):e=>e.flat(),bp=class{constructor(){this.value=null}consider(t){t!=null&&(this.value===null?this.value=t:t<this.value&&(this.value=t))}reset(){this.value=null}};function*UM(e){let t=new bp,r,n=[],i=e.length;for(let a=0;a<i;a++)n[a]=e[a].next().value,n[a]!==void 0&&t.consider(n[a]);if(t.value!==null)for(;;){let a=[];r=t.value,t.reset();for(let s=0;s<i;s++)n[s
Line truncated
|
||||
`),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;for(;~(t=e.indexOf(92));)e[t]=47;return e}async function ZM({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,cache:i={},force:a=!1,parallel:s=!0}){try{C("fs",e),C("dir",t),C("gitdir",r),C("filepath",n);let o=new X(e);await mt.acquire({fs:o,gitdir:r,cache:i},async c=>xp({dir:t,gitdir:r,fs:o,filepath:n,index:c,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function xp({dir:e,gitdir:t,fs:r,filepath:n,index:i,force:a,parallel:s}){n=Array.isArray(n)?n:[n];let o=n.map(async f=>{if(!a&&await ws.isIgnored({fs:r,dir:e,gitdir:t,filepath:f}))return;let d=await r.lstat($(e,f));if(!d)throw new Ne(f);if(d.isDirectory()){let h=await r.readdir($(e,f));if(s){let p=h.map(m=>xp({dir:e,gitdir:t,fs:r,filepath:[$(f,m)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of h)await xp({dir:e,gitdir:t,fs:r,filepath:[$(f,p)],index:i,force:a,parallel:s})}else{let p=await(await Ve.get({fs:r,
Line truncated
|
||||
`,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}let x=0,E=v.length;await mt.acquire({fs:e,gitdir:a,cache:t},async function(_){await Promise.all(v.filter(([k])=>k==="delete"||k==="delete-index").map(async function([k,w]){let A=`${i}/${w}`;k==="delete"&&await e.rm(A),_.delete({filepath:w}),r&&await r({phase:"Updating workdir",loaded:++x,total:E})}))}),await mt.acquire({fs:e,gitdir:a,cache:t},async function(_){for(let[k,w]of v)if(k==="rmdir"||k==="rmdir-index"){let A=`${i}/${w}`;try{k==="rmdir-index"&&_.delete({filepath:w}),await e.rmdir(A),r&&await r({phase:"Updating workdir",loaded:++x,total:E})}catch(S){if(S.code==="ENOTEMPTY")console.log(`Did not delete ${w} because directory is not empty`);else throw S}}}),await Promise.all(v.filter(([_])=>_==="mkdir"||_==="mkdir-index").map(async function([_,k]){let w=`${i}/${k}`;await e.mkdir(w),r&&await r({phase:"Updating workdir",loaded:++x,total:E})})),await mt.acquire({fs:e,gitdir:a,cache:t},async
Line truncated
|
||||
`).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(`
|
||||
`,e.parent){if(e.parent.length===void 0)throw new he("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s}
|
||||
`}let i=e.author;r+=`author ${Ug(i)}
|
||||
`;let n=e.committer||e.author;return r+=`committer ${Ug(n)}
|
||||
`,e.gpgsig&&(r+="gpgsig"+Pg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
|
||||
`+Yn(e.message)}render(){return this._commit}withoutSignature(){let e=Yn(this._commit);if(e.indexOf(`
|
||||
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
|
||||
gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||||
`)+28);return Yn(r+`
|
||||
`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return fL(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Yn(a);let l=t.justHeaders(e._commit)+`
|
||||
gpgsig`+Pg(a)+`
|
||||
`+s;return t.from(l)}};async function Xo({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Mr.from([]),oid:i};let{type:n,object:s}=await tt({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Jr.from(s).parse().object,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Dr.from(s).parse().tree,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new br(i,n,"tree");return{tree:Mr.from(s),oid:i}}var Gg=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await q.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof Ve&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Xo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await tt({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new br(l,c,o.type);let f=Mr.from(u);for(let d of f)a.set(B(r,d.path),d);return f.entries().map(d=>B(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=zE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await tt({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Fr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Pd,{value:function({fs:r,gitdir:i,cache:n}){return new Gg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var jg=class{constructor({fs:e,dir:r,gitdir:i,cache:n,refresh:s=!0}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.refresh=s,this.config=null;let a=this;this.ConstructEntry=class{constructor(l){this._fullpath=l,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){if(await e.type()!=="tree")return null;let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(B(n,r));return s===null?null:s.map(a=>B(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await dt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||gd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await bn($s.wrap({type:"blob",object:h})),r.refresh&&l&&a===l.oid&&(!f||c.mode===l.mode)&&gd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await ht.get({fs:e,gitdir:r}),this.config)}};function cu({refresh:t=!0}={}){let e=Object.create(null);return Object.defineProperty(e,Pd,{value:function({fs:r,dir:i,gitdir:n,cache:s}){return new jg({fs:r,dir:i,gitdir:n,cache:s,refresh:t})}}),Object.freeze(e),e}function dL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var QE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Vg=class{constructor(){this
Line truncated
|
||||
`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=k.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(wa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=wa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Td),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return k.isBuffer(i)?i:k.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Ir(t)}function gL(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function re({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>gL(i)?i:B(wa(e),i)):e}async function xd(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function vL({fs:t,dir:e,gitdir:r=B(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new J(t),a=[Fr({ref:i}),cu(),tl()],o=[],l=await re({fsp:s,dotgit:r});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Zn({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await xd(d,h),g=o.includes(u),v=!await xd(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new iu(u)}});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Is=class{static async isIgnored({fs:e,dir:r,gitdir:i=B(r,".git"),filepath:n}){if(vd(n)===".git")return!0;if(n===".")return!1;let s="",a=B(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:B(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:B(r,f,".gitignore"),filepath:d})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let d=(0,GE.default)().add(s);d.add(f);let h=wa(u.filepath);if(h!=="."&&d.ignores(h))return!0;c?c=!d.test(u.filepath).unignored:c=d.test(u.filepath).ignored}return c}};async function wL({fs:t,gitdir:e,object:r,format:i,oid:n}){if(i!=="deflated")throw new he("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${n.slice(0,2)}/${n.slice(2)}`,a=`${e}/${s}`;await t.exists(a)||await t.write(a,r)}var Rg=null;async function JE(t){return Rg===null&&(Rg=_L()),Rg?bL(t):Ad.default.deflate(t)}async function bL(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function _L(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function Or({fs:t,gitdir:e,type:r,object:i,format:n="content",oid:s=void 0,dryRun:a=!1}){return n!=="deflated"&&(n!=="wrapped"&&(i=$s.wrap({type:r,object:i})),s=await bn(i),i=k.from(await JE(i))),a||await wL({fs:t,gitdir:e,object:i,format:"deflated",oid:s}),s}function eS(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function yL({fs:t,dir:e,gitdir:r=B(e,".git"),filepath:i,cache:n={},force:s=!1,parallel:a=!0}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let o=new J(t),l=await re({fsp:o,dotgit:r});await dt.acquire({fs:o,gitdir:l,cache:n},async c=>{let f=await(await ht.get({fs:o,gitdir:l})).get("core.autocrlf");return Wg({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function Wg({dir:t,gitdir:e,fs:r,filepath:i,in
Line truncated
|
||||
`,author:l,committer:c,signingKey:u})}async function SL({fs:t,onSign:e,dir:r,gitdir:i=B(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",i),R("oid",s),R("note",a),u&&R("onSign",e);let d=new J(t),h=await Ms({fs:d,gitdir:i,author:l});if(!h)throw new Kt("author");let p=await xa({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Kt("committer");let g=await re({fsp:d,dotgit:i});return await EL({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var kL=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function au(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!kL.test(t)&&(!!e||t.includes("/"))}async function sS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!au(r,!0))throw new ji(r,zo.default.clean(r));let s=await ht.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Gi("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await ht.save({fs:t,gitdir:e,config:s})}async function CL({fs:t,dir:e,gitdir:r=B(e,".git"),remote:i,url:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("remote",i),R("url",n);let a=new J(t),o=await re({fsp:a,dotgit:r});return await sS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function AL({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await q.exists({fs:t,gitdir:i,ref:n}))throw new Gi("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await tt({fs:t,cache:e,gitdir:i,oid:f}),h=Jr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Jr.sign(h,r,c));let p=await Or({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function TL({fs:t,onSign:e,dir:r,gitdir:i=B(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",i),R("ref",n),c&&R("onSign",e);let d=new J(t),h=await re({fsp:d,dotgit:i}),p=await Ms({fs:d,gitdir:h,author:s});if(!p)throw new Kt("tagger");return await AL({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function PL({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!au(r,!0))throw new ji(r,zo.default.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Gi("branch",r,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function RL({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let o=new J(t),l=await re({fsp:o,dotgit:r});return await PL({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}async function ou(t,e,r){let i=r.split("/");i.pop();let n=e;for(let s of i){if(s===""||s===".")continue;n=`${n}/${s}`;let a=await t.lstat(n);if(a&&a.isSymbolicLink())throw new va(r)}}var aS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Kg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(_){v="0000000000000000000000000000000000000000"}let b;try{b=await q.resolve({fs:t,gitdir:s,ref:o})}catch(_){if(o==="HEAD")throw _;let C=`${a}/${o}`;if(b=await q.resolve({fs:t,gitdir:s,ref:C}),h){let x=await ht.get({fs:t,gitdir:s});await x.set(`branch.${o}.remote`,a),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await ht.save({fs:t,gitdir:s,config:x})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:b})}if(!c){let _;try{_=await $L({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof Ve&&w.data.what===b?new Yc(o,b):w}let C=_.filter(([w])=>w==="conflict").map(([w,E])=>E);if(C.length>0)throw new zc(C);let x=_.filter(([w])=>w==="error").map(([w,E])=>E);if(x.length>0)throw new he(x.join(", "));if(f){i&&await i({previousHead:v,newHead:b,type:l!=null&&l.length>0?"file":"branch"});return}let S=0,A=_.length;if(await dt.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(_.filter(([E])=>E==="delete"||E==="delete-index").map(async function([E,y]){let P=`${n}/${y}`;E==="delete"&&await t.rm(P),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++S,total:A})}))}),await dt.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[E,y]of
Line truncated
|
||||
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
|
||||
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i}
|
||||
`);return{cleanMerge:h,mergedText:d}}async function lS({fs:t,cache:e,dir:r,gitdir:i=B(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Fr({ref:s}),g=Fr({ref:a}),v=Fr({ref:o}),b=[],_=[],C=[],x=[],S=await Zn({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,E,y]){let P=vd(A),T=await xd(w,E),I=await xd(y,E);switch(`${T}-${I}`){case"false-false":return{mode:await E.mode(),path:P,oid:await E.oid(),type:await E.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:P,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return DL({fs:t,gitdir:i,path:P,ours:w,base:E,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async L=>{if(L.cleanMerge)d||n.insert({filepath:A,oid:L.mergeResult.oid,stage:0});else if(b.push(A),_.push(A),!d){let H="";E&&await E.type()==="blob"&&(H=await E.oid());let te=await w.oid(),xe=await y.oid();n.delete({filepath:A}),H&&n.insert({filepath:A,oid:H,stage:1}),n.insert({filepath:A,oid:te,stage:2}),n.insert({filepath:A,oid:xe,stage:3})}return L.mergeResult});if(E&&!w&&y&&await E.type()==="blob"&&await y.type()==="blob"){if(b.push(A),C.push(A),!d){let L=await E.oid(),H=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:L,stage:1}),n.insert({filepath:A,oid:H,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:P}}if(E&&w&&!y&&await E.type()==="blob"&&await w.type()==="blob"){if(b.push(A),x.push(A),!d){let L=await E.oid(),H=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:L,stage:1}),n.insert({filepath:A,oid:H,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:P}}if(E&&!w&&!y&&(await E.type()==="blob"||await E.type()==="tree"))return;throw new Yo}}},reduce:b.length!==0&&(!r||d)?void 0:async(A,w)=>{let E=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&E.length===0&&A.path!==".")){if(E.length>0||A.path==="."&&E.length===0){let P=new Mr(E).toObject(),T=await Or({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});A.oid=T}return A}}});return b.length!==0?(r&&!d&&await Zn({fs:t,cache:e,dir:r,gitdir:i,trees:[Fr({ref:S.oid})],map:async function(A,[w]){let E=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),P=await w.content();await t.write(E,P,{mode:y})}return!0}}),new ba(b,_,C,x)):S.oid}async function DL({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=ML}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=k.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=k.from(await i.content()).toString("utf8"),b=k.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:C}=await u({branches:[l,a,o],contents:[p,v,b],path:r}),x=await Or({fs:t,gitdir:e,type:"blob",object:k.from(_,"utf8"),dryRun:c});return{cleanMerge:C,mergeResult:{mode:g,path:r,oid:x,type:f}}}var OL={stage:tl,workdir:cu},Fg;async function Qo(t,e){return Fg===void 0&&(Fg=new Vo.default),Fg.acquire(t,e)}async function LL(t,e,r,i,n=null){let s=B(r,i),a=await t.lstat(s);if(!a)throw new Ve(s);if(a.isDirectory())throw new he(`${s}: file expected, but found directory`);let o=n?await ZE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(eS):await t.read(s);if(c===null)throw new Ve(s);l=await Or({fs:t,gitdir:e,type:"blob",object:c})}),l}async function NL({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await du({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await LL(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function FE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?OL[h]():h),a=[],u=await Zn({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Is.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),pa
Line truncated
|
||||
`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ma===null&&(ma=new Vo.default);let n=B(r,"shallow");if(i.size>0){let s=[...i].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"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>n+"/"+s);for(let s of a)await e.mkdir(s);await e.write(n+"/config",`[core]
|
||||
`;await ma.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ma.acquire(n,async function(){await e.rm(n)})}};async function jL({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function VL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(B(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Zg({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new he(l.error);if(l.offsets.has(i))return!0}return!1}async function BE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>tt({fs:t,cache:e,gitdir:r,oid:o}),a=await jL({fs:t,gitdir:r,oid:i});return a||(a=await VL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function Sd({config:t,onAuth:e}){return e&&(async(r,i)=>{let n=i.username||await t.get(`credential.${r}.username`);return e(r,n?{...i,username:n}:i)})}function zL(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function fS(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Rd={name:"isomorphic-git",version:"1.40.0",agent:"git/isomorphic-git@1.40.0"},jo=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function WL(t){let e=t.indexOf("\r"),r=t.indexOf(`
|
||||
`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function dS(t){let e=new jo,r="";return(async()=>(await hu(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=WL(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var kd=class{static demux(e){let r=ot.streamReader(e),i=new jo,n=new jo,s=new jo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function qL(t){let{packetlines:e,packfile:r,progress:i}=kd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{hu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Rs(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Rs(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function YL({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(ot.encode(`want ${c}${l}
|
||||
`)),l="";for(let c of i)o.push(ot.encode(`shallow ${c}
|
||||
`));n!==null&&o.push(ot.encode(`deepen ${n}
|
||||
`)),s!==null&&o.push(ot.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
||||
`));for(let c of a)o.push(ot.encode(`deepen-not ${c}
|
||||
`));o.push(ot.flush());for(let c of r)o.push(ot.encode(`have ${c}
|
||||
`));return o.push(ot.encode(`done
|
||||
`)),o}async function Xg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:b=!1,tags:_=!1,singleBranch:C=!1,headers:x={},prune:S=!1,pruneTags:A=!1}){let w=c||await Ds({fs:t,gitdir:l,test:!0}),E=await ht.get({fs:t,gitdir:l}),y=f||w&&await E.get(`branch.${w}.remote`)||"origin",P=d||await E.get(`remote.${y}.url`);if(typeof P=="undefined")throw new Ir("remote OR url");let T=u||w&&await E.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await E.get("http.corsProxy"));let I=el.getRemoteHelperFor({url:P}),L=await I.discover({http:r,onAuth:Sd({config:E,onAuth:s}),onAuthSuccess:a,onAuthFailure:Sd({config:E,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:P,headers:x,protocolVersion:1}),H=L.auth,te=L.refs;if(te.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!L.capabilities.has("shallow"))throw new Ps("shallow","depth");if(g!==null&&!L.capabilities.has("deepen-since"))throw new Ps("deepen-since","since");if(v.length>0&&!L.capabilities.has("deepen-not"))throw new Ps("deepen-not","exclude");if(b===!0&&!L.capabilities.has("deepen-relative"))throw new Ps("deepen-relative","relative");let{oid:xe,fullref:Z}=q.resolveAgainstMap({ref:T,map:te});for(let N of te.keys())N===Z||N==="HEAD"||N.startsWith("refs/heads/")||_&&N.startsWith("refs/tags/")||te.delete(N);let K=fS([...L.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Rd.agent}`]);b&&K.push("deepen-relative");let ce=C?[xe]:te.values(),pe=C?[w]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),W=[];for(let N of pe)try{N=await q.expand({fs:t,gitdir:l,ref:N});let O=await q.resolve({fs:t,gitdir:l,ref:N});await BE({fs:t,cache:e,gitdir:l,oid:O})&&W.push(O)}catch(O){}W=[...new Set(W)];let X=await Ea.read({fs:t,gitdir:l}),G=L.capabilities.has("shallow")?[...X]:[],Be=YL({capabilities:K,wants:ce,haves:W,shallows:G,depth:p,since:g,exclude:v}),pr=k.from(await Ed(Be)),Ut=await I.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:H,body:[pr],headers:x}),Ie=await qL(Ut.body);Ut.headers&&(Ie.headers=Ut.headers);for(let N of Ie.shallows)if(!X.has(N))try{let{object:O}=await tt({fs:t,cache:e,gitdir:l,oid:N}),ue=new Dr(O),$e=await Promise.all(ue.headers().parent.map(Tr=>BE({fs:t,cache:e,gitdir:l,oid:Tr})));$e.length===0||$e.every(Tr=>Tr)||X.add(N)}catch(O){X.add(N)}for(let N of Ie.unshallows)X.delete(N);if(await Ea.write({fs:t,gitdir:l,oids:X}),C){let N=new Map([[Z,xe]]),O=new Map,ue=10,$e=Z;for(;ue--;){let go=L.symrefs.get($e);if(go===void 0)break;O.set($e,go),$e=go}let Gt=te.get($e);Gt&&N.set($e,Gt);let{pruned:Tr}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:N,symrefs:O,tags:_,prune:S});S&&(Ie.pruned=Tr)}else{let{pruned:N}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:te,symrefs:L.symrefs,tags:_,prune:S,pruneTags:A});S&&(Ie.pruned=N)}if(Ie.HEAD=L.symrefs.get("HEAD"),Ie.HEAD===void 0){let{oid:N}=q.resolveAgainstMap({ref:"HEAD",map:te});for(let[O,ue]of te.entries())if(O!=="HEAD"&&ue===N){Ie.HEAD=O;break}}let Rt=Z.startsWith("refs/tags")?"tag":"branch";if(Ie.FETCH_HEAD={oid:xe,description:`${Rt} '${ga(Z)}' of ${P}`},i||n){let N=dS(Ie.progress);hu(N,async O=>{if(n&&await n(O),i){let ue=O.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ue&&await i({phase:ue[1].trim(),loaded:parseInt(ue[2],10),total:parseInt(ue[3],10)})}})}let $t=k.from(await Ed(Ie.packfile));if(Ut.body.error)throw Ut.body.error;let Xe=$t.slice(-20).toString("hex"),ee={defaultBranch:Ie.HEAD,fetchHead:Ie.FETCH_HEAD.oid,fetchHeadDescription:Ie.FETCH_HEAD.description};if(Ie.headers&&(ee.headers=Ie.headers),S&&(ee.pruned=Ie.pruned),Xe!==""&&!zL($t)){ee.packfile=`objects/pack/pack-${Xe}.pack`;let N=B(l,ee.packfile);await t.write(N,$t);let O=$e=>tt({fs:t,cache:e,gitdir:l,oid:$e}),ue=await jc.fromPack({pack:$t,getExternalRefDelta:O,onProgress:i});await t.write(N.replace(/\.pack$/,".idx"),await ue.toBuffer())}return ee}async function hS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:B(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = ${t}
|
||||
`+(t?"":` logallrefupdates = true
|
||||
bare = ${e}
|
||||
`+(e?"":` 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/pack/${o}`,l=await Ap({fs:e,cache:t,filename:c,getExternalRefDelta:i});if(l.error)throw new le(l.error);for(let u of l.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function CO({fs:e,cache:t,gitdir:r,oid:n}){let i=o=>We({fs:e,cache:t,gitdir:r,oid:o}),a=await kO({fs:e,gitdir:r,oid:n}),s=await TO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new rl("oids",n,a):new Ne(`an object matching "${n}"`)}async function PO({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await CO({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function RO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("gitdir",r),C("ref",n),await q.expand({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}asyn
Line truncated
|
||||
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
|
||||
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
|
||||
`);return{cleanMerge:h,mergedText:d}}async function 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},async w=>OO({fs:e,cache:t,dir:r,gitdir:n,index:w,ourOid:y,theirOid:b,baseOid:E,ourName:oa(i),baseName:"base",theirName:oa(a),dryRun:c,abortOnConflict:u,mergeDriver:v}));if(_ instanceof ps)throw _;return f||(f=`Merge branch '${oa(a)}' into ${oa(i)}`),{oid:await yu({fs:e,cache:t,gitdir:n,message:f,ref:i,tree:_,parent:[y,b],author:d,committer:h,signingKey:p,onSign:m,dryRun:c,noUpdateBranch:l}),tree:_,mergeCommit:!0}}}async function _2({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:c,gitdir:l,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:m,fastForward:v,fastForwardOnly:y,corsProxy:b,singleBranch:x,headers:E,author:_,committer:k,signingKey:w}){try{if(!u){let T=await fa({fs:e,gitdir:l});if(!T)throw new Qt("ref");u=T}let{fetchHead:A,fetchHeadDescription:S}=await Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:
Line truncated
|
||||
`)),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"),oids:i}){let a=new Ep.default,s=[];function o(u,f){let d=Buffer.from(u,f);s.push(d),a.update(d)}async function c({stype:u,object:f}){let d=d8[u],h=f.length,p=h>15?128:0,m=h&15;h=h>>>4;let v=(p|d|m).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o(Sp(2,v),"hex"),h=h>>>7;o(Buffer.from(await c2(f)))}o("PACK"),o("00000002","hex"),o(Sp(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await We({fs:e,cache:t,gitdir:n,oid:u});await c({write:o,object:d,stype:f})}let l=a.digest();return s.push(l),s}async function h8({fs:e,cache:t,gitdir:r,oids:n,write:i}){let a=await T2({fs:e,cache:t,gitdir:r,oids:n}),s=Buffer.from(await fu(a)),c=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await e.write($(r,`objects/pack/${c}`),s),{filename:c}):{filename:c,packfile:new Uint8Array(s)}}async function p8({fs:e,dir:t,gitdir:r=$(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return C("fs",e),C("gitdir",
Line truncated
|
||||
`),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 by 'isomorphic-git removeNote'
|
||||
`,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 function D8({fs:e,cache:t,gitdir:r}){let n;try{n=await q.resolve({fs:e,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Ne)return[]}let{tree:i}=await Ss({fs:e,cache:t,gitdir:r,oid:n});return i}async function N8({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{C("fs",e),C("gitdir",r),C("ref",n);let c=new X(e);return await ys({fs:c,cache:s,dir:t,gitdir:r,trees:[wi({ref:n}),vu(),gu()],map:async function(l,[u,f,d]){if(!u&&!d&&f&&!o&&await ws.isIgnored({fs:c,dir:t,filepath:l})||!i.some(k=>m2(l,k)))return null;if(a&&!a(l))return;let[h,p,m]=await Promise.all([u&&u.type(),f&&f.type(),d&&d.type()]),v=[h,p,m].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((p==="tree"||p==="special")&&!v)return;if(m==="commit")return null;if((m==="tree"||m==="special")&&!v)return;let y=h==="blob"?await u.oid():void 0,b=m==="blob"?a
Line truncated
|
||||
`){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:()=>Ps,RemoteLineParser:()=>Si,append:()=>ke,appendTaskOptions:()=>nm,asArray:()=>_n,asCamelCase:()=>kb,asFunction:()=>bb,asNumber:()=>Ie,asStringArray:()=>Tb,bufferToString:()=>El,callTaskParser:()=>Hp,createInstanceConfig:()=>Ob,delay:()=>Np,filterArray:()=>Rl,filterFunction:()=>Pb,filterHasLength:()=>rm,filterPlainObject:()=>tm,filterPrimitives:()=>em,filterString:()=>Pt,filterStringArray:()=>Rb,filterStringOrStringArray:()=>Mu,filterType:()=>xn,first:()=>Sb,folderExists:()=>Qp,forEachLineWithContent:()=>Jp,getTrailingOptions:()=>rr,including:()=>Ab,isUserFunction:()=>_b,last:()=>ma,objectToString:()=>Pl,orVoid:()=>jp,parseStringResponse:()=>ir,pick:()=>Cb,prefixedArray:()=>Sl,remove:()=>Du,splitOn:()=>xb,toLinesWithContent:()=>Cl,trailingFunctionArgument:()=>Je,trailingOptionsArgument:()=>im});var oe=W({"src/lib/utils/index.ts"(){"use strict";Mb(),SI(),EI(),AI(),kI(),CI(),PI(),Nu()}}),$b=
Line truncated
|
||||
`)){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}withProgress(e){return this._queue.get(e)}createProgress(e){let t=Eu.getName(e.commands[0]),r=um(this.logLabel,t);return{task:e,logger:r,name:t}}push(e){let t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:r}]of Array.from(this._queue.entries()))t===e.task?(r.info("Failed %o",e),r("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):r.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(t);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new yr(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"
Line truncated
|
||||
`).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(Ee(L,Y),h(arguments))},G.prototype.deleteLocalBranch=function(L,Y,ye){return this._runTask(x(L,typeof Y=="boolean"?Y:!1),h(arguments))},G.prototype.deleteLocalBranches=function(L,Y,ye){return this._runTask(b(L,typeof Y=="boolean"?Y:!1),h(arguments))},G.prototype.branch=function(L,Y){return this._runTask(v(d(arguments)),h(arguments))},G.prototype.branchLocal=function(L){return this._runTask(y(),h(arguments))},G.prototype.raw=function(L){let Y=!Array.isArray(L),ye=[].slice.call(Y?arguments:L,0);for(let vt=0;vt<ye.length&&Y;vt++)if(!c(ye[vt])){ye.splice(vt,ye.length-vt);break}ye.push(...d(arguments,0,!0));var De=h(arguments);return ye.length?this._runTask($e(ye,this._trimmed),De):this._runTask(a("Raw: must supply one or more command to execute"),De)},G.prototype.submoduleAdd=function(L,Y,ye){return this._runTask(N(L,Y),h(arguments))},G.prototype.submoduleUpdate=function(L,Y){return this._runTas
Line truncated
|
||||
`),await t.write(i+"/HEAD",`ref: refs/heads/${n}
|
||||
`)}async function ZL({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:b,relative:_,singleBranch:C,noCheckout:x,noTags:S,headers:A,nonBlocking:w,batchSize:E=100}){try{if(await hS({fs:t,gitdir:u}),await sS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await ht.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await ht.save({fs:t,gitdir:u,config:T})}let{defaultBranch:y,fetchHead:P}=await Xg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:b,relative:_,singleBranch:C,headers:A,tags:!S});if(P===null)return;h=h||y,h=h.replace("refs/heads/",""),await Kg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:x,nonBlocking:w,batchSize:E})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function KL({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:b=!1,singleBranch:_=!1,noCheckout:C=!1,noTags:x=!1,headers:S={},cache:A={},nonBlocking:w=!1,batchSize:E=100}){try{R("fs",t),R("http",e),R("gitdir",c),C||R("dir",l),R("url",u);let y=new J(t),P=await re({fsp:y,dotgit:c});return await ZL({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:b,singleBranch:_,noCheckout:C,noTags:x,headers:S,nonBlocking:w,batchSize:E})}catch(y){throw y.caller="git.clone",y}}async function XL({fs:t,onSign:e,dir:r,gitdir:i=B(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:g={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let v=new J(t),b=await re({fsp:v,dotgit:i});return await uu({fs:v,cache:g,onSign:e,gitdir:b,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(v){throw v.caller="git.commit",v}}async function QL({fs:t,dir:e,gitdir:r=B(e,".git"),fullname:i=!1,test:n=!1}){try{R("fs",t),R("gitdir",r);let s=new J(t),a=await re({fsp:s,dotgit:r});return await Ds({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function JL({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:t,gitdir:e,ref:r}))throw new Ve(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Ds({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await q.resolve({fs:t,gitdir:e,ref:n});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:n});let a=ga(r),o=await ht.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await ht.save({fs:t,gitdir:e,config:o})}async function eN({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new J(t),s=await re({fsp:n,dotgit:r});return await JL({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function tN({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new J(t),s=await re({fsp:n,dotgit:r});await q.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function rN({fs:t,gitdir:e,remote:r}){let i=await ht.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await ht.save({fs:t,gitdir:e,config:i})}async function iN({fs:t,dir:e,gitdir:r=B(e,".git"),remote:i}){try{R("fs",t),R("remote",i);let n=new J(t),s=await re({fsp:n,dotgit:r});return await rN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function nN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:t,gitdir:e,ref:r})}async function sN({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new J(t),s=await re({fsp:n,dotgit:r});return await nN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function aN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function oN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(B(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Zg({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new he(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function lN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>tt({fs:t,cache:e,gitdir:r,oid:o}),s=await aN({fs:t,gitdir:r,oid:i}),a=await oN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Vc("oids",i,s):new Ve(`an object matching "${i}"`)}as
Line truncated
|
||||
`)),i.push(ot.encode(`agent=${Rd.agent}
|
||||
`)),(r||e||t)&&i.push(ot.delim()),r&&i.push(ot.encode("peel")),e&&i.push(ot.encode("symrefs")),t&&i.push(ot.encode(`ref-prefix ${t}`)),i.push(ot.flush()),i}async function LN({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let d=await Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return vS(d,c,u,f);let h=await ON({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return DN(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function NN({fs:t,dir:e,gitdir:r=B(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new J(t),n=await re({fsp:i,dotgit:r});return q.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function BN(t,e){return t.committer.timestamp-e.committer.timestamp}var HN="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function HE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===HN)return;let s=i,a,o=await Xo({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await _S({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function _S({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=B(o,c.path),a.push(u)):c.type==="tree"&&(u=tt({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return _S({fs:t,cache:e,gitdir:r,tree:Mr.from(f),fileId:n,oid:s,filepaths:a,parentPath:B(o,c.path)})})),u});return await Promise.all(l),a}async function UN({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c}){let u=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),f=[],d=await Ea.read({fs:t,gitdir:r}),h=await q.resolve({fs:t,gitdir:r,ref:n}),p=[await wn({fs:t,cache:e,gitdir:r,oid:h})],g,v,b;function _(C){b&&i&&f.push(C)}for(;p.length>0;){let C=p.pop();if(u!==void 0&&C.commit.committer.timestamp<=u)break;if(i){let x;try{x=await fu({fs:t,cache:e,gitdir:r,oid:C.commit.tree,filepath:i}),v&&g!==x&&f.push(v),g=x,v=C,b=!0}catch(S){if(S instanceof Ve){let A=l&&g;if(A&&(A=await HE({fs:t,cache:e,gitdir:r,oid:C.commit.tree,fileId:g}),A))if(Array.isArray(A)){if(v){let w=await HE({fs:t,cache:e,gitdir:r,oid:v.commit.tree,fileId:g});if(Array.isArray(w))if(A=A.filter(E=>w.indexOf(E)===-1),A.length===1)A=A[0],i=A,v&&f.push(v);else{A=!1,v&&f.push(v);break}}}else i=A,v&&f.push(v);if(!A){if(b&&g&&(f.push(v),!o))break;if(!o&&!l)throw S}v=C,b=!1}else throw S}}else f.push(C);if(s!==void 0&&f.length===s){_(C);break}if(!d.has(C.oid))for(let x of C.commit.parent){let S=await wn({fs:t,cache:e,gitdir:r,oid:x});p.map(A=>A.oid).includes(S.oid)||p.push(S)}p.length===0&&_(C),p.sort((x,S)=>BN(x.commit,S.commit))}if(c)for(let C of f)C.commit.changes=await GN({fs:t,cache:e,gitdir:r,commit:C,shallow:d.has(C.oid)});return f}async function GN({fs:t,cache:e,gitdir:r,commit:i,shallow:n}){let s=n||!i.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":i.commit.parent[0];return Zn({fs:t,cache:e,gitdir:r,trees:[Fr({ref:i.oid}),Fr({ref:s})],map:async(a,[o,l])=>{let[c,u]=await Promise.all([o&&o.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),a]:void 0;if(u==="tree")return c?[await o.oid(),null,a]:void 0;let[f,d]=await Promise.all([o?o.oid():null,l?l.oid():null]);if(f!==d)return[f,d,a]}})}async function jN({fs:t,dir:e,gitdir:r=B(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,includeChanges:c=!1,cache:u={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let f=new J(t),d=await re({fsp:f,dotgit:r});return await UN({fs:f,cache:u,gitdir:d,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c})}catch(f){throw f.caller="git.log",f}}async function VN({fs:t,onSign:e,dir:r,gitdir:i=B(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:b=!1}){try{R("fs",t),p&&R("onSign",e);let _=new J(t),C=await re({fsp:_,dotgit:i}),x=await Ms({fs:_,gitdir:C,author:d});if(!x&&(!o||!a))throw new Kt("author");let S=await xa({fs:_,gitdir:C,author:x,committer:h});if(!S&&(!o||!a))throw new Kt("committer");return await pS({fs:_,cache:g,dir:r,gitdir:C,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:x,committer:S,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}var zN={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function yS({fs:t,cache:e,dir:r,gitdir:i=B(r,".git"),oids:n}){let s=new Yg.default,a=[];function o(u,f){let d=k.from(u,f);a.push(d),s.update(d)}as
Line truncated
|
||||
`),n=await i();let s=r.toString("utf8").split(`
|
||||
`);if(n=s.shift(),!n.startsWith("unpack "))throw new ya('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function XN({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(ot.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i}
|
||||
`)),i="";return r.push(ot.flush()),r}async function QN({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={}}){let _=u||await Ds({fs:t,gitdir:c});if(typeof _=="undefined")throw new Ir("ref");let C=await ht.get({fs:t,gitdir:c});d=d||await C.get(`branch.${_}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${_}.remote`)||"origin";let x=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof x=="undefined")throw new Ir("remote OR url");let S=f||await C.get(`branch.${_}.merge`);if(typeof x=="undefined")throw new Ir("remoteRef");v===void 0&&(v=await C.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:_}),w=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),E=el.getRemoteHelperFor({url:x}),y=await E.discover({http:r,onAuth:Sd({config:C,onAuth:s}),onAuthSuccess:a,onAuthFailure:Sd({config:C,onAuth:o}),corsProxy:v,service:"git-receive-pack",url:x,headers:b,protocolVersion:1}),P=y.auth,T;if(!S)T=A;else try{T=await q.expandAgainstMap({ref:S,map:y.refs})}catch(X){if(X instanceof Ve)T=S.startsWith("refs/")?S:`refs/heads/${S}`;else throw X}let I=y.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:T,oid:I}}))throw new Ko;let L=!y.capabilities.has("no-thin"),H=new Set;if(!g){let X=[...y.refs.values()],G=new Set;if(I!=="0000000000000000000000000000000000000000"){let Be=await Qg({fs:t,cache:e,gitdir:c,oids:[w,I]});for(let pr of Be)X.push(pr);L&&(G=await Dg({fs:t,cache:e,gitdir:c,oids:Be}))}if(!X.includes(w)){let Be=await ZN({fs:t,cache:e,gitdir:c,start:[w],finish:X});H=await Dg({fs:t,cache:e,gitdir:c,oids:Be})}if(L){try{let Be=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:pr}=await q.resolveAgainstMap({ref:Be.replace(`refs/remotes/${d}/`,""),fullref:Be,map:y.refs}),Ut=[pr];for(let Ie of await Dg({fs:t,cache:e,gitdir:c,oids:Ut}))G.add(Ie)}catch(Be){}for(let Be of G)H.delete(Be)}if(w===I&&(p=!0),!p){if(A.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Zo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await wS({fs:t,cache:e,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new Zo("not-fast-forward")}}let te=fS([...y.capabilities],["report-status","side-band-64k",`agent=${Rd.agent}`]),xe=await XN({capabilities:te,triplets:[{oldoid:I,oid:w,fullRef:T}]}),Z=g?[]:await yS({fs:t,cache:e,gitdir:c,oids:[...H]}),K=await E.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:x,auth:P,headers:b,body:[...xe,...Z]}),{packfile:ce,progress:pe}=await kd.demux(K.body);if(n){let X=dS(pe);hu(X,async G=>{await n(G)})}let W=await KN(ce);if(K.headers&&(W.headers=K.headers),d&&W.ok&&W.refs[T].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:X}):await q.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(W.ok&&Object.values(W.refs).every(X=>X.ok))return W;{let X=Object.entries(W.refs).filter(([G,Be])=>!Be.ok).map(([G,Be])=>`
|
||||
- ${G}: ${Be.error}`).join("");throw new Qc(X,W)}}async function JN({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={},cache:_={}}){try{R("fs",t),R("http",e),R("gitdir",c);let C=new J(t),x=await re({fsp:C,dotgit:c});return await QN({fs:C,cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:x,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:b})}catch(C){throw C.caller="git.push",C}}async function xS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await tt({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Jr.from(s).parse().object,xS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new br(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function ES({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await fu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await xS({fs:t,cache:e,gitdir:r,oid:i})}async function pu({fs:t,dir:e,gitdir:r=B(e,".git"),oid:i,filepath:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new J(t),o=await re({fsp:a,dotgit:r});return await ES({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function SS({fs:t,dir:e,gitdir:r=B(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new J(t),a=await re({fsp:s,dotgit:r});return await wn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function eB({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await q.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await ES({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function tB({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oid",n);let a=new J(t),o=await re({fsp:a,dotgit:r});return await eB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function rB({fs:t,dir:e,gitdir:r=B(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let l=new J(t),c=await re({fsp:l,dotgit:r});s!==void 0&&(i=await fu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await tt({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Dr.from(f.object).parse();break;case"tree":f.object=Mr.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Jr.from(f.object).parse();break;default:throw new br(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function iB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await tt({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new br(i,n,"tag");let a=Jr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function nB({fs:t,dir:e,gitdir:r=B(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new J(t),a=await re({fsp:s,dotgit:r});return await iB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function sB({fs:t,dir:e,gitdir:r=B(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new J(t),o=await re({fsp:a,dotgit:r});return await rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function aB({fs:t,dir:e,gitdir:r=B(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new J(t),a=await re({fsp:s,dotgit:r});await dt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function oB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof Ve))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await du({fs:t,gitdir:i,tree:f});return await uu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
||||
`,author:a,committer:o,signingKey:l})}async function lB({fs:t,onSign:e,dir:r,gitdir:i=B(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",i),R("oid",s);let u=new J(t),f=await re({fsp:u,dotgit:i}),d=await Ms({fs:u,gitdir:f,author:a});if(!d)throw new Kt("author");let h=await xa({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Kt("committer");return await oB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function cB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!au(i,!0))throw new ji(i,zo.default.clean(i));if(!au(r,!0))throw new ji(r,zo.default.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Gi("branch",i,!1);let l=await q.resolve({fs:t,gitdir:e,ref:s,depth:1});await q.writeRef({fs:t,gitdir:e,ref:a,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:s});let u=await Ds({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function uB({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oldref",n);let a=new J(t),o=await re({fsp:a,dotgit:r});return await cB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function kS({gitdir:t,type:e,object:r}){return bn($s.wrap({type:e,object:r}))}async function fB({fs:t,dir:e,gitdir:r=B(e,".git"),filepath:i,ref:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new J(t),o=await re({fsp:a,dotgit:r}),l,c;try{l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await fu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(B(e,i));f&&(c=await kS({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(B(e,i)))),await dt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function dB({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i,depth:n}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new J(t),a=await re({fsp:s,dotgit:r});return await q.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function hB({fs:t,dir:e,gitdir:r=B(e,".git"),path:i,value:n,append:s=!1}){try{R("fs",t),R("gitdir",r),R("path",i);let a=new J(t),o=await re({fsp:a,dotgit:r}),l=await ht.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await ht.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function CS({fs:t,gitdir:e,commit:r}){let i=Dr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Cd=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i}
|
||||
`}static getStashReflogEntry(e,r=!1){return e.split(`
|
||||
`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},Sa=class t{constructor({fs:e,dir:r,gitdir:i=B(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return B(this.gitdir,t.refStash)}get refLogsStashPath(){return B(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ms({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Kt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return CS({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new ji(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?wn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Cd.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Cd.getStashReflogEntry(r,e)}};async function AS({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Sa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Ds({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await SS({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Fr({ref:"HEAD"}),d=await FE({fs:t,dir:e,gitdir:r,treePair:[Fr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=tl()}let h=await FE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new Ve("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function pB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await AS({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await oS({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function mB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await AS({fs:t,dir:e,gitdir:r,message:i});return n}async function TS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Sa({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o<a.length-1;o++){let c=(await wn({fs:t,cache:{},gitdir:r,oid:a[o+1]})).commit.message.startsWith("stash-Index");await cS({fs:t,dir:e,gitdir:r,stashCommit:a[o+1],parentCommit:a[o],wasStaged:c})}}async function PS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let n=new Sa({fs:t,dir:e,gitdir:r});if(!(await n.readStashCommit(i)).commit)return;let a=n.refStashPath;await Qo(a,async()=>{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(`
|
||||
`)+`
|
||||
`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function gB({fs:t,dir:e,gitdir:r}){return new Sa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function vB({fs:t,dir:e,gitdir:r}){let i=new Sa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function wB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await TS({fs:t,dir:e,gitdir:r,refIdx:i}),await PS({fs:t,dir:e,gitdir:r,refIdx:i})}async function bB({fs:t,dir:e,gitdir:r=B(e,".git"),op:i="push",message:n="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",r),R("op",i);let a={push:pB,apply:TS,drop:PS,list:gB,clear:vB,pop:wB,create:mB},o=["apply","drop","pop"];try{let l=new J(t),c=await re({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>B(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new ji(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function _B({fs:t,dir:e,gitdir:r=B(e,".git"),filepath:i,cache:n={},refresh:s=!0}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new J(t),o=await re({fsp:a,dotgit:r});if(await Is.isIgnored({fs:a,gitdir:o,dir:e,filepath:i}))return"ignored";let c=await yB({fs:a,cache:n,gitdir:o}),u=await RS({fs:a,cache:n,gitdir:o,tree:c,path:i}),f=await dt.acquire({fs:a,gitdir:o,cache:n},async function(b){for(let _ of b)if(_.path===i)return _;return null}),d=await a.lstat(B(e,i)),h=u!==null,p=f!==null,g=d!==null,v=async()=>{if(p&&!gd(f,d))return f.oid;{let b=await a.read(B(e,i)),_=await kS({gitdir:o,type:"blob",object:b});return s&&p&&f.oid===_&&d.size!==-1&&dt.acquire({fs:a,gitdir:o,cache:n},async function(C){C.insert({filepath:i,stats:d,oid:_})}),_}};if(!h&&!g&&!p)return"absent";if(!h&&!g&&p)return"*absent";if(!h&&g&&!p)return"*added";if(!h&&g&&p)return await v()===f.oid?"added":"*added";if(h&&!g&&!p)return"deleted";if(h&&!g&&p)return u===f.oid,"*deleted";if(h&&g&&!p)return await v()===u?"*undeleted":"*undeletemodified";if(h&&g&&p){let b=await v();return b===u?b===f.oid?"unmodified":"*unmodified":b===f.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function RS({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await tt({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Mr.from(l);return RS({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new br(a.oid,o,"blob",n.join("/"))}return null}async function yB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof Ve)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function xB({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1,refresh:l=!0}){try{R("fs",t),R("gitdir",r),R("ref",i);let c=new J(t),u=await re({fsp:c,dotgit:r});return await Zn({fs:c,cache:a,dir:e,gitdir:u,trees:[Fr({ref:i}),cu({refresh:l}),tl()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!o&&await Is.isIgnored({fs:c,dir:e,filepath:f})||!n.some(E=>aS(f,E)))return null;if(s&&!s(f))return;let[g,v,b]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),_=[g,v,b].includes("blob");if((g==="tree"||g==="special")&&!_)return;if(g==="commit")return null;if((v==="tree"||v==="special")&&!_)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!_)return;let C=g==="blob"?await d.oid():void 0,x=b==="blob"?await p.oid():void 0,S;g!=="blob"&&v==="blob"&&b!=="blob"?S="42":v==="blob"&&(S=await h.oid());let A=[void 0,C,S,x],w=A.map(E=>A.indexOf(E));return w.shift(),[f,...w]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function EB({fs:t,dir:e,gitdir:r=B(e,".git"),ref:i,object:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let a=new J(t);if(i===void 0)throw new Ir("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await re({fsp:a,dotgit:r}),l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await q.exists({fs:a,gitdir:o,ref:i}))throw new Gi("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function SB({fs:t,dir:e,gitdir:r=B(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{R("fs",t),R("gitdir",r),R("filepath",n);let u=new J(t),f=await re({fsp:u,dotgit:r});if(l)return await dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(B(e,n));if(p){if(p.isDirectory())throw new Fs("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(B(e,n)),!d)throw new Ve(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Fs("directory")}return await dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o
Line truncated
|
||||
|
||||
PROMPT="$1"
|
||||
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
|
||||
@@ -124,245 +125,245 @@ 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[t,r.length===0?void 0:r.join("/")]}function Tn(e){return e.endsWith("/")?e:e.split("/").last().replace(".md","")}function Vl(e){return e===1?"1 minute":`${e} minutes`}function Cj(e){let t=e.lastIndexOf(".");return e.substring(t+1)}function Vs(e){if(e.endsWith(".md"))return!1;let t=Cj(e);return xx.includes(t)}g();var pT=require("obsidian"),Ws=class{constructor(t){this.plugin=t,this.app=t.app}getRelativeVaultPath(t){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+t:t}getRelativeRepoPath(t,r=!0){return r&&this.plugin.settings.basePath.length>0?t.substring(this.plugin.settings.basePath.length+1):t}unload(){}_getTreeStructure(t,r=0){let n=[];for(t=[...t];t.length>0;){let i=t.first(),a=i.path.substring(r);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=t.filter(l=>l.path.substring(r).startsWith(s+"/"));o.forEach(l=>t.remove(l));let c=i.path.substring(0,a.indexOf("
Line truncated
|
||||
`):i="Too many files to list",t=t+`
|
||||
`,IS=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var mu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],S=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(S){let E=S.oldPos-_;A=S&&0<=E&&E<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<S.oldPos?C=this.addToPath(S,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+1>=o&&(g=Math.max(g,_+1))}c++};if(n)(function _(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);b()||_()},0)})();else for(;c<=u&&Date.now()<=d;){let _=b();if(_)return _}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1<a&&l+1<o&&this.equals(i[l+1],r[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,r,i){return i.comparator?i.comparator(e,r):e===r||!!i.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r}castInput(e,r){return e}tokenize(e,r){return Array.from(e)}join(e){return e.join("")}postProcess(e,r){return e}get useLongestToken(){return!1}buildValues(e,r,i){let n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let a=n.length,o=0,l=0,c=0;for(;o<a;o++){let u=n[o];if(u.removed)u.value=this.join(i.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=r.slice(l,l+u.count);f=f.map(function(d,h){let p=i[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var tv=class extends mu{constructor(){super(...arguments),this.tokenize=OB}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
|
||||
`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(`
|
||||
`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
||||
`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},DB=new tv;function rv(t,e,r){return DB.diff(t,e,r)}function OB(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||||
`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n<i.length;n++){let s=i[n];n%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}m();function LB(t){for(let e=0;e<t.length;e++)if(t[e]<" "||t[e]>"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Ns(t){if(!LB(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i<r.length;){let n=r[i];n===7?e+="\\a":n===8?e+="\\b":n===9?e+="\\t":n===10?e+="\\n":n===11?e+="\\v":n===12?e+="\\f":n===13?e+="\\r":n===34?e+='\\"':n===92?e+="\\\\":n>=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var iv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function nv(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;rv(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(rv(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(_){return _.map(function(C){return" "+C})}let d=[],h=0,p=0,g=[],v=1,b=1;for(let _=0;_<u.length;_++){let C=u[_],x=C.lines||NB(C.value);if(C.lines=x,C.added||C.removed){if(!h){let S=u[_-1];h=v,p=b,S&&(g=l>0?f(S.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let S of x)g.push((C.added?"+":"-")+S);C.added?b+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&_<u.length-2)for(let S of f(x))g.push(S);else{let S=Math.min(x.length,l);for(let w of f(x.slice(0,S)))g.push(w);let A={oldStart:h,oldLines:v-h+S,newStart:p,newLines:b-p+S,lines:g};d.push(A),h=0,p=0,g=[]}v+=x.length,b+=x.length}}for(let _ of d)for(let C=0;C<_.lines.length;C++)_.lines[C].endsWith(`
|
||||
`)?_.lines[C]=_.lines[C].slice(0,-1):(_.lines.splice(C+1,0,"\\ No newline at end of file"),C++);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:d}}}function Od(t,e){var r,i,n,s,a,o;if(e||(e=iv),Array.isArray(t)){if(t.length>1&&!e.includeFileHeaders&&!t.every(u=>u.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(u=>Od(u,e)).join(`
|
||||
`)}let l=[];if(t.isGit){if(e=iv,!t.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!t.newFileName)throw new Error("newFileName must be specified for Git patches");let u=t.oldFileName,f=t.newFileName;t.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):t.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+Ns(u)+" "+Ns(f)),t.isDelete&&l.push("deleted file mode "+((r=t.oldMode)!==null&&r!==void 0?r:"100644")),t.isCreate&&l.push("new file mode "+((i=t.newMode)!==null&&i!==void 0?i:"100644")),t.oldMode&&t.newMode&&!t.isDelete&&!t.isCreate&&(l.push("old mode "+t.oldMode),l.push("new mode "+t.newMode)),t.isRename&&(l.push("rename from "+Ns(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Ns(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Ns(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Ns(((o=t.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&t.oldFileName==t.newFileName&&t.oldFileName!==void 0&&l.push("Index: "+t.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=t.hunks.length>0;e.includeFileHeaders&&t.oldFileName!==void 0&&t.newFileName!==void 0&&(!t.isGit||c)&&(l.push("--- "+Ns(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Ns(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u<t.hunks.length;u++){let f=t.hunks[u],d=f.oldLines===0?f.oldStart-1:f.oldStart,h=f.newLines===0?f.newStart-1:f.newStart;l.push("@@ -"+d+","+f.oldLines+" +"+h+","+f.newLines+" @@");for(let p of f.lines)l.push(p)}return l.join(`
|
||||
`)+`
|
||||
`}function MS(t,e,r,i,n,s,a){if(typeof a=="function"&&(a={callback:a}),a!=null&&a.callback){let{callback:o}=a;nv(t,e,r,i,n,s,Object.assign(Object.assign({},a),{callback:l=>{o(l?Od(l,a.headerOptions):void 0)}}))}else{let o=nv(t,e,r,i,n,s,a);return o?Od(o,a==null?void 0:a.headerOptions):void 0}}function gu(t,e,r,i,n,s){return MS(t,t,e,r,i,n,s)}function NB(t){let e=t.endsWith(`
|
||||
`),r=t.split(`
|
||||
`).map(i=>i+`
|
||||
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var En=require("obsidian");m();function DS(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var nl=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var OS=require("obsidian"),BB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},rt=class extends OS.SuggestModal{constructor(e,r){if(super(e.app),this.config={...BB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var tk=ft(ek(),1),rk=require("child_process"),Xn=require("obsidian");function Nd(t){throw new Error(`Unexpected object: ${t}`)}function wu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var ov=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Vi(t,e){let r;if(e){if(e.button===0||e.button===1){let i=Xn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function _n(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new Xn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new Xn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Bs(t){throw new Error("Impossible branch: "+t)}function lv(t){return`rgb(${t.r},${t.g},${t.b})`}function ik(t){var s;let e=(s=tk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function nk(t){return t.diff(Xn.moment.unix(0),"seconds")}function sk(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function bu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function ak(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function ok(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function cv(t,e,r){return t<=e&&e<=r}function yn(t){let[e,...r]=t.split("/");return[e!=null?e:"",r.length===0?void 0:r.join("/")]}function xn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function lk(t){return t===1?"1 minute":`${t} minutes`}function e3(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function al(t){if(t.endsWith(".md"))return!1;let e=e3(t);return IS.includes(e)}function uv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function ol(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Xn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function ck({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ll(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function _u(t,e,r={}){return new Promise((i,n)=>{let s=(0,rk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:o,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var uk=require("os"),Hd=require("obsidian");var cl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,r){var i;this.plugin.setPluginState({operation:e});try{return await r()}finally{(i=this.plugin.statusBar)==null||i.clearProgress(!1),this.plugin.setPluginState({operation:0})}}getRelativeVaultPath(e){return this.plugin.settings.basePath?e===""||e==="."?this.plugin.settings.basePath:this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){if(r){let i=this.p
Line truncated
|
||||
`):n="Too many files to list",e=e+`
|
||||
|
||||
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-change");let a=await this.git.revparse([r.current]);return(await this.git.diff([`${n}..${a}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let s=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(s)}let r=await this.git.status(),n=r.tracking,i=r.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let a=(await this.git.diffSummary([i,n,"--
Line truncated
|
||||
`):[]}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
|
||||
`+n}return e}};m();var bi=require("obsidian"),Ud=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var n;if(this.maybeLog("Read: "+e+JSON.stringify(r)),(typeof r=="string"?r:r==null?void 0:r.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof bi.TFile?(this.maybeLog("Reuse"),this.vault.read(s)):this.adapter.read(e)}else{if(this.isIndexPath(e))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof bi.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,r){var i;if(this.maybeLog("Write: "+e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);if(n instanceof bi.TFile)return this.vault.modify(n,r);if(!this.isHiddenPath(e))await this.vault.create(e,r);else return this.adapter.write(e,r)}else{let n=t3(r);if(this.isIndexPath(e)){this.index=n;let s=Date.now();(i=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof bi.TFile)return this.vault.modifyBinary(s,n);if(!this.isHiddenPath(e))await this.vault.createBinary(e,n);else return this.adapter.writeBinary(e,n)}}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,bi.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){if(!(e==="."||e==="/")){if(!this.isHiddenPath(e)){if(this.vault.getFolderByPath(e))return;await this.vault.createFolder(e);return}return this.adapter.mkdir(e)}}async rmdir(e,r){var i,n;if(!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof bi.TFolder){await this.vault.delete(s,(r==null?void 0:r.recursive)===!0||((i=r==null?void 0:r.options)==null?void 0:i.recursive)===!0);return}}return this.adapter.rmdir(e,(r==null?void 0:r.recursive)===!0||((n=r==null?void 0:r.options)==null?void 0:n.recursive)===!0)}async stat(e){if(this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof bi.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){if(!this.isHiddenPath(e)){let r=this.vault.getAbstractFileByPath(e);if(r instanceof bi.TFile)return this.vault.delete(r)}return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.getIndexPath(),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}getIndexPath(){return this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index")}isIndexPath(e){return e===this.getIndexPath()}isHiddenPath(e){return e.startsWith(this.gitDir)?!0:(0,bi.normalizePath)(e).split("/").some(r=>r.startsWith(".")&&r!==".")}maybeLog(e){}};function t3(t){return t instanceof ArrayBuffer?t:t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice().buffer}var gk=ft(mk(),1),zi=class extends cl{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:"M
Line truncated
|
||||
|
||||
`);return{message:(c=l[0])!=null?c:"",author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
|
||||
|
||||
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}getGitDirPath(){return(0,En.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async updateUpstreamBranch(r){let[i,n]=yn(r),s=await this.branchInfo();await this.wrapFS(de.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[de.TREE({ref:r}),de.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(de.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!ov(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[de.TREE({ref:"HEAD"}),de.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new En.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(de.walk({...s,trees:[de.WORKDIR(),de.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await de.isIgnored({...s,filepath:o})||!ov(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await de.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await pu({...this.getRepo(),filepath:r,oid:n}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof de.Errors.NotFoundError))throw p}),f=(await de.readCommit({...this.getRepo(),oid:n})).commit.parent.first(),d;return f&&(d=await pu({...this.getRepo(),filepath:r,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof de.Errors.NotFoundError))throw p})),gu(s,d!=null?d:"",c!=null?c:"")}let o=(await de.walk({...this.getRepo(),trees:[de.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>pu({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof de.Errors.NotFoundError))throw f});return gu(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",gu(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await de.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){var n,s;let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":(n=i[0])!=null?n:" ",workingDir:i[1]=="?"?"U":(s=i[1])!=null?s:" ",path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new En.Notice(r,i?this.noticeLength:void 0)}};async function*n3(t){yield new Uint8Array(t)}async function s3(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}async function a3(t){let e=new Uint8Array(t);if(e.length<2||e[0]!==31||e[1]!==139)return t;try{let r=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(r).arrayBuffer()}catch(r){return t}}m();var hT=ft(Vd(),1),ri=ft(require("fs/promises"),1),Qn=require("obsidian"),Le=ft(require("path"),1),Ru=require("path");m();var eh=ft(xk(),1);m();var fv=new WeakMap;function pl(...t){let e=new String(t);return fv.set(e,t),e}function _i(t){return t instanceof String&&fv.has(t)}function ml(t){var e;return(e=fv.get(t))!=null?e:[]}var Qd=ft(Vd(),1),QC=require("child_process");var OA=ft(hv(),1),qA=require("node:path");m();function*Ek(t,e){let
Line truncated
|
||||
`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Ov(t,e){return Cu(t,!0).map(r=>e(r))}function Lv(t){return(0,eh.exists)(t,eh.FOLDER)}function Ei(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function pC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function th(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function Sn(t){return Array.isArray(t)?t:[t]}function mC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function yl(t){return Sn(t).map(e=>e instanceof String?e:String(e))}function Qe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Eu(t,e){let r=[];for(let i=0,n=t.length;i<n;i++)r.push(e,t[i]);return r}function Su(t){return(Array.isArray(t)?k.concat(t):t).toString("utf-8")}function gC(t,e){let r={};return e.forEach(i=>{t[i]!==void 0&&(r[i]=t[i])}),r}function _v(t=0){return new Promise(e=>setTimeout(e,t))}function yv(t){if(t!==!1)return t}var wl,$a,Au,rh=Y({"src/lib/utils/util.ts"(){"use strict";Nv(),wl="\0",$a=()=>{},Au=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ar(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function xv(t,e){let r=_i(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function ih(t){return!!t&&Au(t)==="[object Object]"}function vC(t){return typeof t=="function"}var Tu,wC,mt,Kd,nh,Nv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";rh(),Tu=t=>Array.isArray(t),wC=t=>typeof t=="number",mt=t=>typeof t=="string"||_i(t),Kd=t=>mt(t)||Array.isArray(t)&&t.every(mt),nh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Ev,s8=Y({"src/lib/utils/exit-codes.ts"(){"use strict";Ev=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Ev||{})}}),Xd,a8=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";Xd=class bC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new bC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function o8(){throw new Error("LineParser:useMatches not implemented")}var be,Hs,l8=Y({"src/lib/utils/line-parser.ts"(){"use strict";be=class{constructor(t,e){this.matches=[],this.useMatches=o8,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},Hs=class extends be{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function _C(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...yC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var yC,c8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";yC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Bv(t,e=[]){return ih(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(_i(n))r.push(n);else if(xv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)xv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function yr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n<s;n++)"string|number".includes(typeof t[n])&&i.push(String(t[n]));return Bv(Hv(t),i),r||i.push(...u8(t)),i}function u8(t){let e=typeof Ra(t)=="function";return yl(ar(Ra(t,e?1:0),Tu,[]))}function Hv(t){let e=vC(Ra(t));return ar(Ra(t,e?1:0),ih)}function nt(t,e=!0){let r=cC(Ra(t));return e||uC(r)?r:void 0}var f8=Y({"src/lib/utils/task-options.ts"(){"use strict";Nv(),rh()}});function Sv(t,e){return t(e.stdOut,e.stdErr)}function Hr(t,e,r,i=!0){return Sn(r).forEach(n=>{for(let s=Cu(n,i),a=0,o=s.length;a<o;a++){let l=(c=0)=>{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var d8=Y({"src/lib/utils/task-parser.ts"(){"use strict";rh()}}),xC={};St(xC,{ExitCodes:()=>Ev,GitOutputStreams:()=>Xd,LineParser:()=>be,NOOP:()=>$a,NULL:()=>wl,RemoteLineParser:()=>Hs,append:()=>Ei,appendTaskOptions:()=>Bv,asArray:()=>Sn,asCamelCase:()=>mC,asFunction:()=>cC,asNumber:()=>Qe,asStringArray:()=>yl,bufferToString:()=>Su,callTaskParser:()=>Sv,createInstanceConfig:()=>_C,delay:()=>_v,filterArray:()=>Tu,filterFunction:()=>vC,filterHasLength:()=>nh,filterNumber:()=>wC,filterPlainObject:()=>ih,filterPrimitives:()=>xv,filterString:()=>mt,filterStringOrStringArray:()=>Kd,filterType:()=>ar,first:()=>dC,folderExists:()=>Lv,forEachLineWithContent:()=>Ov,getTrailingOptions:()=>yr,including:()=>pC,isUserFunction:()=>uC,last:()=>Ra,objectToString:()=>Au,orVoid:()=>yv,parseStringResponse:()=>Hr,pick:()=>gC,prefixedArray:()=>Eu,remove:()=>th,splitOn:()=>fC,toLinesWithContent:()=>Cu,trailingFunctionArgument:()=>nt,trailingOptionsArgument
Line truncated
|
||||
`)){let l=fC(a,`
|
||||
`);o=l[0],a=l[1]}yield{file:s,key:o,value:a}}}var BC,C8=Y({"src/lib/responses/ConfigList.ts"(){"use strict";ge(),BC=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ra(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function pv(t,e){return typeof t=="string"&&Object.hasOwn(Av,t)?t:e}function A8(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function T8(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return S8(i,t)}}}function P8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return E8(r)}}}function R8(){return{addConfig(t,e,...r){return this._runTask(A8(t,e,r[0]===!0,pv(r[1],"local")),nt(arguments))},getConfig(t,e){return this._runTask(T8(t,pv(e,void 0)),nt(arguments))},listConfig(...t){return this._runTask(P8(pv(t[0],void 0)),nt(arguments))}}}var Av,HC=Y({"src/lib/tasks/config.ts"(){"use strict";C8(),ge(),Av=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Av||{})}});function $8(t){return UC.has(t)}var mv,UC,GC=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";mv=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(mv||{}),UC=new Set(Object.values(mv))}});function F8(...t){return new VC().param(...t)}function I8(t){let e=new Set,r={};return Ov(t,i=>{let[n,s,a]=i.split(wl);e.add(n),(r[n]=r[n]||[]).push({line:Qe(s),path:n,preview:a})}),{paths:e,results:r}}function M8(){return{grep(t){let e=nt(arguments),r=yr(arguments);for(let n of jC)if(r.includes(n))return this._runTask(Nr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=F8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return I8(n)}},e)}}}var jC,xu,Rk,VC,zC=Y({"src/lib/tasks/grep.ts"(){"use strict";ge(),yt(),jC=["-h"],xu=Symbol("grepQuery"),VC=class{constructor(){this[Rk]=[]}*[(Rk=xu,Symbol.iterator)](){for(let t of this[xu])yield t}and(...t){return t.length&&this[xu].push("--and","(",...Eu(t,"-e"),")"),this}param(...t){return this[xu].push(...Eu(t,"-e")),this}}}}),WC={};St(WC,{ResetMode:()=>qd,getResetMode:()=>O8,resetTask:()=>D8});function D8(t,e){let r=["reset"];return qC(t)&&r.push(`--${t}`),r.push(...e),xr(r)}function O8(t){if(qC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function qC(t){return typeof t=="string"&&YC.includes(t)}var qd,YC,ZC=Y({"src/lib/tasks/reset.ts"(){"use strict";ge(),yt(),qd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(qd||{}),YC=yl(Object.values(qd))}});function L8(){return(0,Qd.default)("simple-git")}function $k(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function N8(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function Wv(t,e,r,i=L8()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=N8(ar(e,mt),a,i);return c(r);function l(u,f){return Ei(s,Wv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&$k(a,f)||$a,h=$k(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var KC=Y({"src/lib/git-logger.ts"(){"use strict";ge(),Qd.default.formatters.L=t=>String(nh(t)?t.length:"-"),Qd.default.formatters.B=t=>k.isBuffer(t)?t.toString("utf8"):Au(t)}}),XC,B8=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Us(),KC(),XC=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=Wv(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Br(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger(
Line truncated
|
||||
`).map(M6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return I6(Wd(a[0]),Wd(o[0]));for(let l=0,c=Math.max(a.length,o.length);l<c;l++){let u=sT(Wd(a[l]),Wd(o[l]));if(u)return u}return 0});let i=e?r[0]:[...r].reverse().find(n=>n.indexOf(".")>=0);return new rC(r,i)}}}),oT={};St(oT,{addAnnotatedTagTask:()=>N6,addTagTask:()=>L6,tagListTask:()=>O6});function O6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return aT(r,e)}}}function L6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function N6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var B6=Y({"src/lib/tasks/tag.ts"(){"use strict";D6()}}),H6=i8({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(G8(),_t(JC)),{SimpleGitApi:i}=(GH(),_t(MA)),{Scheduler:n}=(jH(),_t(DA)),{adhocExecTask:s,configurationErrorTask:a}=(yt(),_t(Cv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ge(),_t(xC)),{applyPatchTask:v}=(zH(),_t(NA)),{branchTask:b,branchLocalTask:_,deleteBranchesTask:C,deleteBranchTask:x}=(r6(),_t(zA)),{checkIgnoreTask:S}=(a6(),_t(ZA)),{checkIsRepoTask:A}=(CC(),_t(EC)),{cleanWithOptionsTask:w,isCleanOptionsArray:E}=(LC(),_t(DC)),{diffSummaryTask:y}=(Jv(),_t(dA)),{fetchTask:P}=(f6(),_t(XA)),{moveTask:T}=(m6(),_t(JA)),{pullTask:I}=(v6(),_t(eT)),{pushTagsTask:L}=(AA(),_t(CA)),{addRemoteTask:H,getRemotesTask:te,listRemotesTask:xe,remoteTask:Z,removeRemoteTask:K}=(C6(),_t(rT)),{getResetMode:ce,resetTask:pe}=(ZC(),_t(WC)),{stashListTask:W}=(T6(),_t(iT)),{addSubModuleTask:X,initSubModuleTask:G,subModuleTask:Be,updateSubModuleTask:pr}=(F6(),_t(nT)),{addAnnotatedTagTask:Ut,addTagTask:Ie,tagListTask:Rt}=(B6(),_t(oT)),{straightThroughBufferTask:$t,straightThroughStringTask:Xe}=(yt(),_t(Cv));function ee(N,O){this._plugins=O,this._executor=new r(N.baseDir,new n(N.maxConcurrentProcesses),O),this._trimmed=N.trimmed}(ee.prototype=Object.create(i.prototype)).constructor=ee,ee.prototype.customBinary=function(N){return this._plugins.reconfigure("binary",N),this},ee.prototype.env=function(N,O){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=O,this},ee.prototype.stashList=function(N){return this._runTask(W(g(arguments)||{},l(N)&&N||[]),p(arguments))},ee.prototype.mv=function(N,O){return this._runTask(T(N,O),p(arguments))},ee.prototype.checkoutLatestTag=function(N){var O=this;return this.pull(function(){O.tags(function(ue,$e){O.checkout($e.latest,N)})})},ee.prototype.pull=function(N,O,ue,$e){return this._runTask(I(d(N,u),d(O,u),h(arguments)),p(arguments))},ee.prototype.fetch=function(N,O){return this._runTask(P(d(N,u),d(O,u),h(arguments)),p(arguments))},ee.prototype.silent=function(N){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},ee.prototype.tags=function(N,O){return this._runTask(Rt(h(arguments)),p(arguments))},ee.prototype.rebase=function(){return this._runTask(Xe(["rebase",...h(arguments)]),p(arguments))},ee.prototype.reset=function(N){return this._runTask(pe(ce(N),h(arguments)),p(arguments))},ee.prototype.revert=function(N){let O=p(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),O):this._runTask(Xe(["revert",...h(arguments,0,!0),N]),O)},ee.prototype.addTag=function(N){let O=typeof N=="string"?Ie(N):a("Git.addTag requires a tag name");return this._runTask(O,p(arguments))},ee.prototype.addAnnotatedTag=function(N,O){return this._runTask(Ut(N,O),p(arguments))},ee.prototype.deleteLocalBranch=function(N,O,ue){return this._runTask(x(N,typeof O=="boolean"?O:!1),p(arguments))},ee.prototype.deleteLocalBranches=function(N,O,ue){return this._runTask(C(N,typeof O=="boolean"?O:!1),p(arguments))},ee.prototype.branch=function(N,O){return this._runTask(b(h(arguments)),p(arguments))},ee.prototype.branchLocal=function(N){return this._runTask(_(),p(arguments))},ee.prototype.raw=function(N){let O=!Array.isArray(N),ue=[].slice.call(O?arguments:N,0);for(let Gt=0;Gt<ue.length&&O;Gt++)if(!c(ue[Gt])){ue.splice(Gt,ue.length-Gt);break}ue.push(...h(arguments,0,!0));var $e=p(arguments);return ue.length?this._runTask(Xe(ue,this._trimmed),$e):this._runTask(a("Raw: must supply one or more command to execute"),$e)},ee.prototype.submoduleAdd=function(N,O,ue){return this._runTask(X(N,O),p(arguments))},ee.prototype.submoduleUpdate=function(N,O){return this._runTask(pr(h(arguments,!0)),p(arguments))},ee.prototype.submoduleInit=function(N,O){return this._runTask(G(h(arguments,!0)),p(arguments))},ee.prototype.subModule=function(N,O){return this._runTask(Be(h(arguments)),p(arguments))},ee.prototype.listRemote=function(){return this._runTask(xe(h(arguments)),p(argum
Line truncated
|
||||
`).some(l=>l.contains(n))||await ri.appendFile(r,n+`
|
||||
`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path,n=await this.git.status(i!=null?["--",i]:[]),s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",Le.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(`
|
||||
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Ru.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Id}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Bs(i)}a.push("--",o);let c=await this.git.raw(a);return a4(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}await this.git.add("-A");let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes})}async commit({message:r,amend:i}){return this.withGitOperation(2,async()=>{let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),n})}async stage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r])}async stageAll({dir:r}){await this.git.add(r!=null?r:"-A")}async unstageAll({dir:r}){await this.git.reset(r!=null?["--",r]:[])}async unstage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r])}async discard(r){await this.isTracked(r)&&await this.git.checkout(["--progress","--",r])}async applyPatch(r){let i=Le.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path,n=[];return i!=null&&n.push("--",i),(await this.git.clean(Pa.RECURSIVE+Pa.DRY_RUN,n)).paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){return this.withGitOperation(1,async()=>{try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo();if(!r.current){this.plugin.displayError("No current branch found. Cannot pull.");return}let i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${dT(o)}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.git.reset([])}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${dT(o)}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}})}async push(){return this.withGitOperation(3,async()=>{try{if(this.plugin.settings.updateSubmodules){let a=await this.git.subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let r=await this.git.status(),i=r.tracking,n=r.current;if(!n){this.plugin.displayError("No current branch found. Cannot push.");return}if(!i&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let s=null;return i&&(s=(await this.git.diffS
Line truncated
|
||||
`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=yn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" "),n=i[0];return n===void 0?"":await this.git.raw(n,...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Le.dirname(r)))return;let i=await this.git.raw(["-C",Le.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",Le.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(Le.normalize(r)),o=Le.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Br){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await _u(r||"git",["--version"],{});if(i.error)if(Qn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Md}) of Git for Windows.`);let n=await _u(Md,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Br){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new nl(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},pT={hash:"000000",isZeroCommit:!0,summary:""};function a4(t){let r=t.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&&s.added===r&&s.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}},extractCommon:function(t,r,n,i,a){for(var s=r.length,o=n.length,c=t.oldPos,l=c-i,u=0;l+1<s&&c+1<o&&this.equals(n[c+1],r[l+1],a);)l++,c++,u++,a.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!a.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,l},equals:function(t,r,n){return n.comparator?n.comparator(t,r):t===r||n.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return Array.from(t)},join:function(t){return t.join("")},
Line truncated
|
||||
`));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.plugin.settings.gitDir||void 0,onAuth:()=>{var r,n;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(n=this.plugin.localStorage.getPassword())!=null?n:void 0}},onAuthFailure:async()=>{new ba.Notice("Authentication failed. Please try with different credentials");let r=await new Fe(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new Fe(this.plugin,{placeholder:"Specify your password/personal access token"}).openAndGetResult();if(n)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(n),{username:r,password:n}}return{cancel:!0}},http:{async request({url:r,method:n,headers:i,body:a}){let s;a&&(s=(await Zj(a)).buffer);let o=await(0,ba.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:[new Uint8Array(o.arrayBuffer)],statusCode:o.status,statusMessag
Line truncated
|
||||
|
||||
`);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.asyncIterator](){return this}}}function Yj(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:qj(e)}async function Xj(e,t){let r=Yj(e);for(;;){let{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function Zj(e){let t=0,r=[];await Xj(e,a=>{r.push(a),t+=a.byteLength});let n=new Uint8Array(t),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}var Kj="https://momentjs.com/docs/#/parsing/string-format/",Jj="https://publish.obsidian.md/git-doc/Line+Authoring",Vf=class extends B.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,n=this.plugin,i;n.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=n.gitReady;r.empty(),a||(r.createEl("p",{text:"Git is not ready. When
Line truncated
|
||||
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()})),new B.Setting(r).setName("Miscellaneous").setHeading(),n.gitManager instanceof Te&&new B.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(l=>{let u={split:"Split",git_unified:"Unified"};l.addOptions(u),l.setValue(n.settings.diffStyle),l.onChange(async f=>{n.settings.diffStyle=f,await n.saveSettings()})}),new B.Setting(r).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting.").addToggle(l=>l.setValue(n.settings.disablePopups).onChange(async u=>{n.settings.disablePopups=u,this.d
Line truncated
|
||||
`)),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(`
|
||||
`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s<r.length;){let a=r[s];if(uT(a)){let o=a.split(" "),l=o4(o,n,i);for(s++;uT(r[s]);s++){let c=r[s].split(" ");l4(c,i,n)}c4(i.commits.get(l)),n+=1}else if(!(a===""&&s===r.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${a}`);s++}return i}function o4(t,e,r){let i=t[0],n=t[1],s=t[2];if(i===void 0||n===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${t.join(" ")}`);if(r.hashPerLine.push(i),r.originalFileLineNrPerLine.push(parseInt(n)),r.finalFileLineNrPerLine.push(parseInt(s)),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return i}function l4(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r];if(s===void 0)throw Error(`No commit hash found for git-blame line ${r}`);let a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=fT(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=fT(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function c4(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);iw(t.author)&&(t.author=void 0),iw(t.committer)&&(t.committer=void 0),iw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function iw(t){return!t||Object.keys(t).length===0}function uT(t){return t===void 0?!1:t.length>0&&t[0].trim()===t[0]}function fT(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}function dT(t){return t instanceof Error?t.message:String(t)}m();var BT=require("@codemirror/state");m();var nw=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}init(){this.removeStalesSubscribersTimer===void 0&&this.startRemoveStalesSubscribersInterval()}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){this.removeStalesSubscribersTimer!==void 0&&(window.clearInterval(this.removeStalesSubscribersTimer),this.removeStalesSubscribersTimer=void 0),this.eventsPerFilepath.clear()}},Si=new nw;m();var uh=require("@codemirror/state");m();function u4(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mT={exports:{}};(function(t){(function(){var e="input is invalid type",r=typeof window=="object",i=r?window:{};i.JS_SHA256_NO_WINDOW&&(r=!1);var n=!r&&typeof self=="object";n&&(i=self);var s=!i.JS_SHA256_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",o="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=["hex","array","digest","arrayBuffer"],d=[];(i.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),a&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var h=function(x,S){return function(A){return new b(S,!0).update(A)[x]()}},p=function(x){var S=h("hex",x);S.create=function(){return new b(x)},S.update=function(E){return S.create().update(E)};for(var A=0;A<f.length;++A){var w=f[A];S[w]=h(w,x)}return S},g=function(x,S){return function(A,w){return new _(A,S,!0).update(w)[x]()}},v=function(x){var S=g("hex",x);S.create=function(E){return new _(E,x)},S.update=function(E,y){return S.create(E).update(y)};for(var A=0;A<f.length;++A){var w=f[A];S[w]=g
Line truncated
|
||||
If turned on, do auto ${n} every ${lk(i.settings.autoSaveInterval)} after stopping file edits.
|
||||
This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new j.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new j.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(pt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=pt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new j.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(pt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=pt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new j.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new j.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new j.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(pt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=pt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new j.Setting(r).setName("Commit message").setHeading();let c=new j.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${pt.commitMessage}"`).onClick(()=>{f.setValue(pt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),j.Platform.isDesktopApp&&new j.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=pt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new j.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${ev}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:UT,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new j.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new j.Setting(r).setName("Preview commit message").addButton(f=>f.se
Line truncated
|
||||
`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(`
|
||||
`))})}),i.gitManager instanceof Se&&new j.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(`
|
||||
`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(`
|
||||
`))})}),i.gitManager instanceof Se&&new j.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new j.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==="dateTimeFormatOptions"){let u=(l=i.lastShownDateTimeFormatOptions)!=null?l:o;r="Show "+(s?a:u),r+=r.contains("date")?"":" date",n=s?"hide":u}else Oi(e);t.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=Xl.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(e,n)}))}function UT(e,t,r){r.setAttr(BT,JSON.stringify({hash:e.hash,isZeroCommit:e.isZeroCommit,isWaitingGutter:t}))}function iB(e){let t=e.getAttr(BT);return t?JSON.parse(t):void 0}g();function a0(e,t){return e==="oldest"?rd(0,!1,t).color:rd(void 0,!0,t).color}function rd(e,t,r){let n=Xf(r),i=Date.now()/1e3,a=e!=null?e:0,o=(t?0:i-a)/60/60/24,c=Math.pow(Math.clamp(o/n,0,1),1/2.3),l=aB(),u=r.colorNew,f=r.colorOld,d=l?.4:1,h=c0(u.r,f.r,c)*d,p=c0(u.g,f.g,c)*d,m=c0(u.b,f.b,c)*d;return{color:`rgba(${h},${p},${m},${l?.75:.25})`,daysSinceCommit:o}}function c0(Line truncated
|
||||
(${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.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote()),this.saveLastAuto(new Date,"pull"),this.startAutoPull()},r)}startAutoPush(t){let r=(t!=null?t:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.push()),this.saveLastAuto(new Date,"push"),this.startAutoPush()},r)}clearAutoCommitAndSync(){var r;let t=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,t=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.cancel(),this.plugin.autoCommitDebouncer=void 0,t=!0),t}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPu
Line truncated
|
||||
`).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new j.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Relative paths are resolved from the custom base path, or the vault root when no base path is configured. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new j.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new j.Notice("Obsidian must be restarted for the changes to take affect.")})),new j.Setting(r).setName("Support").setHeading(),new j.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new j.Notice("Debug information copied to clipboard. May contain sensitive information!")},j.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
|
||||
You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),j.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new j.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:T4,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new j.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${Id} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new j.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new j.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new j.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new j.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new j.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.d
Line truncated
|
||||
Either your local time-zone (default),
|
||||
the author's time-zone during commit creation or
|
||||
`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new j.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Iu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new j.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new j.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new j.Setting(this.containerEl).setName("").addText(n=>{let s=hw(r,this.settings.lineAuthor),a=hw(r,pt.lineAuthor);n.setPlaceholder(lv(a)),n.setValue(lv(s)),n.onChange(async o=>{let l=ik(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,hw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?bh(i,n):"rgba(127,127,127,0.3)",o=j.moment.unix(j.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:UT}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,j.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Iu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
|
||||
Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];pt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function hw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Iu(t){let e=j.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var Ur=require("obsidian");var xh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}displayProgress(e){this.progress=e,this.display()}clearProgress(e=!0){this.progress=void 0,e&&this.display()}display(){this.progress?this.displayState():this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){if((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,Ur.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,Ur.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,Ur.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress");return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,Ur.setIcon)(this.iconEl,"git-commit"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"commit");break;case 3:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pushing changes..."),(0,Ur.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,Ur.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,Ur.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,Ur.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Ur.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let r=this.progress.stage?`${this.progress.stage}: `:"";if(this.progress.progress===void 0)return this.progress.stage?`${this.progress.action}: ${this.progress.stage}...`:`${this.progress.action}...`;let i=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${r}${Math.round(this.progress.progress)}%${i}`}getCompactProgressText(){return this.progress?this.progress.progress===void 0?`${this.progress.action}...`:`${this.progress.action} ${Math.round(this.progress.progress)}%`:""}getProgressIcon(){var e;switch((e=this.progress)
Line truncated
|
||||
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Ur.setIcon)(this.iconEl,"globe"):(0,Ur.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus?this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()):this.textEl.empty(),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var Sh=require("obsidian"),Eh=class extends Sh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,Sh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var GT=require("obsidian"),Mu=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,GT.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastA
Line truncated
|
||||
`)}static newName(){let e=ZT[YT]||1;return ZT[YT]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[pw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new mw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},KT=new Map,mw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=KT.get(i);if(s)return e[pw]=s;this.sheet=new n.CSSStyleSheet,KT.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[pw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a<e.length;a++){let o=e[a],l=this.modules.indexOf(o);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;c<o.rules.length;c++)i.insertRule(o.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=o.rules.length,s++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
|
||||
`;this.styleTag.textContent=a;let o=r.head||r;this.styleTag.parentNode!=o&&o.insertBefore(this.styleTag,o.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var p2=require("@codemirror/language"),P4=require("@lezer/highlight"),kt=class t{constructor(e,r,i,n){this.fromA=e,this.toA=r,this.fromB=i,this.toB=n}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function Ma(t,e,r,i,n,s){if(t==i)return[];let a=Ew(t,e,r,i,n,s),o=Sw(t,e+a,r,i,n+a,s);e+=a,r-=o,n+=a,s-=o;let l=r-e,c=s-n;if(!l||!c)return[new kt(e,r,n,s)];if(l>c){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new kt(e,e+f,n,n),new kt(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new kt(e,e,n,n+f),new kt(r,r,n+f+l,s)]}if(l==1||c==1)return[new kt(e,r,n,s)];let u=g2(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ma(t,e,f,i,n,d).concat(Ma(t,f+h,r,i,d+h,s))}return R4(t,e,r,i,n,s)}var Ou=1e9,Lu=0,xw=!1;function R4(t,e,r,i,n,s){let a=r-e,o=s-n;if(Ou<1e9&&Math.min(a,o)>Ou*16||Lu>0&&Date.now()>Lu)return Math.min(a,o)>Ou*64?[new kt(e,r,n,s)]:XT(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);gw.reset(l),vw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?vw:null,d=f?null:gw;for(let h=0;h<l;h++){if(h>Ou||Lu>0&&!(h&63)&&Date.now()>Lu)return XT(t,e,r,i,n,s);let p=gw.advance(h,a,o,l,f,!1,c)||vw.advance(h,a,o,l,d,!0,u);if(p)return $4(t,e,r,e+p[0],i,n,s,n+p[1])}return[new kt(e,r,n,s)]}var Fh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,r,i,n,s,a,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=n+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<i&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(a){let h=s.vec[d];if(h>=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},gw=new Fh,vw=new Fh;function $4(t,e,r,i,n,s,a,o){let l=!1;return!Tl(t,i)&&++i==r&&(l=!0),!Tl(n,o)&&++o==a&&(l=!0),l?[new kt(e,r,s,a)]:Ma(t,e,i,n,s,o).concat(Ma(t,i,r,n,o,a))}function m2(t,e){let r=1,i=Math.min(t,e);for(;r<i;)r=r<<1;return r}function Ew(t,e,r,i,n,s){if(e==r||e==s||t.charCodeAt(e)!=i.charCodeAt(n))return 0;let a=m2(r-e,s-n);for(let o=e,l=n;;){let c=o+a,u=l+a;if(c>r||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Tl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function Sw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=m2(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c<e||u<n||t.slice(c,o)!=i.slice(u,l)){if(a==1)return r-o-(Tl(t,o)?0:1);a=a>>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function ww(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a<o)return c;for(let u=e+a;;){Tl(t,u)||u++;let f=u+a;if(Tl(t,f)||(f+=f==u+1?1:-1),f>=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Ew(t,f,r,i,n+h+d.length,s),g=Sw(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,n+h-g,v])}u=f}if(o<0)return c;a=a>>1}}function g2(t,e,r,i,n,s){let a=r-e,o=s-n;if(a<o){let l=g2(i,n,s,t,e,r);return l&&[l[1],l[0],l[2]]}return a<4||o*2<a?null:ww(t,e,r,i,n,s,Math.floor(a/4),-1)}function XT(t,e,r,i,n,s){xw=!0;let a=r-e,o=s-n,l;if(a<o){let d=ww(i,n,s,t,e,r,Math.floor(a/6),50);l=d&&[d[1],d[0],d[2]]}else l=ww(t,e,r,i,n,s,Math.floor(o/6),50);if(!l)return[new kt(e,r,n,s)];let[c,u,f]=l;return Ma(t,e,c,i,n,u).concat(Ma(t,c+f,r,i,u+f,s))}function v2(t,e){for(let r=1;r<t.length;r++){let i=t[r-1],n=t[r];i.toA>n.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new kt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function F4(t,e,r){for(;;){v2(r,1);let i=!1;for(let n=0;n<r.length;n++){let s=r[n],a,o;(a=Ew(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new kt(s.fromA+a,s.toA,s.fromB+a,s.toB)),(o=Sw(t,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=r[n]=new kt(s.fromA,s.toA-o,s.fromB,s.toB-o));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(n?r[n-1].toA:0),f=(n<r.length-1?r[n+1].fromA:t.length)-s.toA;if(!u||!f)continue;let d=l?t.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&t.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(r[n]=new kt(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),i=!0):f<=d.length&&t.slice(s.toA,s.toA+f)==d.slice(0,f)&&(r[n]=new kt(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),i=!0)}if(!i)break}return r}function I4(t,e,r){for(let i=0,n=0;n<t.length;n++){let s=t[n],a=s.toA-s.fromA,o=s.toB-s.fromB;if(a&&o||a>3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=JT(e,s.fromA,c),d=QT(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,b,_]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(_-h,_)?(s=t[n]=new kt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=QT(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(b,b+p)&&(s=t[n]=new kt(d-a,d,s.fromB+p,s.toB+p),d=s.
Line truncated
|
||||
`),s=e.split(`
|
||||
`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=zt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(n[d-1]);o+l>n.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Tw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:Dh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:Dh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var T2={scanLimit:1e3,timeout:200};function Z4(t,e,r,i){let n=Cw.Text.of(t.split(`
|
||||
`)),s=Cw.Text.of(e.split(`
|
||||
`)),a=r&&i?Jn.updateB(r,n,s,i,T2):Jn.build(n,s,T2),o=[];for(let l=0;l<a.length;l++){let c=a[l],u=Tw(c,n,s);o.push(u)}return{hunks:Aw(t,e,o),chunks:a}}function P2(t,e,r,i){return Z4(t,e,r,i)}var es=require("obsidian"),Wi=class{static hasHunksData(e){let r=e.field(Gr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let i=e.field(Gr);return i?r?i.stagedHunks:i.hunks:[]}static getHunkAtPos(e,r,i){if(!e.field(Gr))return;let s=e.doc.lineAt(r).number,a=this.getHunks(e,i);return zt.findHunk(s,a)[0]}static getCursorHunk(e,r){if(!e.field(Gr))return;let n=e.selection.main.head;return this.getHunkAtPos(e,n,r)}static getHunk(e,r,i){if(i!=null)return this.getHunkAtPos(e,i,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let n=e.selection.main.from,s=e.selection.main.to,a=e.doc.lineAt(n).number,o=Dh(e.doc,s),l=this.getHunks(e,r),c=zt.createPartialHunk(l,a,o);if(!c)return;let u=e.field(Gr);if(r){let f=a,d=o;for(let h of u.hunks)a>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(`
|
||||
`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(`
|
||||
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(`
|
||||
`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(`
|
||||
`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(`
|
||||
`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(`
|
||||
`).length&&!u.compareText.endsWith(`
|
||||
`)&&(c.removed.no_nl_at_eof=!0);return c}},Gr=Pl.StateField.define({create:t=>{},update:(t,e)=>{var n,s,a;let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let o of e.effects)if(o.is(Rl)&&(r.compareText=o.value.compareText,r.compareTextHead=o.value.compareTextHead,i=(t==null?void 0:t.compareText)!==o.value.compareText,i&&(r.chunks=void 0,r.changeDesc=void 0)),o.is(Oh)){let l=(n=e.startState.field(Bu,!1))==null?void 0:n.revision;if(o.value.revision!==l)continue;R2(r,o.value.result,e.state),r.changeDesc=void 0}if(e.docChanged){let o=!r.changeDesc||r.changeDesc.newLength===e.changes.length;console.assert(o,"Git: Hunk changes belong to different document histories."),o||(r.chunks=void 0),r.changeDesc=K4(r.changeDesc,e.changes)}if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let o=X4(e,r.compareText,r.chunks,r.changeDesc,r.maxDiffTimeMs);o&&(R2(r,o,e.state),r.changeDesc=void 0)}}else{r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;let o=e.state.field(es.editorInfoField).file;(a=(s=It.plugin)==null?void 0:s.editorIntegration.signsFeature.changeStatusBar)==null||a.display(r.hunks,o)}return r}});function R2(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(es.editorInfoField).file;(s=(n=It.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Bu=Pl.StateField.define({create:t=>{var e,r;return{debouncer:(0,es.debounce)(i=>{let{state:n,compareText:s,previousChunks:a,changeDesc:o,revision:l}=i,c=n.field(es.editorEditorField,!1);if(!c)return;let u=c.state.field(Bu,!1);if((u==null?void 0:u.revision)!==l)return;let f=$2(n,s,a,o);c.dispatch({effects:Oh.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(r=(e=t.field(es.editorInfoField,!1))==null?void 0:e.file)==null?void 0:r.path}},update:(t,e)=>{var i,n;let r=(n=(i=e.state.field(es.editorInfoField,!1))==null?void 0:i.file)==null?void 0:n.path;return e.docChanged||r!==t.filePath?{...t,revision:{},filePath:r}:t}});function K4(t,e){return!t||t.newLength!==e.length?e:t.composeDesc(e)}function $2(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=P2(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function X4(t,e,r,i,n){let s=t.state,a=Math.abs(t.changes.length-t.changes.newLength),o=s.field(Bu);if(a>1e3||n>16){o.debouncer({state:s,compareText:e,previousChunks:r,changeDesc:i,revision:o.revision});return}else return $2(s,e,r,i)}var Rl=Pl.StateEffect.define(),Oh=Pl.StateEffect.define();function F2(t,e){return e.update({effects:Rl.of(t)})}m();m();m();var st;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(st||(st={}));var I2={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},M2={LINES:"lines",WORDS:"words",NONE:"none"},D2={WORD:"word",CHAR:"char"},Da;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Da||(Da={}));m();var Q4=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],J4=RegExp("["+Q4.join("\\")+"]","g");function O2(t){return t.replace(J4,"\\$&")}function Pw(t){return t&&t.replace(/\\/g,"/")}function L2(t){let e,r,i,n=0;for(e=0,i=t.length;e<i;e++)r=t.charCodeAt(e),n=(n<<5)-n+r,n|=0;return n}function Lh(t){let e=t.length,r=-1/0;for(let i=0;i<e;i++)r=Math.max(r,t[i]);return r}function N2(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function B2(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var H2=["a/","b/","i/","w/","c/","o/"];function Gs(t,e,r){let i=r!==void 0?[...H2,r]:H2,n=e?new RegExp(`^${O2(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function e5(t,e){return Gs(t,"---",e)}function t5(t,e){return Gs(t,"+++",e)}function U2(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,_=/^copy to "?(.+)"?/,C=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,S=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,E=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,L=/^deleted file mode (\d{6}),(\d{6})/,H=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
|
||||
`).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)},0),!0):m}t=this.castInput(t),r=this.castInput(r),t=this.removeEmpty(this.tokenize(t)),r=this.removeEmpty(this.tokenize(r));var o=r.length,c=t.length,l=1,u=o+c;n.maxEditLength&&(u=Math.min(u,n.maxEditLength));var f=[{newPos:-1,components:[]}],d=this.extractCommon(f[0],r,t,0);if(f[0].newPos+1>=o&&d+1>=c)return s([{value:this.join(r),count:r.length}]);function h(){for(var m=-1*l;m<=l;m+=2){var v=void 0,y=f[m-1],b=f[m+1],x=(b?b.newPos:0)-m;y&&(f[m-1]=void 0);var E=y&&y.newPos+1<o,_=b&&0<=x&&x<c;if(!E&&!_){f[m]=void 0;continue}if(!E||_&&y.newPos<b.newPos?(v=xB(b),a.pushComponent(v.components,void 0,!0)):(v=y,v.newPos++,a.pushComponent(v.components,!0,void 0)),x=a.extractCommon(v,r,t,m),v.newPos+1>=o&&x+1>=c)return s(_B(a,v.components,r,t,a.useLongestToken));f[m]=v}l++}if(i)(function m(){setTimeout(function(){if(l>u)return i();h()||m()},0)})();else for(;l<=u;){var p=h();if(p)return p}},pushCompon
Line truncated
|
||||
`);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
|
||||
`);function te(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function xe(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function Z(){te(),xe(),i={blocks:[],deletedLines:0,addedLines:0}}function K(W){te();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(W))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(W))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(W.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:W}}function ce(W){if(i===null||n===null||s===null||o===null)return;let X={content:W},G=i.isCombined?["+ "," +","++"]:["+"],Be=i.isCombined?["- "," -","--"]:["-"];B2(W,G)?(i.addedLines++,X.type=st.INSERT,X.oldNumber=void 0,X.newNumber=o++):B2(W,Be)?(i.deletedLines++,X.type=st.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=st.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function pe(W,X){let G=X;for(;G<H.length-3;){if(W.startsWith("diff"))return!1;if(H[G].startsWith(u)&&H[G+1].startsWith(f)&&H[G+2].startsWith(d))return!0;G++}return!1}return H.forEach((W,X)=>{if(!W||W.startsWith("*"))return;let G,Be=H[X-1],pr=H[X+1],Ut=H[X+2];if(W.startsWith("diff --git")||W.startsWith("diff --combined")){if(Z(),(G=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(W))&&(l=Gs(G[1],void 0,e.dstPrefix),c=Gs(G[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(W.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(Z(),(G=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(W))&&(l=Gs(G[1],void 0,e.dstPrefix),c=Gs(G[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&W.startsWith(u)&&pr.startsWith(f)&&Ut.startsWith(d))&&Z(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&W.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let Rt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";K(Rt);return}if(W.startsWith(u)&&pr.startsWith(f)||W.startsWith(f)&&Be.startsWith(u)){if(i&&!i.oldName&&W.startsWith("--- ")&&(G=e5(W,e.srcPrefix))){i.oldName=G,i.language=N2(i.oldName,i.language);return}if(i&&!i.newName&&W.startsWith("+++ ")&&(G=t5(W,e.dstPrefix))){i.newName=G,i.language=N2(i.newName,i.language);return}}if(i&&(W.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){K(W);return}if(n&&(W.startsWith("+")||W.startsWith("-")||W.startsWith(" "))){ce(W);return}let Ie=!pe(W,X);if(i===null)throw new Error("Where is my file !!!");(G=h.exec(W))?i.oldMode=G[1]:(G=p.exec(W))?i.newMode=G[1]:(G=g.exec(W))?(i.deletedFileMode=G[1],i.isDeleted=!0):(G=v.exec(W))?(i.newFileMode=G[1],i.isNew=!0):(G=b.exec(W))?(Ie&&(i.oldName=G[1]),i.isCopy=!0):(G=_.exec(W))?(Ie&&(i.newName=G[1]),i.isCopy=!0):(G=C.exec(W))?(Ie&&(i.oldName=G[1]),i.isRename=!0):(G=x.exec(W))?(Ie&&(i.newName=G[1]),i.isRename=!0):(G=E.exec(W))?(i.isBinary=!0,i.oldName=Gs(G[1],void 0,e.srcPrefix),i.newName=Gs(G[2],void 0,e.dstPrefix),K("Binary file")):y.test(W)?(i.isBinary=!0,K(W)):(G=S.exec(W))?i.unchangedPercentage=parseInt(G[1],10):(G=A.exec(W))?i.changedPercentage=parseInt(G[1],10):(G=w.exec(W))?(i.checksumBefore=G[1],i.checksumAfter=G[2],G[3]&&(i.mode=G[3])):(G=P.exec(W))?(i.checksumBefore=[G[2],G[3]],i.checksumAfter=G[1]):(G=T.exec(W))?(i.oldMode=[G[2],G[3]],i.newMode=G[1]):(G=I.exec(W))?(i.newFileMode=G[1],i.isNew=!0):(G=L.exec(W))&&(i.deletedFileMode=G[1],i.isDeleted=!0)}),te(),xe(),r}m();m();m();m();var js=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],S=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(S){let E=S.oldPos-_;A=S&&0<=E&&E<o}let w=x&&x.oldPos+1<l;if(!A&&!w){h[_]=void 0;continue}if(!w||A&&x.oldPos<S.oldPos?C=this.addToPath(S,!0,!1,0,i):C=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(C,r,e,_,i),C.oldPos+1>=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+
Line truncated
|
||||
`);return this.hoganUtils.render(W2,"wrapper",{colorScheme:Ol(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Gw=Object.assign(Object.assign({},La),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Uu="generic",q2="line-by-line",p5="icon",m5="tag",Gu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Gw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(Uu,"wrapper",{colorScheme:Ol(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(q2,"file-diff"),n=this.hoganUtils.template(Uu,"file-path"),s=this.hoganUtils.template(p5,"file"),a=this.hoganUtils.template(m5,Nl(e));return i.render({file:e,fileHtmlId:Ll(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Uu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Qt})}generateFileHtml(e){let r=Ml(Il(i=>Ci(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Uu,"block-header",{CSSLineClass:Qt,blockHeader:e.isTooBig?i.header:Vs(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ci(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Qt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(`
|
||||
`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==st.INSERT&&n.length||a.type===st.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===st.CONTEXT?r.push([[a],[],[]]):a.type===st.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===st.INSERT&&i.length>0?n.push(a):a.type===st.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=Lh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}processChangedLines(e,r,i,n){let s={right:"",left:""},a=Math.max(i.length,n.length);for(let o=0;o<a;o++){let l=i[o],c=n[o],u=l!==void 0&&c!==void 0?Gh(l.content,c.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},Ci(l.content,r)),{type:Dl(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},Ci(c.content,r)),{type:Dl(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,r,i){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,i)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let i=this.hoganUtils.render(q2,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(Uu,"line",{type:r.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:r.prefix===" "?" ":r.prefix,content:r.content,lineNumber:i,line:r,file:e})}};m();var jw=Object.assign(Object.assign({},La),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),ju="generic",g5="side-by-side",v5="icon",w5="tag",Vu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},jw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(`
|
||||
`);return this.hoganUtils.render(ju,"wrapper",{colorScheme:Ol(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(g5,"file-diff"),n=this.hoganUtils.template(ju,"file-path"),s=this.hoganUtils.template(v5,"file"),a=this.hoganUtils.template(w5,Nl(e));return i.render({file:e,fileHtmlId:Ll(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(ju,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Qt})}}generateFileHtml(e){let r=Ml(Il(i=>Ci(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ci(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Qt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Qt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s<e.lines.length;s++){let a=e.lines[s];(a.type!==st.INSERT&&n.length||a.type===st.CONTEXT&&i.length>0)&&(r.push([[],i,n]),i=[],n=[]),a.type===st.CONTEXT?r.push([[a],[],[]]):a.type===st.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===st.INSERT&&i.length>0?n.push(a):a.type===st.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=Lh(e.concat(r).map(o=>o.content.length));return n<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?i(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(ju,"block-header",{CSSLineClass:Qt,blockHeader:r!=null&&r.isTooBig?e:Vs(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,i){let n={right:"",left:""},s=Math.max(r.length,i.length);for(let a=0;a<s;a++){let o=r[a],l=i[a],c=o!==void 0&&l!==void 0?Gh(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:Qt.DELETE_CHANGES}:Object.assign(Object.assign({},Ci(o.content,e)),{type:Dl(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:Qt.INSERT_CHANGES}:Object.assign(Object.assign({},Ci(l.content,e)),{type:Dl(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);n.left+=d,n.right+=h}return n}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",i="d2h-code-side-line";return this.hoganUtils.render(ju,"line",{type:(e==null?void 0:e.type)||`${Qt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?i:`${i} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?" ":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};m();var qw=ft(Ww());m();var Ct=ft(Ww()),xt={};xt["file-summary-line"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<li class="d2h-file-list-line">'),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-name-wrapper">'),i.b(`
|
||||
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <a href="#'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-name">'),i.b(i.v(i.f("fileName",t,e,0))),i.b("</a>"),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-stats">'),i.b(`
|
||||
`+r),i.b(' <span class="d2h-lines-added">'),i.b(i.v(i.f("addedLines",t,e,0))),i.b("</span>"),i.b(`
|
||||
`+r),i.b(' <span class="d2h-lines-deleted">'),i.b(i.v(i.f("deletedLines",t,e,0))),i.b("</span>"),i.b(`
|
||||
`+r),i.b(" </span>"),i.b(`
|
||||
`+r),i.b(" </span>"),i.b(`
|
||||
`+r),i.b("</li>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});xt["file-summary-wrapper"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-file-list-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-list-header">'),i.b(`
|
||||
`+r),i.b(' <span class="d2h-file-list-title">Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")</span>"),i.b(`
|
||||
`+r),i.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),i.b(`
|
||||
`+r),i.b(' <a class="d2h-file-switch d2h-show">show</a>'),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(' <ol class="d2h-file-list">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(`
|
||||
`+r),i.b(" </ol>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});xt["generic-block-header"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('"></td>'),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("</div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});xt["generic-empty-diff"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.d("CSSLineClass.INFO",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" File without changes"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});xt["generic-file-path"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-file-name-wrapper">'),i.b(`
|
||||
`+r),i.b(i.rp("<fileIcon0",t,e," ")),i.b(' <span class="d2h-file-name">'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b("</span>"),i.b(`
|
||||
`+r),i.b(i.rp("<fileTag1",t,e," ")),i.b("</span>"),i.b(`
|
||||
`+r),i.b('<label class="d2h-file-collapse">'),i.b(`
|
||||
`+r),i.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),i.b(`
|
||||
`+r),i.b(" Viewed"),i.b(`
|
||||
`+r),i.b("</label>"),i.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});xt["generic-line"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b("<tr>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.f("lineClass",t,e,0))),i.b(" "),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b(' <td class="'),i.b(i.v(i.f("type",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="'),i.b(i.v(i.f("contentClass",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-prefix">'),a.b(a.t(a.f("prefix",n,s,0))),a.b("</span>"),a.b(`
|
||||
`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-prefix"> </span>'),i.b(`
|
||||
`+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' <span class="d2h-code-line-ctn">'),a.b(a.t(a.f("content",n,s,0))),a.b("</span>"),a.b(`
|
||||
`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b(' <span class="d2h-code-line-ctn"><br></span>'),i.b(`
|
||||
`+r)),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </td>"),i.b(`
|
||||
`+r),i.b("</tr>"),i.fl()},partials:{},subs:{}});xt["generic-wrapper"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="d2h-wrapper '),i.b(i.v(i.f("colorScheme",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});xt["icon-file-added"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),i.b(`
|
||||
`+r),i.b(' width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});xt["icon-file-changed"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});xt["icon-file-deleted"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});xt["icon-file-renamed"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),i.b(`
|
||||
`+r),i.b(' viewBox="0 0 14 16" width="14">'),i.b(`
|
||||
`+r),i.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});xt["icon-file"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),i.b(`
|
||||
`+r),i.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),i.b(`
|
||||
`+r),i.b("</svg>"),i.fl()},partials:{},subs:{}});xt["line-by-line-file-diff"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-diff">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
||||
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
|
||||
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(`
|
||||
`+r),i.b(" </tbody>"),i.b(`
|
||||
`+r),i.b(" </table>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});xt["line-by-line-numbers"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div class="line-num1">'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("</div>"),i.b(`
|
||||
`+r),i.b('<div class="line-num2">'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("</div>"),i.fl()},partials:{},subs:{}});xt["side-by-side-file-diff"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<div id="'),i.b(i.v(i.f("fileHtmlId",t,e,0))),i.b('" class="d2h-file-wrapper" data-lang="'),i.b(i.v(i.d("file.language",t,e,0))),i.b('">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-header">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(' <div class="d2h-files-diff">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
||||
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
|
||||
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(`
|
||||
`+r),i.b(" </tbody>"),i.b(`
|
||||
`+r),i.b(" </table>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(' <div class="d2h-file-side-diff">'),i.b(`
|
||||
`+r),i.b(' <div class="d2h-code-wrapper">'),i.b(`
|
||||
`+r),i.b(' <table class="d2h-diff-table">'),i.b(`
|
||||
`+r),i.b(' <tbody class="d2h-diff-tbody">'),i.b(`
|
||||
`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(`
|
||||
`+r),i.b(" </tbody>"),i.b(`
|
||||
`+r),i.b(" </table>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b(" </div>"),i.b(`
|
||||
`+r),i.b("</div>"),i.fl()},partials:{},subs:{}});xt["tag-file-added"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),i.fl()},partials:{},subs:{}});xt["tag-file-changed"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),i.fl()},partials:{},subs:{}});xt["tag-file-deleted"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),i.fl()},partials:{},subs:{}});xt["tag-file-renamed"]=new Ct.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),i.fl()},partials:{},subs:{}});var zu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=qw.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},xt),e),i)}static compile(e){return qw.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var _5=Object.assign(Object.assign(Object.assign({},Gw),jw),{outputFormat:I2.LINE_BY_LINE,drawFileList:!0});function zh(t,e={}){let r=Object.assign(Object.assign({},_5),e),i=typeof t=="string"?U2(t,r):t,n=new zu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new jh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Vu(n,r).render(i):new Gu(n,r).render(i);return o+l}var tP=ft(J2(),1);var Ba=require("obsidian"),Yw=Wu.StateEffect.define();function zs(t,e){let r=t.state,i=r.field(qh),n=r.field(Gr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=zt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(Ba.editorEditorField).dispatch({effects:Yw.of({pos:o,add:!l})})}var qh=Wu.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(Yw)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),rP=Wu.StateField.define({create:t=>eP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Rl)||r.is(Yw))?eP(e.state):t},provide:t=>Wh.showTooltip.computeN([t],e=>e.field(t))}),iP=Wh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function eP(t){let e=t.field(Gr);return e?[...t.field(qh)].map(i=>{let n=t.doc.lineAt(i),s=zt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>y5(s,t,i)}}).filter(i=>i!==void 0):[]}function y5(t,e,r){var g,v;let i=zt.createPatch("file",[t],"10064",!1).join(`
|
||||
`)+`
|
||||
`,n=zh(i,{colorScheme:tP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(b,_)=>{let C=createDiv();return(0,Ba.setIcon)(C,b),C.setAttr("aria-label",_),C.addClass("clickable-icon"),C},l=o("x","Close hunk"),c=o("plus","Stage hunk"),u=o("undo","Reset hunk");a.appendChild(l),a.appendChild(c),a.appendChild(u);let f=createDiv();f.appendChild(a),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(Ba.editorEditorField);l.onclick=()=>{zs(d,r)},c.onclick=()=>{let b=It.plugin;b&&(b.promiseQueue.addTask(()=>b.hunkActions.stageHunk(r)),zs(d,r))},u.onclick=()=>{let b=It.plugin;b&&(b.hunkActions.resetHunk(r),zs(d,r))};let h=(v=(g=It.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Ba.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(b,_)=>{zs(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:b=>{r=b.changes.mapPos(r)}}}function nP(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new Ch(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Xt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Xt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(wi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:wi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);return t.tools.openDiff({aFile:n,aRef:""}),!0}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return jT(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return VT(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.addFileToGitignore(i.path,i instanceof qi.TFolder).catch(n=>t.displayError(n)),!0)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){return r?!1:(t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1})),!0)}}),qi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.c
Line truncated
|
||||
- ${s.map(o=>o.vaultPath).join(`
|
||||
- `)}
|
||||
Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Bl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=Vi(this.plugin.app,s))==null||l.setViewState({type:Os.type,active:!0,state:o}):a=="git_unified"&&((c=Vi(this.plugin.app,s))==null||c.setViewState({type:Ls.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Se))return;let i=await new rt(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Bl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Zh=require("obsidian");var Ha=class extends Zh.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ls.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ls.name}getIcon(){return Ls.icon}async setState(r,i){this.state=r,Zh.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Se&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
|
||||
`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null
|
||||
+++ ${this.state.bFile}
|
||||
@@ -0,0 +1,${a.split(`
|
||||
@@ -0,0 +1,${s.split(`
|
||||
`).length} @@`.split(`
|
||||
`),...a.split(`
|
||||
`),...s.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
|
||||
`)}}if(i){let s=this.parser.parseFromString(zh(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var ts=require("obsidian");var Ul=require("@codemirror/commands");var Xh=require("@codemirror/search"),Hl=require("@codemirror/state"),Yi=require("@codemirror/view");m();var Kh=require("obsidian"),Zw=require("@codemirror/view");function x5(t){return t.selection.ranges.filter(e=>!e.empty).map(e=>t.sliceDoc(e.from,e.to)).join(t.lineBreak)}function E5(t){t.dispatch({...t.state.replaceSelection(""),userEvent:"delete.cut"})}function sP(t,e){t.dispatch({...t.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function aP(t){if(!t&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let r of e)if(r.types.includes("text/html")){let i=await(await r.getType("text/html")).text();return(0,Kh.htmlToMarkdown)(i)}}return navigator.clipboard.readText()}var oP=Zw.EditorView.domEventHandlers({contextmenu(t,e){t.preventDefault();let r=x5(e.state),i=!e.state.readOnly&&e.state.facet(Zw.EditorView.editable),n=Kh.Menu.forEvent(t);return n.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!i||r.length===0).onClick(async()=>{await navigator.clipboard.writeText(r),E5(e)})),n.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(r.length===0).onClick(()=>navigator.clipboard.writeText(r))),n.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!i).onClick(async()=>sP(e,await aP(!1)))),n.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!i).onClick(async()=>sP(e,await aP(!0)))),n.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),n.showAtMouseEvent(t),!0}});var lP=Yi.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),Ua=class extends ts.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ts.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Os.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Os.name}getIcon(){return Os.icon}async setState(r,i){this.state=r,ts.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Br&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{fro
Line truncated
|
||||
`)+`
|
||||
`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=i.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,ts.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=kw(l.state),u=(d=i.parentElement)==null?void 0:d.indexOf(i),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,v=f.toB,b=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&v<=l.state.doc.length&&(b+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,v),insert:b},userEvent:"revert"})}}}return i.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},i}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Yi.lineNumbers)(),(0,Xh.highlightSelectionMatches)(),(0,Yi.drawSelection)(),Yi.keymap.of([...Ul.standardKeymap,Ul.indentWithTab]),(0,Ul.history)(),(0,Xh.search)(),Yi.EditorView.lineWrapping,oP],c=this,u=Yi.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(b=>b.annotation(Hl.Transaction.remote))){let b=g.state.doc.toString();c.fileSaveDebouncer(b)}}})),f={doc:a,extensions:[...l,Hl.EditorState.readOnly.of(!0),lP]},d=[...l];this.bIsEditable?d.push(u):d.push(Hl.EditorState.readOnly.of(!0),lP);let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Se&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Mh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons(s):void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var QR=require("obsidian");m();m();m();var cP,uP,fP;typeof window!="undefined"&&((fP=(uP=(cP=window.__svelte)!=null?cP:window.__svelte={}).v)!=null?fP:uP.v=new Set).add("5");m();m();m();var rs={};var Ye=Symbol("uninitialized"),Ti=Symbol("filename");var Qh="http://www.w3.org/1999/xhtml";m();m();m();m();var Jh=!0;m();var D=!1;m();var is=Array.isArray,dP=Array.prototype.indexOf,Ws=Array.prototype.includes,Gl=Array.from,Kw=Object.keys,or=Object.defineProperty,jr=Object.getOwnPropertyDescriptor,Xw=Object.getOwnPropertyDescriptors,Qw=Object.prototype,hP=Array.prototype,jl=Object.getPrototypeOf,Jw=Object.isExtensible;function e0(t){return typeof t=="function"}var lr=()=>{};function ep(t){for(var e=0;e<t.length;e++)t[e]()}function tp(){var t,e,r=new Promise((i,n)=>{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var Jt=Symbol("$state"),Yu=Symbol("legacy props"),mP=Symbol(""),rp=Symbol("proxy path"),ip=Symbol("attributes"),Zu=Symbol("class"),t0=Symbol("style"),Ku=Symbol("text"),Ga=Symbol("form reset"),r0=Symbol("hmr anchor"),ns=new class extends Error{constructor(){super(...arguments);He(this,"name","StaleReactionError");He(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},pP,i0=!!((pP=globalThis.document)!=null&&pP.contentType)&&globalThis.document.contentType.includes("xml");var Vl=3,Pi=8;m();m();function gP(t){if(D){let e=new Error(`invariant_violation
|
||||
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}"
|
||||
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function np(t){if(D){let e=new Error(`lifecycle_outside_component
|
||||
\`${t}(...)\` can only be used during component initialisation
|
||||
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function wP(){if(D){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function n0(){if(D){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function bP(){if(D){let t=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
|
||||
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function s0(t,e,r){if(D){let i=new Error(`each_key_duplicate
|
||||
${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`}
|
||||
https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function _P(t,e,r){if(D){let i=new Error(`each_key_volatile
|
||||
Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item
|
||||
https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function yP(t){if(D){let e=new Error(`effect_in_teardown
|
||||
\`${t}\` cannot be used inside an effect cleanup function
|
||||
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function xP(){if(D){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function EP(t){if(D){let e=new Error(`effect_orphan
|
||||
\`${t}\` can only be used inside an effect (e.g. during component initialisation)
|
||||
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function SP(){if(D){let t=new Error(`effect_update_depth_exceeded
|
||||
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
|
||||
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function kP(){if(D){let t=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
|
||||
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function CP(t){if(D){let e=new Error(`props_invalid_value
|
||||
Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value
|
||||
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function AP(t){if(D){let e=new Error(`rune_outside_svelte
|
||||
The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
|
||||
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function TP(){if(D){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function PP(){if(D){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function RP(){if(D){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function $P(){if(D){let t=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var An="font-weight: bold",Tn="font-weight: normal";function FP(t){D?console.warn(`%c[svelte] await_reactivity_loss
|
||||
%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\`
|
||||
https://svelte.dev/e/await_reactivity_loss`,An,Tn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function IP(t,e){D?console.warn(`%c[svelte] await_waterfall
|
||||
%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
|
||||
https://svelte.dev/e/await_waterfall`,An,Tn):console.warn("https://svelte.dev/e/await_waterfall")}function MP(){D?console.warn(`%c[svelte] derived_inert
|
||||
%cReading a derived belonging to a now-destroyed effect may result in stale values
|
||||
https://svelte.dev/e/derived_inert`,An,Tn):console.warn("https://svelte.dev/e/derived_inert")}function DP(t,e,r){D?console.warn(`%c[svelte] hydration_attribute_changed
|
||||
%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
|
||||
https://svelte.dev/e/hydration_attribute_changed`,An,Tn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ja(t){D?console.warn(`%c[svelte] hydration_mismatch
|
||||
%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
|
||||
https://svelte.dev/e/hydration_mismatch`,An,Tn):console.warn("https://svelte.dev/e/hydration_mismatch")}function OP(){D?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(j0===void 0){j0=window,i3=document;var e=Element.prototype,t=Node.prototype;a3=jr(t,"firstChild").get,s3=jr(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0,V&&(e.__svelte_meta=null,n3())}}function zr(e=""){return document.createTextNode(e)}function kt(e){return a3.call(e)}function It(e){return s3.call(e)}function U(e,t){if(!ae)return kt(e);var r=kt(ue);if(r===null)r=ue.appendChild(zr());else if(t&&r.nodeType!==3){var n=zr();return r==null||r.before(n),Qe(n),n}return Qe(r),r}function lr(e,t){var i,a;if(!ae){var r=kt(e);return r instanceof Comment&&r.data===""?It(r):r}if(t&&((i=ue)==null?void 0:i.nodeType)!==3){var n=zr();return(a=ue)==null||a.before(n),Qe(n),n}return ue}function Z(e,t=1,r=!1){let n=ae?ue:e;for(var i;t--;)i=n,n=It(n);if(!ae)return n;var a=n==null?void 0:n.nodeType;if(r&&a!==3){var s=zr();return n
Line truncated
|
||||
\`${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("$inspect"),e("$props"),e("$bindable")}g();var k3=new Map;function T3(e,t){var r=k3.get(e);r||(r=new Set,k3.set(e,r)),r.add(t)}g();g();g();g();g();g();function rv(e){ae&&kt(e)!==null&&ho(e)}var C3=!1;function nv(){C3||(C3=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(let r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function $d(e){var t=fe,r=te;Tt(null),it(null);try{return e()}finally{Tt(t),it(r)}}function iv(e,t,r,n=r){e.addEventListener(t,()=>$d(r));let i=e.__on_r;i?e.__on_r=()=>{i(),n(!0)}:e.__on_r=()=>n(!0),nv()}var av=new Set,Ld=new Set;function P3(e,t,r,n){function i(a){if(n.capture||wo.call(t,a),!a.cancelBubble)return $d(()=>r.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ur(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function Er(e,t,r,n,i){var a={captu
Line truncated
|
||||
`:""}${(_=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(){return this.branches}getItemText(r){return r}onChooseItem(r,n){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};g();var J3=require("obsidian");g();var Ac=require("obsidian");g();var q3=require("obsidian"),Wi=class extends q3.Modal{constructor(r,n,i){super(r);this.deletion=n;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let{contentEl:r,titleEl:n}=this;n.setText(`${this.deletion?"Delete":"Discard"} this file?`),r.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=r.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",()=>{this.resolve&&this.reso
Line truncated
|
||||
`)}. 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.toA;if(!u||!f)continue;let d=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=d.length&&e.slice(a.fromA-u,a.fromA)==d.slice(d.length-u)?(r[i]=new ht(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),n=!0):f<=d.length&&e.slice(a.toA,a.toA+f)==d.slice(0,f)&&(r[i]=new ht(a.fromA+f,a.toA+f,a.fromB+f,a.toB+f),n=!0)}if(!n)break}return r}function xH(e,t,r){for(let n=0,i=0;i<e.length;i++){let a=e[i],s=a.toA-a.fromA,o=a.toB-a.fromB;if(s&&o||s>3||o>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-n,u=c-a.toA,f=iP(t,a.fromA,Math.min(l,5)),d=nP(t,a.toA,Math.min(u,5)),h=a.fromA-f,p=d-a.toA;if(!s||!o){let m=Math.max(s,o),[v,y,b]=s?[t,a.fromA,a.toA]:[r,a.fromB,a.toB];h&&p&&(m>h&&t.slice(f,a.fromA)==v.slice(b-h,b)?(a=e[i]=new ht(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=nP(t,a.toA,Math.min(c-a.toA,5))):m>p&&t.slice(a.toA,d)==v.slice(y,y+p)&&(a=e[i]=new ht(d-s,d,a.fromB+p,a.toB+p),d=a.toA,f=iP(t,a.fromA,Math.min(a.fro
Line truncated
|
||||
`+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("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new Fe(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new Fe(this,{options:this.gitManager instanceof nn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof nn}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,Me.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new Fe(this,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(f===void 0){new Me.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new Fe(this,{options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.aLine truncated
|
||||
https://svelte.dev/e/lifecycle_double_unmount`,An,Tn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function sp(t){D?console.warn(`%c[svelte] state_proxy_equality_mismatch
|
||||
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results
|
||||
https://svelte.dev/e/state_proxy_equality_mismatch`,An,Tn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function LP(){D?console.warn(`%c[svelte] state_proxy_unmount
|
||||
%cTried to unmount a state proxy, rather than a component
|
||||
https://svelte.dev/e/state_proxy_unmount`,An,Tn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function NP(){D?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",An,Tn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function BP(t){D?console.warn(`%c[svelte] transition_slide_display
|
||||
%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\`
|
||||
https://svelte.dev/e/transition_slide_display`,An,Tn):console.warn("https://svelte.dev/e/transition_slide_display")}var ne=!1;function Mt(t){ne=t}var we;function ze(t){if(t===null)throw ja(),rs;return we=t}function cr(){return ze(tr(we))}function V(t){if(ne){if(tr(we)!==null)throw ja(),rs;we=t}}function Va(t=1){if(ne){for(var e=t,r=we;e--;)r=tr(r);we=r}}function Pn(t=!0){for(var e=0,r=we;;){if(r.nodeType===Pi){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=tr(r);t&&r.remove(),r=n}}function Qu(t){if(!t||t.nodeType!==Pi)throw ja(),rs;return t.data}m();m();m();m();function ap(t){return t===this.v}function a0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function op(t){return!a0(t,this.v)}m();var At=!1,ss=!1,Zi=!1;m();m();m();var Ju=null;function ur(t,e){return t.label=e,cp(t.v,e),t}function cp(t,e){var r;return(r=t==null?void 0:t[rp])==null||r.call(t,e),t}m();function Ki(t){let e=new Error,r=k5();return r.length===0?null:(r.unshift(`
|
||||
`),or(e,"stack",{value:r.join(`
|
||||
`)}),or(e,"name",{value:t}),e)}function k5(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(`
|
||||
`),i=[];for(let n=0;n<r.length;n++){let s=r[n],a=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];a.includes("svelte/src/internal")||a.includes("node_modules/.vite")||i.push(s)}}return i}function UP(t,e){if(!D)throw new Error("invariant(...) was not guarded by if (DEV)");t||gP(e)}m();var ye=null;function as(t){ye=t}var Rn=null;function ql(t){Rn=t}var Xi=null;function up(t){Xi=t}function lt(t,e=!1,r){ye={p:ye,i:!1,c:null,e:null,s:t,x:null,r:Q,l:ss&&!e?{s:null,u:null,$:[]}:null},D&&(ye.function=r,Xi=r)}function ct(t){var n;var e=ye,r=e.e;if(r!==null){e.e=null;for(var i of r)o0(i)}return t!==void 0&&(e.x=t),e.i=!0,ye=e.p,D&&(Xi=(n=ye==null?void 0:ye.function)!=null?n:null),t!=null?t:{}}function $n(){return!ss||ye!==null&&ye.l===null}m();m();var za=[];function GP(){var t=za;za=[],ep(t)}function Et(t){if(za.length===0&&!Wa){var e=za;queueMicrotask(()=>{e===za&&GP()})}za.push(t)}function jP(){for(;za.length>0;)GP()}m();var l0=new WeakMap;function fp(t){var e=Q;if(e===null)return ae.f|=8388608,t;if(D&&t instanceof Error&&!l0.has(t)&&l0.set(t,C5(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw D&&!e.parent&&t instanceof Error&&VP(t),t;Ji(t,e)}function Ji(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw D&&t instanceof Error&&VP(t),t}}function C5(t,e){var a,o,l;let r=jr(t,"message");if(!(r&&!r.configurable)){for(var i=tf?" ":" ",n=`
|
||||
${i}in ${((a=e.fn)==null?void 0:a.name)||"<unknown>"}`,s=e.ctx;s!==null;)n+=`
|
||||
${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+`
|
||||
${n}
|
||||
`,stack:(l=t.stack)==null?void 0:l.split(`
|
||||
`).filter(c=>!c.includes("svelte/src/internal")).join(`
|
||||
`)}}}function VP(t){let e=l0.get(t);e&&(or(t,"message",{value:e.message}),or(t,"stack",{value:e.stack}))}m();m();var A5=-7169;function Ue(t,e){t.f=t.f&A5|e}function Yl(t){(t.f&512)!==0||t.deps===null?Ue(t,1024):Ue(t,4096)}function zP(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,zP(e.deps))}function dp(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),zP(t.deps),Ue(t,1024)}m();m();m();var WP=!1,hp=!1;function c0(t){var e=hp;try{return hp=!1,[t(),hp]}finally{hp=e}}m();m();m();m();function u0(t){ne&&nr(t)!==null&&Kl(t)}var qP=!1;function f0(){qP||(qP=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ga])==null||e.call(r)})},{capture:!0}))}function zr(t){var e=ae,r=Q;Lt(null),Nt(null);try{return t()}finally{Lt(e),Nt(r)}}function d0(t,e,r,i=r){t.addEventListener(e,()=>zr(r));let n=t[Ga];n?t[Ga]=()=>{n(),i(!0)}:t[Ga]=()=>i(!0),f0()}m();m();m();function YP(t){let e=0,r=dr(0),i;return D&&ur(r,"createSubscriber version"),()=>{qs()&&(F(r),sr(()=>(e===0&&(i=Ze(()=>t(()=>Za(r)))),e+=1,()=>{Et(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Za(r))})})))}}var P5=589824;function w0(t,e,r,i){new h0(t,e,r,i)}var ii,rf,Fi,Ka,Wr,Ii,Sr,ni,ls,Xa,Ys,Xl,nf,sf,Fn,gp,We,KP,XP,p0,QP,m0,pp,mp,g0,v0,h0=class{constructor(e,r,i,n){me(this,We);He(this,"parent");He(this,"is_pending",!1);He(this,"transform_error");me(this,ii);me(this,rf,ne?we:null);me(this,Fi);me(this,Ka);me(this,Wr);me(this,Ii,null);me(this,Sr,null);me(this,ni,null);me(this,ls,null);me(this,Xa,0);me(this,Ys,0);me(this,Xl,!1);me(this,nf,new Set);me(this,sf,new Set);me(this,Fn,null);me(this,gp,YP(()=>(fe(this,Fn,dr($(this,Xa))),D&&ur($(this,Fn),"$effect.pending()"),()=>{fe(this,Fn,null)})));var s,a;fe(this,ii,e),fe(this,Fi,r),fe(this,Ka,o=>{var l=Q;l.b=this,l.f|=128,i(o)}),this.parent=Q.b,this.transform_error=(a=n!=null?n:(s=this.parent)==null?void 0:s.transform_error)!=null?a:(o=>o),fe(this,Wr,ai(()=>{if(ne){let o=$(this,rf);cr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Ee(this,We,XP).call(this,u)}else l?Ee(this,We,QP).call(this):Ee(this,We,KP).call(this)}else Ee(this,We,m0).call(this)},P5)),ne&&fe(this,ii,we)}defer_effect(e){dp(e,$(this,nf),$(this,sf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!$(this,Fi).pending}update_pending_count(e,r){Ee(this,We,g0).call(this,e,r),fe(this,Xa,$(this,Xa)+e),!(!$(this,Fn)||$(this,Xl))&&(fe(this,Xl,!0),Et(()=>{fe(this,Xl,!1),$(this,Fn)&&en($(this,Fn),$(this,Xa))}))}get_effect_pending(){return $(this,gp).call(this),F($(this,Fn))}error(e){var r;if(!$(this,Fi).onerror&&!$(this,Fi).failed)throw e;(r=oe)!=null&&r.is_fork?($(this,Ii)&&oe.skip_effect($(this,Ii)),$(this,Sr)&&oe.skip_effect($(this,Sr)),$(this,ni)&&oe.skip_effect($(this,ni)),oe.oncommit(()=>{Ee(this,We,v0).call(this,e)})):Ee(this,We,v0).call(this,e)}};ii=new WeakMap,rf=new WeakMap,Fi=new WeakMap,Ka=new WeakMap,Wr=new WeakMap,Ii=new WeakMap,Sr=new WeakMap,ni=new WeakMap,ls=new WeakMap,Xa=new WeakMap,Ys=new WeakMap,Xl=new WeakMap,nf=new WeakMap,sf=new WeakMap,Fn=new WeakMap,gp=new WeakMap,We=new WeakSet,KP=function(){try{fe(this,Ii,Bt(()=>$(this,Ka).call(this,$(this,ii))))}catch(e){this.error(e)}},XP=function(e){let r=$(this,Fi).failed,{reset:i,invoke_onerror:n}=Ee(this,We,p0).call(this,e);Et(n),r&&fe(this,ni,Bt(()=>{r($(this,ii),()=>e,()=>i)}))},p0=function(e){var r=!1,i=!1;let n=()=>{if(r){NP();return}r=!0,i&&$P(),$(this,ni)!==null&&In($(this,ni),()=>{fe(this,ni,null)}),Ee(this,We,mp).call(this,()=>{Ee(this,We,m0).call(this)})};return{reset:n,invoke_onerror:()=>{var a,o;try{i=!0,(o=(a=$(this,Fi)).onerror)==null||o.call(a,e,n),i=!1}catch(l){Ji(l,$(this,Wr)&&$(this,Wr).parent)}}}},QP=function(){let e=$(this,Fi).pending;e&&(this.is_pending=!0,fe(this,Sr,Bt(()=>e($(this,ii)))),Et(()=>{var r=fe(this,ls,document.createDocumentFragment()),i=Ht();r.append(i),fe(this,Ii,Ee(this,We,mp).call(this,()=>Bt(()=>$(this,Ka).call(this,i)))),$(this,Ys)===0&&($(this,ii).before(r),fe(this,ls,null),In($(this,Sr),()=>{fe(this,Sr,null)}),Ee(this,We,pp).call(this,oe))}))},m0=function(){try{if(this.is_pending=this.has_pending_snippet(),fe(this,Ys,0),fe(this,Xa,0),fe(this,Ii,Bt(()=>{$(this,Ka).call(this,$(this,ii))})),$(this,Ys)>0){var e=fe(this,ls,document.createDocumentFragment());Ql($(this,Ii),e);let r=$(this,Fi).pending;fe(this,Sr,Bt(()=>r($(this,ii))))}else Ee(this,We,pp).call(this,oe)}catch(r){this.error(r)}},pp=function(e){this.is_pending=!1,e.transfer_effects($(this,nf),$(this,sf))},mp=function(e){var r=Q,i=ae,n=ye;Nt($(this,Wr)),Lt($(this,Wr)),as($(this,Wr).ctx);try{return si.ensure(),e()}catch(s){return fp(s),null}finally{Nt(r),Lt(i),as(n)}},g0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Ee(i=this.parent,We,g0).call(i,e,r);return}fe(this,Ys,$(this,Ys)+e),$(this,Ys)===0&&(Ee(this,We,pp).call(this,r),$(this,Sr)&&In($(this,Sr),()=>{fe(this,Sr,null)}),$(this
Line truncated
|
||||
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==rs&&console.warn("Failed to hydrate: ",o),e.recover===!1&&kP(),kp(),Kl(r),Mt(!1),Js(t,e)}finally{Mt(i),ze(n)}}var Fp=new Map;function OR(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){kp();var l=void 0,c=yR(()=>{var u=r!=null?r:e.appendChild(Ht());w0(u,{pending:()=>{}},h=>{lt({});var p=ye;if(s&&(p.c=s),n&&(i.$$events=n),ne&&rn(h,null),Ip=a,l=t(h,i)||{},Ip=!0,ne&&(Q.nodes.end=we,we===null||we.nodeType!==Pi||we.data!=="]"))throw ja(),rs;ct()},o);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var g=h[p];if(!f.has(g)){f.add(g);var v=DR(g);for(let C of[e,document]){var b=Fp.get(C);b===void 0&&(b=new Map,Fp.set(C,b));var _=b.get(g);_===void 0?(C.addEventListener(g,$p,{passive:v}),b.set(g,1)):b.set(g,_+1)}}}};return d(Gl(N0)),Rp.add(d),()=>{var v;for(var h of f)for(let b of[e,document]){var p=Fp.get(b),g=p.get(h);--g==0?(b.removeEventListener(h,$p),p.delete(h),p.size===0&&Fp.delete(b)):p.set(h,g)}Rp.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return G0.set(l,c),l}var G0=new WeakMap;function gs(t,e){let r=G0.get(t);return r?(G0.delete(t),r(e)):(D&&(Jt in t?LP():OP()),Promise.resolve())}m();m();m();var nn,Nn,fi,lo,mf,gf,Mp,vs=class{constructor(e,r=!0){He(this,"anchor");me(this,nn,new Map);me(this,Nn,new Map);me(this,fi,new Map);me(this,lo,new Set);me(this,mf,!0);me(this,gf,e=>{if($(this,nn).has(e)){var r=$(this,nn).get(e),i=$(this,Nn).get(r);if(i)fc(i),$(this,lo).delete(r);else{var n=$(this,fi).get(r);n&&(fc(n.effect),$(this,Nn).set(r,n.effect),$(this,fi).delete(r),D&&(n.fragment.lastChild[r0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of $(this,nn)){if($(this,nn).delete(s),s===e)break;let o=$(this,fi).get(a);o&&(vt(o.effect),$(this,fi).delete(a))}for(let[s,a]of $(this,Nn)){if(s===r||$(this,lo).has(s))continue;let o=()=>{if(Array.from($(this,nn).values()).includes(s)){var c=document.createDocumentFragment();Ql(a,c),c.append(Ht()),$(this,fi).set(s,{effect:a,fragment:c})}else vt(a);$(this,lo).delete(s),$(this,Nn).delete(s)};$(this,mf)||!i?($(this,lo).add(s),In(a,o,!1)):o()}}});me(this,Mp,e=>{$(this,nn).delete(e);let r=Array.from($(this,nn).values());for(let[i,n]of $(this,fi))r.includes(i)||(vt(n.effect),$(this,fi).delete(i))});this.anchor=e,fe(this,mf,r)}ensure(e,r){var i=oe,n=Cp();if(r&&!$(this,Nn).has(e)&&!$(this,fi).has(e))if(n){var s=document.createDocumentFragment(),a=Ht();s.append(a),$(this,fi).set(e,{effect:Bt(()=>r(a)),fragment:s})}else $(this,Nn).set(e,Bt(()=>r(this.anchor)));if($(this,nn).set(i,e),n){for(let[o,l]of $(this,Nn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of $(this,fi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit($(this,gf)),i.ondiscard($(this,Mp))}else ne&&(this.anchor=we),$(this,gf).call(this,i)}};nn=new WeakMap,Nn=new WeakMap,fi=new WeakMap,lo=new WeakMap,mf=new WeakMap,gf=new WeakMap,Mp=new WeakMap;if(D){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;AP(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){ye===null&&np("onMount"),ss&&ye.l!==null?X5(ye).m.push(t):hr(()=>{let e=Ze(t);if(typeof e=="function")return e})}function X5(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var BR=new Map;function HR(t,e){var r=BR.get(t);r||(r=new Set,BR.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Re(t,e,r=!1){var i;ne&&(i=we,cr());var n=new vs(t),s=r?65536:0;function a(o,l){if(ne){var c=Qu(i);if(o!==parseInt(c.substring(1))){var u=Pn();ze(u),n.anchor=u,Mt(!1),n.ensure(o,l),Mt(!0);return}}n.ensure(o,l)}ai(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function di(t,e){return e}function sU(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o<n;o++){let d=e[o];In(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;V0(t,Gl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;Kl(u),u.append(c),t.items.clear()}V0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function V0(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n<e.length;n++){var s=e[n];if(i!=null&&i.has(s)){s.f|=33554432;let a=document.createDocumentFragment();Ql(s,a)}else vt(e[n],r)}}var dc;function hi(t,e,r,i,n,s=null){var a=t,o=new Map,l=(e&4)!==0;if(l){var c=t;a=ne?ze(nr(c)):c.appendChild(Ht())}ne&&cr();var u=null,f=Qa(()=>{var C=r();return is(C)?C:C==null?[]:Gl(C)});D&&ur(f,"{#each ...}");var d,h=new Map,p=!0;function g(C){(_.effect.f&16384)===0&&(_.pending.delete(C),_.fallback=u,aU(_,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?fc(u):(u.f^=33554432,wf(u,null,a)):
Line truncated
|
||||
\r\f\xA0\v\uFEFF`];function qR(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||WR.includes(i[a-1]))&&(o===i.length||WR.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function wt(t,e,r,i,n,s){var a=t[Zu];if(ne||a!==r||a===void 0){var o=qR(r,i,s);(!ne||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Zu]=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var xU=Symbol("is custom element"),EU=Symbol("is html"),SU=i0?"link":"LINK";function Ce(t,e,r,i){var n=kU(t);if(ne&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===SU)){i||AU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[mP]=r),r==null?t.removeAttribute(e):typeof r!="string"&&CU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function kU(t){var e,r;return(r=t[e=ip])!=null?r:t[e]={[xU]:t.nodeName.includes("-"),[EU]:t.namespaceURI===Qh}}var YR=new Map;function CU(t){var e=t.getAttribute("is")||t.nodeName,r=YR.get(e);if(r)return r;YR.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Xw(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=jl(n)}return r}function AU(t,e,r){var i;D&&(e==="srcset"&&TU(t,r)||W0((i=t.getAttribute(e))!=null?i:"",r)||DP(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function W0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function ZR(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function TU(t,e){var r=ZR(t.srcset),i=ZR(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(W0(r[a][0],n)||W0(n,r[a][0])))}m();m();m();function Z0(t,e,r=e){var i=new WeakSet;d0(t,"input",async n=>{D&&t.type==="checkbox"&&n0();var s=n?t.defaultValue:t.value;if(s=q0(t)?Y0(s):s,r(s),oe!==null&&i.add(oe),await Pp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ne&&t.defaultValue!==t.value||Ze(e)==null&&t.value)&&(r(q0(t)?Y0(t.value):t.value),oe!==null&&i.add(oe)),sr(()=>{D&&t.type==="checkbox"&&n0();var n=e();if(t===document.activeElement){var s=At?us:oe;if(i.has(s))return}q0(t)&&n===Y0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function q0(t){var e=t.type;return e==="number"||e==="range"}function Y0(t){return t===""?null:+t}m();m();m();m();m();function K0(t,e){return t===e||(t==null?void 0:t[Jt])===e}function at(t={},e,r,i){var n=ye.r,s=Q;return Kr(()=>{var a,o;return sr(()=>{a=o,o=(i==null?void 0:i())||[],Ze(()=>{K0(r(...o),t)||(e(t,...o),a&&K0(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&K0(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var x,S;var n=!ss||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=Zs(i)),F(c)):(l&&(l=!1,o=a?Ze(i):i),o);let f;if(s){var d=Jt in t||Yu in t;f=(S=(x=jr(t,e))==null?void 0:x.set)!=null?S:d&&e in t?A=>t[e]=A:void 0}var h,p=!1;s?[h,p]=c0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&CP(e),f(h)));var g;if(n?g=()=>{var A=t[e];return A===void 0?u():(l=!0,A)}:g=()=>{var A=t[e];return A!==void 0&&(o=void 0),A===void 0?o:A},n&&(r&4)===0)return g;if(f){var v=t.$$legacy;return(function(A,w){return arguments.length>0?((!n||!w||v||p)&&f(w?g():A),A):g()})}var b=!1,_=((r&1)!==0?Zs:Qa)(()=>(b=!1,g()));D&&(_.label=e),s&&F(_);var C=Q;return(function(A,w){if(arguments.length>0){let E=w?F(_):n&&s?et(A):A;return se(_,E),b=!0,o!==void 0&&(o=E),A}return oi&&b||(C.f&16384)!==0?_.v:F(_)})}m();m();m();function XR(t){return new Q0(t)}var ws,Oi,Q0=class{constructor(e){me(this,ws);me(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=qa(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Yu?!0:(F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return se((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});fe(this,Oi,(e.hydrate?j0:Js)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!At&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&io(),fe(this,ws,n.$$events);for(let o of Object.keys($(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||or(this,o,{get(){return $(this,Oi)[o]},set(l){$(this,Oi)[o]=l},enumerable:!0});$(this,Oi).$set=o=>{Object.assign(n,o)},$(this,Oi).$destroy=()=>{gs($(this,Oi))}}$set(e){$(this,Oi).$set(
Line truncated
|
||||
`:""}${(E=e.log.author)==null?void 0:E.name}
|
||||
${(0,tb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
|
||||
${e.log.message}`}]),ve("click",u,()=>se(n,!F(n))),le(t,o),ct()}Pt(["click"]);var nG=_e('<div class="tree-item nav-folder mod-root"></div>'),sG=_e('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),aG={hash:"svelte-12n6twc",code:""};function nb(t,e){lt(e,!0),on(t,aG);let r=Di(e,"plugin",15),i=Oe(!1),n=et([]),s=Oe(void 0),a=Oe(et(r().settings.treeStructure)),o;hr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),hr(()=>{n.forEach(x=>(0,ib.setIcon)(x,x.getAttr("data-icon")))}),co(()=>{let x=new IntersectionObserver(A=>{var w;(w=A[0])!=null&&w.isIntersecting&&!F(i)&&u().catch(console.error)}),S=activeDocument.querySelector("#sentinel");return S&&x.observe(S),()=>{x.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}async function c(){var A,w;if(!r().gitReady){se(s,void 0);return}se(i,!0);let x=r().gitManager instanceof Se,S;((w=(A=F(s))==null?void 0:A.length)!=null?w:0)==0?S=x?50:10:S=F(s).length,se(s,await r().gitManager.log(void 0,!1,S),!0),se(i,!1)}async function u(){var w;if(!r().gitReady||F(s)===void 0)return;se(i,!0);let S=r().gitManager instanceof Se?50:10,A=await r().gitManager.log(void 0,!1,S,(w=F(s).last())==null?void 0:w.hash);F(s).push(...A.slice(1)),se(i,!1)}var f=sG(),d=z(f),h=z(d),p=z(h);at(p,x=>n[0]=x,()=>n==null?void 0:n[0]);var g=ie(p,2);let v;at(g,x=>n[1]=x,()=>n==null?void 0:n[1]),V(h),V(d);var b=ie(d,2),_=z(b);{var C=x=>{var S=nG();hi(S,21,()=>F(s),di,(A,w)=>{rb(A,{get view(){return e.view},get showTree(){return F(a)},get log(){return F(w)},get plugin(){return r()}})}),V(S),le(x,S)};Re(_,x=>{F(s)&&x(C)})}Va(4),V(b),V(f),je(()=>{Ce(p,"data-icon",F(a)?"list":"folder"),v=wt(g,1,"clickable-icon nav-action-button",null,v,{loading:F(i)})}),ve("click",p,()=>{se(a,!F(a)),(0,ib.setIcon)(n[0],F(a)?"list":"folder"),r(r().settings.treeStructure=F(a),!0),r().saveSettings()}),ve("click",g,l),le(t,f),ct()}Pt(["click"]);var yf=class extends QR.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return wi.type}getDisplayText(){return wi.name}getIcon(){return wi.icon}onClose(){return this._view&&gs(this._view),super.onClose()}reload(){this._view&&gs(this._view),this._view=Js(nb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var JR=require("obsidian"),Np=class extends JR.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var r$=require("obsidian");m();var ho=require("obsidian");m();var xf=require("obsidian");m();var e$=require("obsidian");var hc=class extends e$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${wu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${wu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${wu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${wu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};var oG=_e('<div data-icon="go-t
Line truncated
|
||||
`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=`
|
||||
`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Wi.getHunk(r.state,!1,e),n=!1;if(i||(i=Wi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(i$.editorInfoField).file.path,a=zt.createPatch(s,[i],"100644",n).join(`
|
||||
`)+`
|
||||
`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Wi.getHunks(r.state,!1),s=i.getCursor().line+1,a=zt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var po=require("obsidian");var Gp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof po.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),bT(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;PT(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new _h(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&po.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(HT),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),ST(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;e&&((r=this.lineAuthorInfoProvider)==null||r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof po.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof po.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",AT)}};m();var pc=require("obsidian");m();m();var mo=require("@codemirror/state"),Vp=require("@codemirror/view");var jp=class extends Vp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=createDiv();return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},lb=mo.StateField.define({create:()=>mo.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Gr,!1);if(!r)return mo.RangeSet.empty;let i=e.effects.some(s=>s.is(Oh)),n=e.effects.some(s=>s.is(Rl));if(i||n||(e.
Line truncated
|
||||
`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof ke.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof ke.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof ke.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof ke.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof ke.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(c$.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=DS(pt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return ke.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(!this.localStorage.getPluginDisabled()){if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new xh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Se(this),await this.gitManager.setGitInstance()):this.gitManager=new zi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new ke.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,ke.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Hp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;(o=this.branchBar)==null?void 0:o.display().catch(console.error)},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new ke.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}}async createNewRepo(){try{await this.gitManager.init(),new ke.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new rt(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new rt(this,{options:this.gitManager instanceof zi?[n]:[],placeholder:"En
Line truncated
|
||||
# Additional Instructions
|
||||
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
|
||||
|
||||
@@ -372,8 +373,8 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
|
||||
=======
|
||||
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)}};
|
||||
\`\`\``]),await this.tools.writeAndOpenFile(i==null?void 0:i.join(`
|
||||
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new rt(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new rt(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,uv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new rt(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new rt(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new rt(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof Ha||i instanceof Ua))return;let n=this.app.workspace.getLeavesOfType(Xt.type).first(),s=this.app.workspace.getLeavesOfType(wi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Ha||(r==null?void 0:r.view)instanceof Ua){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new ke.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof lu.UserCanceledError){new ke.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.settings.showErrorNotices&&new ke.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
|
||||
/*! Bundled license information:
|
||||
|
||||
ieee754/index.js:
|
||||
@@ -393,22 +394,34 @@ safe-buffer/index.js:
|
||||
crc-32/crc32.js:
|
||||
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
||||
|
||||
js-sha256/src/sha256.js:
|
||||
isomorphic-git/index.js:
|
||||
(*!
|
||||
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
||||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
* Copyright (c) James Prevett and other ZenFS contributors.
|
||||
*
|
||||
* Windows support added:
|
||||
* - Backslashes are normalised to forward slashes before processing.
|
||||
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
||||
* normalisation, so absolute Windows paths are handled correctly.
|
||||
* - An absolute argument passed to join() resets the accumulated path,
|
||||
* matching Node behaviour and handling worktree gitdir paths properly.
|
||||
*
|
||||
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
||||
* backslashes are normalised to forward slashes and then collapsed by
|
||||
* normalizeString, losing the UNC root. Git on Windows works with
|
||||
* drive-letter paths, so this is not expected to be a practical issue.
|
||||
*)
|
||||
|
||||
js-sha256/build/sha256.mjs:
|
||||
(**
|
||||
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
||||
*
|
||||
* @version 0.9.0
|
||||
* @version 0.12.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @copyright Chen, Yi-Cyuan 2014-2026
|
||||
* @license MIT
|
||||
*)
|
||||
|
||||
feather-icons/dist/feather.js:
|
||||
(*!
|
||||
Copyright (c) 2016 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*)
|
||||
*/
|
||||
|
||||
/* nosourcemap */
|
||||
+1
-1
@@ -6,5 +6,5 @@
|
||||
"description": "Integrate Git version control with automatic backup and other advanced features.",
|
||||
"isDesktopOnly": false,
|
||||
"fundingUrl": "https://ko-fi.com/vinzent",
|
||||
"version": "2.31.1"
|
||||
"version": "2.39.0"
|
||||
}
|
||||
+572
-443
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user