Last Sync: 2026-01-25 17:34 (Mobile)
This commit is contained in:
1 parent
137948cbc0
commit
0632d92142
5 files changed
+706
-614
No files matched your search
@@ -3,24 +3,24 @@ 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 X5=Object.create;var wl=Object.defineProperty;var K5=Object.getOwnPropertyDescriptor;var Z5=Object.getOwnPropertyNames;var J5=Object.getPrototypeOf,Q5=Object.prototype.hasOwnProperty;var by=t=>{throw TypeError(t)};var eI=(t,e,r)=>e in t?wl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var tI=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),rI=(t,e)=>{for(var r in e)wl(t,r,{get:e[r],enumerable:!0})},_y=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Z5(e))!Q5.call(t,i)&&i!==r&&wl(t,i,{get:()=>e[i],enumerable:!(n=K5(e,i))||n.enumerable});return t};var Ot=(t,e,r)=>(r=t!=null?X5(J5(t)):{},_y(e||!t||!t.__esModule?wl(r,"default",{value:t,enumerable:!0}):r,t)),nI=t=>_y(wl({},"__esModule",{value:!0}),t);var vt=(t,e,r)=>eI(t,typeof e!="symbol"?e+"":e,r),wp=(t,e,r)=>e.has(t)||by("Cannot "+r);var ue=(t,e,r)=>(wp(t,e,"read from private field"),r?r.call(t):e.get(t)),yt=(t,e,r)=>e.has(t)?by("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),It=(t,e,r,n)=>(wp(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),di=(t,e,r)=>(wp(t,e,"access private method"),r);var Ey=M(Iu=>{"use strict";m();Iu.byteLength=aI;Iu.toByteArray=oI;Iu.fromByteArray=uI;var Mn=[],qr=[],iI=typeof Uint8Array!="undefined"?Uint8Array:Array,bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ra=0,xy=bp.length;Ra<xy;++Ra)Mn[Ra]=bp[Ra],qr[bp.charCodeAt(Ra)]=Ra;var Ra,xy;qr[45]=62;qr[95]=63;function Sy(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 n=r===e?0:4-r%4;return[r,n]}function aI(t){var e=Sy(t),r=e[0],n=e[1];return(r+n)*3/4-n}function sI(t,e,r){return(e+r)*3/4-r}function oI(t){var e,r=Sy(t),n=r[0],i=r[1],a=new iI(sI(t,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l<o;l+=4)e=qr[t.charCodeAt(l)]<<18|qr[t.charCodeAt(l+1)]<<12|qr[t.charCodeAt(l+2)]<<6|qr[t.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=qr[t.charCodeAt(l)]<<2|qr[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=qr[t.charCodeAt(l)]<<10|qr[t.charCodeAt(l+1)]<<4|qr[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function lI(t){return Mn[t>>18&63]+Mn[t>>12&63]+Mn[t>>6&63]+Mn[t&63]}function cI(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push(lI(n));return i.join("")}function uI(t){for(var e,r=t.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(cI(t,s,s+a>o?o:s+a));return n===1?(e=t[r-1],i.push(Mn[e>>2]+Mn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Mn[e>>10]+Mn[e>>4&63]+Mn[e<<2&63]+"=")),i.join("")}});var Ay=M(_p=>{m();_p.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,l=(1<<o)-1,c=l>>1,u=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=s*256+t[e+f],f+=d,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-c}return(h?-1:1)*s*Math.pow(2,a-n)};_p.write=function(t,e,r,n,i,a){var s,o,l,c=a*8-i-1,u=(1<<c)-1,f=u>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?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,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+h]=o&255,h+=p,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;t[r+h]=s&255,h+=p,s/=256,c-=8);t[r+h-p]|=g*128}});var Rp=M(Ls=>{"use strict";m();var xp=Ey(),$s=Ay(),ky=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ls.Buffer=O;Ls.SlowBuffer=gI;Ls.INSPECT_MAX_BYTES=50;var Fu=2147483647;Ls.kMaxLength=Fu;O.TYPED_ARRAY_SUPPORT=fI();!O.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 fI(){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(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}});Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}});function hi(t){if(t>Fu)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(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 kp(t)}return Ry(t,e,r)}O.poolSize=8192;function Ry(t,e,r){if(typeof t=="string")return hI(t,e);if(ArrayBuffer.isView(t))return pI(t);if(t==null)throw new TypeError(Line truncated
|
||||
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Kr(i),s=io(e);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(e.oid,20,"hex"),a.writeUInt16BE(J8(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),r=new Kr(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(t._entryToBuffer(l));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([e,i]),s=await bi(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Tf(t,e,r=!0,n=!0){let i=io(t),a=io(e);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 Bm=null,Hm=Symbol("IndexCache");function Q8(){return{map:new Map,stats:new Map}}async function e4(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await Zm.from(i);r.map.set(e,a),r.stats.set(e,n)}async function t4(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);return i===null?!1:Tf(n,i)}var ct=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[Hm]||(n[Hm]=Q8());let s=`${r}/index`;Bm===null&&(Bm=new zl({maxPending:1/0}));let o,l=[];return await Bm.acquire(s,async()=>{let c=n[Hm];await t4(e,s,c)&&await e4(e,s,c);let u=c.map.get(s);if(l=u.unmergedPaths,l.length&&!i)throw new Vl(l);if(o=await a(u),u._dirty){let f=await u.toObject();await e.write(s,f),c.stats.set(s,await e.lstat(s)),u._dirty=!1}}),o}};function Cf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ao(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function $x(t){let e=new Map,r=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:Cf(i),metadata:{},children:[]};e.set(i,a),a.parent=r(ao(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},n=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:Cf(i),metadata:a,parent:r(ao(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function r4(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 pe(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Jm=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=ct.acquire({fs:e,gitdir:r,cache:n},async function(a){return $x(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(e){let r=e._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(Lf),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:io(n.metadata);e._type=n.type==="tree"?"tree":r4(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},jf=Symbol("GitWalkSymbol");function Ya(){let t=Object.create(null);return Object.defineProperty(t,jf,{value:function({fs:e,gitdir:r,cache:n}){return new Jm({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var je=class t extends Ae{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};je.code="NotFoundError";var tr=class t extends Ae{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};tr.code="ObjectTypeError";var Qi=class t extends Ae{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Qi.code="InvalidOidError";var ql=class t extends Ae{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||||
var zM=Object.create;var Rl=Object.defineProperty;var VM=Object.getOwnPropertyDescriptor;var WM=Object.getOwnPropertyNames;var YM=Object.getPrototypeOf,XM=Object.prototype.hasOwnProperty;var Jy=t=>{throw TypeError(t)};var ZM=(t,e,r)=>e in t?Rl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var KM=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),JM=(t,e)=>{for(var r in e)Rl(t,r,{get:e[r],enumerable:!0})},Qy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of WM(e))!XM.call(t,i)&&i!==r&&Rl(t,i,{get:()=>e[i],enumerable:!(n=VM(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?zM(YM(t)):{},Qy(e||!t||!t.__esModule?Rl(r,"default",{value:t,enumerable:!0}):r,t)),QM=t=>Qy(Rl({},"__esModule",{value:!0}),t);var vt=(t,e,r)=>ZM(t,typeof e!="symbol"?e+"":e,r),Gp=(t,e,r)=>e.has(t)||Jy("Cannot "+r);var le=(t,e,r)=>(Gp(t,e,"read from private field"),r?r.call(t):e.get(t)),wt=(t,e,r)=>e.has(t)?Jy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ot=(t,e,r,n)=>(Gp(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),vi=(t,e,r)=>(Gp(t,e,"access private method"),r);var rb=I(Wu=>{"use strict";p();Wu.byteLength=tD;Wu.toByteArray=nD;Wu.fromByteArray=sD;var Dn=[],Yr=[],eD=typeof Uint8Array!="undefined"?Uint8Array:Array,qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(La=0,eb=qp.length;La<eb;++La)Dn[La]=qp[La],Yr[qp.charCodeAt(La)]=La;var La,eb;Yr[45]=62;Yr[95]=63;function tb(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 n=r===e?0:4-r%4;return[r,n]}function tD(t){var e=tb(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rD(t,e,r){return(e+r)*3/4-r}function nD(t){var e,r=tb(t),n=r[0],i=r[1],a=new eD(rD(t,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l<o;l+=4)e=Yr[t.charCodeAt(l)]<<18|Yr[t.charCodeAt(l+1)]<<12|Yr[t.charCodeAt(l+2)]<<6|Yr[t.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Yr[t.charCodeAt(l)]<<2|Yr[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Yr[t.charCodeAt(l)]<<10|Yr[t.charCodeAt(l+1)]<<4|Yr[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function iD(t){return Dn[t>>18&63]+Dn[t>>12&63]+Dn[t>>6&63]+Dn[t&63]}function aD(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push(iD(n));return i.join("")}function sD(t){for(var e,r=t.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(aD(t,s,s+a>o?o:s+a));return n===1?(e=t[r-1],i.push(Dn[e>>2]+Dn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Dn[e>>10]+Dn[e>>4&63]+Dn[e<<2&63]+"=")),i.join("")}});var nb=I(zp=>{p();zp.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,l=(1<<o)-1,u=l>>1,c=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-c)-1,h>>=-c,c+=o;c>0;a=a*256+t[e+f],f+=d,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=s*256+t[e+f],f+=d,c-=8);if(a===0)a=1-u;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-u}return(h?-1:1)*s*Math.pow(2,a-n)};zp.write=function(t,e,r,n,i,a){var s,o,l,u=a*8-i-1,c=(1<<u)-1,f=c>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,m=n?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,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=c?(o=0,s=c):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+h]=o&255,h+=m,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;t[r+h]=s&255,h+=m,s/=256,u-=8);t[r+h-m]|=g*128}});var em=I(Ws=>{"use strict";p();var Vp=rb(),zs=nb(),ib=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ws.Buffer=$;Ws.SlowBuffer=dD;Ws.INSPECT_MAX_BYTES=50;var Yu=2147483647;Ws.kMaxLength=Yu;$.TYPED_ARRAY_SUPPORT=oD();!$.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 oD(){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($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function wi(t){if(t>Yu)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(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 Zp(t)}return lb(t,e,r)}$.poolSize=8192;function lb(t,e,r){if(typeof t=="string")return cD(t,e);if(ArrayBuffer.isView(t))return uD(t);if(t==null)throw new TypeError(Line truncated
|
||||
`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Jr(i),s=mo(e);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(e.oid,20,"hex"),a.writeUInt16BE(YH(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),r=new Jr(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(t._entryToBuffer(l));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([e,i]),s=await ki(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Uf(t,e,r=!0,n=!0){let i=mo(t),a=mo(e);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 ug=null,fg=Symbol("IndexCache");function XH(){return{map:new Map,stats:new Map}}async function ZH(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await _g.from(i);r.map.set(e,a),r.stats.set(e,n)}async function KH(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);return i===null?!1:Uf(n,i)}var ct=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[fg]||(n[fg]=XH());let s=`${r}/index`;ug===null&&(ug=new tc({maxPending:1/0}));let o,l=[];return await ug.acquire(s,async()=>{let u=n[fg];await KH(e,s,u)&&await ZH(e,s,u);let c=u.map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new rc(l);if(o=await a(c),c._dirty){let f=await c.toObject();await e.write(s,f),u.stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function go(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function hE(t){let e=new Map,r=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jf(i),metadata:{},children:[]};e.set(i,a),a.parent=r(go(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},n=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jf(i),metadata:a,parent:r(go(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function JH(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 de(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var xg=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=ct.acquire({fs:e,gitdir:r,cache:n},async function(a){return hE(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(e){let r=e._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(Kf),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:mo(n.metadata);e._type=n.type==="tree"?"tree":JH(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},Jf=Symbol("GitWalkSymbol");function ts(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,gitdir:r,cache:n}){return new xg({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var Le=class t extends Ae{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Le.code="NotFoundError";var rr=class t extends Ae{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};rr.code="ObjectTypeError";var oa=class t extends Ae{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};oa.code="InvalidOidError";var nc=class t extends Ae{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||||
[remote "${e}"]
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
`),this.code=this.name=t.code,this.data={remote:e}}};ql.code="NoRefspecError";var Pf=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
||||
`),this.code=this.name=t.code,this.data={remote:e}}};nc.code="NoRefspecError";var Gf=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(`
|
||||
`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let 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(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(`
|
||||
`)+`
|
||||
`}},Rf=class t{constructor({remotePath:e,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:r,force:n,matchPrefix:i})}static from(e){let[r,n,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=i==="*";if(l!==(s==="*"))throw new pe("Invalid refspec");return new t({remotePath:n,localPath:a,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}},Qm=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(Rf.from(n));return new t(r)}add(e){let r=Rf.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(e){let r=null;for(let n of this.rules){let i=n.translate(e);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function n4(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?t.endsWith("^{}")?1:-1:i}var i4=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},Gl=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}`)},ux={core:{filemode:Gl,bare:Gl,logallrefupdates:Gl,symlinks:Gl,ignorecase:Gl,bigFileThreshold:i4}},a4=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,s4=/^[A-Za-z0-9-.]+$/,o4=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,l4=/^[A-Za-z][A-Za-z-]*$/,c4=/^(.*?)( *[#;].*)$/,u4=t=>{let e=a4.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n]}return null},f4=t=>{let e=o4.exec(t);if(e!=null){let[r,n="true"]=e.slice(1),i=d4(n),a=h4(i);return[r,a]}return null},d4=t=>{let e=c4.exec(t);if(e==null)return t;let[r,n]=e.slice(1);return fx(r)&&fx(n)?`${r}${n}`:r},fx=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,h4=t=>t.split("").reduce((e,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?e:e+r},""),dx=t=>t!=null?t.toLowerCase():null,eg=(t,e,r)=>[dx(t),e,dx(r)].filter(n=>n!=null).join("."),hx=t=>{let e=t.split("."),r=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:r,subsection:i,name:n,path:eg(r,i,n),sectionPath:eg(r,i,null),isSection:!!r}},p4=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),tg=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(`
|
||||
`).map(i=>{let a=null,s=null,o=i.trim(),l=u4(o),c=l!=null;if(c)[r,n]=l;else{let f=f4(o);f!=null&&([a,s]=f)}let u=eg(r,n,a);return{line:i,isSection:c,section:r,subsection:n,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=hx(e).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let l=ux[a]&&ux[a][s];return l?l(o):o});return r?i:i.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(n=>!(n.section===e&&n.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l,isSection:c}=hx(e),u=p4(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:s,value:r,modified:!0});n?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(s4.test(i)&&l4.test(s))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,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}]`:e).join(`
|
||||
`)}},nt=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return tg.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},Af=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],m4=["config","description","index","shallow","commondir"],Um;async function Zi(t,e){return Um===void 0&&(Um=new zl),Um.acquire(t,e)}var V=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new Qi(v);let u=await nt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${n}.fetch`),o.length===0)throw new ql(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=Qm.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(y=>`refs/tags/${y}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,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),E=f.translateOne(b);E&&d.set(y,`ref: ${E}`)}let g=[];if(l){for(let v of f.localNamespaces()){let y=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of y)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,y]of d)await Zi(v,async()=>e.write(F.join(r,v),`${y.trim()}
|
||||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new Qi(i);await Zi(n,async()=>e.write(F.join(r,n),`${i.trim()}
|
||||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){await Zi(n,async()=>e.write(F.join(r,n),`ref: ${i.trim()}
|
||||
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:n}){return t.deleteRefs({fs:e,gitdir:r,refs:[n]})}static async deleteRefs({fs:e,gitdir:r,refs:n}){await Promise.all(n.map(o=>e.rm(F.join(r,o))));let i=await Zi("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),a=Pf.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 Zi("packed-refs",async()=>e.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,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),t.resolve({fs:e,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await t.packedRefs({fs:e,gitdir:r}),s=Af(n).filter(o=>!m4.includes(o));for(let o of s){let l=await Zi(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i})}throw new je(n)}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await t.packedRefs({fs:e,gitdir:r}),a=Af(n);for(let s of a)if(await Zi(s,async()=>e.exists(`${r}/${s}`))||i.has(s))return s;throw new je(n)}static async expandAgainstMap({ref:e,map:r}){let n=Af(e);for(let i of n)if(await r.has(i))return i;throw new je(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let a=Af(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new je(e)}static async packedRefs({fs:e,gitdir:r}){let n=await Zi("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Pf.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=t.packedRefs({fs:e,gitdir:r}),a=null;try{a=await e.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(n4),a}static async listBranches({fs:e,gitdir:r,remote:n}){return n?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${n}`}):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(i=>!i.endsWith("^{}"))}};function g4(t,e){return Lf(px(t),px(e))}function px(t){return t.mode==="040000"?t.path+"/":t.path}function Dx(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 pe(`Unexpected GitTree entry mode: ${t}`)}function v4(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf(32,r);if(n===-1)throw new pe(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let i=t.indexOf(0,r);if(i===-1)throw new pe(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=t.slice(r,n).toString("utf8");a==="40000"&&(a="040000");let s=Dx(a),o=t.slice(n+1,i).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new no(o);let l=t.slice(i+1,i+21).toString("hex");r=i+21,e.push({mode:a,path:o,oid:l,type:s})}return e}function y4(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 pe(`Could not understand file mode: ${t}`)}function w4(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=y4(t.mode),t.type||(t.type=Dx(t.mode)),t}var hr=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=v4(e);else if(Array.isArray(e))this._entries=e.map(w4);else throw new pe("invalid type passed to GitTree constructor");this._entries.sort(Ox)}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(g4),Buffer.concat(e.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 e of this._entries)yield e}},ea=class{static wrap({type:e,object:r}){return Buffer.concat([Buffer.from(`${e} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(e){let r=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,r).toString("utf8"),a=e.slice(r+1,n).toString("utf8"),s=e.length-(n+1);if(parseInt(a)!==s)throw new pe(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(n+1))}}};async function Lx({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await t.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function b4(t,e){let r=new Kr(t),n=mx(r);if(n!==e.byteLength)throw new pe(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=mx(r),a,s=vx(r,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Kr(a);for(o.copy(s);!r.eof();)o.copy(vx(r,e));let l=o.tell();if(i!==l)throw new pe(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function mx(t){let e=0,r=0,n=null;do n=t.readUInt8(),e|=(n&127)<<r,r+=7;while(n&128);return e}function gx(t,e,r){let n=0,i=0;for(;r--;)e&1&&(n|=t.readUInt8()<<i),e>>=1,i+=8;return n}function vx(t,e){let r=t.readUInt8(),n=128,i=15,a=112;if(r&n){let s=gx(t,r&i,4),o=gx(t,(r&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(r)}function _4(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function jx(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:_4(t)}var Mf=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=jx(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>x4(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 x4(t){return t.reduce((e,r)=>e+r.length,0)}async function S4(t,e){let r=new Mf(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new pe(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new pe(`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:l,ofs:c,reference:u}=await E4(r),f=new cg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new pe(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new pe("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:a,offset:s,end:h,reference:u,ofs:c})}}}}async function E4(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let s=4;do e=await t.byte(),n|=(e&127)<<s,s+=7;while(e&128)}let i,a;if(r===6){let s=0;i=0;let o=[];do e=await t.byte(),i|=(e&127)<<s,s+=7,o.push(e);while(e&128);a=Buffer.from(o)}return r===7&&(a=await t.read(20)),{typ
Line truncated
|
||||
`,t}function Of(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:F4(i)}}function F4(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),$4(n)}function $4(t){return t===0?t:-t}var Mr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new pe("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||||
`}},qf=class t{constructor({remotePath:e,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:r,force:n,matchPrefix:i})}static from(e){let[r,n,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=i==="*";if(l!==(s==="*"))throw new de("Invalid refspec");return new t({remotePath:n,localPath:a,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}},Sg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(qf.from(n));return new t(r)}add(e){let r=qf.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(e){let r=null;for(let n of this.rules){let i=n.translate(e);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function QH(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(r<n)||+(r>n);return i===0?t.endsWith("^{}")?1:-1:i}var e3=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},ec=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}`)},jS={core:{filemode:ec,bare:ec,logallrefupdates:ec,symlinks:ec,ignorecase:ec,bigFileThreshold:e3}},t3=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,r3=/^[A-Za-z0-9-.]+$/,n3=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,i3=/^[A-Za-z][A-Za-z-]*$/,a3=/^(.*?)( *[#;].*)$/,s3=t=>{let e=t3.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n]}return null},o3=t=>{let e=n3.exec(t);if(e!=null){let[r,n="true"]=e.slice(1),i=l3(n),a=c3(i);return[r,a]}return null},l3=t=>{let e=a3.exec(t);if(e==null)return t;let[r,n]=e.slice(1);return GS(r)&&GS(n)?`${r}${n}`:r},GS=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,c3=t=>t.split("").reduce((e,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?e:e+r},""),qS=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[qS(t),e,qS(r)].filter(n=>n!=null).join("."),zS=t=>{let e=t.split("."),r=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:r,subsection:i,name:n,path:Eg(r,i,n),sectionPath:Eg(r,i,null),isSection:!!r}},u3=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),kg=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(`
|
||||
`).map(i=>{let a=null,s=null,o=i.trim(),l=s3(o),u=l!=null;if(u)[r,n]=l;else{let f=o3(o);f!=null&&([a,s]=f)}let c=Eg(r,n,a);return{line:i,isSection:u,section:r,subsection:n,name:a,value:s,path:c}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=zS(e).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let l=jS[a]&&jS[a][s];return l?l(o):o});return r?i:i.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(n=>!(n.section===e&&n.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l,isSection:u}=zS(e),c=u3(this.parsedConfig,f=>f.path===o);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let f=this.parsedConfig[c],d=Object.assign({},f,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(r3.test(i)&&i3.test(s))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:u,section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,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}]`:e).join(`
|
||||
`)}},nt=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return kg.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},Bf=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],f3=["config","description","index","shallow","commondir"],dg;async function aa(t,e){return dg===void 0&&(dg=new tc),dg.acquire(t,e)}var z=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:u=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new oa(v);let c=await nt.get({fs:e,gitdir:r});if(!o){if(o=await c.getall(`remote.${n}.fetch`),o.length===0)throw new nc(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=Sg.from(o),d=new Map;if(u){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(w=>`refs/tags/${w}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let w=i.get(v);d.set(v,w)}}let h=f.translate([...i.keys()]);for(let[v,w]of h){let b=i.get(v);d.set(w,b)}let m=f.translate([...a.keys()]);for(let[v,w]of m){let b=a.get(v),E=f.translateOne(b);E&&d.set(w,`ref: ${E}`)}let g=[];if(l){for(let v of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of w)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,w]of d)await aa(v,async()=>e.write(O.join(r,v),`${w.trim()}
|
||||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new oa(i);await aa(n,async()=>e.write(O.join(r,n),`${i.trim()}
|
||||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){await aa(n,async()=>e.write(O.join(r,n),`ref: ${i.trim()}
|
||||
`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:n}){return t.deleteRefs({fs:e,gitdir:r,refs:[n]})}static async deleteRefs({fs:e,gitdir:r,refs:n}){await Promise.all(n.map(o=>e.rm(O.join(r,o))));let i=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),a=Gf.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 aa("packed-refs",async()=>e.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,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),t.resolve({fs:e,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await t.packedRefs({fs:e,gitdir:r}),s=Bf(n).filter(o=>!f3.includes(o));for(let o of s){let l=await aa(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i})}throw new Le(n)}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await t.packedRefs({fs:e,gitdir:r}),a=Bf(n);for(let s of a)if(await aa(s,async()=>e.exists(`${r}/${s}`))||i.has(s))return s;throw new Le(n)}static async expandAgainstMap({ref:e,map:r}){let n=Bf(e);for(let i of n)if(await r.has(i))return i;throw new Le(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let a=Bf(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new Le(e)}static async packedRefs({fs:e,gitdir:r}){let n=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Gf.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=t.packedRefs({fs:e,gitdir:r}),a=null;try{a=await e.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(QH),a}static async listBranches({fs:e,gitdir:r,remote:n}){return n?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${n}`}):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(i=>!i.endsWith("^{}"))}};function d3(t,e){return Kf(VS(t),VS(e))}function VS(t){return t.mode==="040000"?t.path+"/":t.path}function pE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new de(`Unexpected GitTree entry mode: ${t}`)}function h3(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf(32,r);if(n===-1)throw new de(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next space character.`);let i=t.indexOf(0,r);if(i===-1)throw new de(`GitTree: Error parsing buffer at byte location ${r}: Could not find the next null character.`);let a=t.slice(r,n).toString("utf8");a==="40000"&&(a="040000");let s=pE(a),o=t.slice(n+1,i).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new po(o);let l=t.slice(i+1,i+21).toString("hex");r=i+21,e.push({mode:a,path:o,oid:l,type:s})}return e}function p3(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 de(`Could not understand file mode: ${t}`)}function m3(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=p3(t.mode),t.type||(t.type=pE(t.mode)),t}var pr=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=h3(e);else if(Array.isArray(e))this._entries=e.map(m3);else throw new de("invalid type passed to GitTree constructor");this._entries.sort(uE)}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(d3),Buffer.concat(e.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 e of this._entries)yield e}},la=class{static wrap({type:e,object:r}){return Buffer.concat([Buffer.from(`${e} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(e){let r=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,r).toString("utf8"),a=e.slice(r+1,n).toString("utf8"),s=e.length-(n+1);if(parseInt(a)!==s)throw new de(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(n+1))}}};async function mE({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await t.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function g3(t,e){let r=new Jr(t),n=WS(r);if(n!==e.byteLength)throw new de(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=WS(r),a,s=XS(r,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Jr(a);for(o.copy(s);!r.eof();)o.copy(XS(r,e));let l=o.tell();if(i!==l)throw new de(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function WS(t){let e=0,r=0,n=null;do n=t.readUInt8(),e|=(n&127)<<r,r+=7;while(n&128);return e}function YS(t,e,r){let n=0,i=0;for(;r--;)e&1&&(n|=t.readUInt8()<<i),e>>=1,i+=8;return n}function XS(t,e){let r=t.readUInt8(),n=128,i=15,a=112;if(r&n){let s=YS(t,r&i,4),o=YS(t,(r&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(r)}function v3(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function gE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:v3(t)}var zf=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=gE(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>w3(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 w3(t){return t.reduce((e,r)=>e+r.length,0)}async function y3(t,e){let r=new zf(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new de(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new de(`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:l,ofs:u,reference:c}=await b3(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new de(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new de("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:a,offset:s,end:h,reference:c,ofs:u})}}}}async function b3(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let s=4;do e=await t.byte(),n|=(e&127)<<s,s+=7;while(e&128)}let i,a;if(r===6){let s=0;i=0;let o=[];do e=await t.byte(),i|=(e&127)<<s,s+=7,o.push(e);while(e&128);a=Buffer.from(o)}return r===7&&(a=await t.read(20)),{typ
Line truncated
|
||||
`,t}function Vf(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:R3(i)}}function R3(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),I3(n)}function I3(t){return t===0?t:-t}var Fr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new de("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 ${rg(e.tagger)}
|
||||
tagger ${Ag(e.tagger)}
|
||||
|
||||
${e.message}
|
||||
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||||
@@ -29,49 +29,49 @@ ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexO
|
||||
|
||||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||||
`),r=[];for(let i of e)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=Of(n.tagger)),n.committer&&(n.committer=Of(n.committer)),n}withoutSignature(){let e=wi(this._tag);return e.indexOf(`
|
||||
`+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=Vf(n.tagger)),n.committer&&(n.committer=Vf(n.committer)),n}withoutSignature(){let e=Ei(this._tag);return e.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return wi(e)}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:a}=await r({payload:i,secretKey:n});a=wi(a);let s=i+a;return t.from(s)}};function zm(t){return t.trim().split(`
|
||||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Ei(e)}payload(){return this.withoutSignature()+`
|
||||
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:a}=await r({payload:i,secretKey:n});a=Ei(a);let s=i+a;return t.from(s)}};function pg(t){return t.trim().split(`
|
||||
`).map(e=>" "+e).join(`
|
||||
`)+`
|
||||
`}function D4(t){return t.split(`
|
||||
`}function $3(t){return t.split(`
|
||||
`).map(e=>e.replace(/^ /,"")).join(`
|
||||
`)}var pr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new pe("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),a=wi(n+`
|
||||
gpgsig`+zm(r)+`
|
||||
`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return wi(e.slice(e.indexOf(`
|
||||
`)}var mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new de("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),a=Ei(n+`
|
||||
gpgsig`+pg(r)+`
|
||||
`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Ei(e.slice(e.indexOf(`
|
||||
|
||||
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
||||
|
||||
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
|
||||
`),r=[];for(let i of e)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=Of(n.author)),n.committer&&(n.committer=Of(n.committer)),n}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
||||
`+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=Vf(n.author)),n.committer&&(n.committer=Vf(n.committer)),n}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree}
|
||||
`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||||
`,e.parent){if(e.parent.length===void 0)throw new pe("commit 'parent' property should be an array");for(let a of e.parent)r+=`parent ${a}
|
||||
`}let n=e.author;r+=`author ${rg(n)}
|
||||
`;let i=e.committer||e.author;return r+=`committer ${rg(i)}
|
||||
`,e.gpgsig&&(r+="gpgsig"+zm(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
|
||||
`+wi(e.message)}render(){return this._commit}withoutSignature(){let e=wi(this._commit);if(e.indexOf(`
|
||||
`,e.parent){if(e.parent.length===void 0)throw new de("commit 'parent' property should be an array");for(let a of e.parent)r+=`parent ${a}
|
||||
`}let n=e.author;r+=`author ${Ag(n)}
|
||||
`;let i=e.committer||e.author;return r+=`committer ${Ag(i)}
|
||||
`,e.gpgsig&&(r+="gpgsig"+pg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+`
|
||||
`+Ei(e.message)}render(){return this._commit}withoutSignature(){let e=Ei(this._commit);if(e.indexOf(`
|
||||
gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(`
|
||||
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||||
`)+28);return wi(r+`
|
||||
`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return D4(e)}static async sign(e,r,n){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await r({payload:i,secretKey:n});s=wi(s);let l=t.justHeaders(e._commit)+`
|
||||
gpgsig`+zm(s)+`
|
||||
`+a;return t.from(l)}};async function fo({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:hr.from([]),oid:n};let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Mr.from(a).parse().object,fo({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=pr.from(a).parse().tree,fo({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new tr(n,i,"tree");return{tree:hr.from(a),oid:n}}var ng=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await V.resolve({fs:e,gitdir:r,ref:n})}catch(c){c instanceof je&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await fo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),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(e){let r=e._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 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 Ge({fs:n,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new tr(l,c,o.type);let f=hr.from(u);for(let d of f)s.set(F.join(r,d.path),d);return f.entries().map(d=>F.join(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:n}=r.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(e._fullpath);e._mode=Ix(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await Ge({fs:n,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function Rr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,jf,{value:function({fs:r,gitdir:n,cache:i}){return new ng({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var ig=class{constructor({fs:e,dir:r,gitdir:n,cache:i}){this.fs=e,this.cache=i,this.dir=r,this.gitdir=n,this.config=null;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(e){let r=e._fullpath,{fs:n,dir:i}=this,a=await n.readdir(F.join(i,r));return a===null?null:a.map(s=>F.join(r,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{fs:r,dir:n}=this,i=await r.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=io(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await this._getGitConfig(r,i)).get("core.autocrlf"),o=await r.read(`${n}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:n,gitdir:i,cache:a}=this,s;await ct.acquire({fs:n,gitdir:i,cache:a},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Tf(c,l,f,d)){let h=await e.content();h===void 0?s=void 0:(s=await bi(ea.wrap({type:"blob",object:h})),l&&s===l.oid&&(!f||c.mode===l.mode)&&Tf(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:s}))}else s=l.oid}),e._oid=s}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await nt.get({fs:e,gitdir:r}),this.config)}};function yo(){let t=Object.create(null);return Object.defineProperty(t,jf,{value:function({fs:e,dir:r,gitdir:n,cache:i}){return new ig({fs:e,dir:r,gitdir:n,cache:i})}}),Object.freeze(t),t}function L4(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var Hx=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),ag=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};function*j4(t){let e=new ag,r,n=[],i=t.lengt
Line truncated
|
||||
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(e,r,n={}){try{await this._writeFile(e,r,n);return}catch(i){await this.mkdir(ao(e)),await this._writeFile(e,r,n)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=ao(e);if(i==="."||i==="/"||i===e)throw n;await this.mkdir(i),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(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Lf),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}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 n=await this._readlink(e,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function P(t,e){if(e===void 0)throw new dr(t)}async function If(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 Ux({fs:t,dir:e,gitdir:r=F.join(e,".git"),commit:n="HEAD",cache:i={}}){try{P("fs",t),P("dir",e),P("gitdir",r);let a=new Q(t),s=[Rr({ref:n}),yo(),Ya()],o=[];await ct.acquire({fs:a,gitdir:r,cache:i},async function(c){o=c.unmergedPaths});let l=await ra({fs:a,cache:i,dir:e,gitdir:r,trees:s,map:async function(c,[u,f,d]){let h=!await If(f,d),p=o.includes(c),g=!await If(d,u);if(h||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(g)return!1;throw new ac(c)}});await ct.acquire({fs:a,gitdir:r,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var na=class{static async isIgnored({fs:e,dir:r,gitdir:n=F.join(r,".git"),filepath:i}){if(Cf(i)===".git")return!0;if(i===".")return!1;let a="",s=F.join(n,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:F.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");o.push({gitignore:F.join(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=q8().add(a);d.add(f);let h=ao(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 H4({fs:t,gitdir:e,object:r,format:n,oid:i}){if(n!=="deflated")throw new pe("GitObjectStoreLoose expects objects to write to be in deflated format");let a=`objects/${i.slice(0,2)}/${i.slice(2)}`,s=`${e}/${a}`;await t.exists(s)||await t.write(s,r)}var Vm=null;async function Gx(t){return Vm===null&&(Vm=G4()),Vm?U4(t):cg.deflate(t)}async function U4(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function G4(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function mr({fs:t,gitdir:e,type:r,object:n,format:i="content",oid:a=void 0,dryRun:s=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=ea.wrap({type:r,object:n})),a=await bi(n),n=Buffer.from(await Gx(n))),s||await H4({fs:t,gitdir:e,object:n,format:"deflated",oid:a}),a}function zx(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function Vx({fs:t,dir:e,gitdir:r=F.join(e,".git"),filepath:n,cache:i={},force:a=!1,parallel:s=!0}){try{P("fs",t),P("dir",e),P("gitdir",r),P("filepath",n);let o=new Q(t);await ct.acquire({fs:o,gitdir:r,cache:i},async l=>{let u=await(await nt.get({fs:o,gitdir:r})).get("core.autocrlf");return og({dir:e,gitdir:r,fs:o,filepath:n,index:l,force:a,parallel:s,autocrlf:u})})}catch(o){throw o.caller="git.add",o}}async function og({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:a,parallel:s,autocrlf:o}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!a&&await na.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(F.join(t,d));if(!h)throw new je(d);if(h.isDirectory()){let p=await r.readdir(F.join(t,d));if(s){let g=p.map(v=>og({dir:t,gitdir:e,fs:r,filepath:[F.join(d,v)],inde
Line truncated
|
||||
`,author:l,committer:c,signingKey:u})}async function Kx({fs:t,onSign:e,dir:r,gitdir:n=F.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{P("fs",t),P("gitdir",n),P("oid",a),P("note",s),u&&P("onSign",e);let d=new Q(t),h=await ia({fs:d,gitdir:n,author:l});if(!h)throw new zt("author");let p=await ho({fs:d,gitdir:n,author:h,committer:c});if(!p)throw new zt("committer");return await z4({fs:new Q(d),cache:f,onSign:e,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 Zx({fs:t,gitdir:e,remote:r,url:n,force:i}){if(r!==zn.clean(r))throw new mn(r,zn.clean(r));let a=await nt.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new pn("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await nt.save({fs:t,gitdir:e,config:a})}async function Jx({fs:t,dir:e,gitdir:r=F.join(e,".git"),remote:n,url:i,force:a=!1}){try{return P("fs",t),P("gitdir",r),P("remote",n),P("url",i),await Zx({fs:new Q(t),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function V4({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await V.exists({fs:t,gitdir:n,ref:i}))throw new pn("tag",i);let f=await V.resolve({fs:t,gitdir:n,ref:l||"HEAD"}),{type:d}=await Ge({fs:t,cache:e,gitdir:n,oid:f}),h=Mr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(h=await Mr.sign(h,r,c));let p=await mr({fs:t,gitdir:n,type:"tag",object:h.toObject()});await V.writeRef({fs:t,gitdir:n,ref:i,value:p})}async function Qx({fs:t,onSign:e,dir:r,gitdir:n=F.join(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{P("fs",t),P("gitdir",n),P("ref",i),c&&P("onSign",e);let d=new Q(t),h=await ia({fs:d,gitdir:n,author:a});if(!h)throw new zt("tagger");return await V4({fs:d,cache:f,onSign:e,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function q4({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==zn.clean(r))throw new mn(r,zn.clean(r));let s=`refs/heads/${r}`;if(!a&&await V.exists({fs:t,gitdir:e,ref:s}))throw new pn("branch",r,!1);let o;try{o=await V.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch(l){}o&&await V.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await V.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function eS({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return P("fs",t),P("gitdir",r),P("ref",n),await q4({fs:new Q(t),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var tS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function fg({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(n)try{v=await V.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let y;try{y=await V.resolve({fs:t,gitdir:a,ref:o})}catch(b){if(o==="HEAD")throw b;let E=`${s}/${o}`;if(y=await V.resolve({fs:t,gitdir:a,ref:E}),h){let S=await nt.get({fs:t,gitdir:a});await S.set(`branch.${o}.remote`,s),await S.set(`branch.${o}.merge`,`refs/heads/${o}`),await nt.save({fs:t,gitdir:a,config:S})}await V.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:y})}if(!c){let b;try{b=await W4({fs:t,cache:e,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof je&&w.data.what===y?new Kl(o,y):w}let E=b.filter(([w])=>w==="conflict").map(([w,x])=>x);if(E.length>0)throw new Xl(E);let S=b.filter(([w])=>w==="error").map(([w,x])=>x);if(S.length>0)throw new pe(S.join(", "));if(f){n&&await n({previousHead:v,newHead:y,type:l!=null&&l.length>0?"file":"branch"});return}let A=0,k=b.length;if(await ct.acquire({fs:t,gitdir:a,cache:e},async function(w){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,_]){let T=`${i}/${_}`;x==="delete"&&await t.rm(T),w.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}))}),await ct.acquire({fs:t,gitdir:a,cache:e},async function(w){for(let[x,_]of b)if(x==="rmdir"||x==="rmdir-index"){let T=`${i}/${_}`;try{x==="rmdir"&&await t.rmdir(T),w.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}catch(C){if(C.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw C}}}),await Promise.all(b.filter(([w])=>w==="mkdir"||w==="mkdir-index").map(async function([w,x]){let _=`${i}/${x}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++A,total:k})})),p){let w=b.filter(([_])=>_==
Line truncated
|
||||
`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:r,oids:n}){Ga===null&&(Ga=new zl);let i=F.join(r,"shallow");if(n.size>0){let a=[...n].join(`
|
||||
`)+28);return Ei(r+`
|
||||
`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $3(e)}static async sign(e,r,n){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await r({payload:i,secretKey:n});s=Ei(s);let l=t.justHeaders(e._commit)+`
|
||||
gpgsig`+pg(s)+`
|
||||
`+a;return t.from(l)}};async function xo({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:pr.from([]),oid:n};let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,xo({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=mr.from(a).parse().tree,xo({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new rr(n,i,"tree");return{tree:pr.from(a),oid:n}}var Tg=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await z.resolve({fs:e,gitdir:r,ref:n})}catch(u){u instanceof Le&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await xo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),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(e){let r=e._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 l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:u,object:c}=await qe({fs:n,cache:i,gitdir:a,oid:l});if(u!==o.type)throw new rr(l,u,o.type);let f=pr.from(c);for(let d of f)s.set(O.join(r,d.path),d);return f.entries().map(d=>O.join(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:n}=r.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(e._fullpath);e._mode=fE(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(e._fullpath).oid,{type:l,object:u}=await qe({fs:n,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(u)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function $r({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Jf,{value:function({fs:r,gitdir:n,cache:i}){return new Tg({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:n,cache:i}){this.fs=e,this.cache=i,this.dir=r,this.gitdir=n,this.config=null;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(e){let r=e._fullpath,{fs:n,dir:i}=this,a=await n.readdir(O.join(i,r));return a===null?null:a.map(s=>O.join(r,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{fs:r,dir:n}=this,i=await r.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=mo(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await this._getGitConfig(r,i)).get("core.autocrlf"),o=await r.read(`${n}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:n,gitdir:i,cache:a}=this,s;await ct.acquire({fs:n,gitdir:i,cache:a},async function(o){let l=o.entriesMap.get(e._fullpath),u=await e.stat(),f=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Uf(u,l,f,d)){let h=await e.content();h===void 0?s=void 0:(s=await ki(la.wrap({type:"blob",object:h})),l&&s===l.oid&&(!f||u.mode===l.mode)&&Uf(u,l,f,d)&&o.insert({filepath:e._fullpath,stats:u,oid:s}))}else s=l.oid}),e._oid=s}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await nt.get({fs:e,gitdir:r}),this.config)}};function Co(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,dir:r,gitdir:n,cache:i}){return new Cg({fs:e,dir:r,gitdir:n,cache:i})}}),Object.freeze(t),t}function F3(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var yE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Pg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};function*O3(t){let e=new Pg,r,n=[],i=t.lengt
Line truncated
|
||||
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(e,r,n={}){try{await this._writeFile(e,r,n);return}catch(i){await this.mkdir(go(e)),await this._writeFile(e,r,n)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=go(e);if(i==="."||i==="/"||i===e)throw n;await this.mkdir(i),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(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Kf),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}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 n=await this._readlink(e,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function C(t,e){if(e===void 0)throw new hr(t)}async function Wf(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 bE({fs:t,dir:e,gitdir:r=O.join(e,".git"),commit:n="HEAD",cache:i={}}){try{C("fs",t),C("dir",e),C("gitdir",r);let a=new J(t),s=[$r({ref:n}),Co(),ts()],o=[];await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){o=u.unmergedPaths});let l=await ua({fs:a,cache:i,dir:e,gitdir:r,trees:s,map:async function(u,[c,f,d]){let h=!await Wf(f,d),m=o.includes(u),g=!await Wf(d,c);if(h||m)return c?{path:u,mode:await c.mode(),oid:await c.oid(),type:await c.type(),content:await c.content()}:void 0;if(g)return!1;throw new gc(u)}});await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){for(let c of l)if(c!==!1){if(!c){await a.rmdir(`${e}/${c.path}`,{recursive:!0}),u.delete({filepath:c.path});continue}if(c.type==="blob"){let f=new TextDecoder().decode(c.content);await a.write(`${e}/${c.path}`,f,{mode:c.mode}),u.insert({filepath:c.path,oid:c.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var fa=class{static async isIgnored({fs:e,dir:r,gitdir:n=O.join(r,".git"),filepath:i}){if(jf(i)===".git")return!0;if(i===".")return!1;let a="",s=O.join(n,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:O.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let c=1;c<l.length;c++){let f=l.slice(0,c).join("/"),d=l.slice(c).join("/");o.push({gitignore:O.join(r,f,".gitignore"),filepath:d})}let u=!1;for(let c of o){let f;try{f=await e.read(c.gitignore,"utf8")}catch(m){if(m.code==="NOENT")continue}let d=jH().add(a);d.add(f);let h=go(c.filepath);if(h!=="."&&d.ignores(h))return!0;u?u=!d.test(c.filepath).unignored:u=d.test(c.filepath).ignored}return u}};async function L3({fs:t,gitdir:e,object:r,format:n,oid:i}){if(n!=="deflated")throw new de("GitObjectStoreLoose expects objects to write to be in deflated format");let a=`objects/${i.slice(0,2)}/${i.slice(2)}`,s=`${e}/${a}`;await t.exists(s)||await t.write(s,r)}var mg=null;async function _E(t){return mg===null&&(mg=B3()),mg?N3(t):Fg.deflate(t)}async function N3(t){let e=new CompressionStream("deflate"),r=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(r).arrayBuffer())}function B3(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function gr({fs:t,gitdir:e,type:r,object:n,format:i="content",oid:a=void 0,dryRun:s=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=la.wrap({type:r,object:n})),a=await ki(n),n=Buffer.from(await _E(n))),s||await L3({fs:t,gitdir:e,object:n,format:"deflated",oid:a}),a}function xE(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function SE({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={},force:a=!1,parallel:s=!0}){try{C("fs",t),C("dir",e),C("gitdir",r),C("filepath",n);let o=new J(t);await ct.acquire({fs:o,gitdir:r,cache:i},async l=>{let c=await(await nt.get({fs:o,gitdir:r})).get("core.autocrlf");return Ig({dir:e,gitdir:r,fs:o,filepath:n,index:l,force:a,parallel:s,autocrlf:c})})}catch(o){throw o.caller="git.add",o}}async function Ig({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:a,parallel:s,autocrlf:o}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!a&&await fa.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(O.join(t,d));if(!h)throw new Le(d);if(h.isDirectory()){let m=await r.readdir(O.join(t,d));if(s){let g=m.map(v=>Ig({dir:t,gitdir:e,fs:r,filepath:[O.join(d,v)],inde
Line truncated
|
||||
`,author:l,committer:u,signingKey:c})}async function CE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:u,signingKey:c,cache:f={}}){try{C("fs",t),C("gitdir",n),C("oid",a),C("note",s),c&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:l});if(!h)throw new zt("author");let m=await So({fs:d,gitdir:n,author:h,committer:u});if(!m)throw new zt("committer");return await H3({fs:new J(d),cache:f,onSign:e,gitdir:n,ref:i,oid:a,note:s,force:o,author:h,committer:m,signingKey:c})}catch(d){throw d.caller="git.addNote",d}}async function PE({fs:t,gitdir:e,remote:r,url:n,force:i}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=await nt.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new vn("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await nt.save({fs:t,gitdir:e,config:a})}async function RE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n,url:i,force:a=!1}){try{return C("fs",t),C("gitdir",r),C("remote",n),C("url",i),await PE({fs:new J(t),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function U3({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!c&&await z.exists({fs:t,gitdir:n,ref:i}))throw new vn("tag",i);let f=await z.resolve({fs:t,gitdir:n,ref:l||"HEAD"}),{type:d}=await qe({fs:t,cache:e,gitdir:n,oid:f}),h=Fr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});u&&(h=await Fr.sign(h,r,u));let m=await gr({fs:t,gitdir:n,type:"tag",object:h.toObject()});await z.writeRef({fs:t,gitdir:n,ref:i,value:m})}async function IE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1,cache:f={}}){try{C("fs",t),C("gitdir",n),C("ref",i),u&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:a});if(!h)throw new zt("tagger");return await U3({fs:d,cache:f,onSign:e,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:u,force:c})}catch(d){throw d.caller="git.annotatedTag",d}}async function j3({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let s=`refs/heads/${r}`;if(!a&&await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",r,!1);let o;try{o=await z.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch(l){}o&&await z.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function $E({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),await j3({fs:new J(t),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var FE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:u,noUpdateHead:c,dryRun:f,force:d,track:h=!0,nonBlocking:m=!1,batchSize:g=100}){let v;if(n)try{v=await z.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let w;try{w=await z.resolve({fs:t,gitdir:a,ref:o})}catch(b){if(o==="HEAD")throw b;let E=`${s}/${o}`;if(w=await z.resolve({fs:t,gitdir:a,ref:E}),h){let x=await nt.get({fs:t,gitdir:a});await x.set(`branch.${o}.remote`,s),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await nt.save({fs:t,gitdir:a,config:x})}await z.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:w})}if(!u){let b;try{b=await G3({fs:t,cache:e,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(y){throw y instanceof Le&&y.data.what===w?new oc(o,w):y}let E=b.filter(([y])=>y==="conflict").map(([y,S])=>S);if(E.length>0)throw new sc(E);let x=b.filter(([y])=>y==="error").map(([y,S])=>S);if(x.length>0)throw new de(x.join(", "));if(f){n&&await n({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"});return}let k=0,A=b.length;if(await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){await Promise.all(b.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,_]){let T=`${i}/${_}`;S==="delete"&&await t.rm(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}))}),await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){for(let[S,_]of b)if(S==="rmdir"||S==="rmdir-index"){let T=`${i}/${_}`;try{S==="rmdir"&&await t.rmdir(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw P}}}),await Promise.all(b.filter(([y])=>y==="mkdir"||y==="mkdir-index").map(async function([y,S]){let _=`${i}/${S}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++k,total:A})})),m){let y=b.filter(([_])=>_==
Line truncated
|
||||
`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:r,oids:n}){Za===null&&(Za=new tc);let i=O.join(r,"shallow");if(n.size>0){let a=[...n].join(`
|
||||
`)+`
|
||||
`;await Ga.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Ga.acquire(i,async function(){await e.rm(i)})}};async function Q4({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function eD({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await t.readdir(F.join(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,l=await ug({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new pe(l.error);if(l.offsets.has(n))return!0}return!1}async function Cx({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=o=>Ge({fs:t,cache:e,gitdir:r,oid:o}),s=await Q4({fs:t,gitdir:r,oid:n});return s||(s=await eD({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a})),s}function tD(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function nS(t,e){let r=t.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var Bf={name:"isomorphic-git",version:"1.32.2",agent:"git/isomorphic-git@1.32.2"},ro=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 rD(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 iS(t){let e=new ro,r="";return(async()=>(await uc(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=rD(r);if(i===-1)break;e.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&e.write(r),e.end()))(),e}var $f=class{static demux(e){let r=Qe.streamReader(e),n=new ro,i=new ro,a=new ro,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),e.error?i.destroy(e.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 l=o.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function nD(t){let{packetlines:e,packfile:r,progress:n}=$f.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{uc(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Qi(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Qi(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.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:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function iD({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Qe.encode(`want ${c}${l}
|
||||
`)),l="";for(let c of n)o.push(Qe.encode(`shallow ${c}
|
||||
`;await Za.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Za.acquire(i,async function(){await e.rm(i)})}};async function X3({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await t.readdir(O.join(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,l=await Og({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new de(l.error);if(l.offsets.has(n))return!0}return!1}async function sE({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),s=await X3({fs:t,gitdir:r,oid:n});return s||(s=await Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a})),s}function K3(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function ME(t,e){let r=t.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var td={name:"isomorphic-git",version:"1.32.2",agent:"git/isomorphic-git@1.32.2"},ho=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 J3(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 DE(t){let e=new ho,r="";return(async()=>(await _c(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=J3(r);if(i===-1)break;e.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&e.write(r),e.end()))(),e}var Xf=class{static demux(e){let r=Qe.streamReader(e),n=new ho,i=new ho,a=new ho,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),e.error?i.destroy(e.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 l=o.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function Q3(t){let{packetlines:e,packfile:r,progress:n}=Xf.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((u,c)=>{_c(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,m]=d.split(" ");s.push({oid:h,status:m}),m||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{l||(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function e8({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let u of e)o.push(Qe.encode(`want ${u}${l}
|
||||
`)),l="";for(let u of n)o.push(Qe.encode(`shallow ${u}
|
||||
`));i!==null&&o.push(Qe.encode(`deepen ${i}
|
||||
`)),a!==null&&o.push(Qe.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
|
||||
`));for(let c of s)o.push(Qe.encode(`deepen-not ${c}
|
||||
`));o.push(Qe.flush());for(let c of r)o.push(Qe.encode(`have ${c}
|
||||
`));for(let u of s)o.push(Qe.encode(`deepen-not ${u}
|
||||
`));o.push(Qe.flush());for(let u of r)o.push(Qe.encode(`have ${u}
|
||||
`));return o.push(Qe.encode(`done
|
||||
`)),o}async function hg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:y=!1,tags:b=!1,singleBranch:E=!1,headers:S={},prune:A=!1,pruneTags:k=!1}){let w=c||await sa({fs:t,gitdir:l,test:!0}),x=await nt.get({fs:t,gitdir:l}),_=f||w&&await x.get(`branch.${w}.remote`)||"origin",T=d||await x.get(`remote.${_}.url`);if(typeof T=="undefined")throw new dr("remote OR url");let C=u||w&&await x.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let I=go.getRemoteHelperFor({url:T}),L=await I.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:S,protocolVersion:1}),$=L.auth,J=L.refs;if(J.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!L.capabilities.has("shallow"))throw new Ji("shallow","depth");if(g!==null&&!L.capabilities.has("deepen-since"))throw new Ji("deepen-since","since");if(v.length>0&&!L.capabilities.has("deepen-not"))throw new Ji("deepen-not","exclude");if(y===!0&&!L.capabilities.has("deepen-relative"))throw new Ji("deepen-relative","relative");let{oid:de,fullref:le}=V.resolveAgainstMap({ref:C,map:J});for(let U of J.keys())U===le||U==="HEAD"||U.startsWith("refs/heads/")||b&&U.startsWith("refs/tags/")||J.delete(U);let ce=nS([...L.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Bf.agent}`]);y&&ce.push("deepen-relative");let Te=E?[de]:J.values(),ne=E?[w]:await V.listRefs({fs:t,gitdir:l,filepath:"refs"}),N=[];for(let U of ne)try{U=await V.expand({fs:t,gitdir:l,ref:U});let Je=await V.resolve({fs:t,gitdir:l,ref:U});await Cx({fs:t,cache:e,gitdir:l,oid:Je})&&N.push(Je)}catch(Je){}N=[...new Set(N)];let W=await qa.read({fs:t,gitdir:l}),B=L.capabilities.has("shallow")?[...W]:[],$e=iD({capabilities:ce,wants:Te,haves:N,shallows:B,depth:p,since:g,exclude:v}),lr=Buffer.from(await Ff($e)),Ut=await I.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:$,body:[lr],headers:S}),X=await nD(Ut.body);Ut.headers&&(X.headers=Ut.headers);for(let U of X.shallows)if(!W.has(U))try{let{object:Je}=await Ge({fs:t,cache:e,gitdir:l,oid:U}),j=new pr(Je),Z=await Promise.all(j.headers().parent.map(We=>Cx({fs:t,cache:e,gitdir:l,oid:We})));Z.length===0||Z.every(We=>We)||W.add(U)}catch(Je){W.add(U)}for(let U of X.unshallows)W.delete(U);if(await qa.write({fs:t,gitdir:l,oids:W}),E){let U=new Map([[le,de]]),Je=new Map,j=10,Z=le;for(;j--;){let Rt=L.symrefs.get(Z);if(Rt===void 0)break;Je.set(Z,Rt),Z=Rt}let Se=J.get(Z);Se&&U.set(Z,Se);let{pruned:We}=await V.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:U,symrefs:Je,tags:b,prune:A});A&&(X.pruned=We)}else{let{pruned:U}=await V.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:J,symrefs:L.symrefs,tags:b,prune:A,pruneTags:k});A&&(X.pruned=U)}if(X.HEAD=L.symrefs.get("HEAD"),X.HEAD===void 0){let{oid:U}=V.resolveAgainstMap({ref:"HEAD",map:J});for(let[Je,j]of J.entries())if(Je!=="HEAD"&&j===U){X.HEAD=Je;break}}let Oe=le.startsWith("refs/tags")?"tag":"branch";if(X.FETCH_HEAD={oid:de,description:`${Oe} '${za(le)}' of ${T}`},n||i){let U=iS(X.progress);uc(U,async Je=>{if(i&&await i(Je),n){let j=Je.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);j&&await n({phase:j[1].trim(),loaded:parseInt(j[2],10),total:parseInt(j[3],10)})}})}let De=Buffer.from(await Ff(X.packfile));if(Ut.body.error)throw Ut.body.error;let Pt=De.slice(-20).toString("hex"),Le={defaultBranch:X.HEAD,fetchHead:X.FETCH_HEAD.oid,fetchHeadDescription:X.FETCH_HEAD.description};if(X.headers&&(Le.headers=X.headers),A&&(Le.pruned=X.pruned),Pt!==""&&!tD(De)){Le.packfile=`objects/pack/pack-${Pt}.pack`;let U=F.join(l,Le.packfile);await t.write(U,De);let Je=Z=>Ge({fs:t,cache:e,gitdir:l,oid:Z}),j=await Wl.fromPack({pack:De,getExternalRefDelta:Je,onProgress:n});await t.write(U.replace(/\.pack$/,".idx"),await j.toBuffer())}return Le}async function aS({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:F.join(r,".git"),defaultBranch:i="master"}){if(await t.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 t.mkdir(s);await t.write(n+"/config",`[core]
|
||||
`)),o}async function Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:u,remoteRef:c,remote:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:E=!1,headers:x={},prune:k=!1,pruneTags:A=!1}){let y=u||await pa({fs:t,gitdir:l,test:!0}),S=await nt.get({fs:t,gitdir:l}),_=f||y&&await S.get(`branch.${y}.remote`)||"origin",T=d||await S.get(`remote.${_}.url`);if(typeof T=="undefined")throw new hr("remote OR url");let P=c||y&&await S.get(`branch.${y}.merge`)||u||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let F=Ao.getRemoteHelperFor({url:T}),D=await F.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:x,protocolVersion:1}),M=D.auth,re=D.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!D.capabilities.has("shallow"))throw new sa("shallow","depth");if(g!==null&&!D.capabilities.has("deepen-since"))throw new sa("deepen-since","since");if(v.length>0&&!D.capabilities.has("deepen-not"))throw new sa("deepen-not","exclude");if(w===!0&&!D.capabilities.has("deepen-relative"))throw new sa("deepen-relative","relative");let{oid:ye,fullref:me}=z.resolveAgainstMap({ref:P,map:re});for(let G of re.keys())G===me||G==="HEAD"||G.startsWith("refs/heads/")||b&&G.startsWith("refs/tags/")||re.delete(G);let fe=ME([...D.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${td.agent}`]);w&&fe.push("deepen-relative");let Ge=E?[ye]:re.values(),oe=E?[y]:await z.listRefs({fs:t,gitdir:l,filepath:"refs"}),B=[];for(let G of oe)try{G=await z.expand({fs:t,gitdir:l,ref:G});let Je=await z.resolve({fs:t,gitdir:l,ref:G});await sE({fs:t,cache:e,gitdir:l,oid:Je})&&B.push(Je)}catch(Je){}B=[...new Set(B)];let Z=await Qa.read({fs:t,gitdir:l}),H=D.capabilities.has("shallow")?[...Z]:[],Oe=e8({capabilities:fe,wants:Ge,haves:B,shallows:H,depth:m,since:g,exclude:v}),cr=Buffer.from(await Yf(Oe)),Gt=await F.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:M,body:[cr],headers:x}),Y=await Q3(Gt.body);Gt.headers&&(Y.headers=Gt.headers);for(let G of Y.shallows)if(!Z.has(G))try{let{object:Je}=await qe({fs:t,cache:e,gitdir:l,oid:G}),N=new mr(Je),X=await Promise.all(N.headers().parent.map(We=>sE({fs:t,cache:e,gitdir:l,oid:We})));X.length===0||X.every(We=>We)||Z.add(G)}catch(Je){Z.add(G)}for(let G of Y.unshallows)Z.delete(G);if(await Qa.write({fs:t,gitdir:l,oids:Z}),E){let G=new Map([[me,ye]]),Je=new Map,N=10,X=me;for(;N--;){let $t=D.symrefs.get(X);if($t===void 0)break;Je.set(X,$t),X=$t}let Ee=re.get(X);Ee&&G.set(X,Ee);let{pruned:We}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:G,symrefs:Je,tags:b,prune:k});k&&(Y.pruned=We)}else{let{pruned:G}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:re,symrefs:D.symrefs,tags:b,prune:k,pruneTags:A});k&&(Y.pruned=G)}if(Y.HEAD=D.symrefs.get("HEAD"),Y.HEAD===void 0){let{oid:G}=z.resolveAgainstMap({ref:"HEAD",map:re});for(let[Je,N]of re.entries())if(Je!=="HEAD"&&N===G){Y.HEAD=Je;break}}let Ie=me.startsWith("refs/tags")?"tag":"branch";if(Y.FETCH_HEAD={oid:ye,description:`${Ie} '${Ka(me)}' of ${T}`},n||i){let G=DE(Y.progress);_c(G,async Je=>{if(i&&await i(Je),n){let N=Je.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);N&&await n({phase:N[1].trim(),loaded:parseInt(N[2],10),total:parseInt(N[3],10)})}})}let Me=Buffer.from(await Yf(Y.packfile));if(Gt.body.error)throw Gt.body.error;let It=Me.slice(-20).toString("hex"),De={defaultBranch:Y.HEAD,fetchHead:Y.FETCH_HEAD.oid,fetchHeadDescription:Y.FETCH_HEAD.description};if(Y.headers&&(De.headers=Y.headers),k&&(De.pruned=Y.pruned),It!==""&&!K3(Me)){De.packfile=`objects/pack/pack-${It}.pack`;let G=O.join(l,De.packfile);await t.write(G,Me);let Je=X=>qe({fs:t,cache:e,gitdir:l,oid:X}),N=await ic.fromPack({pack:Me,getExternalRefDelta:Je,onProgress:n});await t.write(G.replace(/\.pack$/,".idx"),await N.toBuffer())}return De}async function LE({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O.join(r,".git"),defaultBranch:i="master"}){if(await t.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 t.mkdir(s);await t.write(n+"/config",`[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = ${e}
|
||||
@@ -79,32 +79,28 @@ gpgsig`+zm(s)+`
|
||||
`)+` symlinks = false
|
||||
ignorecase = true
|
||||
`),await t.write(n+"/HEAD",`ref: refs/heads/${i}
|
||||
`)}async function aD({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:y,relative:b,singleBranch:E,noCheckout:S,noTags:A,headers:k,nonBlocking:w,batchSize:x=100}){try{if(await aS({fs:t,gitdir:u}),await Zx({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let C=await nt.get({fs:t,gitdir:u});await C.set("http.corsProxy",d),await nt.save({fs:t,gitdir:u,config:C})}let{defaultBranch:_,fetchHead:T}=await hg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:y,relative:b,singleBranch:E,headers:k,tags:!A});if(T===null)return;h=h||_,h=h.replace("refs/heads/",""),await fg({fs:t,cache:e,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:S,nonBlocking:w,batchSize:x})}catch(_){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function sS({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=F.join(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:y=!1,singleBranch:b=!1,noCheckout:E=!1,noTags:S=!1,headers:A={},cache:k={},nonBlocking:w=!1,batchSize:x=100}){try{return P("fs",t),P("http",e),P("gitdir",c),E||P("dir",l),P("url",u),await aD({fs:new Q(t),cache:k,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:y,singleBranch:b,noCheckout:E,noTags:S,headers:A,nonBlocking:w,batchSize:x})}catch(_){throw _.caller="git.clone",_}}async function oS({fs:t,onSign:e,dir:r,gitdir:n=F.join(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{P("fs",t),l||P("message",i),o&&P("onSign",e);let g=new Q(t);return await Nf({fs:g,cache:p,onSign:e,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function lS({fs:t,dir:e,gitdir:r=F.join(e,".git"),fullname:n=!1,test:i=!1}){try{return P("fs",t),P("gitdir",r),await sa({fs:new Q(t),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function sD({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await V.exists({fs:t,gitdir:e,ref:r}))throw new je(r);let i=await V.expand({fs:t,gitdir:e,ref:r}),a=await sa({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await V.resolve({fs:t,gitdir:e,ref:i});await V.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await V.deleteRef({fs:t,gitdir:e,ref:i});let s=za(r),o=await nt.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await nt.save({fs:t,gitdir:e,config:o})}async function cS({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n}){try{return P("fs",t),P("ref",n),await sD({fs:new Q(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function uS({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n}){try{P("fs",t),P("ref",n),await V.deleteRef({fs:new Q(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function oD({fs:t,gitdir:e,remote:r}){let n=await nt.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await nt.save({fs:t,gitdir:e,config:n})}async function fS({fs:t,dir:e,gitdir:r=F.join(e,".git"),remote:n}){try{return P("fs",t),P("remote",n),await oD({fs:new Q(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function lD({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await V.deleteRef({fs:t,gitdir:e,ref:r})}async function dS({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n}){try{return P("fs",t),P("ref",n),await lD({fs:new Q(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function cD({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function uD({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await t.readdir(F.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,c=await ug({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new pe(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function fD({fs:t,cache:e,gitdir:r,oid:n}){let i=o=>Ge({fs:t,cache:e,gitdir:r,oid:o}),a=await cD({fs:t,gitdir:r,oid:n}),s=await uD({fs:t,cache:e,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 Yl("oids",n,a):new je(`an object matching "${n}"`)}async function hS({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,cache:i={}}){try{return P("fs",t),P("gitdir",r),P("oid",n),await fD({fs:new Q(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function pS({fs:t,dir:e,gitdir:
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 hD({fs:t,cache:e,dir:r,gitdir:n=F.join(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Rr({ref:a}),g=Rr({ref:s}),v=Rr({ref:o}),y=[],b=[],E=[],S=[],A=await ra({fs:t,cache:e,dir:r,gitdir:n,trees:[p,g,v],map:async function(k,[w,x,_]){let T=Cf(k),C=await If(w,x),I=await If(_,x);switch(`${C}-${I}`){case"false-false":return{mode:await x.mode(),path:T,oid:await x.oid(),type:await x.type()};case"false-true":return!_&&await w.type()==="tree"?{mode:await w.mode(),path:T,oid:await w.oid(),type:await w.type()}:_?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!w&&await _.type()==="tree"?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:w?{mode:await w.mode(),path:T,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&_&&await w.type()==="tree"&&await _.type()==="tree")return{mode:await w.mode(),path:T,oid:await w.oid(),type:"tree"};if(w&&_&&await w.type()==="blob"&&await _.type()==="blob")return pD({fs:t,gitdir:n,path:T,ours:w,base:x,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async L=>{if(L.cleanMerge)d||i.insert({filepath:k,oid:L.mergeResult.oid,stage:0});else if(y.push(k),b.push(k),!d){let $="";x&&await x.type()==="blob"&&($=await x.oid());let J=await w.oid(),de=await _.oid();i.delete({filepath:k}),$&&i.insert({filepath:k,oid:$,stage:1}),i.insert({filepath:k,oid:J,stage:2}),i.insert({filepath:k,oid:de,stage:3})}return L.mergeResult});if(x&&!w&&_&&await x.type()==="blob"&&await _.type()==="blob"){if(y.push(k),E.push(k),!d){let L=await x.oid(),$=await _.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:L,stage:1}),i.insert({filepath:k,oid:$,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:T}}if(x&&w&&!_&&await x.type()==="blob"&&await w.type()==="blob"){if(y.push(k),S.push(k),!d){let L=await x.oid(),$=await w.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:L,stage:1}),i.insert({filepath:k,oid:$,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:T}}if(x&&!w&&!_&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new oo}}},reduce:y.length!==0&&(!r||d)?void 0:async(k,w)=>{let x=w.filter(Boolean);if(k&&!(k&&k.type==="tree"&&x.length===0&&k.path!==".")){if(x.length>0||k.path==="."&&x.length===0){let T=new hr(x).toObject(),C=await mr({fs:t,gitdir:n,type:"tree",object:T,dryRun:f});k.oid=C}return k}}});return y.length!==0?(r&&!d&&await ra({fs:t,cache:e,dir:r,gitdir:n,trees:[Rr({ref:A.oid})],map:async function(k,[w]){let x=`${r}/${k}`;if(await w.type()==="blob"){let _=await w.mode(),T=new TextDecoder().decode(await w.content());await t.write(x,T,{mode:_})}return!0}}),new lo(y,b,E,S)):A.oid}async function pD({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=dD}){let f="blob",d="100755",h="",p="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),p=Buffer.from(await i.content()).toString("utf8"));let g=d===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await a.oid(),type:f}};if(await a.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};let v=Buffer.from(await n.content()).toString("utf8"),y=Buffer.from(await a.content()).toString("utf8"),{mergedText:b,cleanMerge:E}=await u({branches:[l,s,o],contents:[p,v,y],path:r}),S=await mr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:c});return{cleanMerge:E,mergeResult:{mode:g,path:r,oid:S,type:f}}}async function mS({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:g,mergeDriver:v,allowUnrelatedHistories:y=!1}){i===void 0&&(i=await sa({fs:t,gitdir:n,fullname:!0})),i=await V.expand({fs:t,gitdir:n,ref:i}),a=await V.expand({fs:t,gitdir:n,ref:a});let b=await V.resolve({fs:t,gitdir:n,ref:i}),E=await V.resolve({fs:t,gitdir:n,ref:a}),S=await pg({fs:t,cache:e,gitdir:n,oids:[b,E]});if(S.length!==1)if(S.length===0&&y)S.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new oo;let A=S[0];if(A===E)return{oid:b,alreadyMerged:!0};if(s&&A===b)return!l&&!c&&await V.writeRef({fs:t,gitdir:n,ref:i,value:E}),{oid:E,fastForward:!0};{if(o)throw new Jl;let k=await ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async x=>hD({fs:t,cache:e,dir:r,gitdir:n,index:x,ourOid:b,theirOid:E,baseOid:A,ourName:za(i),baseName:"base",theirName:za(a),dryRun:l,abortOnConflict:u,mergeDriver:v}));if(k instanceof lo)throw k;return f||(f=`Merge branch '${za(a)}' into ${za(i)}`),{oid:await Nf({fs:t,cache:e,gitdir:n,message:f,ref:i,tree:k,parent:[b,E],author:d,committer:h,signi
Line truncated
|
||||
`)),n.push(Qe.encode(`agent=${Bf.agent}
|
||||
`)),(r||e||t)&&n.push(Qe.delim()),r&&n.push(Qe.encode("peel")),e&&n.push(Qe.encode("symrefs")),t&&n.push(Qe.encode(`ref-prefix ${t}`)),n.push(Qe.flush()),n}async function NS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{P("http",t),P("url",a);let d=await mo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return AS(d,c,u,f);let h=await xD({prefix:c,symrefs:u,peelTags:f}),p=await mo.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return _D(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function BS({fs:t,dir:e,gitdir:r=F.join(e,".git")}){try{return P("fs",t),P("gitdir",r),V.listTags({fs:new Q(t),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function SD(t,e){return t.committer.timestamp-e.committer.timestamp}var ED="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function Px({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===ED)return;let a=n,s,o=await fo({fs:t,cache:e,gitdir:r,oid:n}),l=o.tree;return i===o.oid?s=o.path:(s=await HS({fs:t,cache:e,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function HS({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=F.join(o,c.path),s.push(u)):c.type==="tree"&&(u=Ge({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return HS({fs:t,cache:e,gitdir:r,tree:hr.from(f),fileId:i,oid:a,filepaths:s,parentPath:F.join(o,c.path)})})),u});return await Promise.all(l),s}async function AD({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await qa.read({fs:t,gitdir:r}),d=await V.resolve({fs:t,gitdir:r,ref:i}),h=[await po({fs:t,cache:e,gitdir:r,oid:d})],p,g,v;function y(b){v&&n&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(n){let E;try{E=await lc({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:n}),g&&p!==E&&u.push(g),p=E,g=b,v=!0}catch(S){if(S instanceof je){let A=l&&p;if(A&&(A=await Px({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),A))if(Array.isArray(A)){if(g){let k=await Px({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(k))if(A=A.filter(w=>k.indexOf(w)===-1),A.length===1)A=A[0],n=A,g&&u.push(g);else{A=!1,g&&u.push(g);break}}}else n=A,g&&u.push(g);if(!A){if(v&&p&&(u.push(g),!o))break;if(!o&&!l)throw S}g=b,v=!1}else throw S}}else u.push(b);if(a!==void 0&&u.length===a){y(b);break}if(!f.has(b.oid))for(let E of b.commit.parent){let S=await po({fs:t,cache:e,gitdir:r,oid:E});h.map(A=>A.oid).includes(S.oid)||h.push(S)}h.length===0&&y(b),h.sort((E,S)=>SD(E.commit,S.commit))}return u}async function US({fs:t,dir:e,gitdir:r=F.join(e,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return P("fs",t),P("gitdir",r),P("ref",i),await AD({fs:new Q(t),cache:c,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function GS({fs:t,onSign:e,dir:r,gitdir:n=F.join(r,".git"),ours:i,theirs:a,fastForward:s=!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:y=!1}){try{P("fs",t),p&&P("onSign",e);let b=new Q(t),E=await ia({fs:b,gitdir:n,author:d});if(!E&&(!o||!s))throw new zt("author");let S=await ho({fs:b,gitdir:n,author:E,committer:h});if(!S&&(!o||!s))throw new zt("committer");return await mS({fs:b,cache:g,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:E,committer:S,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:y})}catch(b){throw b.caller="git.merge",b}}var kD={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function zS({fs:t,cache:e,dir:r,gitdir:n=F.join(r,".git"),oids:i}){let a=new Mx,s=[];function o(u,f){let d=Buffer.from(u,f);s.push(d),a.update(d)}async function l({stype:u,object:f}){let d=kD[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let v=(p|d|g).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o(lg(2,v),"hex"),h=h>>>7;o(Buffer.from(await Gx(f)))}o("PACK"),o("00000002","hex"),o(lg(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await Ge({fs:t,cache:e,gitdir:n,oid:u});await l({write:o,object:d,stype:f})}let c=a.digest();return s.push(c),s}async function TD({fs:t,cache:e,gitdir:r,oids:n,write:i}){let a=await zS({fs:t,cache:e,gitdir:r,oids:n}),s=Buffer.from(await Ff(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(F.join(r,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function VS({fs:t,dir:e,gi
Line truncated
|
||||
`)}async function t8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:u,gitdir:c,url:f,corsProxy:d,ref:h,remote:m,depth:g,since:v,exclude:w,relative:b,singleBranch:E,noCheckout:x,noTags:k,headers:A,nonBlocking:y,batchSize:S=100}){try{if(await LE({fs:t,gitdir:c}),await PE({fs:t,gitdir:c,remote:m,url:f,force:!1}),d){let P=await nt.get({fs:t,gitdir:c});await P.set("http.corsProxy",d),await nt.save({fs:t,gitdir:c,config:P})}let{defaultBranch:_,fetchHead:T}=await Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:h,remote:m,corsProxy:d,depth:g,since:v,exclude:w,relative:b,singleBranch:E,headers:A,tags:!k});if(T===null)return;h=h||_,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:n,onPostCheckout:l,dir:u,gitdir:c,ref:h,remote:m,noCheckout:x,nonBlocking:y,batchSize:S})}catch(_){throw await t.rmdir(c,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function NE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u=O.join(l,".git"),url:c,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:m=void 0,since:g=void 0,exclude:v=[],relative:w=!1,singleBranch:b=!1,noCheckout:E=!1,noTags:x=!1,headers:k={},cache:A={},nonBlocking:y=!1,batchSize:S=100}){try{return C("fs",t),C("http",e),C("gitdir",u),E||C("dir",l),C("url",c),await t8({fs:new J(t),cache:A,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u,url:c,corsProxy:f,ref:d,remote:h,depth:m,since:g,exclude:v,relative:w,singleBranch:b,noCheckout:E,noTags:x,headers:k,nonBlocking:y,batchSize:S})}catch(_){throw _.caller="git.clone",_}}async function BE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:u=!1,noUpdateBranch:c=!1,ref:f,parent:d,tree:h,cache:m={}}){try{C("fs",t),l||C("message",i),o&&C("onSign",e);let g=new J(t);return await Qf({fs:g,cache:m,onSign:e,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:u,noUpdateBranch:c,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function HE({fs:t,dir:e,gitdir:r=O.join(e,".git"),fullname:n=!1,test:i=!1}){try{return C("fs",t),C("gitdir",r),await pa({fs:new J(t),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function r8({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await z.exists({fs:t,gitdir:e,ref:r}))throw new Le(r);let i=await z.expand({fs:t,gitdir:e,ref:r}),a=await pa({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await z.resolve({fs:t,gitdir:e,ref:i});await z.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await z.deleteRef({fs:t,gitdir:e,ref:i});let s=Ka(r),o=await nt.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await nt.save({fs:t,gitdir:e,config:o})}async function UE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await r8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function jE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{C("fs",t),C("ref",n),await z.deleteRef({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function n8({fs:t,gitdir:e,remote:r}){let n=await nt.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await nt.save({fs:t,gitdir:e,config:n})}async function GE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n}){try{return C("fs",t),C("remote",n),await n8({fs:new J(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function i8({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await z.deleteRef({fs:t,gitdir:e,ref:r})}async function qE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await i8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function a8({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function s8({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await t.readdir(O.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,u=await Og({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(u.error)throw new de(u.error);for(let c of u.offsets.keys())c.startsWith(n)&&a.push(c)}return a}async function o8({fs:t,cache:e,gitdir:r,oid:n}){let i=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),a=await a8({fs:t,gitdir:r,oid:n}),s=await s8({fs:t,cache:e,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 ac("oids",n,a):new Le(`an object matching "${n}"`)}async function zE({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await o8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function VE({fs:t,dir:e,gitdir:
Line truncated
|
||||
`,d+=m.conflict.a.join(""),d+=`${"=".repeat(f)}
|
||||
`,d+=m.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
|
||||
`);return{cleanMerge:h,mergedText:d}}async function c8({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:u="base",theirName:c="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let m=$r({ref:a}),g=$r({ref:s}),v=$r({ref:o}),w=[],b=[],E=[],x=[],k=await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[m,g,v],map:async function(A,[y,S,_]){let T=jf(A),P=await Wf(y,S),F=await Wf(_,S);switch(`${P}-${F}`){case"false-false":return{mode:await S.mode(),path:T,oid:await S.oid(),type:await S.type()};case"false-true":return!_&&await y.type()==="tree"?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:_?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!y&&await _.type()==="tree"?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:y?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&_&&await y.type()==="tree"&&await _.type()==="tree")return{mode:await y.mode(),path:T,oid:await y.oid(),type:"tree"};if(y&&_&&await y.type()==="blob"&&await _.type()==="blob")return u8({fs:t,gitdir:n,path:T,ours:y,base:S,theirs:_,ourName:l,baseName:u,theirName:c,mergeDriver:h}).then(async D=>{if(D.cleanMerge)d||i.insert({filepath:A,oid:D.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!d){let M="";S&&await S.type()==="blob"&&(M=await S.oid());let re=await y.oid(),ye=await _.oid();i.delete({filepath:A}),M&&i.insert({filepath:A,oid:M,stage:1}),i.insert({filepath:A,oid:re,stage:2}),i.insert({filepath:A,oid:ye,stage:3})}return D.mergeResult});if(S&&!y&&_&&await S.type()==="blob"&&await _.type()==="blob"){if(w.push(A),E.push(A),!d){let D=await S.oid(),M=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:T}}if(S&&y&&!_&&await S.type()==="blob"&&await y.type()==="blob"){if(w.push(A),x.push(A),!d){let D=await S.oid(),M=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:T}}if(S&&!y&&!_&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new wo}}},reduce:w.length!==0&&(!r||d)?void 0:async(A,y)=>{let S=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let T=new pr(S).toObject(),P=await gr({fs:t,gitdir:n,type:"tree",object:T,dryRun:f});A.oid=P}return A}}});return w.length!==0?(r&&!d&&await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[$r({ref:k.oid})],map:async function(A,[y]){let S=`${r}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),T=new TextDecoder().decode(await y.content());await t.write(S,T,{mode:_})}return!0}}),new yo(w,b,E,x)):k.oid}async function u8({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:u,mergeDriver:c=l8}){let f="blob",d="100755",h="",m="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),m=Buffer.from(await i.content()).toString("utf8"));let g=d===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await a.oid(),type:f}};if(await a.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};let v=Buffer.from(await n.content()).toString("utf8"),w=Buffer.from(await a.content()).toString("utf8"),{mergedText:b,cleanMerge:E}=await c({branches:[l,s,o],contents:[m,v,w],path:r}),x=await gr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:u});return{cleanMerge:E,mergeResult:{mode:g,path:r,oid:x,type:f}}}async function WE({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,onSign:g,mergeDriver:v,allowUnrelatedHistories:w=!1}){i===void 0&&(i=await pa({fs:t,gitdir:n,fullname:!0})),i=await z.expand({fs:t,gitdir:n,ref:i}),a=await z.expand({fs:t,gitdir:n,ref:a});let b=await z.resolve({fs:t,gitdir:n,ref:i}),E=await z.resolve({fs:t,gitdir:n,ref:a}),x=await Ng({fs:t,cache:e,gitdir:n,oids:[b,E]});if(x.length!==1)if(x.length===0&&w)x.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new wo;let k=x[0];if(k===E)return{oid:b,alreadyMerged:!0};if(s&&k===b)return!l&&!u&&await z.writeRef({fs:t,gitdir:n,ref:i,value:E}),{oid:E,fastForward:!0};{if(o)throw new cc;let A=await ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async S=>c8({fs:t,cache:e,dir:r,gitdir:n,index:S,ourOid:b,theirOid:E,baseOid:k,ourName:Ka(i),baseName:"base",theirName:Ka(a),dryRun:l,abortOnConflict:c,mergeDriver:v}));if(A instanceof yo)throw A;return f||(f=`Merge branch '${Ka(a)}' into ${Ka(i)}`),{oid:await Qf({fs:t,cache:e,gitdir:n,message:f,ref:i,tree:A,parent:[b,E],author:d,committer:h,sig
Line truncated
|
||||
`)),n.push(Qe.encode(`agent=${td.agent}
|
||||
`)),(r||e||t)&&n.push(Qe.delim()),r&&n.push(Qe.encode("peel")),e&&n.push(Qe.encode("symrefs")),t&&n.push(Qe.encode(`ref-prefix ${t}`)),n.push(Qe.flush()),n}async function vk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:u,symrefs:c,peelTags:f}){try{C("http",t),C("url",a);let d=await ko.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return nk(d,u,c,f);let h=await w8({prefix:u,symrefs:c,peelTags:f}),m=await ko.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return v8(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function wk({fs:t,dir:e,gitdir:r=O.join(e,".git")}){try{return C("fs",t),C("gitdir",r),z.listTags({fs:new J(t),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function y8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function oE({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===b8)return;let a=n,s,o=await xo({fs:t,cache:e,gitdir:r,oid:n}),l=o.tree;return i===o.oid?s=o.path:(s=await yk({fs:t,cache:e,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function yk({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=n.entries().map(function(u){let c;return u.oid===i?(c=O.join(o,u.path),s.push(c)):u.type==="tree"&&(c=qe({fs:t,cache:e,gitdir:r,oid:u.oid}).then(function({object:f}){return yk({fs:t,cache:e,gitdir:r,tree:pr.from(f),fileId:i,oid:a,filepaths:s,parentPath:O.join(o,u.path)})})),c});return await Promise.all(l),s}async function _8({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l}){let u=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),c=[],f=await Qa.read({fs:t,gitdir:r}),d=await z.resolve({fs:t,gitdir:r,ref:i}),h=[await Eo({fs:t,cache:e,gitdir:r,oid:d})],m,g,v;function w(b){v&&n&&c.push(b)}for(;h.length>0;){let b=h.pop();if(u!==void 0&&b.commit.committer.timestamp<=u)break;if(n){let E;try{E=await yc({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:n}),g&&m!==E&&c.push(g),m=E,g=b,v=!0}catch(x){if(x instanceof Le){let k=l&&m;if(k&&(k=await oE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(g){let A=await oE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:m});if(Array.isArray(A))if(k=k.filter(y=>A.indexOf(y)===-1),k.length===1)k=k[0],n=k,g&&c.push(g);else{k=!1,g&&c.push(g);break}}}else n=k,g&&c.push(g);if(!k){if(v&&m&&(c.push(g),!o))break;if(!o&&!l)throw x}g=b,v=!1}else throw x}}else c.push(b);if(a!==void 0&&c.length===a){w(b);break}if(!f.has(b.oid))for(let E of b.commit.parent){let x=await Eo({fs:t,cache:e,gitdir:r,oid:E});h.map(k=>k.oid).includes(x.oid)||h.push(x)}h.length===0&&w(b),h.sort((E,x)=>y8(E.commit,x.commit))}return c}async function bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:u={}}){try{return C("fs",t),C("gitdir",r),C("ref",i),await _8({fs:new J(t),cache:u,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l})}catch(c){throw c.caller="git.log",c}}async function _k({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,cache:g={},mergeDriver:v,allowUnrelatedHistories:w=!1}){try{C("fs",t),m&&C("onSign",e);let b=new J(t),E=await da({fs:b,gitdir:n,author:d});if(!E&&(!o||!s))throw new zt("author");let x=await So({fs:b,gitdir:n,author:E,committer:h});if(!x&&(!o||!s))throw new zt("committer");return await WE({fs:b,cache:g,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:u,abortOnConflict:c,message:f,author:E,committer:x,signingKey:m,onSign:e,mergeDriver:v,allowUnrelatedHistories:w})}catch(b){throw b.caller="git.merge",b}}var x8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function xk({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),oids:i}){let a=new cE,s=[];function o(c,f){let d=Buffer.from(c,f);s.push(d),a.update(d)}async function l({stype:c,object:f}){let d=x8[c],h=f.length,m=h>15?128:0,g=h&15;h=h>>>4;let v=(m|d|g).toString(16);for(o(v,"hex");m;)m=h>127?128:0,v=m|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await _E(f)))}o("PACK"),o("00000002","hex"),o($g(8,i.length),"hex");for(let c of i){let{type:f,object:d}=await qe({fs:t,cache:e,gitdir:n,oid:c});await l({write:o,object:d,stype:f})}let u=a.digest();return s.push(u),s}async function S8({fs:t,cache:e,gitdir:r,oids:n,write:i}){let a=await xk({fs:t,cache:e,gitdir:r,oids:n}),s=Buffer.from(await Yf(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(O.join(r,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function Sk({fs:t,dir:e,gi
Line truncated
|
||||
`),i=await n();let a=r.toString("utf8").split(`
|
||||
`);if(i=a.shift(),!i.startsWith("unpack "))throw new Va('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.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 RD({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(Qe.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
|
||||
`)),n="";return r.push(Qe.flush()),r}async function MD({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:y={}}){let b=u||await sa({fs:t,gitdir:c});if(typeof b=="undefined")throw new dr("ref");let E=await nt.get({fs:t,gitdir:c});d=d||await E.get(`branch.${b}.pushRemote`)||await E.get("remote.pushDefault")||await E.get(`branch.${b}.remote`)||"origin";let S=h||await E.get(`remote.${d}.pushurl`)||await E.get(`remote.${d}.url`);if(typeof S=="undefined")throw new dr("remote OR url");let A=f||await E.get(`branch.${b}.merge`);if(typeof S=="undefined")throw new dr("remoteRef");v===void 0&&(v=await E.get("http.corsProxy"));let k=await V.expand({fs:t,gitdir:c,ref:b}),w=g?"0000000000000000000000000000000000000000":await V.resolve({fs:t,gitdir:c,ref:k}),x=go.getRemoteHelperFor({url:S}),_=await x.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:S,headers:y,protocolVersion:1}),T=_.auth,C;if(!A)C=k;else try{C=await V.expandAgainstMap({ref:A,map:_.refs})}catch(W){if(W instanceof je)C=A.startsWith("refs/")?A:`refs/heads/${A}`;else throw W}let I=_.refs.get(C)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:S,localRef:{ref:g?"(delete)":k,oid:w},remoteRef:{ref:C,oid:I}}))throw new uo;let L=!_.capabilities.has("no-thin"),$=new Set;if(!g){let W=[..._.refs.values()],B=new Set;if(I!=="0000000000000000000000000000000000000000"){let $e=await pg({fs:t,cache:e,gitdir:c,oids:[w,I]});for(let lr of $e)W.push(lr);L&&(B=await Xm({fs:t,cache:e,gitdir:c,oids:$e}))}if(!W.includes(w)){let $e=await CD({fs:t,cache:e,gitdir:c,start:[w],finish:W});$=await Xm({fs:t,cache:e,gitdir:c,oids:$e})}if(L){try{let $e=await V.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:lr}=await V.resolveAgainstMap({ref:$e.replace(`refs/remotes/${d}/`,""),fullref:$e,map:_.refs}),Ut=[lr];for(let X of await Xm({fs:t,cache:e,gitdir:c,oids:Ut}))B.add(X)}catch($e){}for(let $e of B)$.delete($e)}if(w===I&&(p=!0),!p){if(k.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new co("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await RS({fs:t,cache:e,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new co("not-fast-forward")}}let J=nS([..._.capabilities],["report-status","side-band-64k",`agent=${Bf.agent}`]),de=await RD({capabilities:J,triplets:[{oldoid:I,oid:w,fullRef:C}]}),le=g?[]:await zS({fs:t,cache:e,gitdir:c,oids:[...$]}),ce=await x.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:S,auth:T,headers:y,body:[...de,...le]}),{packfile:Te,progress:ne}=await $f.demux(ce.body);if(i){let W=iS(ne);uc(W,async B=>{await i(B)})}let N=await PD(Te);if(ce.headers&&(N.headers=ce.headers),d&&N.ok&&N.refs[C].ok&&!k.startsWith("refs/tags")){let W=`refs/remotes/${d}/${C.replace("refs/heads","")}`;g?await V.deleteRef({fs:t,gitdir:c,ref:W}):await V.writeRef({fs:t,gitdir:c,ref:W,value:w})}if(N.ok&&Object.values(N.refs).every(W=>W.ok))return N;{let W=Object.entries(N.refs).filter(([B,$e])=>!$e.ok).map(([B,$e])=>`
|
||||
- ${B}: ${$e.error}`).join("");throw new Ql(W,N)}}async function WS({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=F.join(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:y={},cache:b={}}){try{return P("fs",t),P("http",e),P("gitdir",c),await MD({fs:new Q(t),cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:y})}catch(E){throw E.caller="git.push",E}}async function YS({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Mr.from(a).parse().object,YS({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new tr(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function XS({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await lc({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await YS({fs:t,cache:e,gitdir:r,oid:n})}async function KS({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,filepath:i,cache:a={}}){try{return P("fs",t),P("gitdir",r),P("oid",n),await XS({fs:new Q(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function mg({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,cache:i={}}){try{return P("fs",t),P("gitdir",r),P("oid",n),await po({fs:new Q(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function OD({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await V.resolve({gitdir:r,fs:t,ref:n}),{blob:s}=await XS({fs:t,cache:e,gitdir:r,oid:a,filepath:i});return s}async function ZS({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return P("fs",t),P("gitdir",r),P("ref",n),P("oid",i),await OD({fs:new Q(t),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function JS({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{P("fs",t),P("gitdir",r),P("oid",n);let l=new Q(t);a!==void 0&&(n=await lc({fs:l,cache:o,gitdir:r,oid:n,filepath:a}));let u=await Ge({fs:l,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=pr.from(u.object).parse();break;case"tree":u.object=hr.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=Mr.from(u.object).parse();break;default:throw new tr(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function ID({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new tr(n,i,"tag");let s=Mr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function QS({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,cache:i={}}){try{return P("fs",t),P("gitdir",r),P("oid",n),await ID({fs:new Q(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function eE({fs:t,dir:e,gitdir:r=F.join(e,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return P("fs",t),P("gitdir",r),P("oid",n),await wo({fs:new Q(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function tE({fs:t,dir:e,gitdir:r=F.join(e,".git"),filepath:n,cache:i={}}){try{P("fs",t),P("gitdir",r),P("filepath",n),await ct.acquire({fs:new Q(t),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function FD({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await V.resolve({gitdir:n,fs:t,ref:i})}catch(p){if(!(p instanceof je))throw p}let f=(await wo({fs:t,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let d=await cc({fs:t,gitdir:n,tree:f});return await Nf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
||||
`,author:s,committer:o,signingKey:l})}async function rE({fs:t,onSign:e,dir:r,gitdir:n=F.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{P("fs",t),P("gitdir",n),P("oid",a);let u=new Q(t),f=await ia({fs:u,gitdir:n,author:s});if(!f)throw new zt("author");let d=await ho({fs:u,gitdir:n,author:f,committer:o});if(!d)throw new zt("committer");return await FD({fs:u,cache:c,onSign:e,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function $D({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(n!==zn.clean(n))throw new mn(n,zn.clean(n));if(r!==zn.clean(r))throw new mn(r,zn.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await V.exists({fs:t,gitdir:e,ref:s}))throw new pn("branch",n,!1);let l=await V.resolve({fs:t,gitdir:e,ref:a,depth:1});await V.writeRef({fs:t,gitdir:e,ref:s,value:l}),await V.deleteRef({fs:t,gitdir:e,ref:a});let u=await sa({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await V.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function nE({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n,oldref:i,checkout:a=!1}){try{return P("fs",t),P("gitdir",r),P("ref",n),P("oldref",i),await $D({fs:new Q(t),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function iE({gitdir:t,type:e,object:r}){return bi(ea.wrap({type:e,object:r}))}async function aE({fs:t,dir:e,gitdir:r=F.join(e,".git"),filepath:n,ref:i,cache:a={}}){try{P("fs",t),P("gitdir",r),P("filepath",n);let s=new Q(t),o,l;try{o=await V.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await lc({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(F.join(e,n));u&&(l=await iE({gitdir:r,type:"blob",object:u}),o===l&&(c=await s.lstat(F.join(e,n)))),await ct.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function sE({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n,depth:i}){try{return P("fs",t),P("gitdir",r),P("ref",n),await V.resolve({fs:new Q(t),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function oE({fs:t,dir:e,gitdir:r=F.join(e,".git"),path:n,value:i,append:a=!1}){try{P("fs",t),P("gitdir",r),P("path",n);let s=new Q(t),o=await nt.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await nt.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function lE({fs:t,gitdir:e,commit:r}){let n=pr.from(r).toObject();return await mr({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var Df=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,r,n){let i=e.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",s=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${e.email} ${s} ${o} ${n}
|
||||
`);if(i=a.shift(),!i.startsWith("unpack "))throw new Ja('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),u=l.indexOf(" ");u===-1&&(u=l.length);let c=l.slice(0,u),f=l.slice(u+1);e.refs[c]={ok:o==="ok",error:f}}return e}async function A8({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(Qe.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
|
||||
`)),n="";return r.push(Qe.flush()),r}async function T8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={}}){let b=c||await pa({fs:t,gitdir:u});if(typeof b=="undefined")throw new hr("ref");let E=await nt.get({fs:t,gitdir:u});d=d||await E.get(`branch.${b}.pushRemote`)||await E.get("remote.pushDefault")||await E.get(`branch.${b}.remote`)||"origin";let x=h||await E.get(`remote.${d}.pushurl`)||await E.get(`remote.${d}.url`);if(typeof x=="undefined")throw new hr("remote OR url");let k=f||await E.get(`branch.${b}.merge`);if(typeof x=="undefined")throw new hr("remoteRef");v===void 0&&(v=await E.get("http.corsProxy"));let A=await z.expand({fs:t,gitdir:u,ref:b}),y=g?"0000000000000000000000000000000000000000":await z.resolve({fs:t,gitdir:u,ref:A}),S=Ao.getRemoteHelperFor({url:x}),_=await S.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:x,headers:w,protocolVersion:1}),T=_.auth,P;if(!k)P=A;else try{P=await z.expandAgainstMap({ref:k,map:_.refs})}catch(Z){if(Z instanceof Le)P=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw Z}let F=_.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:P,oid:F}}))throw new _o;let D=!_.capabilities.has("no-thin"),M=new Set;if(!g){let Z=[..._.refs.values()],H=new Set;if(F!=="0000000000000000000000000000000000000000"){let Oe=await Ng({fs:t,cache:e,gitdir:u,oids:[y,F]});for(let cr of Oe)Z.push(cr);D&&(H=await yg({fs:t,cache:e,gitdir:u,oids:Oe}))}if(!Z.includes(y)){let Oe=await E8({fs:t,cache:e,gitdir:u,start:[y],finish:Z});M=await yg({fs:t,cache:e,gitdir:u,oids:Oe})}if(D){try{let Oe=await z.resolve({fs:t,gitdir:u,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:cr}=await z.resolveAgainstMap({ref:Oe.replace(`refs/remotes/${d}/`,""),fullref:Oe,map:_.refs}),Gt=[cr];for(let Y of await yg({fs:t,cache:e,gitdir:u,oids:Gt}))H.add(Y)}catch(Oe){}for(let Oe of H)M.delete(Oe)}if(y===F&&(m=!0),!m){if(A.startsWith("refs/tags")&&F!=="0000000000000000000000000000000000000000")throw new bo("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&F!=="0000000000000000000000000000000000000000"&&!await lk({fs:t,cache:e,gitdir:u,oid:y,ancestor:F,depth:-1}))throw new bo("not-fast-forward")}}let re=ME([..._.capabilities],["report-status","side-band-64k",`agent=${td.agent}`]),ye=await A8({capabilities:re,triplets:[{oldoid:F,oid:y,fullRef:P}]}),me=g?[]:await xk({fs:t,cache:e,gitdir:u,oids:[...M]}),fe=await S.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:x,auth:T,headers:w,body:[...ye,...me]}),{packfile:Ge,progress:oe}=await Xf.demux(fe.body);if(i){let Z=DE(oe);_c(Z,async H=>{await i(H)})}let B=await k8(Ge);if(fe.headers&&(B.headers=fe.headers),d&&B.ok&&B.refs[P].ok&&!A.startsWith("refs/tags")){let Z=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await z.deleteRef({fs:t,gitdir:u,ref:Z}):await z.writeRef({fs:t,gitdir:u,ref:Z,value:y})}if(B.ok&&Object.values(B.refs).every(Z=>Z.ok))return B;{let Z=Object.entries(B.refs).filter(([H,Oe])=>!Oe.ok).map(([H,Oe])=>`
|
||||
- ${H}: ${Oe.error}`).join("");throw new uc(Z,B)}}async function kk({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:u=O.join(l,".git"),ref:c,remoteRef:f,remote:d="origin",url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={},cache:b={}}){try{return C("fs",t),C("http",e),C("gitdir",u),await T8({fs:new J(t),cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m,delete:g,corsProxy:v,headers:w})}catch(E){throw E.caller="git.push",E}}async function Ak({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,Ak({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new rr(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function Tk({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await Ak({fs:t,cache:e,gitdir:r,oid:n})}async function Ck({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Tk({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function Bg({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Eo({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function C8({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await z.resolve({gitdir:r,fs:t,ref:n}),{blob:s}=await Tk({fs:t,cache:e,gitdir:r,oid:a,filepath:i});return s}async function Pk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oid",i),await C8({fs:new J(t),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function Rk({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{C("fs",t),C("gitdir",r),C("oid",n);let l=new J(t);a!==void 0&&(n=await yc({fs:l,cache:o,gitdir:r,oid:n,filepath:a}));let c=await qe({fs:l,cache:o,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(c.oid=n,i==="parsed")switch(c.format="parsed",c.type){case"commit":c.object=mr.from(c.object).parse();break;case"tree":c.object=pr.from(c.object).entries();break;case"blob":s?c.object=c.object.toString(s):(c.object=new Uint8Array(c.object),c.format="content");break;case"tag":c.object=Fr.from(c.object).parse();break;default:throw new rr(c.oid,c.type,"blob|commit|tag|tree")}else(c.format==="deflated"||c.format==="wrapped")&&(c.type=c.format);return c}catch(l){throw l.caller="git.readObject",l}}async function P8({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new rr(n,i,"tag");let s=Fr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function Ik({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await P8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function $k({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Po({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function Fk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n),await ct.acquire({fs:new J(t),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function R8({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let u;try{u=await z.resolve({gitdir:n,fs:t,ref:i})}catch(m){if(!(m instanceof Le))throw m}let f=(await Po({fs:t,gitdir:n,oid:u||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(m=>m.path!==a);let d=await bc({fs:t,gitdir:n,tree:f});return await Qf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:u&&[u],message:`Note removed by 'isomorphic-git removeNote'
|
||||
`,author:s,committer:o,signingKey:l})}async function Ok({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:u={}}){try{C("fs",t),C("gitdir",n),C("oid",a);let c=new J(t),f=await da({fs:c,gitdir:n,author:s});if(!f)throw new zt("author");let d=await So({fs:c,gitdir:n,author:f,committer:o});if(!d)throw new zt("committer");return await R8({fs:c,cache:u,onSign:e,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(c){throw c.caller="git.removeNote",c}}async function I8({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(n!==Xn.clean(n))throw new wn(n,Xn.clean(n));if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",n,!1);let l=await z.resolve({fs:t,gitdir:e,ref:a,depth:1});await z.writeRef({fs:t,gitdir:e,ref:s,value:l}),await z.deleteRef({fs:t,gitdir:e,ref:a});let c=await pa({fs:t,gitdir:e,fullname:!0})===a;(i||c)&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function Mk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,oldref:i,checkout:a=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oldref",i),await I8({fs:new J(t),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Dk({gitdir:t,type:e,object:r}){return ki(la.wrap({type:e,object:r}))}async function Lk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i,cache:a={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let s=new J(t),o,l;try{o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await yc({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},c=e&&await s.read(O.join(e,n));c&&(l=await Dk({gitdir:r,type:"blob",object:c}),o===l&&(u=await s.lstat(O.join(e,n)))),await ct.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:u,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function Nk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,depth:i}){try{return C("fs",t),C("gitdir",r),C("ref",n),await z.resolve({fs:new J(t),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n,value:i,append:a=!1}){try{C("fs",t),C("gitdir",r),C("path",n);let s=new J(t),o=await nt.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await nt.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function Hk({fs:t,gitdir:e,commit:r}){let n=mr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var Zf=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,r,n){let i=e.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",s=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${e.email} ${s} ${o} ${n}
|
||||
`}static getStashReflogEntry(e,r=!1){return e.split(`
|
||||
`).filter(a=>a).reverse().map((a,s)=>r?`stash@{${s}}: ${a.split(" ")[1]}`:a)}},DD={stage:Ya,workdir:yo},Km;async function vo(t,e){return Km===void 0&&(Km=new zl),Km.acquire(t,e)}async function LD(t,e,r,n,i=null){let a=F.join(r,n),s=await t.lstat(a);if(!s)throw new je(a);if(s.isDirectory())throw new pe(`${a}: file expected, but found directory`);let o=i?await Lx({fs:t,gitdir:e,oid:i}):void 0,l=o?i:void 0;return o||await vo({fs:t,gitdir:e,currentFilepath:a},async()=>{let c=s.isSymbolicLink()?await t.readlink(a).then(zx):await t.read(a);if(c===null)throw new je(a);l=await mr({fs:t,gitdir:e,type:"blob",object:c})}),l}async function jD({fs:t,dir:e,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){let s=await Promise.all(a.children.map(i));a.oid=await cc({fs:t,gitdir:r,tree:s}),a.mode=16384}}else a.type==="blob"&&(a.oid=await LD(t,r,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function Rx({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",a=n.map(h=>typeof h=="string"?DD[h]():h),s=[],u=await ra({fs:t,cache:{},dir:e,gitdir:r,trees:a,map:async(h,[p,g])=>{if(!(h==="."||await na.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&s.push([p,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0?p:void 0),iterate:async(h,p)=>{let g=[];for(let v of p){let[y,b]=v;i?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(v):s.push([null,b])):y&&(b?g.push(v):s.push([y,null]))}return g.length?Promise.all(g.map(h)):[]}});if(s.length===0||u.length===0)return null;let d=(await jD({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return cc({fs:t,gitdir:r,tree:d})}async function ND({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){let s=[],o=[],l=await ra({fs:t,cache:{},dir:e,gitdir:r,trees:[Rr({ref:i}),Rr({ref:n})],map:async(c,[u,f])=>{if(c==="."||await na.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let p=d==="tree"?"rmdir":"rm";return d==="tree"&&s.push(c),d==="blob"&&a&&o.push({filepath:c,oid:await u.oid()}),{method:p,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(a&&o.push({filepath:c,oid:h,stats:await t.lstat(F.join(e,c))}),{method:"write",filepath:c,oid:h})}});await vo({fs:t,gitdir:r,dirRemoved:s,ops:l},async()=>{for(let c of l){let u=F.join(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!s.some(f=>u.startsWith(f))){let{object:f}=await Ge({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await ct.acquire({fs:t,gitdir:r,cache:{}},async c=>{o.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}var Wa=class t{constructor({fs:e,dir:r,gitdir:n=F.join(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return F.join(this.gitdir,t.refStash)}get refLogsStashPath(){return F.join(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await ia({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:n}){return lE({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:n,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 mn(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?po({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return V.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=Df.createStashReflogEntry(n,e,r),a=this.refLogsStashPath;await vo({filepath:a,entry:i},async()=>{let s=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,s+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let n=(await this.fs.read(this.refLogsStashPath)).toString();return Df.getStashReflogEntry(n,e)}};async function BD({fs:t,dir:e,gitdir:r,message:n=""}){let i=new Wa({fs:t,dir:e,gitdir:r});await i.getAuthor();let a=await sa({fs:t,gitdir:r,fullname:!1}),s=await V.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await mg({fs:t,dir:e,gitdir:r,oid:s})).commit.message,c=[s],u=null,f=Rr({ref:"H
Line truncated
|
||||
`),"utf8");let c=o[o.length-1].split(" ")[1];await i.writeStashRef(c)}else await t.rm(l)})}async function HD({fs:t,dir:e,gitdir:r}){return new Wa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function UD({fs:t,dir:e,gitdir:r}){let n=new Wa({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await vo(i,async()=>{await Promise.all(i.map(async a=>{if(await t.exists(a))return t.rm(a)}))})}async function GD({fs:t,dir:e,gitdir:r,refIdx:n=0}){await cE({fs:t,dir:e,gitdir:r,refIdx:n}),await uE({fs:t,dir:e,gitdir:r,refIdx:n})}async function fE({fs:t,dir:e,gitdir:r=F.join(e,".git"),op:n="push",message:i="",refIdx:a=0}){P("fs",t),P("dir",e),P("gitdir",r),P("op",n);let s={push:BD,apply:cE,drop:uE,list:HD,clear:UD,pop:GD},o=["apply","drop","pop"];try{let l=new Q(t);["refs","logs","logs/refs"].map(f=>F.join(r,f)).forEach(async f=>{await l.exists(f)||await l.mkdir(f)});let u=s[n];if(u){if(o.includes(n)&&a<0)throw new mn(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await u({fs:l,dir:e,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function dE({fs:t,dir:e,gitdir:r=F.join(e,".git"),filepath:n,cache:i={}}){try{P("fs",t),P("gitdir",r),P("filepath",n);let a=new Q(t);if(await na.isIgnored({fs:a,gitdir:r,dir:e,filepath:n}))return"ignored";let o=await zD({fs:a,cache:i,gitdir:r}),l=await hE({fs:a,cache:i,gitdir:r,tree:o,path:n}),c=await ct.acquire({fs:a,gitdir:r,cache:i},async function(g){for(let v of g)if(v.path===n)return v;return null}),u=await a.lstat(F.join(e,n)),f=l!==null,d=c!==null,h=u!==null,p=async()=>{if(d&&!Tf(c,u))return c.oid;{let g=await a.read(F.join(e,n)),v=await iE({gitdir:r,type:"blob",object:g});return d&&c.oid===v&&u.size!==-1&&ct.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()===c.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===c.oid,"*deleted";if(f&&h&&!d)return await p()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let g=await p();return g===l?g===c.oid?"unmodified":"*unmodified":g===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function hE({fs:t,cache:e,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:l}=await Ge({fs:t,cache:e,gitdir:r,oid:s.oid});if(o==="tree"){let c=hr.from(l);return hE({fs:t,cache:e,gitdir:r,tree:c,path:i})}if(o==="blob")throw new tr(s.oid,o,"blob",i.join("/"))}return null}async function zD({fs:t,cache:e,gitdir:r}){let n;try{n=await V.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof je)return[]}let{tree:i}=await wo({fs:t,cache:e,gitdir:r,oid:n});return i}async function pE({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{P("fs",t),P("gitdir",r),P("ref",n);let l=new Q(t);return await ra({fs:l,cache:s,dir:e,gitdir:r,trees:[Rr({ref:n}),yo(),Ya()],map:async function(c,[u,f,d]){if(!u&&!d&&f&&!o&&await na.isIgnored({fs:l,dir:e,filepath:c})||!i.some(k=>tS(c,k)))return null;if(a&&!a(c))return;let[h,p,g]=await Promise.all([u&&u.type(),f&&f.type(),d&&d.type()]),v=[h,p,g].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((p==="tree"||p==="special")&&!v)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!v)return;let y=h==="blob"?await u.oid():void 0,b=g==="blob"?await d.oid():void 0,E;h!=="blob"&&p==="blob"&&g!=="blob"?E="42":p==="blob"&&(E=await f.oid());let S=[void 0,y,E,b],A=S.map(k=>S.indexOf(k));return A.shift(),[c,...A]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function mE({fs:t,dir:e,gitdir:r=F.join(e,".git"),ref:n,object:i,force:a=!1}){try{P("fs",t),P("gitdir",r),P("ref",n);let s=new Q(t);if(n===void 0)throw new dr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await V.resolve({fs:s,gitdir:r,ref:i||"HEAD"});if(!a&&await V.exists({fs:s,gitdir:r,ref:n}))throw new pn("tag",n);await V.writeRef({fs:s,gitdir:r,ref:n,value:o})}catch(s){throw s.caller="git.tag",s}}async function gE({fs:t,dir:e,gitdir:r=F.join(e,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{P("fs",t),P("gitdir",r),P("filepath",i);let u=new Q(t);if(l)return await ct.acquire({fs:u,gitdir:r,cache:n},async function(d){if(!c){let h=await u.lstat(F.join(e,i));if(h){if(h.isDirectory())throw new ta("directory");return}}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(F.join(e,i)),!f)throw new je(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new ta("directory")}return await ct.acquire({fs:u,gitdir:r,cache:n},async function(d){if(!o&&!d.has({filepath:i}))throw new je(`file at "${i}" in index and "add" not set`);let h;if(a)h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,m
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EB(t,e){if(t){if(typeof t=="string")return ST(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 ST(t,e)}}function ST(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function AB(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,a=void 0;try{for(var s=t[Symbol.iterator](),o;!(n=(o=s.next()).done)&&(r.push(o.value),!(e&&r.length===e));n=!0);}catch(l){i=!0,a=l}finally{try{!n&&s.return!=null&&s.return()}finally{if(i)throw a}}return r}}function kB(t){if(Array.isArray(t))return t}var AT=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,kT=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,TT=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,CT=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,PT=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,RT=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,MT=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function bc(t,e){return t.indexOf(e)>-1}function TB(t,e,r){var n=t/255,i=e/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case n:return(i-a)/l%6;case i:return(a-n)/l+2;default:return(n-i)/l+4}}();return[f*60,u*100,c*100]}function CB(t,e,r){var n=t/60,i=e/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),l=a-s/2,c=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=nr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var PB=function(){function t(e){var r=nr(e,4),n=r[0],i=r[1],a=r[2],s=r[3];_B(this,t),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 xB(t,[{key:"toRgbString",value:function(){var r=nr(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=nr(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=nr(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=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=TB(n,i,a),l=nr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function Po(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3];return new PB([r,n,i,a])}function u0(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return Po([r,n,i,1])}function md(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3],s=CB(r,n,i),o=nr(s,3),l=o[0],c=o[1],u=o[2];return Po([l,c,u,a])}function OT(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return md([r,n,i,1])}function RB(t){var e=AT.exec(t)||kT.exec(t),r=nr(e,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,Po([n,i,a,s])}function MB(t){var e=TT.exec(t)||PT.exec(t)||CT.exec(t)||RT.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=bc(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=bc(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=bc(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(bc(s,"%")?100:1),Po([n,i,a,s])}function OB(t){var e=MT.exec(t),r=nr(e,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,bB.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(bc(o,"%")?100:1),md([n,a,s,o])}function IT(t){return _T.default[t]?u0(_T.default[t]):AT.test(t)||kT.test(t)?RB(t):TT.test(t)||PT.test(t)||CT.test(t)||RT.test(t)?MB(t):MT.test(t)?OB(t):null}var IB={fromString:IT,fromRgb:u0,fromRgba:Po,fromHsl:OT,fromHsla:md};xi.default=IB});var f0=M((BX,DT)=>{"use strict";m();var $T=Object.prototype.toString;DT.exports=function(e){var r=$T.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&$T.call(e.callee)==="[object Function]"),n}});var VT=M((UX,zT)=>{"
Line truncated
|
||||
`)>=0)return!1;return!0}function Z7(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Wn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Wn.call(Array(e+1),r)}}function R0(t,e){if(t.length===0)return"";var r=`
|
||||
`+e.prev+e.base;return r+Wn.call(t,","+r)+`
|
||||
`+e.prev}function _d(t,e){var r=P0(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=Si(t,i)?e(t[i],t):""}var a=typeof E0=="function"?E0(t):[],s;if(Ro){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var l in t)Si(t,l)&&(r&&String(Number(l))===l&&l<t.length||Ro&&s["$"+l]instanceof Symbol||(UC.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if(typeof E0=="function")for(var c=0;c<a.length;c++)GC.call(t,a[c])&&n.push("["+e(a[c])+"]: "+e(t[a[c]],t));return n}});var ZC=M((SK,KC)=>{"use strict";m();var J7=Pc(),Q7=ur(),Ed=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},e9=function(t,e){if(t){var r=Ed(t,e);return r&&r.value}},t9=function(t,e,r){var n=Ed(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},r9=function(t,e){return t?!!Ed(t,e):!1},n9=function(t,e){if(t)return Ed(t,e,!0)};KC.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Q7("Side channel does not contain "+J7(n))},delete:function(n){var i=e&&e.next,a=n9(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return e9(e,n)},has:function(n){return r9(e,n)},set:function(n,i){e||(e={next:void 0}),t9(e,n,i)}};return r}});var F0=M((AK,QC)=>{"use strict";m();var i9=Fn(),Rc=xt(),a9=Pc(),s9=ur(),JC=i9("%Map%",!0),o9=Rc("Map.prototype.get",!0),l9=Rc("Map.prototype.set",!0),c9=Rc("Map.prototype.has",!0),u9=Rc("Map.prototype.delete",!0),f9=Rc("Map.prototype.size",!0);QC.exports=!!JC&&function(){var e,r={assert:function(n){if(!r.has(n))throw new s9("Side channel does not contain "+a9(n))},delete:function(n){if(e){var i=u9(e,n);return f9(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return o9(e,n)},has:function(n){return e?c9(e,n):!1},set:function(n,i){e||(e=new JC),l9(e,n,i)}};return r}});var tP=M((TK,eP)=>{"use strict";m();var d9=Fn(),kd=xt(),h9=Pc(),Ad=F0(),p9=ur(),Mo=d9("%WeakMap%",!0),m9=kd("WeakMap.prototype.get",!0),g9=kd("WeakMap.prototype.set",!0),v9=kd("WeakMap.prototype.has",!0),y9=kd("WeakMap.prototype.delete",!0);eP.exports=Mo?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new p9("Side channel does not contain "+h9(i))},delete:function(i){if(Mo&&i&&(typeof i=="object"||typeof i=="function")){if(e)return y9(e,i)}else if(Ad&&r)return r.delete(i);return!1},get:function(i){return Mo&&i&&(typeof i=="object"||typeof i=="function")&&e?m9(e,i):r&&r.get(i)},has:function(i){return Mo&&i&&(typeof i=="object"||typeof i=="function")&&e?v9(e,i):!!r&&r.has(i)},set:function(i,a){Mo&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Mo),g9(e,i,a)):Ad&&(r||(r=Ad()),r.set(i,a))}};return n}:Ad});var $0=M((PK,rP)=>{"use strict";m();var w9=ur(),b9=Pc(),_9=ZC(),x9=F0(),S9=tP(),E9=S9||x9||_9;rP.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new w9("Side channel does not contain "+b9(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=E9()),e.set(n,i)}};return r}});var iP=M((MK,nP)=>{"use strict";m();var A9=Yu(),Mc=$0()(),Ei=ur(),D0={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ei("`O` is not an object");if(typeof e!="string")throw new Ei("`slot` must be a string");if(Mc.assert(t),!D0.has(t,e))throw new Ei("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ei("`O` is not an object");if(typeof e!="string")throw new Ei("`slot` must be a string");var r=Mc.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ei("`O` is not an object");if(typeof e!="string")throw new Ei("`slot` must be a string");var r=Mc.get(t);return!!r&&A9(r,"$"+e)},set:function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Ei("`O` is not an object");if(typeof e!="string")throw new Ei("`slot` must be a string");var n=Mc.get(t);n||(n={},Mc.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(D0);nP.exports=D0});var oP=M((IK,sP)=>{"use strict";m();var Oc=iP(),k9=Bu(),aP=typeof StopIteration=="object"?StopIteration:null;sP.exports=function(e){if(!aP)throw new k9("this environment lacks StopIteration");Oc.set(e,"[[Done]]",!1);var r={next:function(){var i=Oc.get(this,"[[Iterator]]"),a=!!Oc.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Oc.set(i,"[[Done]]",!0),s!==aP)throw s;return{done:!0,value:void 0}}}};return Oc.set(r,"[[Iterator]]",e),r}});var L0=M(($K,cP)=>{"use strict";m();var lP=xt(),T9=lP("String.prototype.valueOf"),C9=function(e){try{return T9(e),!0}catch(r){return!1}},P9=lP("Object.prototype.toString"),R9="[object String]",M9=zi()();cP.exports=function(e){return typeof e=="string"?!0:!e||typeof e!="object"?!1:M9?C9(e):P9(e)===R9}});var N0=M((LK,dP)=>{"use strict";m();var j0=typeof Map=="function"&&Map.prototype?Map:null,O9=typeof Set=="function"&&Set.prototype?Set:null,Td;j0||(Td=function(e){return!1});var fP=j0?Map.prototype.has:null,uP=O9?Set.prototyp
Line truncated
|
||||
`});Te=!1,N=ce.length}function X(Oe,De){var Pt="="+B,Le=Oe.indexOf(Pt,De),U=c(Oe.substring(Oe.indexOf("=",De)+1,Le)).split(" ");return W=U[0],B=U[U.length-1],Le+Pt.length-1}for(_&&(_=_.split(" "),W=_[0],B=_[1]),ne=0;ne<T;ne++)$==C?u(W,x,ne)?(--ne,$e(),$=I):x.charAt(ne)==`
|
||||
`?Ut(Te):le+=x.charAt(ne):$==I?(ne+=W.length-1,de=t.tags[x.charAt(ne+1)],J=de?x.charAt(ne+1):"_v",J=="="?(ne=X(x,ne),$=C):(de&&ne++,$=L),Te=ne):u(B,x,ne)?(ce.push({tag:J,n:c(le),otag:W,ctag:B,i:J=="/"?Te-W.length:ne+B.length}),le="",ne+=B.length-1,$=C,J=="{"&&(B=="}}"?ne++:l(ce[ce.length-1]))):le+=x.charAt(ne);return Ut(Te,!0),ce};function l(w){w.n.substr(w.n.length-1)==="}"&&(w.n=w.n.substring(0,w.n.length-1))}function c(w){return w.trim?w.trim():w.replace(/^\s*|\s*$/g,"")}function u(w,x,_){if(x.charAt(_)!=w.charAt(0))return!1;for(var T=1,C=w.length;T<C;T++)if(x.charAt(_+T)!=w.charAt(T))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(w,x,_,T){var C=[],I=null,L=null,$=null;for(L=_[_.length-1];w.length>0;){if($=w.shift(),L&&L.tag=="<"&&!($.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[$.tag]<=t.tags.$||h($,T))_.push($),$.nodes=d(w,$.tag,_,T);else if($.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+$.n);if(I=_.pop(),$.n!=I.n&&!p($.n,I.n,T))throw new Error("Nesting error: "+I.n+" vs. "+$.n);return I.end=$.i,C}else $.tag==`
|
||||
`&&($.last=w.length==0||w[0].tag==`
|
||||
`);C.push($)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return C}function h(w,x){for(var _=0,T=x.length;_<T;_++)if(x[_].o==w.n)return w.tag="#",!0}function p(w,x,_){for(var T=0,C=_.length;T<C;T++)if(_[T].c==w&&_[T].o==x)return!0}function g(w){var x=[];for(var _ in w)x.push('"'+b(_)+'": function(c,p,t,i) {'+w[_]+"}");return"{ "+x.join(",")+" }"}function v(w){var x=[];for(var _ in w.partials)x.push('"'+b(_)+'":{name:"'+b(w.partials[_].name)+'", '+v(w.partials[_])+"}");return"partials: {"+x.join(",")+"}, subs: "+g(w.subs)}t.stringify=function(w,x,_){return"{code: function (c,p,i) { "+t.wrapMain(w.code)+" },"+v(w)+"}"};var y=0;t.generate=function(w,x,_){y=0;var T={code:"",subs:{},partials:{}};return t.walk(w,T),_.asString?this.stringify(T,x,_):this.makeTemplate(T,x,_)},t.wrapMain=function(w){return'var t=this;t.b(i=i||"");'+w+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(w,x,_){var T=this.makePartials(w);return T.code=new Function("c","p","i",this.wrapMain(w.code)),new this.template(T,x,this,_)},t.makePartials=function(w){var x,_={subs:{},partials:w.partials,name:w.name};for(x in _.partials)_.partials[x]=this.makePartials(_.partials[x]);for(x in w.subs)_.subs[x]=new Function("c","p","t","i",w.subs[x]);return _};function b(w){return w.replace(a,"\\\\").replace(r,'\\"').replace(n,"\\n").replace(i,"\\r").replace(s,"\\u2028").replace(o,"\\u2029")}function E(w){return~w.indexOf(".")?"d":"f"}function S(w,x){var _="<"+(x.prefix||""),T=_+w.n+y++;return x.partials[T]={name:w.n,partials:{}},x.code+='t.b(t.rp("'+b(T)+'",c,p,"'+(w.indent||"")+'"));',T}t.codegen={"#":function(w,x){x.code+="if(t.s(t."+E(w.n)+'("'+b(w.n)+'",c,p,1),c,p,0,'+w.i+","+w.end+',"'+w.otag+" "+w.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(w.nodes,x),x.code+="});c.pop();}"},"^":function(w,x){x.code+="if(!t.s(t."+E(w.n)+'("'+b(w.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(w.nodes,x),x.code+="};"},">":S,"<":function(w,x){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,_);var T=x.partials[S(w,x)];T.subs=_.subs,T.partials=_.partials},$:function(w,x){var _={subs:{},code:"",partials:x.partials,prefix:w.n};t.walk(w.nodes,_),x.subs[w.n]=_.code,x.inPartial||(x.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,x){x.code+=k('"\\n"'+(w.last?"":" + i"))},_v:function(w,x){x.code+="t.b(t.v(t."+E(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,x){x.code+=k('"'+b(w.text)+'"')},"{":A,"&":A};function A(w,x){x.code+="t.b(t.t(t."+E(w.n)+'("'+b(w.n)+'",c,p,0)));'}function k(w){return"t.b("+w+");"}t.walk=function(w,x){for(var _,T=0,C=w.length;T<C;T++)_=t.codegen[w[T].tag],_&&_(w[T],x);return x},t.parse=function(w,x,_){return _=_||{},d(w,"",[],_.sectionTags||[])},t.cache={},t.cacheKey=function(w,x){return[w,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},t.compile=function(w,x){x=x||{};var _=t.cacheKey(w,x),T=this.cache[_];if(T){var C=T.partials;for(var I in C)delete C[I].instance;return T}return T=this.generate(this.parse(this.scan(w,x.delimiters),w,x),w,x),this.cache[_]=T}})(typeof Wv!="undefined"?Wv:Hogan)});var _M=M(Yv=>{m();var BU={};(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,y,b){var E;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,g,v,y,b)),E=!!d,!g&&E&&h&&h.push(typeof d=="object"?d:h[h.length-1]),E)},d:function(d,h,p,g){var v,y=d.split("."),b=this.f(y[0],h,p,g),E=this.options.modelGet,S=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var A=1;A<y.length;A++)v=e(y[A],b,E),v!==void 0?(S=b,b=v):b="";return g&&!b?!1:(!g&&typeof b=="function"&&(h.push(S),b=this.mv(b,h,p),h.pop()),b)},f:function(d,h,p,g){for(var v=!1,y=null,b=!1,E=this.options.modelGet,S=h.length-1;S>=0;S--)if(y=h[S],v=e(d,y,E),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v){var y=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(c(d.call(h,g)),h,p)),this.options.delimiters=y,!1},ct:function(d,
Line truncated
|
||||
`){return t.split(r).reduce((n,i)=>{let a=e?i.trim():i;return a&&n.push(a),n},[])}function Bg(t,e){return gc(t,!0).map(r=>e(r))}function Hg(t){return(0,rd.exists)(t,rd.FOLDER)}function Me(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function mA(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function nd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function Vn(t){return Array.isArray(t)?t:[t]}function gA(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function vA(t){return Vn(t).map(String)}function He(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function dc(t,e){let r=[];for(let n=0,i=t.length;n<i;n++)r.push(e,t[n]);return r}function hc(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function yA(t,e){return Object.assign({},...e.map(r=>r in t?{[r]:t[r]}:{}))}function Ag(t=0){return new Promise(e=>setTimeout(e,t))}function kg(t){if(t!==!1)return t}var Ao,Qa,vc,id=q({"src/lib/utils/util.ts"(){"use strict";Ao="\0",Qa=()=>{},vc=Object.prototype.toString.call.bind(Object.prototype.toString)}});function qn(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Tg(t,e){let r=Kf(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function ad(t){return!!t&&vc(t)==="[object Object]"}function wA(t){return typeof t=="function"}var yc,Vt,bA,Zf,Ug,_A=q({"src/lib/utils/argument-filters.ts"(){"use strict";id(),pc(),yc=t=>Array.isArray(t),Vt=t=>typeof t=="string",bA=t=>Array.isArray(t)&&t.every(Vt),Zf=t=>Vt(t)||Array.isArray(t)&&t.every(Vt),Ug=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),Cg,gL=q({"src/lib/utils/exit-codes.ts"(){"use strict";Cg=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Cg||{})}}),Jf,vL=q({"src/lib/utils/git-output-streams.ts"(){"use strict";Jf=class xA{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new xA(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),me,oa,yL=q({"src/lib/utils/line-parser.ts"(){"use strict";me=class{constructor(t,e){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(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},oa=class extends me{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 SA(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...EA},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var EA,wL=q({"src/lib/utils/simple-git-options.ts"(){"use strict";EA={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Gg(t,e=[]){return ad(t)?Object.keys(t).reduce((r,n)=>{let i=t[n];if(Kf(i))r.push(i);else if(Tg(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let a of i)Tg(a,["string","number"])||r.push(n+"="+a);else r.push(n);return r},e):e}function vr(t,e=0,r=!1){let n=[];for(let i=0,a=e<0?t.length:e;i<a;i++)"string|number".includes(typeof t[i])&&n.push(String(t[i]));return Gg(zg(t),n),r||n.push(...bL(t)),n}function bL(t){let e=typeof Ja(t)=="function";return qn(Ja(t,e?1:0),yc,[])}function zg(t){let e=wA(Ja(t));return qn(Ja(t,e?1:0),ad)}function at(t,e=!0){let r=uA(Ja(t));return e||fA(r)?r:void 0}var _L=q({"src/lib/utils/task-options.ts"(){"use strict";_A(),id(),pc()}});function Pg(t,e){return t(e.stdOut,e.stdErr)}function br(t,e,r,n=!0){return Vn(r).forEach(i=>{for(let a=gc(i,n),s=0,o=a.length;s<o;s++){let l=(c=0)=>{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var xL=q({"src/lib/utils/task-parser.ts"(){"use strict";id()}}),AA={};ft(AA,{ExitCodes:()=>Cg,GitOutputStreams:()=>Jf,LineParser:()=>me,NOOP:()=>Qa,NULL:()=>Ao,RemoteLineParser:()=>oa,append:()=>Me,appendTaskOptions:()=>Gg,asArray:()=>Vn,asCamelCase:()=>gA,asFunction:()=>uA,asNumber:()=>He,asStringArray:()=>vA,bufferToString:()=>hc,callTaskParser:()=>Pg,createInstanceConfig:()=>SA,delay:()=>Ag,filterArray:()=>yc,filterFunction:()=>wA,filterHasLength:()=>Ug,filterPlainObject:()=>ad,filterPrimitives:()=>Tg,filterString:()=>Vt,filterStringArray:()=>bA,filterStringOrStringArray:()=>Zf,filterType:()=>qn,first:()=>hA,folderExists:()=>Hg,forEachLineWithContent:()=>Bg,getTrailingOptions:()=>vr,including:()=>mA,isUserFunction:()=>fA,last:()=>Ja,objectToString:()=>vc,orVoid:()=>kg,parseStringResponse:()=>br,pick:()=>yA,prefixedArray:()=>dc,remove:()=>nd,splitOn:()=>dA,toLinesWithContent:()=>gc,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>
Line truncated
|
||||
`)){let l=dA(s,`
|
||||
`);o=l[0],s=l[1]}yield{file:a,key:o,value:s}}}var UA,DL=q({"src/lib/responses/ConfigList.ts"(){"use strict";he(),UA=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=Ja(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);n.hasOwnProperty(e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function wg(t,e){return typeof t=="string"&&Og.hasOwnProperty(t)?t:e}function LL(t,e,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function jL(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return FL(n,t)}}}function NL(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return IL(r)}}}function BL(){return{addConfig(t,e,...r){return this._runTask(LL(t,e,r[0]===!0,wg(r[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(jL(t,wg(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(NL(wg(t[0],void 0)),at(arguments))}}}var Og,GA=q({"src/lib/tasks/config.ts"(){"use strict";DL(),he(),Og=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Og||{})}});function HL(t){return zA.has(t)}var bg,zA,VA=q({"src/lib/tasks/diff-name-status.ts"(){"use strict";bg=(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))(bg||{}),zA=new Set(Object.values(bg))}});function UL(...t){return new WA().param(...t)}function GL(t){let e=new Set,r={};return Bg(t,n=>{let[i,a,s]=n.split(Ao);e.add(i),(r[i]=r[i]||[]).push({line:He(a),path:i,preview:s})}),{paths:e,results:r}}function zL(){return{grep(t){let e=at(arguments),r=vr(arguments);for(let i of qA)if(r.includes(i))return this._runTask(yr(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=UL().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(i){return GL(i)}},e)}}}var qA,fc,OE,WA,YA=q({"src/lib/tasks/grep.ts"(){"use strict";he(),ut(),qA=["-h"],fc=Symbol("grepQuery"),WA=class{constructor(){this[OE]=[]}*[(OE=fc,Symbol.iterator)](){for(let t of this[fc])yield t}and(...t){return t.length&&this[fc].push("--and","(",...dc(t,"-e"),")"),this}param(...t){return this[fc].push(...dc(t,"-e")),this}}}}),XA={};ft(XA,{ResetMode:()=>Wf,getResetMode:()=>qL,resetTask:()=>VL});function VL(t,e){let r=["reset"];return KA(t)&&r.push(`--${t}`),r.push(...e),rr(r)}function qL(t){if(KA(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function KA(t){return ZA.includes(t)}var Wf,ZA,JA=q({"src/lib/tasks/reset.ts"(){"use strict";ut(),Wf=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Wf||{}),ZA=Array.from(Object.values(Wf))}});function WL(){return(0,Qf.default)("simple-git")}function IE(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...i)=>{t(n,...i),r(n,...i)}:t:(n,...i)=>{t(`%s ${n}`,e,...i),r&&r(n,...i)}}function YL(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function Kg(t,e,r,n=WL()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?n.extend(e):e,o=YL(qn(e,Vt),s,n);return c(r);function l(u,f){return Me(a,Kg(t,o.replace(/^[^:]+/,u),f,n))}function c(u){let f=u&&`[${u}]`||"",d=s&&IE(s,f)||Qa,h=IE(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:c})}}var QA=q({"src/lib/git-logger.ts"(){"use strict";he(),Qf.default.formatters.L=t=>String(Ug(t)?t.length:"-"),Qf.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):vc(t)}}),ek,XL=q({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;la(),QA(),ek=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let n=t.getName(r.commands[0]),i=Kg(this.logLabel,n);return{task:r,logger:i,name:n}}push(r){let n=this.createProgress(r);return n.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,n),n}fatal(r){for(let[n,{logger:i}]of Array.from(this._queue.entries()))n===r.task?(i.info("Failed %o",r),i("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):i.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(n);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 n=this.withProgress(r);if(!n)throw new wr(void 0,"TasksPendingQueue: attempt called for an unknown task");return n.logger("Starting
Line truncated
|
||||
`).map(zN).filter(Boolean);e||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return GN(Vf(s[0]),Vf(o[0]));for(let l=0,c=Math.max(s.length,o.length);l<c;l++){let u=oT(Vf(s[l]),Vf(o[l]));if(u)return u}return 0});let n=e?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new nA(r,n)}}}),cT={};ft(cT,{addAnnotatedTagTask:()=>YN,addTagTask:()=>WN,tagListTask:()=>qN});function qN(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return lT(r,e)}}}function WN(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function YN(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var XN=q({"src/lib/tasks/tag.ts"(){"use strict";VN()}}),KN=hL({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(JL(),it(rk)),{SimpleGitApi:n}=(Kj(),it(Dk)),{Scheduler:i}=(Zj(),it(Lk)),{configurationErrorTask:a}=(ut(),it(Mg)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:p}=(he(),it(AA)),{applyPatchTask:g}=(Qj(),it(Bk)),{branchTask:v,branchLocalTask:y,deleteBranchesTask:b,deleteBranchTask:E}=(uN(),it(qk)),{checkIgnoreTask:S}=(hN(),it(Xk)),{checkIsRepoTask:A}=(PA(),it(kA)),{cloneTask:k,cloneMirrorTask:w}=(gN(),it(Kk)),{cleanWithOptionsTask:x,isCleanOptionsArray:_}=(BA(),it(jA)),{diffSummaryTask:T}=(n0(),it(mk)),{fetchTask:C}=(_N(),it(Qk)),{moveTask:I}=(AN(),it(tT)),{pullTask:L}=(TN(),it(rT)),{pushTagsTask:$}=(Rk(),it(Pk)),{addRemoteTask:J,getRemotesTask:de,listRemotesTask:le,remoteTask:ce,removeRemoteTask:Te}=(DN(),it(iT)),{getResetMode:ne,resetTask:N}=(JA(),it(XA)),{stashListTask:W}=(jN(),it(aT)),{addSubModuleTask:B,initSubModuleTask:$e,subModuleTask:lr,updateSubModuleTask:Ut}=(UN(),it(sT)),{addAnnotatedTagTask:X,addTagTask:Oe,tagListTask:De}=(XN(),it(cT)),{straightThroughBufferTask:Pt,straightThroughStringTask:Le}=(ut(),it(Mg));function U(j,Z){this._plugins=Z,this._executor=new r(j.baseDir,new i(j.maxConcurrentProcesses),Z),this._trimmed=j.trimmed}(U.prototype=Object.create(n.prototype)).constructor=U,U.prototype.customBinary=function(j){return this._plugins.reconfigure("binary",j),this},U.prototype.env=function(j,Z){return arguments.length===1&&typeof j=="object"?this._executor.env=j:(this._executor.env=this._executor.env||{})[j]=Z,this},U.prototype.stashList=function(j){return this._runTask(W(p(arguments)||{},o(j)&&j||[]),h(arguments))};function Je(j,Z,Se,We){return typeof Se!="string"?a(`git.${j}() requires a string 'repoPath'`):Z(Se,f(We,c),d(arguments))}U.prototype.clone=function(){return this._runTask(Je("clone",k,...arguments),h(arguments))},U.prototype.mirror=function(){return this._runTask(Je("mirror",w,...arguments),h(arguments))},U.prototype.mv=function(j,Z){return this._runTask(I(j,Z),h(arguments))},U.prototype.checkoutLatestTag=function(j){var Z=this;return this.pull(function(){Z.tags(function(Se,We){Z.checkout(We.latest,j)})})},U.prototype.pull=function(j,Z,Se,We){return this._runTask(L(f(j,c),f(Z,c),d(arguments)),h(arguments))},U.prototype.fetch=function(j,Z){return this._runTask(C(f(j,c),f(Z,c),d(arguments)),h(arguments))},U.prototype.silent=function(j){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},U.prototype.tags=function(j,Z){return this._runTask(De(d(arguments)),h(arguments))},U.prototype.rebase=function(){return this._runTask(Le(["rebase",...d(arguments)]),h(arguments))},U.prototype.reset=function(j){return this._runTask(N(ne(j),d(arguments)),h(arguments))},U.prototype.revert=function(j){let Z=h(arguments);return typeof j!="string"?this._runTask(a("Commit must be a string"),Z):this._runTask(Le(["revert",...d(arguments,0,!0),j]),Z)},U.prototype.addTag=function(j){let Z=typeof j=="string"?Oe(j):a("Git.addTag requires a tag name");return this._runTask(Z,h(arguments))},U.prototype.addAnnotatedTag=function(j,Z){return this._runTask(X(j,Z),h(arguments))},U.prototype.deleteLocalBranch=function(j,Z,Se){return this._runTask(E(j,typeof Z=="boolean"?Z:!1),h(arguments))},U.prototype.deleteLocalBranches=function(j,Z,Se){return this._runTask(b(j,typeof Z=="boolean"?Z:!1),h(arguments))},U.prototype.branch=function(j,Z){return this._runTask(v(d(arguments)),h(arguments))},U.prototype.branchLocal=function(j){return this._runTask(y(),h(arguments))},U.prototype.raw=function(j){let Z=!Array.isArray(j),Se=[].slice.call(Z?arguments:j,0);for(let Rt=0;Rt<Se.length&&Z;Rt++)if(!l(Se[Rt])){Se.splice(Rt,Se.length-Rt);break}Se.push(...d(arguments,0,!0));var We=h(arguments);return Se.length?this._runTask(Le(Se,this._trimmed),We):this._runTask(a("Raw: must supply one or more command to execute"),We)},U.prototype.submoduleAdd=function(j,Z,Se){return this._runTask(B(j,Z),h(arguments))},U.prototype.submoduleUpdate=function(j,Z){return this._runTask
Line truncated
|
||||
`).filter(a=>a).reverse().map((a,s)=>r?`stash@{${s}}: ${a.split(" ")[1]}`:a)}},$8={stage:ts,workdir:Co},bg;async function To(t,e){return bg===void 0&&(bg=new tc),bg.acquire(t,e)}async function F8(t,e,r,n,i=null){let a=O.join(r,n),s=await t.lstat(a);if(!s)throw new Le(a);if(s.isDirectory())throw new de(`${a}: file expected, but found directory`);let o=i?await mE({fs:t,gitdir:e,oid:i}):void 0,l=o?i:void 0;return o||await To({fs:t,gitdir:e,currentFilepath:a},async()=>{let u=s.isSymbolicLink()?await t.readlink(a).then(xE):await t.read(a);if(u===null)throw new Le(a);l=await gr({fs:t,gitdir:e,type:"blob",object:u})}),l}async function O8({fs:t,dir:e,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){let s=await Promise.all(a.children.map(i));a.oid=await bc({fs:t,gitdir:r,tree:s}),a.mode=16384}}else a.type==="blob"&&(a.oid=await F8(t,r,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function lE({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",a=n.map(h=>typeof h=="string"?$8[h]():h),s=[],c=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:a,map:async(h,[m,g])=>{if(!(h==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!m||await m.oid()!==await g.oid()&&await g.oid()!==void 0)&&s.push([m,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,m)=>(m=m.filter(Boolean),h?(h.children=m,h):m.length>0?m:void 0),iterate:async(h,m)=>{let g=[];for(let v of m){let[w,b]=v;i?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(v):s.push([null,b])):w&&(b?g.push(v):s.push([w,null]))}return g.length?Promise.all(g.map(h)):[]}});if(s.length===0||c.length===0)return null;let d=(await O8({fs:t,dir:e,gitdir:r,entries:c})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return bc({fs:t,gitdir:r,tree:d})}async function M8({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){let s=[],o=[],l=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:[$r({ref:i}),$r({ref:n})],map:async(u,[c,f])=>{if(u==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:u}))return;let d=f?await f.type():await c.type();if(d!=="tree"&&d!=="blob")return;if(!f&&c){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&s.push(u),d==="blob"&&a&&o.push({filepath:u,oid:await c.oid()}),{method:m,filepath:u}}let h=await f.oid();if(!c||await c.oid()!==h)return d==="tree"?{method:"mkdir",filepath:u}:(a&&o.push({filepath:u,oid:h,stats:await t.lstat(O.join(e,u))}),{method:"write",filepath:u,oid:h})}});await To({fs:t,gitdir:r,dirRemoved:s,ops:l},async()=>{for(let u of l){let c=O.join(e,u.filepath);switch(u.method){case"rmdir":await t.rmdir(c);break;case"mkdir":await t.mkdir(c);break;case"rm":await t.rm(c);break;case"write":if(!s.some(f=>c.startsWith(f))){let{object:f}=await qe({fs:t,cache:{},gitdir:r,oid:u.oid});await t.exists(c)&&await t.rm(c),await t.write(c,f)}break}}}),await ct.acquire({fs:t,gitdir:r,cache:{}},async u=>{o.forEach(({filepath:c,stats:f,oid:d})=>{u.insert({filepath:c,stats:f,oid:d})})})}var es=class t{constructor({fs:e,dir:r,gitdir:n=O.join(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O.join(this.gitdir,t.refStash)}get refLogsStashPath(){return O.join(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await da({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:n}){return Hk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:n,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 wn(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?Eo({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return z.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=Zf.createStashReflogEntry(n,e,r),a=this.refLogsStashPath;await To({filepath:a,entry:i},async()=>{let s=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,s+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let n=(await this.fs.read(this.refLogsStashPath)).toString();return Zf.getStashReflogEntry(n,e)}};async function D8({fs:t,dir:e,gitdir:r,message:n=""}){let i=new es({fs:t,dir:e,gitdir:r});await i.getAuthor();let a=await pa({fs:t,gitdir:r,fullname:!1}),s=await z.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Bg({fs:t,dir:e,gitdir:r,oid:s})).commit.message,u=[s],c=null,f=$r({ref:"H
Line truncated
|
||||
`),"utf8");let u=o[o.length-1].split(" ")[1];await i.writeStashRef(u)}else await t.rm(l)})}async function L8({fs:t,dir:e,gitdir:r}){return new es({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function N8({fs:t,dir:e,gitdir:r}){let n=new es({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await To(i,async()=>{await Promise.all(i.map(async a=>{if(await t.exists(a))return t.rm(a)}))})}async function B8({fs:t,dir:e,gitdir:r,refIdx:n=0}){await Uk({fs:t,dir:e,gitdir:r,refIdx:n}),await jk({fs:t,dir:e,gitdir:r,refIdx:n})}async function Gk({fs:t,dir:e,gitdir:r=O.join(e,".git"),op:n="push",message:i="",refIdx:a=0}){C("fs",t),C("dir",e),C("gitdir",r),C("op",n);let s={push:D8,apply:Uk,drop:jk,list:L8,clear:N8,pop:B8},o=["apply","drop","pop"];try{let l=new J(t);["refs","logs","logs/refs"].map(f=>O.join(r,f)).forEach(async f=>{await l.exists(f)||await l.mkdir(f)});let c=s[n];if(c){if(o.includes(n)&&a<0)throw new wn(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await c({fs:l,dir:e,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function qk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let a=new J(t);if(await fa.isIgnored({fs:a,gitdir:r,dir:e,filepath:n}))return"ignored";let o=await H8({fs:a,cache:i,gitdir:r}),l=await zk({fs:a,cache:i,gitdir:r,tree:o,path:n}),u=await ct.acquire({fs:a,gitdir:r,cache:i},async function(g){for(let v of g)if(v.path===n)return v;return null}),c=await a.lstat(O.join(e,n)),f=l!==null,d=u!==null,h=c!==null,m=async()=>{if(d&&!Uf(u,c))return u.oid;{let g=await a.read(O.join(e,n)),v=await Dk({gitdir:r,type:"blob",object:g});return d&&u.oid===v&&c.size!==-1&&ct.acquire({fs:a,gitdir:r,cache:i},async function(w){w.insert({filepath:n,stats:c,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 m()===u.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===u.oid,"*deleted";if(f&&h&&!d)return await m()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let g=await m();return g===l?g===u.oid?"unmodified":"*unmodified":g===u.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function zk({fs:t,cache:e,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:l}=await qe({fs:t,cache:e,gitdir:r,oid:s.oid});if(o==="tree"){let u=pr.from(l);return zk({fs:t,cache:e,gitdir:r,tree:u,path:i})}if(o==="blob")throw new rr(s.oid,o,"blob",i.join("/"))}return null}async function H8({fs:t,cache:e,gitdir:r}){let n;try{n=await z.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Le)return[]}let{tree:i}=await Po({fs:t,cache:e,gitdir:r,oid:n});return i}async function Vk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let l=new J(t);return await ua({fs:l,cache:s,dir:e,gitdir:r,trees:[$r({ref:n}),Co(),ts()],map:async function(u,[c,f,d]){if(!c&&!d&&f&&!o&&await fa.isIgnored({fs:l,dir:e,filepath:u})||!i.some(A=>FE(u,A)))return null;if(a&&!a(u))return;let[h,m,g]=await Promise.all([c&&c.type(),f&&f.type(),d&&d.type()]),v=[h,m,g].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((m==="tree"||m==="special")&&!v)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!v)return;let w=h==="blob"?await c.oid():void 0,b=g==="blob"?await d.oid():void 0,E;h!=="blob"&&m==="blob"&&g!=="blob"?E="42":m==="blob"&&(E=await f.oid());let x=[void 0,w,E,b],k=x.map(A=>x.indexOf(A));return k.shift(),[u,...k]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Wk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,force:a=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let s=new J(t);if(n===void 0)throw new hr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"});if(!a&&await z.exists({fs:s,gitdir:r,ref:n}))throw new vn("tag",n);await z.writeRef({fs:s,gitdir:r,ref:n,value:o})}catch(s){throw s.caller="git.tag",s}}async function Yk({fs:t,dir:e,gitdir:r=O.join(e,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:l,force:u}){try{C("fs",t),C("gitdir",r),C("filepath",i);let c=new J(t);if(l)return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!u){let h=await c.lstat(O.join(e,i));if(h){if(h.isDirectory())throw new ca("directory");return}}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await c.lstat(O.join(e,i)),!f)throw new Le(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new ca("directory")}return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!o&&!d.has({filepath:i}))throw new Le(`file at "${i}" in index and "add" not set`);let h;if(a)h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,m
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K8(t,e){if(t){if(typeof t=="string")return mA(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 mA(t,e)}}function mA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function J8(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,a=void 0;try{for(var s=t[Symbol.iterator](),o;!(n=(o=s.next()).done)&&(r.push(o.value),!(e&&r.length===e));n=!0);}catch(l){i=!0,a=l}finally{try{!n&&s.return!=null&&s.return()}finally{if(i)throw a}}return r}}function Q8(t){if(Array.isArray(t))return t}var vA=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,wA=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,yA=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,bA=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,_A=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,xA=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,SA=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Ec(t,e){return t.indexOf(e)>-1}function e6(t,e,r){var n=t/255,i=e/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),l=s-o,u=(s+o)/2;if(l===0)return[0,0,u*100];var c=l/(1-Math.abs(2*u-1)),f=function(){switch(s){case n:return(i-a)/l%6;case i:return(a-n)/l+2;default:return(n-i)/l+4}}();return[f*60,c*100,u*100]}function t6(t,e,r){var n=t/60,i=e/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),l=a-s/2,u=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]}(),c=nr(u,3),f=c[0],d=c[1],h=c[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var r6=function(){function t(e){var r=nr(e,4),n=r[0],i=r[1],a=r[2],s=r[3];Y8(this,t),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 X8(t,[{key:"toRgbString",value:function(){var r=nr(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=nr(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=nr(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=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=e6(n,i,a),l=nr(o,3),u=l[0],c=l[1],f=l[2];return[u,c,f,s]}}]),t}();function $o(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3];return new r6([r,n,i,a])}function Wg(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return $o([r,n,i,1])}function ld(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3],s=t6(r,n,i),o=nr(s,3),l=o[0],u=o[1],c=o[2];return $o([l,u,c,a])}function EA(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return ld([r,n,i,1])}function n6(t){var e=vA.exec(t)||wA.exec(t),r=nr(e,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,$o([n,i,a,s])}function i6(t){var e=yA.exec(t)||_A.exec(t)||bA.exec(t)||xA.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=Ec(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ec(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Ec(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Ec(s,"%")?100:1),$o([n,i,a,s])}function a6(t){var e=SA.exec(t),r=nr(e,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,W8.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Ec(o,"%")?100:1),ld([n,a,s,o])}function kA(t){return hA.default[t]?Wg(hA.default[t]):vA.test(t)||wA.test(t)?n6(t):yA.test(t)||_A.test(t)||bA.test(t)||xA.test(t)?i6(t):SA.test(t)?a6(t):null}var s6={fromString:kA,fromRgb:Wg,fromRgba:$o,fromHsl:EA,fromHsla:ld};Ai.default=s6});var Yg=I((cZ,CA)=>{"use strict";p();var TA=Object.prototype.toString;CA.exports=function(e){var r=TA.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&TA.call(e.callee)==="[object Function]"),n}});var LA=I((fZ,DA)=>{"
Line truncated
|
||||
`)>=0)return!1;return!0}function E4(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Kn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Kn.call(Array(e+1),r)}}function hv(t,e){if(t.length===0)return"";var r=`
|
||||
`+e.prev+e.base;return r+Kn.call(t,","+r)+`
|
||||
`+e.prev}function pd(t,e){var r=dv(t),n=[];if(r){n.length=t.length;for(var i=0;i<t.length;i++)n[i]=Ti(t,i)?e(t[i],t):""}var a=typeof ov=="function"?ov(t):[],s;if(Fo){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var l in t)Ti(t,l)&&(r&&String(Number(l))===l&&l<t.length||Fo&&s["$"+l]instanceof Symbol||(OT.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if(typeof ov=="function")for(var u=0;u<a.length;u++)MT.call(t,a[u])&&n.push("["+e(a[u])+"]: "+e(t[a[u]],t));return n}});var GT=I((VZ,jT)=>{"use strict";p();var k4=Fc(),A4=fr(),vd=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},T4=function(t,e){if(t){var r=vd(t,e);return r&&r.value}},C4=function(t,e,r){var n=vd(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},P4=function(t,e){return t?!!vd(t,e):!1},R4=function(t,e){if(t)return vd(t,e,!0)};jT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new A4("Side channel does not contain "+k4(n))},delete:function(n){var i=e&&e.next,a=R4(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return T4(e,n)},has:function(n){return P4(e,n)},set:function(n,i){e||(e={next:void 0}),C4(e,n,i)}};return r}});var vv=I((YZ,zT)=>{"use strict";p();var I4=Bn(),Oc=St(),$4=Fc(),F4=fr(),qT=I4("%Map%",!0),O4=Oc("Map.prototype.get",!0),M4=Oc("Map.prototype.set",!0),D4=Oc("Map.prototype.has",!0),L4=Oc("Map.prototype.delete",!0),N4=Oc("Map.prototype.size",!0);zT.exports=!!qT&&function(){var e,r={assert:function(n){if(!r.has(n))throw new F4("Side channel does not contain "+$4(n))},delete:function(n){if(e){var i=L4(e,n);return N4(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return O4(e,n)},has:function(n){return e?D4(e,n):!1},set:function(n,i){e||(e=new qT),M4(e,n,i)}};return r}});var WT=I((ZZ,VT)=>{"use strict";p();var B4=Bn(),yd=St(),H4=Fc(),wd=vv(),U4=fr(),Oo=B4("%WeakMap%",!0),j4=yd("WeakMap.prototype.get",!0),G4=yd("WeakMap.prototype.set",!0),q4=yd("WeakMap.prototype.has",!0),z4=yd("WeakMap.prototype.delete",!0);VT.exports=Oo?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new U4("Side channel does not contain "+H4(i))},delete:function(i){if(Oo&&i&&(typeof i=="object"||typeof i=="function")){if(e)return z4(e,i)}else if(wd&&r)return r.delete(i);return!1},get:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?j4(e,i):r&&r.get(i)},has:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?q4(e,i):!!r&&r.has(i)},set:function(i,a){Oo&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Oo),G4(e,i,a)):wd&&(r||(r=wd()),r.set(i,a))}};return n}:wd});var wv=I((JZ,YT)=>{"use strict";p();var V4=fr(),W4=Fc(),Y4=GT(),X4=vv(),Z4=WT(),K4=Z4||X4||Y4;YT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new V4("Side channel does not contain "+W4(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=K4()),e.set(n,i)}};return r}});var ZT=I((eK,XT)=>{"use strict";p();var J4=cf(),Mc=wv()(),Ci=fr(),yv={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");if(Mc.assert(t),!yv.has(t,e))throw new Ci("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return!!r&&J4(r,"$"+e)},set:function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var n=Mc.get(t);n||(n={},Mc.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(yv);XT.exports=yv});var QT=I((rK,JT)=>{"use strict";p();var Dc=ZT(),Q4=ef(),KT=typeof StopIteration=="object"?StopIteration:null;JT.exports=function(e){if(!KT)throw new Q4("this environment lacks StopIteration");Dc.set(e,"[[Done]]",!1);var r={next:function(){var i=Dc.get(this,"[[Iterator]]"),a=!!Dc.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Dc.set(i,"[[Done]]",!0),s!==KT)throw s;return{done:!0,value:void 0}}}};return Dc.set(r,"[[Iterator]]",e),r}});var bv=I((iK,tC)=>{"use strict";p();var eC=St(),e5=eC("String.prototype.valueOf"),t5=function(e){try{return e5(e),!0}catch(r){return!1}},r5=eC("Object.prototype.toString"),n5="[object String]",i5=Ji()();tC.exports=function(e){return typeof e=="string"?!0:!e||typeof e!="object"?!1:i5?t5(e):r5(e)===n5}});var xv=I((sK,iC)=>{"use strict";p();var _v=typeof Map=="function"&&Map.prototype?Map:null,a5=typeof Set=="function"&&Set.prototype?Set:null,bd;_v||(bd=function(e){return!1});var nC=_v?Map.prototype.has:null,rC=a5?Set.prototyp
Line truncated
|
||||
`});Ge=!1,B=fe.length}function Y(Ie,Me){var It="="+H,De=Ie.indexOf(It,Me),G=u(Ie.substring(Ie.indexOf("=",Me)+1,De)).split(" ");return Z=G[0],H=G[G.length-1],De+It.length-1}for(_&&(_=_.split(" "),Z=_[0],H=_[1]),oe=0;oe<T;oe++)M==P?c(Z,S,oe)?(--oe,Oe(),M=F):S.charAt(oe)==`
|
||||
`?Gt(Ge):me+=S.charAt(oe):M==F?(oe+=Z.length-1,ye=t.tags[S.charAt(oe+1)],re=ye?S.charAt(oe+1):"_v",re=="="?(oe=Y(S,oe),M=P):(ye&&oe++,M=D),Ge=oe):c(H,S,oe)?(fe.push({tag:re,n:u(me),otag:Z,ctag:H,i:re=="/"?Ge-Z.length:oe+H.length}),me="",oe+=H.length-1,M=P,re=="{"&&(H=="}}"?oe++:l(fe[fe.length-1]))):me+=S.charAt(oe);return Gt(Ge,!0),fe};function l(y){y.n.substr(y.n.length-1)==="}"&&(y.n=y.n.substring(0,y.n.length-1))}function u(y){return y.trim?y.trim():y.replace(/^\s*|\s*$/g,"")}function c(y,S,_){if(S.charAt(_)!=y.charAt(0))return!1;for(var T=1,P=y.length;T<P;T++)if(S.charAt(_+T)!=y.charAt(T))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(y,S,_,T){var P=[],F=null,D=null,M=null;for(D=_[_.length-1];y.length>0;){if(M=y.shift(),D&&D.tag=="<"&&!(M.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[M.tag]<=t.tags.$||h(M,T))_.push(M),M.nodes=d(y,M.tag,_,T);else if(M.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+M.n);if(F=_.pop(),M.n!=F.n&&!m(M.n,F.n,T))throw new Error("Nesting error: "+F.n+" vs. "+M.n);return F.end=M.i,P}else M.tag==`
|
||||
`&&(M.last=y.length==0||y[0].tag==`
|
||||
`);P.push(M)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return P}function h(y,S){for(var _=0,T=S.length;_<T;_++)if(S[_].o==y.n)return y.tag="#",!0}function m(y,S,_){for(var T=0,P=_.length;T<P;T++)if(_[T].c==y&&_[T].o==S)return!0}function g(y){var S=[];for(var _ in y)S.push('"'+b(_)+'": function(c,p,t,i) {'+y[_]+"}");return"{ "+S.join(",")+" }"}function v(y){var S=[];for(var _ in y.partials)S.push('"'+b(_)+'":{name:"'+b(y.partials[_].name)+'", '+v(y.partials[_])+"}");return"partials: {"+S.join(",")+"}, subs: "+g(y.subs)}t.stringify=function(y,S,_){return"{code: function (c,p,i) { "+t.wrapMain(y.code)+" },"+v(y)+"}"};var w=0;t.generate=function(y,S,_){w=0;var T={code:"",subs:{},partials:{}};return t.walk(y,T),_.asString?this.stringify(T,S,_):this.makeTemplate(T,S,_)},t.wrapMain=function(y){return'var t=this;t.b(i=i||"");'+y+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(y,S,_){var T=this.makePartials(y);return T.code=new Function("c","p","i",this.wrapMain(y.code)),new this.template(T,S,this,_)},t.makePartials=function(y){var S,_={subs:{},partials:y.partials,name:y.name};for(S in _.partials)_.partials[S]=this.makePartials(_.partials[S]);for(S in y.subs)_.subs[S]=new Function("c","p","t","i",y.subs[S]);return _};function b(y){return y.replace(a,"\\\\").replace(r,'\\"').replace(n,"\\n").replace(i,"\\r").replace(s,"\\u2028").replace(o,"\\u2029")}function E(y){return~y.indexOf(".")?"d":"f"}function x(y,S){var _="<"+(S.prefix||""),T=_+y.n+w++;return S.partials[T]={name:y.n,partials:{}},S.code+='t.b(t.rp("'+b(T)+'",c,p,"'+(y.indent||"")+'"));',T}t.codegen={"#":function(y,S){S.code+="if(t.s(t."+E(y.n)+'("'+b(y.n)+'",c,p,1),c,p,0,'+y.i+","+y.end+',"'+y.otag+" "+y.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(y.nodes,S),S.code+="});c.pop();}"},"^":function(y,S){S.code+="if(!t.s(t."+E(y.n)+'("'+b(y.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(y.nodes,S),S.code+="};"},">":x,"<":function(y,S){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var T=S.partials[x(y,S)];T.subs=_.subs,T.partials=_.partials},$:function(y,S){var _={subs:{},code:"",partials:S.partials,prefix:y.n};t.walk(y.nodes,_),S.subs[y.n]=_.code,S.inPartial||(S.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,S){S.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,S){S.code+="t.b(t.v(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=A('"'+b(y.text)+'"')},"{":k,"&":k};function k(y,S){S.code+="t.b(t.t(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,S){for(var _,T=0,P=y.length;T<P;T++)_=t.codegen[y[T].tag],_&&_(y[T],S);return S},t.parse=function(y,S,_){return _=_||{},d(y,"",[],_.sectionTags||[])},t.cache={},t.cacheKey=function(y,S){return[y,!!S.asString,!!S.disableLambda,S.delimiters,!!S.modelGet].join("||")},t.compile=function(y,S){S=S||{};var _=t.cacheKey(y,S),T=this.cache[_];if(T){var P=T.partials;for(var F in P)delete P[F].instance;return T}return T=this.generate(this.parse(this.scan(y,S.delimiters),y,S),y,S),this.cache[_]=T}})(typeof F0!="undefined"?F0:Hogan)});var BF=I(O0=>{p();var eV={};(function(t){t.Template=function(d,h,m,g){d=d||{},this.r=d.code||this.r,this.c=m,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,m){return""},v:c,t:u,render:function(h,m,g){return this.ri([h],m||{},g)},ri:function(d,h,m){return this.r(d,h,m)},ep:function(d,h){var m=this.partials[d],g=h[m.name];if(m.instance&&m.base==g)return m.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,m.subs){h.stackText||(h.stackText={});for(key in m.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,m.subs,m.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,m,g){var v=this.ep(d,m);return v?v.ri(h,m,g):""},rs:function(d,h,m){var g=d[d.length-1];if(!f(g)){m(d,h,this);return}for(var v=0;v<g.length;v++)d.push(g[v]),m(d,h,this),d.pop()},s:function(d,h,m,g,v,w,b){var E;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,m,g,v,w,b)),E=!!d,!g&&E&&h&&h.push(typeof d=="object"?d:h[h.length-1]),E)},d:function(d,h,m,g){var v,w=d.split("."),b=this.f(w[0],h,m,g),E=this.options.modelGet,x=null;if(d==="."&&f(h[h.length-2]))b=h[h.length-1];else for(var k=1;k<w.length;k++)v=e(w[k],b,E),v!==void 0?(x=b,b=v):b="";return g&&!b?!1:(!g&&typeof b=="function"&&(h.push(x),b=this.mv(b,h,m),h.pop()),b)},f:function(d,h,m,g){for(var v=!1,w=null,b=!1,E=this.options.modelGet,x=h.length-1;x>=0;x--)if(w=h[x],v=e(d,w,E),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,m)),v):g?!1:""},ls:function(d,h,m,g,v){var w=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(u(d.call(h,g)),h,m)),this.options.delimiters=w,!1},ct:function(d,
Line truncated
|
||||
|
||||
PROMPT="$1"
|
||||
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
|
||||
@@ -127,48 +123,51 @@ done
|
||||
RESPONSE=$(cat "$TEMP_FILE.response")
|
||||
|
||||
echo "$RESPONSE"
|
||||
`,pT=["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();var mT=require("obsidian"),wB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},ze=class extends mT.SuggestModal{constructor(e,r){if(super(e.app),this.config={...wB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>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 n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};m();function gT(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var Co=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var e3=Ot(FT()),t3=require("child_process"),r3=Ot(QR()),Ai=require("obsidian");function Ud(t){throw new Error(`Unexpected object: ${t}`)}function Ic(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var pv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function vn(t,e){let r;if(e){if(e.button===0||e.button===1){let n=Ai.Keymap.isModEvent(e);r=t.workspace.getLeaf(n)}}else r=t.workspace.getLeaf(!1);return r}function Xn(t,e,r,n,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(r);if(a!=null){let s=new Ai.Menu;t.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}else{let s=new Ai.Menu;t.workspace.trigger("obsidian-git:menu",s,r,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function pa(t){throw new Error("Impossible branch: "+t)}function mv(t){return`rgb(${t.r},${t.g},${t.b})`}function n3(t){var a;let e=(a=e3.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[r,n,i]=e;return{r,g:n,b:i}}function i3(t){return t.diff(Ai.moment.unix(0),"seconds")}function a3(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function s3(t,e){return(0,r3.default)(t,e,{strict:!0})}function Fc(t,e){return new Proxy(t,{get(r,n){return n==="length"?Math.min(e,r.length):r[n]}})}function o3(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function l3(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),n=t.substring(e,t.length);return r+n}function gv(t,e,r){return t<=e&&e<=r}function ki(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function Kn(t){return t.endsWith("/")?t:t.split("/
Line truncated
|
||||
`,aA=["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"];p();p();p();var xc=class{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let a=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(a,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,i)}diffWithOptionsObj(e,r,n,i){var a;let s=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},o=r.length,l=e.length,u=1,c=o+l;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let f=(a=n.timeout)!==null&&a!==void 0?a:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,n);if(h[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,w=()=>{for(let b=Math.max(g,-u);b<=Math.min(v,u);b+=2){let E,x=h[b-1],k=h[b+1];x&&(h[b-1]=void 0);let A=!1;if(k){let S=k.oldPos-b;A=k&&0<=S&&S<o}let y=x&&x.oldPos+1<l;if(!A&&!y){h[b]=void 0;continue}if(!y||A&&x.oldPos<k.oldPos?E=this.addToPath(k,!0,!1,0,n):E=this.addToPath(x,!1,!0,1,n),m=this.extractCommon(E,r,e,b,n),E.oldPos+1>=l&&m+1>=o)return s(this.buildValues(E.lastComponent,r,e))||!0;h[b]=E,E.oldPos+1>=l&&(v=Math.min(v,b-1)),m+1>=o&&(g=Math.max(g,b+1))}u++};if(i)(function b(){setTimeout(function(){if(u>c||Date.now()>d)return i(void 0);w()||b()},0)})();else for(;u<=c&&Date.now()<=d;){let b=w();if(b)return b}}addToPath(e,r,n,i,a){let s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,i,a){let s=r.length,o=n.length,l=e.oldPos,u=l-i,c=0;for(;u+1<s&&l+1<o&&this.equals(n[l+1],r[u+1],a);)u++,l++,c++,a.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!a.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,r,n){return n.comparator?n.comparator(e,r):e===r||!!n.ignoreCase&&e.toLowerCase()===r.toLowerCase()}removeEmpty(e){let r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);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,n){let i=[],a;for(;e;)i.push(e),a=e.previousComponent,delete e.previousComponent,e=a;i.reverse();let s=i.length,o=0,l=0,u=0;for(;o<s;o++){let c=i[o];if(c.removed)c.value=this.join(n.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=r.slice(l,l+c.count);f=f.map(function(d,h){let m=n[u+h];return m.length>d.length?m:d}),c.value=this.join(f)}else c.value=this.join(r.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}};p();var Gg=class extends xc{constructor(){super(...arguments),this.tokenize=q8}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
||||
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
||||
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
||||
`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}},G8=new Gg;function qg(t,e,r){return G8.diff(t,e,r)}function q8(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||||
`));let r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let a=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r}p();function zg(t,e,r,n,i,a,s){let o;s?typeof s=="function"?o={callback:s}:o=s: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:c}=o;qg(r,n,Object.assign(Object.assign({},o),{callback:f=>{let d=u(f);c(d)}}))}else return u(qg(r,n,o));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(b){return b.map(function(E){return" "+E})}let d=[],h=0,m=0,g=[],v=1,w=1;for(let b=0;b<c.length;b++){let E=c[b],x=E.lines||z8(E.value);if(E.lines=x,E.added||E.removed){if(!h){let k=c[b-1];h=v,m=w,k&&(g=l>0?f(k.lines.slice(-l)):[],h-=g.length,m-=g.length)}for(let k of x)g.push((E.added?"+":"-")+k);E.added?w+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&b<c.length-2)for(let k of f(x))g.push(k);else{let k=Math.min(x.length,l);for(let y of f(x.slice(0,k)))g.push(y);let A={oldStart:h,oldLines:v-h+k,newStart:m,newLines:w-m+k,lines:g};d.push(A),h=0,m=0,g=[]}v+=x.length,w+=x.length}}for(let b of d)for(let E=0;E<b.lines.length;E++)b.lines[E].endsWith(`
|
||||
`)?b.lines[E]=b.lines[E].slice(0,-1):(b.lines.splice(E+1,0,"\\ No newline at end of file"),E++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:a,hunks:d}}}function od(t){if(Array.isArray(t))return t.map(od).join(`
|
||||
`);let e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader));for(let r=0;r<t.hunks.length;r++){let n=t.hunks[r];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@");for(let i of n.lines)e.push(i)}return e.join(`
|
||||
`)+`
|
||||
`}function sA(t,e,r,n,i,a,s){if(typeof s=="function"&&(s={callback:s}),s!=null&&s.callback){let{callback:o}=s;zg(t,e,r,n,i,a,Object.assign(Object.assign({},s),{callback:l=>{o(l?od(l):void 0)}}))}else{let o=zg(t,e,r,n,i,a,s);return o?od(o):void 0}}function Sc(t,e,r,n,i,a){return sA(t,t,e,r,n,i,a)}function z8(t){let e=t.endsWith(`
|
||||
`),r=t.split(`
|
||||
`).map(n=>n+`
|
||||
`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var te=bt(Hg()),is=require("obsidian");p();function oA(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var Io=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};p();var lA=require("obsidian"),V8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},ze=class extends lA.SuggestModal{constructor(e,r){if(super(e.app),this.config={...V8,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>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 n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};p();var V2=bt(AA()),W2=require("child_process"),Y2=bt(z2()),Pi=require("obsidian");function Md(t){throw new Error(`Unexpected object: ${t}`)}function Lc(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var Kv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function bn(t,e){let r;if(e){if(e.button===0||e.button===1){let n=Pi.Keymap.isModEvent(e);r=t.workspace.getLeaf(n)}}else r=t.workspace.getLeaf(!1);return r}function Qn(t,e,r,n,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(r);if(a!=null){let s=new Pi.Menu;t.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}else{let s=new Pi.Menu;t.workspace.trigger("obsidian-git:menu",s,r,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function ba(t){throw new Error("Impossible branch: "+t)}function Jv(t){return`rgb(${t.r},${t.g},${t.b})`}function X2(t){var a;let e=(a=V2.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[r,n,i]=e;return{r,g:n,b:i}}function Z2(t){return t.diff(Pi.moment.unix(0),"seconds")}function K2(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function J2(t,e){return(0,Y2.default)(t,e,{strict:!0})}function Nc(t,e){return new Proxy(t,{get(r,n){return n==="length"?Math.min(e,r.length):r[n]}})}function Q2(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function eP(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),n=t.substring(e,t.length);return r+n}function Qv(t,e,r){return t<=e&&e<=r}function Ri(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function ei(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function tP(t){return t===1?"1 minute":`${t} minutes`}function uU(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function Do(t){if(t.endsWith(".md"))return!1;let e=uU(t);return aA.includes(e)}function ew(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function Lo(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Pi.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(n){return!0}}function rP({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function No(t,e,r,n){let i=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:i,linktext:n})}function Bc(t,e,r={}){return new Promise((n,i)=>{let a=(0,W2.spawn)(t,e,r),s="",o="";a.stdout.on("data",l=>{s+=l.toString()}),a.stderr.on("data",l=>{o+=l.toString()}),a.on("error",l=>{n({error:new Error(l.message),stdout:s,stderr:s,code:1})}),a.on("close",l=>{n({stdout:s,stderr:o,code:l!=null?l:1,error:void 0})})})}p();var nP=require("obsidian"),Bo=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let n=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(r);if(a.contains("/
Line truncated
|
||||
`):i="Too many files to list",e=e+`
|
||||
|
||||
Affected files:
|
||||
`+i}return e}};var Ce=class extends $o{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var n;if(await this.isGitInstalled()){let i=this.app.vault.adapter,a=i.getBasePath(),s=a;this.plugin.settings.basePath&&(await i.exists((0,Ti.normalizePath)(this.plugin.settings.basePath))?s=Ve.join(a,this.plugin.settings.basePath):r||new Ti.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=s,this.git=fT({baseDir:s,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?hd:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir;if(o.length>0){let v=o.join(":")+":"+process.env.PATH;process.env.PATH=v}c&&(process.env.GIT_DIR=c);for(let v of l){let[y,b]=v.split("=");process.env[y]=b}let u="simple-git",f=",",h=((n=localStorage.debug)!=null?n:"").split(f);if(!h.includes(u)&&!h.includes(`-${u}`)&&(h.push(u),p3.default.enable(h.join(f))),await this.git.checkIsRepo()){let v=await this.git.revparse("--show-cdup"),y=(0,Dc.resolve)(s+Dc.sep+v);this.absoluteRepoPath=y,await this.git.cwd(y)}let p=Ve.join(a,this.app.vault.configDir,"plugins","obsidian-git"),g=Ve.join(p,es);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=g),process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=Ve.join(p,pd),process.env.SSH_ASKPASS==g&&this.askpass().catch(v=>this.plugin.displayError(v))}}getRelativeVaultPath(r){let i=this.app.vault.adapter.getBasePath(),a=Ve.join(this.absoluteRepoPath,r),s=Ve.relative(i,a);return Ti.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=Ve.join(a,r),l=Ve.relative(s,o);return Ti.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}async askpass(){let r=this.app.vault.adapter,n=r.getBasePath(),i=Ve.join(n,this.app.vault.configDir,"plugins","obsidian-git"),a=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await Fr.writeFile(Ve.join(i,es),hT),await Fr.chmod(Ve.join(i,es),493),this.watchAbortController=new AbortController;let{signal:s}=this.watchAbortController;try{let o=Fr.watch(i,{signal:s});for await(let l of o){if(l.filename!=pd)continue;let c=a+pd;if(!await r.exists(c))continue;let u=await r.read(c),f;u.length>60&&(f=new Ti.Notice(u,999999));let d=await new ze(this.plugin,{allowEmpty:!0,obscure:!0,placeholder:u.length>60?"Enter a response to the message.":u}).openAndGetResult();f==null||f.hide(),await r.exists(c)&&await r.write(`${c}.response`,d!=null?d:"")}}catch(o){this.plugin.displayError(o),await Fr.rm(Ve.join(i,es),{force:!0}),await Fr.rm(Ve.join(i,`${es}.response`),{force:!0}),await new Promise(l=>setTimeout(l,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=Ve.join(this.app.vault.configDir,"plugins","obsidian-git",es),i=this.getRelativeRepoPath(n,!0);(await Fr.readFile(r,"utf-8")).split(`
|
||||
`).some(l=>l.contains(i))||await Fr.appendFile(r,i+`
|
||||
`)}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 n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=await this.git.status(n!=null?["--",n]:[]);this.plugin.setPluginState({gitAction:0});let a=i.files.map(s=>{let o=this.formatPath(s);return{path:o.path,from:o.from,index:s.index==="?"?"U":s.index,workingDir:s.working_dir==="?"?"U":s.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:a,changed:a.filter(s=>s.workingDir!==" "),staged:a.filter(s=>s.index!==" "&&s.index!="U"),conflicted:i.conflicted.map(s=>this.formatPath({path:s}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",Ve.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await s).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",c=>{o+=c.toString("utf8")}),i.on("end",()=>{let u=o.split(`
|
||||
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Dc.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return r.from!=null?{from:n(r.from),path:n(r.path)}:{path:n(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 l=`-C${dd}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",l);break;case"all-commits":s.push("-C","-C",l);break;default:pa(n)}s.push("--",o);let c=await this.git.raw(s);return jH(c)}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]),this.plugin.setPluginState({gitAction:0})}async getUntrackedPaths(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=["ls-files","--others","--exclude-standard","--directory"];n!=null&&i.push("--",n);let a=await this.git.raw(i);return this.plugin.setPluginState({gitAction:0}),a.split(/\r\n|\r|\n/).filter(s=>s.length>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=
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){let[a,s]=ki(r),o=await this.branchInfo();await this.git.push(["--set-upstream",a,`${o.current}:${s}`])}}}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(Ve.dirname(r)))return;let n=await this.git.raw(["-C",Ve.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",Ve.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 s=this.app.vault.adapter.getFullPath(Ve.normalize(r)),o=Ve.relative(n,s);return{submodule:n,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 wr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),n=await $c(r||"git",["--version"],{});if(n.error)if(Ti.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${hd}) of Git for Windows.`);let i=await $c(hd,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof wr){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 Co(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}}},m3={hash:"000000",isZeroCommit:!0,summary:""};function jH(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(d3(r[a])){let s=r[a].split(" "),o=NH(s,i,n);for(a++;d3(r[a]);a++){let l=r[a].split(" ");BH(l,n,i)}HH(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 NH(t,e,r){let n=t[0];if(r.hashPerLine.push(n),r.originalFileLineNrPerLine.push(parseInt(t[1])),r.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return n}function BH(t,e,r){let n=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[r],s=e.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=h3(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=h3(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}e.commits.set(a,s)}function HH(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);yv(t.author)&&(t.author=void 0),yv(t.committer)&&(t.committer=void 0),yv(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function yv(t){return!t||Object.keys(t).length===0}function d3(t){return t.length>0&&t[0].trim()===t[0]}function h3(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var Q3=require("@codemirror/state");m();var O3=require("@codemirror/state"),th=require("obsidian");m();var bv=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Do=new bv;m();var Jd=require("@codemirror/state"),T3=Ot(_v());m();var z=require("obsidian");m();m();function yn(){}yn.prototype={diff:function(e,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(S){return S=s.postProcess(S,i),a?(setTimeout(function(){a(S)},0),!0):S}e=this.castInput(e,i),r=this.castInput(r,i),e=this.removeEmpty(this.tokenize(e,i)),r=this.removeEmpty(this.tokenize(r,i));var l=r.length,c=e.length,u=1,f=l+c;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}],g=this.extractCommon(p[0],r,e,0,i);if(p[0].oldPos+1>=c&&g+1>=l)return o(g3(s,p[0].lastComponent,r,e,s.useLongestToken));var v=-1/0,y=1/0;function b(){for(var S=Math.max(v,-u);S<=Math.min(y,u);S+=2){var A=void 0,k=p[S-1],w=p[S+1];k&&(p[S-1]=void 0);var x=!1;if(w){var _=w.oldPos-S;x=w&&0<=_&&_<l}var T=k&&k.oldPos+1<c;if(!x&&!T){p[S]=void 0;continue}if(!T||x&&k.oldPos<w.oldPos?A=s.addToPath(w,!0,!1,0,i):A=s.addToPath(k,!1,!0,1,i),g=s.extractCommon(A,r,e,S,i),A.oldPos+1>=c&&g+1>=l)return o(g3(s,A.lastComponent,r,e,s.useLongestToken));p[S]=A,A.oldPos+1>=c&&(y=Math.min(y,S-1)),g+1>=l&&(v=Math.max(v,S+1))}u++}if(a)(function S(){setTimeout(function(){if(u>f||Date.now()>h)return a();b()||S()},0)})();else for(;u<=f&&Date.now()<=h;){var E=b();if(E)return E}},addToPath:function(e,r,n,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}},extractCommon:function(e,r,n,i,a){for(var s=r.length,o=n.length,l=e.oldPos,c=l-i,u=0;c+1<s&&l+1<o&&this.equals(n[l+1],r[c+1],a);)c++,l++,u++,a.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!a.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c},equals:function(e,r,n){return n.comparator?n.comparator(e,r):e===r||n.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return Array.from(e)},join:function(e){return e.join("")},
Line truncated
|
||||
`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i<n.length;i++){var a=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r};Wd.equals=function(t,e,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
||||
`))&&(t=t.trim()),(!r.newlineIsToken||!e.includes(`
|
||||
`))&&(e=e.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
||||
`)&&(t=t.slice(0,-1)),e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1))),yn.prototype.equals.call(this,t,e,r)};function _3(t,e,r){return Wd.diff(t,e,r)}var VH=new yn;VH.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var qH=new yn;qH.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function x3(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vd(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?x3(Object(r),!0).forEach(function(n){XH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x3(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function WH(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YH(t){var e=WH(t,"string");return typeof e=="symbol"?e:e+""}function Av(t){"@babel/helpers - typeof";return Av=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Av(t)}function XH(t,e,r){return e=YH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xv(t){return KH(t)||ZH(t)||JH(t)||QH()}function KH(t){if(Array.isArray(t))return kv(t)}function ZH(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function JH(t,e){if(t){if(typeof t=="string")return kv(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 kv(t,e)}}function kv(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function QH(){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 jc=new yn;jc.useLongestToken=!0;jc.tokenize=Wd.tokenize;jc.castInput=function(t,e){var r=e.undefinedReplacement,n=e.stringifyReplacer,i=n===void 0?function(a,s){return typeof s=="undefined"?r:s}:n;return typeof t=="string"?t:JSON.stringify(Tv(t,null,null,i),i," ")};jc.equals=function(t,e,r){return yn.prototype.equals.call(jc,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function Tv(t,e,r,n,i){e=e||[],r=r||[],n&&(t=n(i,t));var a;for(a=0;a<e.length;a+=1)if(e[a]===t)return r[a];var s;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),s=new Array(t.length),r.push(s),a=0;a<t.length;a+=1)s[a]=Tv(t[a],e,r,n,i);return e.pop(),r.pop(),s}if(t&&t.toJSON&&(t=t.toJSON()),Av(t)==="object"&&t!==null){e.push(t),s={},r.push(s);var o=[],l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&o.push(l);for(o.sort(),a=0;a<o.length;a+=1)l=o[a],s[l]=Tv(t[l],e,r,n,l);e.pop(),r.pop()}else s=t;return s}var Cv=new yn;Cv.tokenize=function(t){return t.slice()};Cv.join=Cv.removeEmpty=function(t){return t};function S3(t,e,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,l=o.callback;_3(r,n,Vd(Vd({},s),{},{callback:function(f){var d=c(f);l(d)}}))}else return c(_3(r,n,s));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(x){return x.map(function(_){return" "+_})}for(var d=[],h=0,p=0,g=[],v=1,y=1,b=function(){var _=u[E],T=_.lines||tU(_.value);if(_.lines=T,_.added||_.removed){var C;if(!h){var I=u[E-1];h=v,p=y,I&&(g=s.context>0?f(I.lines.slice(-s.context)):[],h-=g.length,p-=g.length)}(C=g).push.apply(C,xv(T.map(function(le){return(_.added?"+":"-")+le}))),_.added?y+=T.length:v+=T.length}else{if(h)if(T.length<=s.context*2&&E<u.length-2){var L;(L=g).push.apply(L,xv(f(T)))}else{var $,J=Math.min(T.length,s.context);($=g).push.apply($,xv(f(T.slice(0,J))));var de={oldStart:h,oldLines:v-h+J,newStart:p,newLines:y-p+J,lines:g};d.push(de),h=0,p=0,g=[]}v+=T.length,y+=T.length}},E=0;E<u.length;E++)b();for(var S=0,A=d;S<A.length;S++)for(var k=A[S],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:t,newFileName:e,oldHeader:i,newHeader:a,hunks:d}}}function Pv(t){if(Array.isArray(t))return t.map(Pv).join(`
|
||||
`);var e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader));for(var r=0;r<t.hunks.length;r++){var n=t.hunks[r];n.oldLines===0&&(n.oldStart-=1),n.newLines===0&&(n.newStart-=1),e.push("@@ -"+n.oldStart+","+n.oldLines+" +"+n.newStart+","+n.newLines+" @@"),e.push.apply(e,n.lines)}return e.join(`
|
||||
`)+`
|
||||
`}function eU(t,e,r,n,i,a,s){var o;if(typeof s=="function"&&(s={callback:s}),(o=s)!==null&&o!==void 0&&o.callback){var c=s,u=c.callback;S3(t,e,r,n,i,a,Vd(Vd({},s),{},{callback:function(d){d?u(Pv(d)):u()}}))}else{var l=S3(t,e,r,n,i,a,s);return l?Pv(l):void 0}}function Yd(t,e,r,n,i,a){return eU(t,t,e,r,n,i,a)}function tU(t){var e=t.endsWith(`
|
||||
`),r=t.split(`
|
||||
`).map(function(n){return n+`
|
||||
`});return e?r.pop():r.push(r.pop().slice(0,-1)),r}var re=Ot(gg()),rs=require("obsidian");m();var ma=require("obsidian"),Xd=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)),r=="utf8"||r.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof ma.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof ma.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);return n instanceof ma.TFile?this.vault.modify(n,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof ma.TFile?this.vault.modifyBinary(n,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),n=[...r.files,...r.folders],i;return e!=="/"?i=n.map(a=>(0,ma.normalizePath)(a.substring(e.length))):i=n,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var n,i;return this.adapter.rmdir(e,(i=(n=r==null?void 0:r.options)==null?void 0:n.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);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}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof ma.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(e);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(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var wn=class extends $o{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 Xd(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 rs.Notice("Authentication failed. Please try with different credentials");let r=await new ze(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new ze(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 iU(a));let o=await(0,rs.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:nU(o.arrayBuffer),statusCode:o.status,statusMessage:o.sta
Line truncated
|
||||
`+i}return e}};p();var _a=require("obsidian"),Dd=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)),r=="utf8"||r.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modify(n,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modifyBinary(n,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),n=[...r.files,...r.folders],i;return e!=="/"?i=n.map(a=>(0,_a.normalizePath)(a.substring(e.length))):i=n,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var n,i;return this.adapter.rmdir(e,(i=(n=r==null?void 0:r.options)==null?void 0:n.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);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}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof _a.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(e);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(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var cP=bt(lP()),_n=class extends Bo{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 Dd(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 is.Notice("Authentication failed. Please try with different credentials");let r=await new ze(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new ze(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).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 pU(a));let o=await(0,is.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:hU(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let n=await r
Line truncated
|
||||
|
||||
`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(`
|
||||
|
||||
`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[n,i]=ki(r),a=await this.branchInfo();await this.wrapFS(re.default.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:[re.default.TREE({ref:r}),re.default.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(re.default.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!pv(a,n))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.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(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[re.default.TREE({ref:"HEAD"}),re.default.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new rs.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(re.default.walk({...a,trees:[re.default.WORKDIR(),re.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await re.default.isIgnored({...a,filepath:o})||!pv(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(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(c,[u])=>{if(r==c){let f=await u.oid();return(await re.default.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h}),u=await re.default.readCommit({...this.getRepo(),oid:i}),f=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h});return Yd(a,f!=null?f:"",c!=null?c:"")}let o=(await re.default.walk({...this.getRepo(),trees:[re.default.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(n){let c=await this.resolveRef("HEAD").then(f=>(0,re.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof re.default.Errors.NotFoundError))throw f});return Yd(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",Yd(a,l,c)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await re.default.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 rs.Notice(r,n?this.noticeLength:void 0)}};async function*nU(t){yield new Uint8Array(t)}async function iU(t){let e=new ReadableStream({async start(n){for await(let i of t)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}var aU="https://momentjs.com/docs/#/parsing/string-format/",sU="https://publish.obsidian.md/git-doc/Line+Authoring",Kd=class extends z.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 all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let s;if(a){new z.Setting(r).setName("Automatic").setHeading(),new z.Setting(r).setName("Spli
Line truncated
|
||||
If turned on, do auto ${i} every ${c3(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.refreshDisplayWithDelay(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new z.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.refreshDisplayWithDelay()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new z.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"autoPushInterval"}),u.setPlaceholder(String(Xe.autoPushInterval)),u.onChange(async f=>{f!==""?n.settings.autoPushInterval=Number(f):n.settings.autoPushInterval=Xe.autoPushInterval,await n.saveSettings(),n.automaticsManager.reload("push")})}),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new z.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"autoPullInterval"}),u.setPlaceholder(String(Xe.autoPullInterval)),u.onChange(async f=>{f!==""?n.settings.autoPullInterval=Number(f):n.settings.autoPullInterval=Xe.autoPullInterval,await n.saveSettings(),n.automaticsManager.reload("pull")})}),new z.Setting(r).setName(`Auto ${i} only staged files`).setDesc(`If turned on, only staged files are committed on ${i}. If turned off, all changed files are committed.`).addToggle(u=>u.setValue(n.settings.autoCommitOnlyStaged).onChange(async f=>{n.settings.autoCommitOnlyStaged=f,await n.saveSettings()})),new z.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.refreshDisplayWithDelay()})),s=new z.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(Xe.autoCommitMessage).onChange(async f=>{f===""?n.settings.autoCommitMessage=Xe.autoCommitMessage:n.settings.autoCommitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:u,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new z.Setting(r).setName("Commit message").setHeading(),new z.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(Xe.commitMessage).onChange(async f=>{f===""?n.settings.commitMessage=Xe.commitMessage:n.settings.commitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:u,settingsProperty:"commitMessage"})}),new z.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(u=>{u.onChange(async f=>{f===""?n.settings.commitMessageScript=Xe.commitMessageScript:n.settings.commitMessageScript=f,await n.saveSettings()}),this.setNonDefaultValue({text:u,settingsProperty:"commitMessageScript"})});let c=new z.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()}));c.descEl.innerHTML=`
|
||||
Specify custom date format. E.g. "${l0}. See <a href="https://momentjs.com">Moment.js</a> for more formats.`,new z.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 z.Setting(r).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new z.Notice(`${f}`)})),new z.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 z.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof Ce&&new z.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 z.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 z.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 z.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.refreshDisplayWithDelay(),await n.saveSettings()})),new z.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.refreshDisplayWithDelay(),await n.saveSettings()})),n.gitManager instanceof Ce&&(new z.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new z.Setting(r).setName("History view").setHeading(),new z.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(n.settings.authorInHistoryView),c.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new z.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(c=>c.setValue(n.settings.dateInHistoryView).onChange(async u=>{n.settings.dateInHistoryView=u,await n.saveSettings(),await n.refresh()})),new z.Setting(r).setName("Source control view").setHeading(),new z.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(c=>c.setValue(n.settings.refreshSourceControl).onChange(async u=>{n.settings.refreshSourceControl=u,await n.saveSettings()})),new z.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"refreshSourceControlTimer"}),c.setPlaceholder(String(Xe.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?n.settings.refreshSourceControlTimer=Math.max(Number(f),500):n.settings.refreshSourceControlTimer=Xe.refreshSourceControlTimer,await n.saveSettings(),n.setRefreshDebouncer()})}),new z.Setting(r).setName("Miscellaneous").setHeading(),n.gitManager instanceof Ce&&new z.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(c=>{let u={split:"Split",git_unified:"Unified"};c.addOptions(u),c.setValue(n.settings.diffStyle),c.onChange(async f=>{n.settings.diffStyle=f,await n.saveSettings()})}),new z.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations t
Line truncated
|
||||
`)),c.onChange(u=>{n.localStorage.setEnvVars(u.split(`
|
||||
`))})}),n.gitManager instanceof Ce&&new z.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(n.localStorage.getPATHPaths().join(`
|
||||
`)),c.onChange(u=>{n.localStorage.setPATHPaths(u.split(`
|
||||
`))})}),n.gitManager instanceof Ce&&new z.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 n.gitManager.setGitInstance()})}),new z.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
|
||||
`),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()}async updateUpstreamBranch(r){let[n,i]=Ri(r),a=await this.branchInfo();await this.wrapFS(te.default.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:[te.default.TREE({ref:r}),te.default.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(te.default.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!Kv(a,n))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),u=await(o==null?void 0:o.oid()),c="equal";if(l!==u&&(c="M"),l===void 0&&(c="A"),u===void 0&&(c="D"),l===void 0&&u===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),c!=="equal")return{path:a,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[te.default.TREE({ref:"HEAD"}),te.default.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new is.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(te.default.walk({...a,trees:[te.default.WORKDIR(),te.default.STAGE()],map:async function(o,[l,u]){if(!u&&l&&await te.default.isIgnored({...a,filepath:o})||!Kv(o,r))return null;let[c,f]=await Promise.all([l&&l.type(),u&&u.type()]),d=[c,f].includes("blob");if((c==="tree"||c==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await u.oid():void 0,m;return c==="blob"&&f!=="blob"?m="42":c==="blob"&&(m=await l.oid()),m?h?m!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));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(u,[c])=>{if(r==u){let f=await c.oid();return(await te.default.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let u=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h}),c=await te.default.readCommit({...this.getRepo(),oid:i}),f=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:c.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h});return Sc(a,f!=null?f:"",u!=null?u:"")}let o=(await te.default.walk({...this.getRepo(),trees:[te.default.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(n){let u=await this.resolveRef("HEAD").then(f=>(0,te.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof te.default.Errors.NotFoundError))throw f});return Sc(a,u!=null?u:"",l)}else{let u;return await this.app.vault.adapter.exists(a)?u=await this.app.vault.adapter.read(a):u="",Sc(a,l,u)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await te.default.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 is.Notice(r,n?this.noticeLength:void 0)}};async function*hU(t){yield new Uint8Array(t)}async function pU(t){let e=new ReadableStream({async start(n){for await(let i of t)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}p();var QI=bt(Bd()),Dr=bt(require("fs/promises")),$i=require("obsidian"),He=bt(require("path")),Xc=require("path");p();var Kd=bt(mP(),1),Yd=bt(Bd(),1),HR=require("child_process"),SI=bt(nw(),1),qo=bt(nw(),1),XI=require("node:events"),Sw=Object.defineProperty,FU=Object.getOwnPropertyDescriptor,Ew=Object.getOwnPropertyNames,OU=Object.prototype.hasOwnProperty,V=(t,e)=>function(){return t&&(e=(0,t[Ew(t)[0]])(t=0)),e},MU=(t,e)=>function(){return e||(0,t[Ew(t)[0]])((e={exports:{}}).exports,e),e.exports},ft=(t,e)=>{for(var r in e)Sw(t,r,{get:e[r],enumerable:!0})},DU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ew(e))!OU.c
Line truncated
|
||||
`){return t.split(r).reduce((n,i)=>{let a=e?i.trim():i;return a&&n.push(a),n},[])}function kw(t,e){return zc(t,!0).map(r=>e(r))}function Aw(t){return(0,Kd.exists)(t,Kd.FOLDER)}function Re(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function eR(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Jd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function ti(t){return Array.isArray(t)?t:[t]}function tR(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function rR(t){return ti(t).map(String)}function Ue(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function Uc(t,e){let r=[];for(let n=0,i=t.length;n<i;n++)r.push(e,t[n]);return r}function jc(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function nR(t,e){return Object.assign({},...e.map(r=>r in t?{[r]:t[r]}:{}))}function uw(t=0){return new Promise(e=>setTimeout(e,t))}function fw(t){if(t!==!1)return t}var zo,us,Vc,Qd=V({"src/lib/utils/util.ts"(){"use strict";zo="\0",us=()=>{},Vc=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ri(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function dw(t,e){let r=zd(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function eh(t){return!!t&&Vc(t)==="[object Object]"}function iR(t){return typeof t=="function"}var Wc,Vt,aR,Vd,Tw,sR=V({"src/lib/utils/argument-filters.ts"(){"use strict";Qd(),Gc(),Wc=t=>Array.isArray(t),Vt=t=>typeof t=="string",aR=t=>Array.isArray(t)&&t.every(Vt),Vd=t=>Vt(t)||Array.isArray(t)&&t.every(Vt),Tw=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),hw,NU=V({"src/lib/utils/exit-codes.ts"(){"use strict";hw=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(hw||{})}}),Wd,BU=V({"src/lib/utils/git-output-streams.ts"(){"use strict";Wd=class oR{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new oR(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),he,xa,HU=V({"src/lib/utils/line-parser.ts"(){"use strict";he=class{constructor(t,e){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(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},xa=class extends he{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 lR(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...cR},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var cR,UU=V({"src/lib/utils/simple-git-options.ts"(){"use strict";cR={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Cw(t,e=[]){return eh(t)?Object.keys(t).reduce((r,n)=>{let i=t[n];if(zd(i))r.push(i);else if(dw(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let a of i)dw(a,["string","number"])||r.push(n+"="+a);else r.push(n);return r},e):e}function wr(t,e=0,r=!1){let n=[];for(let i=0,a=e<0?t.length:e;i<a;i++)"string|number".includes(typeof t[i])&&n.push(String(t[i]));return Cw(Pw(t),n),r||n.push(...jU(t)),n}function jU(t){let e=typeof cs(t)=="function";return ri(cs(t,e?1:0),Wc,[])}function Pw(t){let e=iR(cs(t));return ri(cs(t,e?1:0),eh)}function at(t,e=!0){let r=XP(cs(t));return e||ZP(r)?r:void 0}var GU=V({"src/lib/utils/task-options.ts"(){"use strict";sR(),Qd(),Gc()}});function pw(t,e){return t(e.stdOut,e.stdErr)}function _r(t,e,r,n=!0){return ti(r).forEach(i=>{for(let a=zc(i,n),s=0,o=a.length;s<o;s++){let l=(u=0)=>{if(!(s+u>=o))return a[s+u]};e.some(({parse:u})=>u(l,t))}}),t}var qU=V({"src/lib/utils/task-parser.ts"(){"use strict";Qd()}}),uR={};ft(uR,{ExitCodes:()=>hw,GitOutputStreams:()=>Wd,LineParser:()=>he,NOOP:()=>us,NULL:()=>zo,RemoteLineParser:()=>xa,append:()=>Re,appendTaskOptions:()=>Cw,asArray:()=>ti,asCamelCase:()=>tR,asFunction:()=>XP,asNumber:()=>Ue,asStringArray:()=>rR,bufferToString:()=>jc,callTaskParser:()=>pw,createInstanceConfig:()=>lR,delay:()=>uw,filterArray:()=>Wc,filterFunction:()=>iR,filterHasLength:()=>Tw,filterPlainObject:()=>eh,filterPrimitives:()=>dw,filterString:()=>Vt,filterStringArray:()=>aR,filterStringOrStringArray:()=>Vd,filterType:()=>ri,first:()=>JP,folderExists:()=>Aw,forEachLineWithContent:()=>kw,getTrailingOptions:()=>wr,including:()=>eR,isUserFunction:()=>ZP,last:()=>cs,objectToString:()=>Vc,orVoid:()=>fw,parseStringResponse:()=>_r,pick:()=>nR,prefixedArray:()=>Uc,remove:()=>Jd,splitOn:()=>KP,toLinesWithContent:()=>zc,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>
Line truncated
|
||||
`)){let l=KP(s,`
|
||||
`);o=l[0],s=l[1]}yield{file:a,key:o,value:s}}}var TR,ij=V({"src/lib/responses/ConfigList.ts"(){"use strict";ue(),TR=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=cs(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);n.hasOwnProperty(e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function iw(t,e){return typeof t=="string"&&vw.hasOwnProperty(t)?t:e}function aj(t,e,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function sj(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return rj(n,t)}}}function oj(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return tj(r)}}}function lj(){return{addConfig(t,e,...r){return this._runTask(aj(t,e,r[0]===!0,iw(r[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(sj(t,iw(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(oj(iw(t[0],void 0)),at(arguments))}}}var vw,CR=V({"src/lib/tasks/config.ts"(){"use strict";ij(),ue(),vw=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(vw||{})}});function cj(t){return PR.has(t)}var aw,PR,RR=V({"src/lib/tasks/diff-name-status.ts"(){"use strict";aw=(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))(aw||{}),PR=new Set(Object.values(aw))}});function uj(...t){return new $R().param(...t)}function fj(t){let e=new Set,r={};return kw(t,n=>{let[i,a,s]=n.split(zo);e.add(i),(r[i]=r[i]||[]).push({line:Ue(a),path:i,preview:s})}),{paths:e,results:r}}function dj(){return{grep(t){let e=at(arguments),r=wr(arguments);for(let i of IR)if(r.includes(i))return this._runTask(yr(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=uj().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(i){return fj(i)}},e)}}}var IR,Hc,vP,$R,FR=V({"src/lib/tasks/grep.ts"(){"use strict";ue(),ut(),IR=["-h"],Hc=Symbol("grepQuery"),$R=class{constructor(){this[vP]=[]}*[(vP=Hc,Symbol.iterator)](){for(let t of this[Hc])yield t}and(...t){return t.length&&this[Hc].push("--and","(",...Uc(t,"-e"),")"),this}param(...t){return this[Hc].push(...Uc(t,"-e")),this}}}}),OR={};ft(OR,{ResetMode:()=>jd,getResetMode:()=>pj,resetTask:()=>hj});function hj(t,e){let r=["reset"];return MR(t)&&r.push(`--${t}`),r.push(...e),ir(r)}function pj(t){if(MR(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function MR(t){return DR.includes(t)}var jd,DR,LR=V({"src/lib/tasks/reset.ts"(){"use strict";ut(),jd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(jd||{}),DR=Array.from(Object.values(jd))}});function mj(){return(0,Yd.default)("simple-git")}function wP(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...i)=>{t(n,...i),r(n,...i)}:t:(n,...i)=>{t(`%s ${n}`,e,...i),r&&r(n,...i)}}function gj(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function Mw(t,e,r,n=mj()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?n.extend(e):e,o=gj(ri(e,Vt),s,n);return u(r);function l(c,f){return Re(a,Mw(t,o.replace(/^[^:]+/,c),f,n))}function u(c){let f=c&&`[${c}]`||"",d=s&&wP(s,f)||us,h=wP(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:u})}}var NR=V({"src/lib/git-logger.ts"(){"use strict";ue(),Yd.default.formatters.L=t=>String(Tw(t)?t.length:"-"),Yd.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Vc(t)}}),BR,vj=V({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Sa(),NR(),BR=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let n=t.getName(r.commands[0]),i=Mw(this.logLabel,n);return{task:r,logger:i,name:n}}push(r){let n=this.createProgress(r);return n.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,n),n}fatal(r){for(let[n,{logger:i}]of Array.from(this._queue.entries()))n===r.task?(i.info("Failed %o",r),i("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):i.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(n);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 n=this.withProgress(r);if(!n)throw new br(void 0,"TasksPendingQueue: attempt called for an unknown task");return n.logger("Starting
Line truncated
|
||||
`).map(dq).filter(Boolean);e||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return fq(Ud(s[0]),Ud(o[0]));for(let l=0,u=Math.max(s.length,o.length);l<u;l++){let c=VI(Ud(s[l]),Ud(o[l]));if(c)return c}return 0});let n=e?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new jP(r,n)}}}),YI={};ft(YI,{addAnnotatedTagTask:()=>gq,addTagTask:()=>mq,tagListTask:()=>pq});function pq(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return WI(r,e)}}}function mq(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function gq(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var vq=V({"src/lib/tasks/tag.ts"(){"use strict";hq()}}),wq=MU({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(bj(),it(UR)),{SimpleGitApi:n}=(wG(),it(_I)),{Scheduler:i}=(yG(),it(xI)),{configurationErrorTask:a}=(ut(),it(gw)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:u,filterStringOrStringArray:c,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:m}=(ue(),it(uR)),{applyPatchTask:g}=(_G(),it(kI)),{branchTask:v,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:E}=($G(),it(II)),{checkIgnoreTask:x}=(MG(),it(OI)),{checkIsRepoTask:k}=(pR(),it(fR)),{cloneTask:A,cloneMirrorTask:y}=(NG(),it(MI)),{cleanWithOptionsTask:S,isCleanOptionsArray:_}=(kR(),it(SR)),{diffSummaryTask:T}=(jw(),it(eI)),{fetchTask:P}=(GG(),it(NI)),{moveTask:F}=(WG(),it(HI)),{pullTask:D}=(XG(),it(UI)),{pushTagsTask:M}=(mI(),it(pI)),{addRemoteTask:re,getRemotesTask:ye,listRemotesTask:me,remoteTask:fe,removeRemoteTask:Ge}=(iq(),it(GI)),{getResetMode:oe,resetTask:B}=(LR(),it(OR)),{stashListTask:Z}=(sq(),it(qI)),{addSubModuleTask:H,initSubModuleTask:Oe,subModuleTask:cr,updateSubModuleTask:Gt}=(uq(),it(zI)),{addAnnotatedTagTask:Y,addTagTask:Ie,tagListTask:Me}=(vq(),it(YI)),{straightThroughBufferTask:It,straightThroughStringTask:De}=(ut(),it(gw));function G(N,X){this._plugins=X,this._executor=new r(N.baseDir,new i(N.maxConcurrentProcesses),X),this._trimmed=N.trimmed}(G.prototype=Object.create(n.prototype)).constructor=G,G.prototype.customBinary=function(N){return this._plugins.reconfigure("binary",N),this},G.prototype.env=function(N,X){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=X,this},G.prototype.stashList=function(N){return this._runTask(Z(m(arguments)||{},o(N)&&N||[]),h(arguments))};function Je(N,X,Ee,We){return typeof Ee!="string"?a(`git.${N}() requires a string 'repoPath'`):X(Ee,f(We,u),d(arguments))}G.prototype.clone=function(){return this._runTask(Je("clone",A,...arguments),h(arguments))},G.prototype.mirror=function(){return this._runTask(Je("mirror",y,...arguments),h(arguments))},G.prototype.mv=function(N,X){return this._runTask(F(N,X),h(arguments))},G.prototype.checkoutLatestTag=function(N){var X=this;return this.pull(function(){X.tags(function(Ee,We){X.checkout(We.latest,N)})})},G.prototype.pull=function(N,X,Ee,We){return this._runTask(D(f(N,u),f(X,u),d(arguments)),h(arguments))},G.prototype.fetch=function(N,X){return this._runTask(P(f(N,u),f(X,u),d(arguments)),h(arguments))},G.prototype.silent=function(N){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(N,X){return this._runTask(Me(d(arguments)),h(arguments))},G.prototype.rebase=function(){return this._runTask(De(["rebase",...d(arguments)]),h(arguments))},G.prototype.reset=function(N){return this._runTask(B(oe(N),d(arguments)),h(arguments))},G.prototype.revert=function(N){let X=h(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),X):this._runTask(De(["revert",...d(arguments,0,!0),N]),X)},G.prototype.addTag=function(N){let X=typeof N=="string"?Ie(N):a("Git.addTag requires a tag name");return this._runTask(X,h(arguments))},G.prototype.addAnnotatedTag=function(N,X){return this._runTask(Y(N,X),h(arguments))},G.prototype.deleteLocalBranch=function(N,X,Ee){return this._runTask(E(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.deleteLocalBranches=function(N,X,Ee){return this._runTask(b(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.branch=function(N,X){return this._runTask(v(d(arguments)),h(arguments))},G.prototype.branchLocal=function(N){return this._runTask(w(),h(arguments))},G.prototype.raw=function(N){let X=!Array.isArray(N),Ee=[].slice.call(X?arguments:N,0);for(let $t=0;$t<Ee.length&&X;$t++)if(!l(Ee[$t])){Ee.splice($t,Ee.length-$t);break}Ee.push(...d(arguments,0,!0));var We=h(arguments);return Ee.length?this._runTask(De(Ee,this._trimmed),We):this._runTask(a("Raw: must supply one or more command to execute"),We)},G.prototype.submoduleAdd=function(N,X,Ee){return this._runTask(H(N,X),h(arguments))},G.prototype.submoduleUpdate=function(N,X){return this._runTas
Line truncated
|
||||
`).some(l=>l.contains(i))||await Dr.appendFile(r,i+`
|
||||
`)}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 n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=await this.git.status(n!=null?["--",n]:[]);this.plugin.setPluginState({gitAction:0});let a=i.files.map(s=>{let o=this.formatPath(s);return{path:o.path,from:o.from,index:s.index==="?"?"U":s.index,workingDir:s.working_dir==="?"?"U":s.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:a,changed:a.filter(s=>s.workingDir!==" "),staged:a.filter(s=>s.index!==" "&&s.index!="U"),conflicted:i.conflicted.map(s=>this.formatPath({path:s}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",He.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await s).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",u=>{o+=u.toString("utf8")}),i.on("end",()=>{let c=o.split(`
|
||||
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Xc.sep}).filter(f=>!!f);c.reverse(),r(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return r.from!=null?{from:n(r.from),path:n(r.path)}:{path:n(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 l=`-C${id}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",l);break;case"all-commits":s.push("-C","-C",l);break;default:ba(n)}s.push("--",o);let u=await this.git.raw(s);return Uq(u)}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]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let n=He.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,r),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=[];n!=null&&i.push("--",n);let a=await this.git.clean(ls.RECURSIVE+ls.DRY_RUN,i);return this.plugin.setPluginState({gitAction:0}),a.paths}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{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,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=aw
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){let[a,s]=Ri(r),o=await this.branchInfo();await this.git.push(["--set-upstream",a,`${o.current}:${s}`])}}}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(He.dirname(r)))return;let n=await this.git.raw(["-C",He.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",He.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 s=this.app.vault.adapter.getFullPath(He.normalize(r)),o=He.relative(n,s);return{submodule:n,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(),n=await Bc(r||"git",["--version"],{});if(n.error)if($i.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${ad}) of Git for Windows.`);let i=await Bc(ad,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof br){let n=String(r.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Io(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}}},e$={hash:"000000",isZeroCommit:!0,summary:""};function Uq(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(KI(r[a])){let s=r[a].split(" "),o=jq(s,i,n);for(a++;KI(r[a]);a++){let l=r[a].split(" ");Gq(l,n,i)}qq(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 jq(t,e,r){let n=t[0];if(r.hashPerLine.push(n),r.originalFileLineNrPerLine.push(parseInt(t[1])),r.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return n}function Gq(t,e,r){let n=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[r],s=e.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=JI(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=JI(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}e.commits.set(a,s)}function qq(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Vw(t.author)&&(t.author=void 0),Vw(t.committer)&&(t.committer=void 0),Vw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Vw(t){return!t||Object.keys(t).length===0}function KI(t){return t.length>0&&t[0].trim()===t[0]}function JI(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}p();var k$=require("@codemirror/state");p();var Ww=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Fi=new Ww;p();var oh=require("@codemirror/state"),t$=bt(Yw());function r$(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var n$=oh.StateEffect.define();function i$(t,e,r){return r.update({effects:n$.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Wo=oh.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(n$))return r.value;return zq(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function lh(t){var a;let e=t$.sha256.create();if(!t)return e;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=t;e.update(r==="untracked"?"t":"f"),e.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var tn={get:void 0,save:void 0};function a$(t,e){tn.get=t,tn.save=e}function ch(t){var e,r;return(r=(e=sh(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:sh(Xe.lineAuthor.coloringMaxAge).asDays()}function zq(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,n,i,a)=>{var m;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(r).number,u=s.lineAt(n).number,c=o.lineAt(i).number,f=o.lineAt(a).number,d=u-l+1,h=f-c+1;for(let g=c;g<=f;g++){let v=(m=e.lineOffsetsFromUnsavedChanges.get(g))!=null?m:0,w=f===g,b=h-d;w&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}p();function s$(){Yo=void 0,Xw=[],uh=0,dh.clear(),hh.clear(),Xo.clear()}var Yo,fh=()=>Yo;function o$(t,e){var i;let r=e.length;if(r<((i=Yo==null?void 0:Yo.length)!=null?i:0))return;Yo={gutter:t,length:r,text:e};let n=tn.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,tn.save(n))}var Xw=[],Vq=15,uh=0;function l$(t){Xw[uh]=t,uh=(uh+1)%Vq}function c$(){return K2(Xw)}var dh=new Map,hh=new Map,Xo=new Set;p();var x$=require("@codemirror/state"),S$=require("@codemirror/view");p();var Qw=require("@codemirror/view"),w$=bt(Yw()),vh=require("obsidian");p();p();var ph={x:-10,y:-10};function u$(){ph.x===-10&&window.addEventListener("mousedown",t=>{ph.x=t.clientX,ph.y=t.clientY})}function f$(){for(let t of Xo)if(Wq(t,ph))return t}function Wq(t,e){let{x:r,y:n,width:i,height:a}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+i&&n<=e.y&&e.y<=n+a}var d$="data-commit";function h$(t,e,r){if(e.hasFocus())return;let n=f$();if(!n)return;let i=Xq(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&Yq(i,t),Zw("showCommitHash",t),Zw("authorDisplay",t),Zw("dateTimeFormatOptions",t))}function Yq(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-aut
Line truncated
|
||||
If turned on, do auto ${i} every ${tP(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(c=>c.setValue(n.settings.autoBackupAfterFileChange).onChange(async f=>{n.settings.autoBackupAfterFileChange=f,this.refreshDisplayWithDelay(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new U.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(c=>c.setValue(n.settings.setLastSaveToLastCommit).onChange(async f=>{n.settings.setLastSaveToLastCommit=f,await n.saveSettings(),n.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPushInterval"}),c.setPlaceholder(String(Xe.autoPushInterval)),c.onChange(async f=>{f!==""?n.settings.autoPushInterval=Number(f):n.settings.autoPushInterval=Xe.autoPushInterval,await n.saveSettings(),n.automaticsManager.reload("push")})}),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPullInterval"}),c.setPlaceholder(String(Xe.autoPullInterval)),c.onChange(async f=>{f!==""?n.settings.autoPullInterval=Number(f):n.settings.autoPullInterval=Xe.autoPullInterval,await n.saveSettings(),n.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${i} only staged files`).setDesc(`If turned on, only staged files are committed on ${i}. If turned off, all changed files are committed.`).addToggle(c=>c.setValue(n.settings.autoCommitOnlyStaged).onChange(async f=>{n.settings.autoCommitOnlyStaged=f,await n.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(c=>c.setValue(n.settings.customMessageOnAutoBackup).onChange(async f=>{n.settings.customMessageOnAutoBackup=f,await n.saveSettings(),this.refreshDisplayWithDelay()})),s=new U.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(c=>{c.setPlaceholder(Xe.autoCommitMessage).onChange(async f=>{f===""?n.settings.autoCommitMessage=Xe.autoCommitMessage:n.settings.autoCommitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading(),new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(c=>{c.setPlaceholder(Xe.commitMessage).onChange(async f=>{f===""?n.settings.commitMessage=Xe.commitMessage:n.settings.commitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessage"})}),new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(c=>{c.onChange(async f=>{f===""?n.settings.commitMessageScript=Xe.commitMessageScript:n.settings.commitMessageScript=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(c=>c.setDefaultFormat(n.settings.commitDateFormat).setValue(n.settings.commitDateFormat).onChange(async f=>{n.settings.commitDateFormat=f,await n.saveSettings()}));u.descEl.innerHTML=`
|
||||
Specify custom date format. E.g. "${jg}. See <a href="https://momentjs.com">Moment.js</a> for more formats.`,new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(c=>{var f;return c.setValue((f=n.localStorage.getHostname())!=null?f:"").onChange(d=>{n.localStorage.setHostname(d)})}),new U.Setting(r).setName("Preview commit message").addButton(c=>c.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new U.Notice(`${f}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(c=>c.setValue(n.settings.listChangedFilesInMessageBody).onChange(async f=>{n.settings.listChangedFilesInMessageBody=f,await n.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof _e&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(c=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};c.addOptions(f),c.setValue(n.settings.syncMethod),c.onChange(async d=>{n.settings.syncMethod=d,await n.saveSettings()})}),new U.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(c=>{let f={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};c.addOptions(f),c.setValue(n.settings.mergeStrategy),c.onChange(async d=>{n.settings.mergeStrategy=d,await n.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(c=>c.setValue(n.settings.autoPullOnBoot).onChange(async f=>{n.settings.autoPullOnBoot=f,await n.saveSettings()})),new U.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 U.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(c=>c.setValue(!n.settings.disablePush).onChange(async f=>{n.settings.disablePush=!f,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.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(c=>c.setValue(n.settings.pullBeforePush).onChange(async f=>{n.settings.pullBeforePush=f,this.refreshDisplayWithDelay(),await n.saveSettings()})),n.gitManager instanceof _e&&(new U.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new U.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(c=>c.setValue(n.settings.hunks.showSigns).onChange(async f=>{n.settings.hunks.showSigns=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(c=>c.setValue(n.settings.hunks.hunkCommands).onChange(async f=>{n.settings.hunks.hunkCommands=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Status bar with summary of line changes").addDropdown(c=>c.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(n.settings.hunks.statusBar).onChange(async f=>{n.settings.hunks.statusBar=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new U.Setting(r).setName("History view").setHeading(),new U.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(u=>{let c={hide:"Hide",full:"Full",initials:"Initials"};u.addOptions(c),u.setValue(n.settings.authorInHistoryView),u.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new U.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(u=>u.setValue(n.settings.dateInHistoryView).onChange(async c=>{n.settings.dateInHistoryView=c,await n.saveSettings(),await n.refresh()})),new U.Setting(r).setName("Source control view").setHeading(),ne
Line truncated
|
||||
`)),u.onChange(c=>{n.localStorage.setEnvVars(c.split(`
|
||||
`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(u=>{u.setValue(n.localStorage.getPATHPaths().join(`
|
||||
`)),u.onChange(c=>{n.localStorage.setPATHPaths(c.split(`
|
||||
`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(u=>{u.setButtonText("Reload"),u.setCta(),u.onClick(async()=>{await n.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(`
|
||||
Sets the relative path to the vault from which the Git binary should be executed.
|
||||
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
|
||||
`).addText(c=>{c.setValue(n.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{n.settings.basePath=u,await n.saveSettings(),n.gitManager.updateBasePath(u||"").catch(f=>n.displayError(f))})}),new z.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(n.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{n.settings.gitDir=u,await n.saveSettings()})}),new z.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(n.localStorage.getPluginDisabled()).onChange(u=>{n.localStorage.setPluginDisabled(u),u?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new z.Notice("Obsidian must be restarted for the changes to take affect.")})),new z.Setting(r).setName("Support").setHeading(),new z.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.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 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 z.Notice("Debug information copied to clipboard. May contain sensitive information!")},z.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"),z.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 z.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="${sU}">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.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let n=new z.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=`
|
||||
`).addText(u=>{u.setValue(n.settings.basePath),u.setPlaceholder("directory/directory-with-git-repo"),u.onChange(async c=>{n.settings.basePath=c,await n.saveSettings(),n.gitManager.updateBasePath(c||"").catch(f=>n.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(u=>{u.setValue(n.settings.gitDir),u.setPlaceholder(".git"),u.onChange(async c=>{n.settings.gitDir=c,await n.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(u=>u.setValue(n.localStorage.getPluginDisabled()).onChange(c=>{n.localStorage.setPluginDisabled(c),c?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(u=>{u.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 l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let u=r.createDiv();u.setAttr("align","center"),u.setText(`Debugging and logging:
|
||||
You can always see the logs of this and every other plugin by opening the console with`);let c=r.createDiv();c.setAttr("align","center"),c.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?c.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):c.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.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,n){this.settings.lineAuthor[r]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.innerHTML=`
|
||||
<a href="${lz}">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.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let n=new U.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.
|
||||
@@ -176,12 +175,12 @@ You can always see the logs of this and every other plugin by opening the consol
|
||||
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 ${dd} characters) within the same (or all) commit(s), <em>the originating</em> commit's information is shown.`,new z.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new z.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 z.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.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new z.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 z.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=`
|
||||
for matches (at least ${id} characters) within the same (or all) commit(s), <em>the originating</em> commit's information is shown.`,new U.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new U.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 U.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.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new U.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 U.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 z.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,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new z.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=`
|
||||
`;let i=new U.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,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new U.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 highly recommended to use
|
||||
@@ -195,7 +194,7 @@ You can always see the logs of this and every other plugin by opening the consol
|
||||
See: <a href="https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css">
|
||||
List of available CSS variables in Obsidian
|
||||
<a/>
|
||||
`,new z.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=`
|
||||
`,new U.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).
|
||||
@@ -206,22 +205,37 @@ You can always see the logs of this and every other plugin by opening the consol
|
||||
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 z.Setting(this.containerEl).setName("").addText(i=>{let a=Rv(r,this.settings.lineAuthor),s=Rv(r,Xe.lineAuthor);i.setPlaceholder(mv(s)),i.setValue(mv(a)),i.onChange(async o=>{let l=n3(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,Rv(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?Mv(r,n):"rgba(127,127,127,0.3)",s=z.moment.unix(z.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
|
||||
`}}createColorSetting(r){let n=new U.Setting(this.containerEl).setName("").addText(i=>{let a=n0(r,this.settings.lineAuthor),s=n0(r,Xe.lineAuthor);i.setPlaceholder(Jv(s)),i.setValue(Jv(a)),i.onChange(async o=>{let l=X2(o);if(l!==void 0){let u=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,n0(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?gh(r,n):"rgba(127,127,127,0.3)",s=U.moment.unix(U.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,z.moment)().format(r);return`<a href="${aU}">Format string</a> to display the authoring date.</br>Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=Zd(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]}setNonDefaultValue({settingsProperty:r,text:n}){let i=this.plugin.settings[r];Xe[r]!==i&&(typeof i=="string"||typeof i=="number"||typeof i=="boolean"?n.setValue(String(i)):n.setValue(JSON.stringify(i)))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function Rv(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Zd(t){let e=z.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function C3(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var P3=Jd.StateEffect.define();function R3(t,e,r){return r.update({effects:P3.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Lo=Jd.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(P3))return r.value;return oU(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function Qd(t){var a;let e=T3.sha256.create();if(!t)return e;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=t;e.update(r==="untracked"?"t":"f"),e.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var Qr={get:void 0,save:void 0};function M3(t,e){Qr.get=t,Qr.save=e}function eh(t){var e,r;return(r=(e=Zd(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Zd(Xe.lineAuthor.coloringMaxAge).asDays()}function oU(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,n,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(r).number,c=s.lineAt(n).number,u=o.lineAt(i).number,f=o.lineAt(a).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let v=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,y=f===g,b=h-d;y&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}var Ov=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let n=this.view.state,i=R3(e,r,n);this.view.dispatch(i)}updateToNewState(e){let r=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,r&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(Do.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){Do.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(th.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(th.editorEditorField)}},I3=O3.StateField.define({create:t=>new Ov(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});m();function F3(){jo=void 0,Iv=[],rh=0,ih.clear(),ah.clear(),No.clear()}var jo,nh=()=>jo;function $3(t,e){var i;let r=e.length;if(r<((i=jo==null?void 0:jo.length)!=null?i:0))return;jo={gutter:t,length:r,text:e};let n=Qr.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,Qr.save(n))}var Iv=[],lU=15,rh=0;function D3(t){Iv[rh]=t,rh=(rh+1)%lU}function L3(){return a3(Iv)}var ih=new Map,ah=new Map,No=new Set;m();var K3=require("@codemirror/state"),Z3=require("@codemirror/view");m();var Lv=require("@codemirror/view"),q3=Ot(_v()),lh=require("obsidian");m();m();var sh={x:-10,y:-10};function j3(){sh.x===-10&&window.addEventListener("mousedown",t=>{sh.x=t.clientX,sh.y=t.clientY})}function N3(){for(let t of No)if(cU(t,sh))return t}function cU(t,e){let{x:r,y:n,width:i,height:a}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+i&&n<=e.y&&e.y<=n+a}m();var Nc={};var B3="data-commit";function H3(t,e,r){if(e.hasFocus())return;let n=N3();if(!n)return;let i=fU(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&uU(i,t),Fv("showCommitHash",t),Fv("authorDisplay",t),Fv("dateTimeFormatOptions",t))}function uU(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(t.hash)))}function Fv(t,e){var l,c;let r,n,i=Nc.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Xe.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",n=a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(s?a:u),n=s?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(s?a:u),r+=r.contains("date")?"":" date",n=s?"hide":u}else pa(t);e.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=Nc.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,n)}))}function U3(t,e,r){r.setAttr(B3,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function fU(t){let e=t.getAttr(B3);return e?JSON.parse(e):void 0}m();function Mv(t,e){return t==="oldest"?oh(0,!1,e).color:oh(void 0,!0,e).color}function oh(t,e,r){let n=eh(r),i=Date.now()/1eLine truncated
|
||||
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,$r.setIcon)(this.iconEl,"globe"):(0,$r.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var ph=require("obsidian"),hh=class extends ph.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,ph.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)}};m();var tM=require("obsidian"),Bc=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,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),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 e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,tM.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 n=this.diff(this.plugin.settings.autoSaveInterval,r);if(n>0)return this.startAutoCommitAndSync(n),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebo
Line truncated
|
||||
- ${a.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(To,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&To.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(To,"/",!0)}openDiff({aFile:e,bFile:r,aRef:n,bRef:i,event:a}){var l,c;let s=this.plugin.settings.diffStyle;Ho.Platform.isMobileApp&&(s="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:n,bRef:i};s=="split"?(l=vn(this.plugin.app,a))==null||l.setViewState({type:ca.type,active:!0,state:o}):s=="git_unified"&&((c=vn(this.plugin.app,a))==null||c.setViewState({type:ua.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Ce))return;let n=await new ze(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new Ho.Notice(`Running '${n}'...`,999999);try{let a=await e.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};m();m();m();m();var Ke;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(Ke||(Ke={}));var lM={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},cM={LINES:"lines",WORDS:"words",NONE:"none"},uM={WORD:"word",CHAR:"char"},as;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(as||(as={}));m();var SU=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],EU=RegExp("["+SU.join("\\")+"]","g");function fM(t){return t.replace(EU,"\\$&")}function Hv(t){return t&&t.replace(/\\/g,"/")}function dM(t){let e,r,n,i=0;for(e=0,n=t.length;e<n;e++)r=t.charCodeAt(e),i=(i<<5)-i+r,i|=0;return i}function yh(t){let e=t.length,r=-1/0;for(let n=0;n<e;n++)r=Math.max(r,t[n]);return r}function hM(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function pM(t,e){return e.reduce((r,n)=>r||t.startsWith(n),!1)}var mM=["a/","b/","i/","w/","c/","o/"];function ga(t,e,r){let n=r!==void 0?[...mM,r]:mM,i=e?new RegExp(`^${fM(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=n.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function AU(t,e){return ga(t,"---",e)}function kU(t,e){return ga(t,"+++",e)}function gM(t,e={}){let r=[],n=null,i=null,a=null,s=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})/,y=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,E=/^rename from "?(.+)"?/,S=/^rename to "?(.+)"?/,A=/^similarity index (\d+)%/,k=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,T=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,C=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,L=/^deleted file mode (\d{6}),(\d{6})/,$=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
|
||||
>${o}</div>`}`}previewCustomDateTimeDescriptionHtml(r){let n=(0,U.moment)().format(r);return`<a href="${oz}">Format string</a> to display the authoring date.</br>Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=sh(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]}setNonDefaultValue({settingsProperty:r,text:n}){let i=this.plugin.settings[r];Xe[r]!==i&&(typeof i=="string"||typeof i=="number"||typeof i=="boolean"?n.setValue(String(i)):n.setValue(JSON.stringify(i)))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function n0(t,e){return t==="oldest"?e.colorOld:e.colorNew}function sh(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}p();var Lr=require("obsidian");var bh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,Lr.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,Lr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Lr.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Lr.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Lr.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Lr.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Lr.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let i=(0,Lr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=`
|
||||
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Lr.setIcon)(this.iconEl,"globe"):(0,Lr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.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()}};p();var xh=require("obsidian"),_h=class extends xh.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,xh.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)}};p();var T$=require("obsidian"),Zc=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,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),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 e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,T$.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 n=this.diff(this.plugin.settings.autoSaveInterval,r);if(n>0)return this.startAutoCommitAndSync(n),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebo
Line truncated
|
||||
`)}static newName(){let e=O$[F$]||1;return O$[F$]=e+1,i0+e.toString(36)}static mount(e,r,n){let i=e[a0],a=n&&n.nonce;i?a&&i.setNonce(a):i=new s0(e,a),i.mount(Array.isArray(r)?r:[r],e)}},M$=new Map,s0=class{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let a=M$.get(n);if(a)return e[a0]=a;this.sheet=new i.CSSStyleSheet,M$.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[a0]=this}mount(e,r){let n=this.sheet,i=0,a=0;for(let s=0;s<e.length;s++){let o=e[s],l=this.modules.indexOf(o);if(l<a&&l>-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,o),n)for(let u=0;u<o.rules.length;u++)n.insertRule(o.rules[u],i++)}else{for(;a<l;)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 l=0;l<this.modules.length;l++)s+=this.modules[l].getRules()+`
|
||||
`;this.styleTag.textContent=s;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 Q$=require("@codemirror/language"),cz=require("@lezer/highlight"),ht=class t{constructor(e,r,n,i){this.fromA=e,this.toA=r,this.fromB=n,this.toB=i}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function hs(t,e,r,n,i,a){if(t==n)return[];let s=p0(t,e,r,n,i,a),o=m0(t,e+s,r,n,i+s,a);e+=s,r-=o,i+=s,a-=o;let l=r-e,u=a-i;if(!l||!u)return[new ht(e,r,i,a)];if(l>u){let f=t.slice(e,r).indexOf(n.slice(i,a));if(f>-1)return[new ht(e,e+f,i,i),new ht(e+f+u,r,a,a)]}else if(u>l){let f=n.slice(i,a).indexOf(t.slice(e,r));if(f>-1)return[new ht(e,e,i,i+f),new ht(r,r,i+f+l,a)]}if(l==1||u==1)return[new ht(e,r,i,a)];let c=tF(t,e,r,n,i,a);if(c){let[f,d,h]=c;return hs(t,e,f,n,i,d).concat(hs(t,f+h,r,n,d+h,a))}return uz(t,e,r,n,i,a)}var Jc=1e9,Qc=0,h0=!1;function uz(t,e,r,n,i,a){let s=r-e,o=a-i;if(Jc<1e9&&Math.min(s,o)>Jc*16||Qc>0&&Date.now()>Qc)return Math.min(s,o)>Jc*64?[new ht(e,r,i,a)]:D$(t,e,r,n,i,a);let l=Math.ceil((s+o)/2);o0.reset(l),l0.reset(l);let u=(h,m)=>t.charCodeAt(e+h)==n.charCodeAt(i+m),c=(h,m)=>t.charCodeAt(r-h-1)==n.charCodeAt(a-m-1),f=(s-o)%2!=0?l0:null,d=f?null:o0;for(let h=0;h<l;h++){if(h>Jc||Qc>0&&!(h&63)&&Date.now()>Qc)return D$(t,e,r,n,i,a);let m=o0.advance(h,s,o,l,f,!1,u)||l0.advance(h,s,o,l,d,!0,c);if(m)return fz(t,e,r,e+m[0],n,i,a,i+m[1])}return[new ht(e,r,i,a)]}var Rh=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,n,i,a,s,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let u=i+l,c=l==-e||l!=e&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,f=c-l;for(;c<r&&f<n&&o(c,f);)c++,f++;if(this.vec[u]=c,c>r)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-l;if(d>=0&&d<this.len&&a.vec[d]!=-1)if(s){let h=a.vec[d];if(h>=r-c)return[h,i+h-d]}else{let h=r-a.vec[d];if(c>=h)return[c,f]}}}return null}},o0=new Rh,l0=new Rh;function fz(t,e,r,n,i,a,s,o){let l=!1;return!Jo(t,n)&&++n==r&&(l=!0),!Jo(i,o)&&++o==s&&(l=!0),l?[new ht(e,r,a,s)]:hs(t,e,n,i,a,o).concat(hs(t,n,r,i,o,s))}function eF(t,e){let r=1,n=Math.min(t,e);for(;r<n;)r=r<<1;return r}function p0(t,e,r,n,i,a){if(e==r||e==a||t.charCodeAt(e)!=n.charCodeAt(i))return 0;let s=eF(r-e,a-i);for(let o=e,l=i;;){let u=o+s,c=l+s;if(u>r||c>a||t.slice(o,u)!=n.slice(l,c)){if(s==1)return o-e-(Jo(t,o)?0:1);s=s>>1}else{if(u==r||c==a)return u-e;o=u,l=c}}}function m0(t,e,r,n,i,a){if(e==r||i==a||t.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=eF(r-e,a-i);for(let o=r,l=a;;){let u=o-s,c=l-s;if(u<e||c<i||t.slice(u,o)!=n.slice(c,l)){if(s==1)return r-o-(Jo(t,o)?0:1);s=s>>1}else{if(u==e||c==i)return r-u;o=u,l=c}}}function c0(t,e,r,n,i,a,s,o){let l=n.slice(i,a),u=null;for(;;){if(u||s<o)return u;for(let c=e+s;;){Jo(t,c)||c++;let f=c+s;if(Jo(t,f)||(f+=f==c+1?1:-1),f>=r)break;let d=t.slice(c,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let m=p0(t,f,r,n,i+h+d.length,a),g=m0(t,e,c,n,i,i+h),v=d.length+m+g;(!u||u[2]<v)&&(u=[c-g,i+h-g,v])}c=f}if(o<0)return u;s=s>>1}}function tF(t,e,r,n,i,a){let s=r-e,o=a-i;if(s<o){let l=tF(n,i,a,t,e,r);return l&&[l[1],l[0],l[2]]}return s<4||o*2<s?null:c0(t,e,r,n,i,a,Math.floor(s/4),-1)}function D$(t,e,r,n,i,a){h0=!0;let s=r-e,o=a-i,l;if(s<o){let d=c0(n,i,a,t,e,r,Math.floor(s/6),50);l=d&&[d[1],d[0],d[2]]}else l=c0(t,e,r,n,i,a,Math.floor(o/6),50);if(!l)return[new ht(e,r,i,a)];let[u,c,f]=l;return hs(t,e,u,n,i,c).concat(hs(t,u+f,r,n,c+f,a))}function rF(t,e){for(let r=1;r<t.length;r++){let n=t[r-1],i=t[r];n.toA>i.fromA-e&&n.toB>i.fromB-e&&(t[r-1]=new ht(n.fromA,i.toA,n.fromB,i.toB),t.splice(r--,1))}}function dz(t,e,r){for(;;){rF(r,1);let n=!1;for(let i=0;i<r.length;i++){let a=r[i],s,o;(s=p0(t,a.fromA,a.toA,e,a.fromB,a.toB))&&(a=r[i]=new ht(a.fromA+s,a.toA,a.fromB+s,a.toB)),(o=m0(t,a.fromA,a.toA,e,a.fromB,a.toB))&&(a=r[i]=new ht(a.fromA,a.toA-o,a.fromB,a.toB-o));let l=a.toA-a.fromA,u=a.toB-a.fromB;if(l&&u)continue;let c=a.fromA-(i?r[i-1].toA:0),f=(i<r.length-1?r[i+1].fromA:t.length)-a.toA;if(!c||!f)continue;let d=l?t.slice(a.fromA,a.toA):e.slice(a.fromB,a.toB);c<=d.length&&t.slice(a.fromA-c,a.fromA)==d.slice(d.length-c)?(r[i]=new ht(a.fromA-c,a.toA-c,a.fromB-c,a.toB-c),n=!0):f<=d.length&&t.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 hz(t,e,r){for(let n=0,i=0;i<t.length;i++){let a=t[i],s=a.toA-a.fromA,o=a.toB-a.fromB;if(s&&o||s>3||o>3){let l=i==t.length-1?e.length:t[i+1].fromA,u=a.fromA-n,c=l-a.toA,f=N$(e,a.fromA,u),d=L$(e,a.toA,c),h=a.fromA-f,m=d-a.toA;if((!s||!o)&&h&&m){let g=Math.max(s,o),[v,w,b]=s?[e,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&e.slice(f,a.fromA)==v.slice(b-h,b)?(a=t[i]=new ht(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=L$(e,a.toA,l-a.toA)):g>m&&e.slice(a.toA,d)==v.slice(w,w+m)&&(a=t[i]=new ht(d-s,d,a.fromB+m,a.toB+m),d=a.
Line truncated
|
||||
`),a=e.split(`
|
||||
`);for(let s of r){let{oldStart:o,oldLines:l,newStart:u,newLines:c}=s,f=Et.createHunk(o,l,u,c);if(s.oldLines>0){for(let d=o;d<o+l;d++)f.removed.lines.push(i[d-1]);o+l>i.length&&i.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(s.newLines>0){for(let d=u;d<u+c;d++)f.added.lines.push(a[d-1]);u+c>a.length&&a.last()!=""&&(f.added.no_nl_at_eof=!0)}n.push(f)}return n}function y0(t,e,r){let n=e.lineAt(t.fromA).number,i=t.fromA==t.toA?0:Fh(e,t.endA)-n+1,a=r.lineAt(t.fromB).number,s=t.fromB==t.toB?0:Fh(r,t.endB)-a+1,o={oldStart:n,oldLines:i,newStart:a,newLines:s};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var hF={scanLimit:1e3,timeout:200};function Pz(t,e,r,n){let i=v0.Text.of(t.split(`
|
||||
`)),a=v0.Text.of(e.split(`
|
||||
`)),s=r&&n?Oi.updateB(r,i,a,n,hF):Oi.build(i,a,hF),o=[];for(let l=0;l<s.length;l++){let u=s[l],c=y0(u,i,a);o.push(c)}return{hunks:w0(t,e,o),chunks:s}}function pF(t,e,r,n){return Pz(t,e,r,n)}var el=require("obsidian");function Fh(t,e){let r=t.lineAt(e);return!(r.text.length==0&&r.number==t.lines)?r.number:r.number-1}var Sn=class{static hasHunksData(e){let r=e.field(xr,!1);return!!r&&!r.isDirty}static getHunks(e,r){let n=e.field(xr);return n?r?n.stagedHunks:n.hunks:[]}static getHunkAtPos(e,r,n){if(!e.field(xr))return;let a=e.doc.lineAt(r).number,s=this.getHunks(e,n);return Et.findHunk(a,s)[0]}static getCursorHunk(e,r){if(!e.field(xr))return;let i=e.selection.main.head;return this.getHunkAtPos(e,i,r)}static getHunk(e,r,n){if(n!=null)return this.getHunkAtPos(e,n,r);if(e.selection.main.empty)return this.getCursorHunk(e,r);let i=e.selection.main.from,a=e.selection.main.to,s=e.doc.lineAt(i).number,o=Fh(e.doc,a),l=this.getHunks(e,r),u=Et.createPartialHunk(l,s,o);if(!u)return;let c=e.field(xr);if(r){let f=s,d=o;for(let h of c.hunks)s>h.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));u.added.lines=c.compareText.split(`
|
||||
`).slice(f-1,d),c.compareTextHead?u.removed.lines=c.compareTextHead.split(`
|
||||
`).slice(u.removed.start-1,u.removed.start-1+u.removed.count):u.removed.lines=[]}else u.added.lines=e.doc.toString().split(`
|
||||
`).slice(s-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(`
|
||||
`)&&(u.added.no_nl_at_eof=!0),u.removed.lines=c.compareText.split(`
|
||||
`).slice(u.removed.start-1,u.removed.start-1+u.removed.count),u.removed.start+u.removed.count-1===c.compareText.split(`
|
||||
`).length&&!c.compareText.endsWith(`
|
||||
`)&&(u.removed.no_nl_at_eof=!0);return u}},xr=Qo.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let i of e.effects)i.is(tl)&&(r.compareText=i.value.compareText,r.compareTextHead=i.value.compareTextHead,n=(t==null?void 0:t.compareText)!==i.value.compareText,n&&(r.chunks=void 0)),i.is(tu)&&mF(r,i.value,e.state);if(r.compareText!==void 0){if(n||e.docChanged){r.isDirty=!0;let i=Rz(e,r.compareText,r.chunks,r.maxDiffTimeMs);i&&mF(r,i,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function mF(t,e,r){var i,a;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let n=r.field(el.editorInfoField).file;(a=(i=Zn.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,n)}var b0=Qo.StateField.define({create:()=>({debouncer:(0,el.debounce)(t=>{let{state:e,compareText:r,previousChunks:n,changeDesc:i}=t,a=gF(e,r,n,i);e.field(el.editorEditorField).dispatch({effects:tu.of(a)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let n of e.effects)if(n.is(tu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function gF(t,e,r,n){let i=t.doc.toString(),a=performance.now(),{hunks:s,chunks:o}=pF(e,i,r,n),l=performance.now()-a;return{hunks:s,chunks:o,diffDuration:l}}function Rz(t,e,r,n){let i=t.state,a=Math.abs(t.changes.length-t.changes.newLength),s=i.field(b0);if(a>1e3||n>16)s.debouncer({state:i,compareText:e,previousChunks:r,changeDesc:s.changeDesc});else return s.changeDesc=void 0,gF(i,e,r,t.changes)}var tl=Qo.StateEffect.define(),tu=Qo.StateEffect.define();function vF(t,e){return e.update({effects:tl.of(t)})}p();p();p();var Ze;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(Ze||(Ze={}));var wF={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},yF={LINES:"lines",WORDS:"words",NONE:"none"},bF={WORD:"word",CHAR:"char"},ms;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ms||(ms={}));p();var Iz=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],$z=RegExp("["+Iz.join("\\")+"]","g");function _F(t){return t.replace($z,"\\$&")}function _0(t){return t&&t.replace(/\\/g,"/")}function xF(t){let e,r,n,i=0;for(e=0,n=t.length;e<n;e++)r=t.charCodeAt(e),i=(i<<5)-i+r,i|=0;return i}function Oh(t){let e=t.length,r=-1/0;for(let n=0;n<e;n++)r=Math.max(r,t[n]);return r}function SF(t,e){let r=t.split(".");return r.length>1?r[r.length-1]:e}function EF(t,e){return e.reduce((r,n)=>r||t.startsWith(n),!1)}var kF=["a/","b/","i/","w/","c/","o/"];function Ea(t,e,r){let n=r!==void 0?[...kF,r]:kF,i=e?new RegExp(`^${_F(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=n.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Fz(t,e){return Ea(t,"---",e)}function Oz(t,e){return Ea(t,"+++",e)}function AF(t,e={}){let r=[],n=null,i=null,a=null,s=null,o=null,l=null,u=null,c="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,m=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,E=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,k=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,T=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,F=/^new file mode (\d{6})/,D=/^deleted file mode (\d{6}),(\d{6})/,M=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
|
||||
`).split(`
|
||||
`);function J(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function de(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&c!==null&&(n.newName=c),n.newName&&(r.push(n),n=null)),l=null,c=null}function le(){J(),de(),n={blocks:[],deletedLines:0,addedLines:0}}function ce(N){J();let W;n!==null&&((W=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(N))?(n.isCombined=!1,a=parseInt(W[1],10),o=parseInt(W[2],10)):(W=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(N))?(n.isCombined=!0,a=parseInt(W[1],10),s=parseInt(W[2],10),o=parseInt(W[3],10)):(N.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:N}}function Te(N){if(n===null||i===null||a===null||o===null)return;let W={content:N},B=n.isCombined?["+ "," +","++"]:["+"],$e=n.isCombined?["- "," -","--"]:["-"];pM(N,B)?(n.addedLines++,W.type=Ke.INSERT,W.oldNumber=void 0,W.newNumber=o++):pM(N,$e)?(n.deletedLines++,W.type=Ke.DELETE,W.oldNumber=a++,W.newNumber=void 0):(W.type=Ke.CONTEXT,W.oldNumber=a++,W.newNumber=o++),i.lines.push(W)}function ne(N,W){let B=W;for(;B<$.length-3;){if(N.startsWith("diff"))return!1;if($[B].startsWith(u)&&$[B+1].startsWith(f)&&$[B+2].startsWith(d))return!0;B++}return!1}return $.forEach((N,W)=>{if(!N||N.startsWith("*"))return;let B,$e=$[W-1],lr=$[W+1],Ut=$[W+2];if(N.startsWith("diff --git")||N.startsWith("diff --combined")){if(le(),(B=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(N))&&(l=ga(B[1],void 0,e.dstPrefix),c=ga(B[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(N.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(le(),(B=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(N))&&(l=ga(B[1],void 0,e.dstPrefix),c=ga(B[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&N.startsWith(u)&&lr.startsWith(f)&&Ut.startsWith(d))&&le(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&N.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let Oe=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";ce(Oe);return}if(N.startsWith(u)&&lr.startsWith(f)||N.startsWith(f)&&$e.startsWith(u)){if(n&&!n.oldName&&N.startsWith("--- ")&&(B=AU(N,e.srcPrefix))){n.oldName=B,n.language=hM(n.oldName,n.language);return}if(n&&!n.newName&&N.startsWith("+++ ")&&(B=kU(N,e.dstPrefix))){n.newName=B,n.language=hM(n.newName,n.language);return}}if(n&&(N.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){ce(N);return}if(i&&(N.startsWith("+")||N.startsWith("-")||N.startsWith(" "))){Te(N);return}let X=!ne(N,W);if(n===null)throw new Error("Where is my file !!!");(B=h.exec(N))?n.oldMode=B[1]:(B=p.exec(N))?n.newMode=B[1]:(B=g.exec(N))?(n.deletedFileMode=B[1],n.isDeleted=!0):(B=v.exec(N))?(n.newFileMode=B[1],n.isNew=!0):(B=y.exec(N))?(X&&(n.oldName=B[1]),n.isCopy=!0):(B=b.exec(N))?(X&&(n.newName=B[1]),n.isCopy=!0):(B=E.exec(N))?(X&&(n.oldName=B[1]),n.isRename=!0):(B=S.exec(N))?(X&&(n.newName=B[1]),n.isRename=!0):(B=x.exec(N))?(n.isBinary=!0,n.oldName=ga(B[1],void 0,e.srcPrefix),n.newName=ga(B[2],void 0,e.dstPrefix),ce("Binary file")):_.test(N)?(n.isBinary=!0,ce(N)):(B=A.exec(N))?n.unchangedPercentage=parseInt(B[1],10):(B=k.exec(N))?n.changedPercentage=parseInt(B[1],10):(B=w.exec(N))?(n.checksumBefore=B[1],n.checksumAfter=B[2],B[3]&&(n.mode=B[3])):(B=T.exec(N))?(n.checksumBefore=[B[2],B[3]],n.checksumAfter=B[1]):(B=C.exec(N))?(n.oldMode=[B[2],B[3]],n.newMode=B[1]):(B=I.exec(N))?(n.newFileMode=B[1],n.isNew=!0):(B=L.exec(N))&&(n.deletedFileMode=B[1],n.isDeleted=!0)}),J(),de(),r}m();m();m();function CU(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],n;for(n=0;n<=e.length;n++)r[n]=[n];let i;for(i=0;i<=t.length;i++)r[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?r[n][i]=r[n-1][i-1]:r[n][i]=Math.min(r[n-1][i-1]+1,Math.min(r[n][i-1]+1,r[n-1][i]+1));return r[e.length][t.length]}function Uo(t){return(e,r)=>{let n=t(e).trim(),i=t(r).trim();return CU(n,i)/(n.length+i.length)}}function Go(t){function e(n,i,a=new Map){let s=1/0,o;for(let l=0;l<n.length;++l)for(let c=0;c<i.length;++c){let u=JSON.stringify([n[l],i[c]]),f;a.has(u)&&(f=a.get(u))||(f=t(n[l],i[c]),a.set(u,f)),f<s&&(s=f,o={indexA:l,indexB:c,score:s})}return o}function r(n,i,a=0,s=new Map){let o=e(n,i,s);if(!o||n.length+i.length<3)return[[n,i]];let l=n.slice(0,o.indexA),c=i.slice(0,o.indexB),u=[n[o.indexA]],f=[i[o.indexB]],d=o.indexA+1,h=o.indexB+1,p=n.slice(d),g=i.slice(h),v=r(l,c,a+1,s),y=r(u,f,a+1,s),b=r(p,g,a+1,s),E=y;return(o.indexA>0||o.indexB>0)&&(E=v.concat(E)),(n.length>d||i.length>h)&&(E=E.concat(b)),E}return r}var Dt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info
Line truncated
|
||||
`);return this.hoganUtils.render(yM,"wrapper",{colorScheme:Vo(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Vv=Object.assign(Object.assign({},ss),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Gc="generic",wM="line-by-line",$U="icon",DU="tag",zc=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Vv),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||||
`);return this.hoganUtils.render(Gc,"wrapper",{colorScheme:Vo(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(wM,"file-diff"),i=this.hoganUtils.template(Gc,"file-path"),a=this.hoganUtils.template($U,"file"),s=this.hoganUtils.template(DU,Wo(e));return n.render({file:e,fileHtmlId:qo(e),diffs:r,filePath:i.render({fileDiffName:os(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Gc,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Dt})}generateFileHtml(e){let r=Go(Uo(n=>en(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(Gc,"block-header",{CSSLineClass:Dt,blockHeader:e.isTooBig?n.header:va(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(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=en(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:Dt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(`
|
||||
`)}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==Ke.INSERT&&i.length||s.type===Ke.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ke.CONTEXT?r.push([[s],[],[]]):s.type===Ke.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ke.INSERT&&n.length>0?i.push(s):s.type===Ke.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=yh(e.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(e,r):[[e,r]]}processChangedLines(e,r,n,i){let a={right:"",left:""},s=Math.max(n.length,i.length);for(let o=0;o<s;o++){let l=n[o],c=i[o],u=l!==void 0&&c!==void 0?wh(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:Dt.DELETE_CHANGES}:Object.assign(Object.assign({},en(l.content,r)),{type:zo(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:Dt.INSERT_CHANGES}:Object.assign(Object.assign({},en(c.content,r)),{type:zo(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);a.left+=h,a.right+=p}return a}generateLineHtml(e,r,n){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let n=this.hoganUtils.render(wM,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(Gc,"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:e})}};m();var qv=Object.assign(Object.assign({},ss),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Vc="generic",LU="side-by-side",jU="icon",NU="tag",qc=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},qv),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||||
`);return this.hoganUtils.render(Vc,"wrapper",{colorScheme:Vo(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(LU,"file-diff"),i=this.hoganUtils.template(Vc,"file-path"),a=this.hoganUtils.template(jU,"file"),s=this.hoganUtils.template(NU,Wo(e));return n.render({file:e,fileHtmlId:qo(e),diffs:r,filePath:i.render({fileDiffName:os(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Vc,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Dt})}}generateFileHtml(e){let r=Go(Uo(n=>en(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=en(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Dt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Dt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}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(e){let r=[],n=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==Ke.INSERT&&i.length||s.type===Ke.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ke.CONTEXT?r.push([[s],[],[]]):s.type===Ke.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ke.INSERT&&n.length>0?i.push(s):s.type===Ke.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=yh(e.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(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(Vc,"block-header",{CSSLineClass:Dt,blockHeader:r!=null&&r.isTooBig?e:va(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,n){let i={right:"",left:""},a=Math.max(r.length,n.length);for(let s=0;s<a;s++){let o=r[s],l=n[s],c=o!==void 0&&l!==void 0?wh(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:Dt.DELETE_CHANGES}:Object.assign(Object.assign({},en(o.content,e)),{type:zo(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:Dt.INSERT_CHANGES}:Object.assign(Object.assign({},en(l.content,e)),{type:zo(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);i.left+=d,i.right+=h}return i}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(Vc,"line",{type:(e==null?void 0:e.type)||`${Dt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?n:`${n} 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 Kv=Ot(Xv());m();var ht=Ot(Xv()),dt={};dt["file-summary-line"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<li class="d2h-file-list-line">'),n.b(`
|
||||
`);function re(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function ye(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&u!==null&&(n.newName=u),n.newName&&(r.push(n),n=null)),l=null,u=null}function me(){re(),ye(),n={blocks:[],deletedLines:0,addedLines:0}}function fe(B){re();let Z;n!==null&&((Z=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(B))?(n.isCombined=!1,a=parseInt(Z[1],10),o=parseInt(Z[2],10)):(Z=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(B))?(n.isCombined=!0,a=parseInt(Z[1],10),s=parseInt(Z[2],10),o=parseInt(Z[3],10)):(B.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:B}}function Ge(B){if(n===null||i===null||a===null||o===null)return;let Z={content:B},H=n.isCombined?["+ "," +","++"]:["+"],Oe=n.isCombined?["- "," -","--"]:["-"];EF(B,H)?(n.addedLines++,Z.type=Ze.INSERT,Z.oldNumber=void 0,Z.newNumber=o++):EF(B,Oe)?(n.deletedLines++,Z.type=Ze.DELETE,Z.oldNumber=a++,Z.newNumber=void 0):(Z.type=Ze.CONTEXT,Z.oldNumber=a++,Z.newNumber=o++),i.lines.push(Z)}function oe(B,Z){let H=Z;for(;H<M.length-3;){if(B.startsWith("diff"))return!1;if(M[H].startsWith(c)&&M[H+1].startsWith(f)&&M[H+2].startsWith(d))return!0;H++}return!1}return M.forEach((B,Z)=>{if(!B||B.startsWith("*"))return;let H,Oe=M[Z-1],cr=M[Z+1],Gt=M[Z+2];if(B.startsWith("diff --git")||B.startsWith("diff --combined")){if(me(),(H=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(B.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(me(),(H=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&B.startsWith(c)&&cr.startsWith(f)&&Gt.startsWith(d))&&me(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&B.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let Ie=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";fe(Ie);return}if(B.startsWith(c)&&cr.startsWith(f)||B.startsWith(f)&&Oe.startsWith(c)){if(n&&!n.oldName&&B.startsWith("--- ")&&(H=Fz(B,e.srcPrefix))){n.oldName=H,n.language=SF(n.oldName,n.language);return}if(n&&!n.newName&&B.startsWith("+++ ")&&(H=Oz(B,e.dstPrefix))){n.newName=H,n.language=SF(n.newName,n.language);return}}if(n&&(B.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){fe(B);return}if(i&&(B.startsWith("+")||B.startsWith("-")||B.startsWith(" "))){Ge(B);return}let Y=!oe(B,Z);if(n===null)throw new Error("Where is my file !!!");(H=h.exec(B))?n.oldMode=H[1]:(H=m.exec(B))?n.newMode=H[1]:(H=g.exec(B))?(n.deletedFileMode=H[1],n.isDeleted=!0):(H=v.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=w.exec(B))?(Y&&(n.oldName=H[1]),n.isCopy=!0):(H=b.exec(B))?(Y&&(n.newName=H[1]),n.isCopy=!0):(H=E.exec(B))?(Y&&(n.oldName=H[1]),n.isRename=!0):(H=x.exec(B))?(Y&&(n.newName=H[1]),n.isRename=!0):(H=S.exec(B))?(n.isBinary=!0,n.oldName=Ea(H[1],void 0,e.srcPrefix),n.newName=Ea(H[2],void 0,e.dstPrefix),fe("Binary file")):_.test(B)?(n.isBinary=!0,fe(B)):(H=k.exec(B))?n.unchangedPercentage=parseInt(H[1],10):(H=A.exec(B))?n.changedPercentage=parseInt(H[1],10):(H=y.exec(B))?(n.checksumBefore=H[1],n.checksumAfter=H[2],H[3]&&(n.mode=H[3])):(H=T.exec(B))?(n.checksumBefore=[H[2],H[3]],n.checksumAfter=H[1]):(H=P.exec(B))?(n.oldMode=[H[2],H[3]],n.newMode=H[1]):(H=F.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=D.exec(B))&&(n.deletedFileMode=H[1],n.isDeleted=!0)}),re(),ye(),r}p();p();p();function En(){}En.prototype={diff:function(e,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(x){return x=s.postProcess(x,i),a?(setTimeout(function(){a(x)},0),!0):x}e=this.castInput(e,i),r=this.castInput(r,i),e=this.removeEmpty(this.tokenize(e,i)),r=this.removeEmpty(this.tokenize(r,i));var l=r.length,u=e.length,c=1,f=l+u;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,m=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(m[0],r,e,0,i);if(m[0].oldPos+1>=u&&g+1>=l)return o(TF(s,m[0].lastComponent,r,e,s.useLongestToken));var v=-1/0,w=1/0;function b(){for(var x=Math.max(v,-c);x<=Math.min(w,c);x+=2){var k=void 0,A=m[x-1],y=m[x+1];A&&(m[x-1]=void 0);var S=!1;if(y){var _=y.oldPos-x;S=y&&0<=_&&_<l}var T=A&&A.oldPos+1<u;if(!S&&!T){m[x]=void 0;continue}if(!T||S&&A.oldPos<y.oldPos?k=s.addToPath(y,!0,!1,0,i):k=s.addToPath(A,!1,!0,1,i),g=s.extractCommon(k,r,e,x,i),k.oldPos+1>=u&&g+1>=l)return o(TF(s,k.lastComponent,r,e,s.useLongestToken));m[x]=k,k.oldPos+1>=u&&(w=Math.min(w,x-1)),g
Line truncated
|
||||
`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i<n.length;i++){var a=n[i];i%2&&!e.newlineIsToken?r[r.length-1]+=a:r.push(a)}return r};T0.equals=function(t,e,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
||||
`))&&(t=t.trim()),(!r.newlineIsToken||!e.includes(`
|
||||
`))&&(e=e.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
||||
`)&&(t=t.slice(0,-1)),e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1))),En.prototype.equals.call(this,t,e,r)};var Bz=new En;Bz.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var Hz=new En;Hz.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function E0(t){"@babel/helpers - typeof";return E0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E0(t)}var nu=new En;nu.useLongestToken=!0;nu.tokenize=T0.tokenize;nu.castInput=function(t,e){var r=e.undefinedReplacement,n=e.stringifyReplacer,i=n===void 0?function(a,s){return typeof s=="undefined"?r:s}:n;return typeof t=="string"?t:JSON.stringify(k0(t,null,null,i),i," ")};nu.equals=function(t,e,r){return En.prototype.equals.call(nu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function k0(t,e,r,n,i){e=e||[],r=r||[],n&&(t=n(i,t));var a;for(a=0;a<e.length;a+=1)if(e[a]===t)return r[a];var s;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),s=new Array(t.length),r.push(s),a=0;a<t.length;a+=1)s[a]=k0(t[a],e,r,n,i);return e.pop(),r.pop(),s}if(t&&t.toJSON&&(t=t.toJSON()),E0(t)==="object"&&t!==null){e.push(t),s={},r.push(s);var o=[],l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&o.push(l);for(o.sort(),a=0;a<o.length;a+=1)l=o[a],s[l]=k0(t[l],e,r,n,l);e.pop(),r.pop()}else s=t;return s}var A0=new En;A0.tokenize=function(t){return t.slice()};A0.join=A0.removeEmpty=function(t){return t};p();function jz(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],n;for(n=0;n<=e.length;n++)r[n]=[n];let i;for(i=0;i<=t.length;i++)r[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=t.length;i++)e.charAt(n-1)===t.charAt(i-1)?r[n][i]=r[n-1][i-1]:r[n][i]=Math.min(r[n-1][i-1]+1,Math.min(r[n][i-1]+1,r[n-1][i]+1));return r[e.length][t.length]}function rl(t){return(e,r)=>{let n=t(e).trim(),i=t(r).trim();return jz(n,i)/(n.length+i.length)}}function nl(t){function e(n,i,a=new Map){let s=1/0,o;for(let l=0;l<n.length;++l)for(let u=0;u<i.length;++u){let c=JSON.stringify([n[l],i[u]]),f;a.has(c)&&(f=a.get(c))||(f=t(n[l],i[u]),a.set(c,f)),f<s&&(s=f,o={indexA:l,indexB:u,score:s})}return o}function r(n,i,a=0,s=new Map){let o=e(n,i,s);if(!o||n.length+i.length<3)return[[n,i]];let l=n.slice(0,o.indexA),u=i.slice(0,o.indexB),c=[n[o.indexA]],f=[i[o.indexB]],d=o.indexA+1,h=o.indexB+1,m=n.slice(d),g=i.slice(h),v=r(l,u,a+1,s),w=r(c,f,a+1,s),b=r(m,g,a+1,s),E=w;return(o.indexA>0||o.indexB>0)&&(E=v.concat(E)),(n.length>d||i.length>h)&&(E=E.concat(b)),E}return r}var Lt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},gs={matching:yF.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:bF.WORD,colorScheme:ms.LIGHT},ni="/",MF=rl(t=>t.value),Gz=nl(MF);function P0(t){return t.indexOf("dev/null")!==-1}function qz(t){return t.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function zz(t){return t.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function il(t){switch(t){case Ze.CONTEXT:return Lt.CONTEXT;case Ze.INSERT:return Lt.INSERTS;case Ze.DELETE:return Lt.DELETES}}function al(t){switch(t){case ms.DARK:return"d2h-dark-color-scheme";case ms.AUTO:return"d2h-auto-color-scheme";case ms.LIGHT:default:return"d2h-light-color-scheme"}}function Vz(t){return t?2:1}function ka(t){return t.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function rn(t,e,r=!0){let n=Vz(e);return{prefix:t.substring(0,n),content:r?ka(t.substring(n)):t.substring(n)}}function vs(t){let e=_0(t.oldName),r=_0(t.newName);if(e!==r&&!P0(e)&&!P0(r)){let n=[],i=[],a=e.split(ni),s=r.split(ni),o=a.length,l=s.length,u=0,c=o-1,f=l-1;for(;u<c&&u<f&&a[u]===s[u];)n.push(s[u]),u+=1;for(;c>u&&f>u&&a[c]===s[f];)i.unshift(s[f]),c-=1,f-=1;let d=n.join(ni),h=i.join(ni),m=a.slice(u,c+1).join(ni),g=s.slice(u,f+1).join(ni);return d.length&&h.length?d+ni+"{"+m+" \u2192 "+g+"}"+ni+h:d.length?d+ni+"{"+m+" \u2192 "+g+"}":h.length?"{"+m+" \u2192 "+g+"}"+ni+h:e+" \u2192 "+r}else return P0(r)?e:r}function sl(t){return`d2h-${xF(vs(t)).toString().slice(-6)}`}function ol(t){let e="file-changed";return t.isRename||t.isCopy?e="file-renamed":t.isNew?e="file-added":t.isDeleted?e="file-deleted":t.newName!==t.oldName&&(e="file-renamed"),e}function Nh(t,e,r,n={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},gs),n),l=rn(t,r,!1),u=rn(e,r,!1);if(l.content.length>a||u.content.length>a)return{oldLine:{prefix:l.prefix,content:ka(l.content)},newLine:{prefix:u.prefix,content:ka(u.content)}};let c=o==="char"?$F(l.content,u.content):OF(l.content,u.content),f=[];if(o==="word"&&i==="words"){let h=c.filter(v=>v.removed),m=c.filter(v=>v.added);Gz(m,h).forEach(v=>{v[0].length===1&&v[1].length===1&&MF(v[0][0],v[1][0])<s&&(f.push(v[0][0]),f.push(v[1][0]))})}let d=c.reduce((h,m)=>
Line truncated
|
||||
`);return this.hoganUtils.render(DF,"wrapper",{colorScheme:al(this.config.colorScheme),filesNumber:e.length,files:r})}};p();var I0=Object.assign(Object.assign({},gs),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),iu="generic",LF="line-by-line",Xz="icon",Zz="tag",au=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},I0),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||||
`);return this.hoganUtils.render(iu,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(LF,"file-diff"),i=this.hoganUtils.template(iu,"file-path"),a=this.hoganUtils.template(Xz,"file"),s=this.hoganUtils.template(Zz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(iu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Lt})}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(iu,"block-header",{CSSLineClass:Lt,blockHeader:e.isTooBig?n.header:ka(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(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e,e.isCombined,l,u);i+=c,i+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:Lt.CONTEXT,prefix:u,content:c,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=u}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(`
|
||||
`)}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==Ze.INSERT&&i.length||s.type===Ze.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.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(e,r):[[e,r]]}processChangedLines(e,r,n,i){let a={right:"",left:""},s=Math.max(n.length,i.length);for(let o=0;o<s;o++){let l=n[o],u=i[o],c=l!==void 0&&u!==void 0?Nh(l.content,u.content,r,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:Lt.DELETE_CHANGES}:Object.assign(Object.assign({},rn(l.content,r)),{type:il(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=u!==void 0&&u.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:Lt.INSERT_CHANGES}:Object.assign(Object.assign({},rn(u.content,r)),{type:il(u.type)})),{oldNumber:u.oldNumber,newNumber:u.newNumber}):void 0,{left:h,right:m}=this.generateLineHtml(e,f,d);a.left+=h,a.right+=m}return a}generateLineHtml(e,r,n){return{left:this.generateSingleLineHtml(e,r),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,r){if(r===void 0)return"";let n=this.hoganUtils.render(LF,"numbers",{oldNumber:r.oldNumber||"",newNumber:r.newNumber||""});return this.hoganUtils.render(iu,"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:e})}};p();var $0=Object.assign(Object.assign({},gs),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),su="generic",Kz="side-by-side",Jz="icon",Qz="tag",ou=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},$0),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
|
||||
`);return this.hoganUtils.render(su,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(Kz,"file-diff"),i=this.hoganUtils.template(su,"file-path"),a=this.hoganUtils.template(Jz,"file"),s=this.hoganUtils.template(Qz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(su,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Lt})}}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e.isCombined,l,u);i.left+=c,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Lt.CONTEXT,prefix:u,content:c,number:l.oldNumber},{type:Lt.CONTEXT,prefix:u,content:c,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=u}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(e){let r=[],n=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==Ze.INSERT&&i.length||s.type===Ze.CONTEXT&&n.length>0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.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(e,r):[[e,r]]}makeHeaderHtml(e,r){return this.hoganUtils.render(su,"block-header",{CSSLineClass:Lt,blockHeader:r!=null&&r.isTooBig?e:ka(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,r,n){let i={right:"",left:""},a=Math.max(r.length,n.length);for(let s=0;s<a;s++){let o=r[s],l=n[s],u=o!==void 0&&l!==void 0?Nh(o.content,l.content,e,this.config):void 0,c=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:Lt.DELETE_CHANGES}:Object.assign(Object.assign({},rn(o.content,e)),{type:il(o.type)})),{number:o.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:Lt.INSERT_CHANGES}:Object.assign(Object.assign({},rn(l.content,e)),{type:il(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(c,f);i.left+=d,i.right+=h}return i}generateLineHtml(e,r){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(r)}}generateSingleHtml(e){let r="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(su,"line",{type:(e==null?void 0:e.type)||`${Lt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?n:`${n} 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})}};p();var D0=bt(M0());p();var pt=bt(M0()),dt={};dt["file-summary-line"]=new pt.Template({code:function(t,e,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",t,e," ")),n.b(' <a href="#'),n.b(n.v(n.f("fileHtmlId",t,e,0))),n.b('" class="d2h-file-name">'),n.b(n.v(n.f("fileName",t,e,0))),n.b("</a>"),n.b(`
|
||||
`+r),n.b(' <span class="d2h-file-stats">'),n.b(`
|
||||
@@ -229,7 +243,7 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e)
|
||||
`+r),n.b(' <span class="d2h-lines-deleted">'),n.b(n.v(n.f("deletedLines",t,e,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:{}});dt["file-summary-wrapper"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b("</li>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});dt["file-summary-wrapper"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",t,e,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",t,e,0))),n.b(")</span>"),n.b(`
|
||||
`+r),n.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),n.b(`
|
||||
@@ -238,24 +252,24 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e)
|
||||
`+r),n.b(' <ol class="d2h-file-list">'),n.b(`
|
||||
`+r),n.b(" "),n.b(n.t(n.f("files",t,e,0))),n.b(`
|
||||
`+r),n.b(" </ol>"),n.b(`
|
||||
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["generic-block-header"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||||
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["generic-block-header"]=new pt.Template({code:function(t,e,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",t,e,0))),n.b(" "),n.b(n.v(n.d("CSSLineClass.INFO",t,e,0))),n.b('"></td>'),n.b(`
|
||||
`+r),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b(' <div class="'),n.b(n.v(n.f("contentClass",t,e,0))),n.b('">'),n.s(n.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),n.s(n.f("blockHeader",t,e,1),t,e,1,0,0,"")||n.b(" "),n.b("</div>"),n.b(`
|
||||
`+r),n.b(" </td>"),n.b(`
|
||||
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});dt["generic-empty-diff"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||||
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});dt["generic-empty-diff"]=new pt.Template({code:function(t,e,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",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b(' <div class="'),n.b(n.v(n.f("contentClass",t,e,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:{}});dt["generic-file-path"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<span class="d2h-file-name-wrapper">'),n.b(`
|
||||
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});dt["generic-file-path"]=new pt.Template({code:function(t,e,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",t,e," ")),n.b(' <span class="d2h-file-name">'),n.b(n.v(n.f("fileDiffName",t,e,0))),n.b("</span>"),n.b(`
|
||||
`+r),n.b(n.rp("<fileTag1",t,e," ")),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:{}});dt["generic-line"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b("<tr>"),n.b(`
|
||||
`+r),n.b("</label>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});dt["generic-line"]=new pt.Template({code:function(t,e,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",t,e,0))),n.b(" "),n.b(n.v(n.f("type",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b(" "),n.b(n.t(n.f("lineNumber",t,e,0))),n.b(`
|
||||
`+r),n.b(" </td>"),n.b(`
|
||||
@@ -267,23 +281,23 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e)
|
||||
`+r)}),t.pop()),n.s(n.f("content",t,e,1),t,e,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:{}});dt["generic-wrapper"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b("</tr>"),n.fl()},partials:{},subs:{}});dt["generic-wrapper"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b(" "),n.b(n.t(n.f("content",t,e,0))),n.b(`
|
||||
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["icon-file-added"]=new ht.Template({code:function(t,e,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("</div>"),n.fl()},partials:{},subs:{}});dt["icon-file-added"]=new pt.Template({code:function(t,e,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:{}});dt["icon-file-changed"]=new ht.Template({code:function(t,e,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("</svg>"),n.fl()},partials:{},subs:{}});dt["icon-file-changed"]=new pt.Template({code:function(t,e,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:{}});dt["icon-file-deleted"]=new ht.Template({code:function(t,e,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("</svg>"),n.fl()},partials:{},subs:{}});dt["icon-file-deleted"]=new pt.Template({code:function(t,e,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:{}});dt["icon-file-renamed"]=new ht.Template({code:function(t,e,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("</svg>"),n.fl()},partials:{},subs:{}});dt["icon-file-renamed"]=new pt.Template({code:function(t,e,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:{}});dt["icon-file"]=new ht.Template({code:function(t,e,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("</svg>"),n.fl()},partials:{},subs:{}});dt["icon-file"]=new pt.Template({code:function(t,e,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:{}});dt["line-by-line-file-diff"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",t,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b("</svg>"),n.fl()},partials:{},subs:{}});dt["line-by-line-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",t,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",t,e,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",t,e,0))),n.b(`
|
||||
`+r),n.b(" </div>"),n.b(`
|
||||
@@ -296,8 +310,8 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e)
|
||||
`+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:{}});dt["line-by-line-numbers"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",t,e,0))),n.b("</div>"),n.b(`
|
||||
`+r),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",t,e,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["side-by-side-file-diff"]=new ht.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",t,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",t,e,0))),n.b('">'),n.b(`
|
||||
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["line-by-line-numbers"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",t,e,0))),n.b("</div>"),n.b(`
|
||||
`+r),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",t,e,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["side-by-side-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",t,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",t,e,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",t,e,0))),n.b(`
|
||||
`+r),n.b(" </div>"),n.b(`
|
||||
@@ -321,60 +335,69 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e)
|
||||
`+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:{}});dt["tag-file-added"]=new ht.Template({code:function(t,e,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:{}});dt["tag-file-changed"]=new ht.Template({code:function(t,e,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:{}});dt["tag-file-deleted"]=new ht.Template({code:function(t,e,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:{}});dt["tag-file-renamed"]=new ht.Template({code:function(t,e,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 Wc=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=Kv.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},dt),e),n)}static compile(e){return Kv.compile(e,{asString:!1})}render(e,r,n,i,a){let s=this.templateKey(e,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var HU=Object.assign(Object.assign(Object.assign({},Vv),qv),{outputFormat:lM.LINE_BY_LINE,drawFileList:!0});function SM(t,e={}){let r=Object.assign(Object.assign({},HU),e),n=typeof t=="string"?gM(t,r):t,i=new Wc(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new bh(i,s).render(n):"",l=r.outputFormat==="side-by-side"?new qc(i,r).render(n):new zc(i,r).render(n);return o+l}var xh=require("obsidian");var ls=class extends xh.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 ua.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 ua.name}getIcon(){return ua.icon}async setState(r,n){this.state=r,xh.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 Ce&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
|
||||
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});dt["tag-file-added"]=new pt.Template({code:function(t,e,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:{}});dt["tag-file-changed"]=new pt.Template({code:function(t,e,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:{}});dt["tag-file-deleted"]=new pt.Template({code:function(t,e,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:{}});dt["tag-file-renamed"]=new pt.Template({code:function(t,e,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 lu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=D0.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},dt),e),n)}static compile(e){return D0.compile(e,{asString:!1})}render(e,r,n,i,a){let s=this.templateKey(e,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var tV=Object.assign(Object.assign(Object.assign({},I0),$0),{outputFormat:wF.LINE_BY_LINE,drawFileList:!0});function Uh(t,e={}){let r=Object.assign(Object.assign({},tV),e),n=typeof t=="string"?AF(t,r):t,i=new lu(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new Bh(i,s).render(n):"",l=r.outputFormat==="side-by-side"?new ou(i,r).render(n):new au(i,r).render(n);return o+l}var zF=bt(GF());var uu=require("obsidian"),L0=cu.StateEffect.define();function ws(t,e){let r=t.state,n=r.field(Gh),i=r.field(xr),a=r.doc.lineAt(e!=null?e:r.selection.main.head).number,s=Et.findHunk(a,i==null?void 0:i.hunks)[0];if(!s)return;let o=r.doc.line(Math.max(1,s.added.start)).from,l=n.has(o);return r.field(uu.editorEditorField).dispatch({effects:L0.of({pos:o,add:!l})})}var Gh=cu.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let n of e.effects)n.is(L0)&&(n.value.add?t.add(n.value.pos):t.delete(n.value.pos));for(let n of t)r.add(e.changes.mapPos(n));return r}}),VF=cu.StateField.define({create:t=>qF(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(tl)||r.is(L0))?qF(e.state):t},provide:t=>jh.showTooltip.computeN([t],e=>e.field(t))}),WF=jh.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 qF(t){let e=t.field(xr);return e?[...t.field(Gh)].map(n=>{let i=t.doc.lineAt(n),a=Et.findHunk(i.number,e.hunks)[0];if(a)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>rV(a,t,n)}}).filter(n=>n!==void 0):[]}function rV(t,e,r){let n=Et.createPatch("file",[t],"10064",!1).join(`
|
||||
`)+`
|
||||
`,i=Uh(n,{colorScheme:zF.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),a=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),s=document.createElement("div"),o=document.createElement("div");o.addClass("tooltip-toolbar");let l=(h,m)=>{let g=document.createElement("div");return(0,uu.setIcon)(g,h),g.setAttr("aria-label",m),g.addClass("clickable-icon"),g},u=l("x","Close hunk"),c=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(u),o.appendChild(c),o.appendChild(f),s.appendChild(o),s.appendChild(a),s.addClass("git-diff-tooltip","git-diff");let d=e.field(uu.editorEditorField);return u.onclick=()=>{ws(d,r)},c.onclick=()=>{let h=Zn.plugin;h&&(h.promiseQueue.addTask(()=>h.hunkActions.stageHunk(r)),ws(d,r))},f.onclick=()=>{let h=Zn.plugin;h&&(h.hunkActions.resetHunk(r),ws(d,r))},{dom:s,update:h=>{r=h.changes.mapPos(r)}}}function YF(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 n=await e.vault.adapter.read(r),a=await new Eh(e,n).openAndGetReslt();a!==void 0&&(await e.vault.adapter.write(r,a),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Dt.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Dt.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Qr.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Qr.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;{let i=t.gitManager.getRelativeRepoPath(n.path,!0);t.tools.openDiff({aFile:i,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:n})=>{if(n)return C$(r,n,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:n})=>{if(n)return P$(n,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 n=e.workspace.getActiveFile();if(r)return n!==null;t.addFileToGitignore(n.path,n instanceof kn.TFolder).catch(i=>t.displayError(i))}}),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 n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:n})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),kn.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 n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:n})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-cur
Line truncated
|
||||
- ${a.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(Ro,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&Ro.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(Ro,"/",!0)}openDiff({aFile:e,bFile:r,aRef:n,bRef:i,event:a}){var l,u;let s=this.plugin.settings.diffStyle;ll.Platform.isMobileApp&&(s="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:n,bRef:i};s=="split"?(l=bn(this.plugin.app,a))==null||l.setViewState({type:ma.type,active:!0,state:o}):s=="git_unified"&&((u=bn(this.plugin.app,a))==null||u.setViewState({type:ga.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof _e))return;let n=await new ze(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new ll.Notice(`Running '${n}'...`,999999);try{let a=await e.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};p();var zh=require("obsidian");var ys=class extends zh.ItemView{constructor(r,n){super(r);this.plugin=n;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return ga.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 ga.name}getIcon(){return ga.icon}async setState(r,n){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 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 _e&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
|
||||
`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);n=[...`--- /dev/null
|
||||
+++ ${this.state.bFile}
|
||||
@@ -0,0 +1,${a.split(`
|
||||
`).length} @@`.split(`
|
||||
`),...a.split(`
|
||||
`).map(o=>`+${o}`)].join(`
|
||||
`)}}if(n){let a=this.parser.parseFromString(SM(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}}}};m();var Qo=require("obsidian");var el=require("@codemirror/commands");m();var Ie=require("@codemirror/view"),ke=require("@codemirror/state");m();var Zv="\u037C",EM=typeof Symbol=="undefined"?"__"+Zv:Symbol.for(Zv),Jv=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),AM=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},Sh=class{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,o,l,c){let u=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&o==null)return l.push(s[0]+";");for(let h in o){let p=o[h];if(/&/.test(h))a(h.split(/,\s*/).map(g=>s.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),p,l);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,g=>"-"+g.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((n&&!f&&!c?s.map(n):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in e)a(i(s),e[s],this.rules)}getRules(){return this.rules.join(`
|
||||
`)}static newName(){let e=AM[EM]||1;return AM[EM]=e+1,Zv+e.toString(36)}static mount(e,r,n){let i=e[Jv],a=n&&n.nonce;i?a&&i.setNonce(a):i=new Qv(e,a),i.mount(Array.isArray(r)?r:[r],e)}},kM=new Map,Qv=class{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let a=kM.get(n);if(a)return e[Jv]=a;this.sheet=new i.CSSStyleSheet,kM.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[Jv]=this}mount(e,r){let n=this.sheet,i=0,a=0;for(let s=0;s<e.length;s++){let o=e[s],l=this.modules.indexOf(o);if(l<a&&l>-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,o),n)for(let c=0;c<o.rules.length;c++)n.insertRule(o.rules[c],i++)}else{for(;a<l;)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 l=0;l<this.modules.length;l++)s+=this.modules[l].getRules()+`
|
||||
`;this.styleTag.textContent=s;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 zM=require("@codemirror/language"),UU=require("@lezer/highlight"),pt=class t{constructor(e,r,n,i){this.fromA=e,this.toA=r,this.fromB=n,this.toB=i}offset(e,r=e){return new t(this.fromA+e,this.toA+e,this.fromB+r,this.toB+r)}};function us(t,e,r,n,i,a){if(t==n)return[];let s=o1(t,e,r,n,i,a),o=l1(t,e+s,r,n,i+s,a);e+=s,r-=o,i+=s,a-=o;let l=r-e,c=a-i;if(!l||!c)return[new pt(e,r,i,a)];if(l>c){let f=t.slice(e,r).indexOf(n.slice(i,a));if(f>-1)return[new pt(e,e+f,i,i),new pt(e+f+c,r,a,a)]}else if(c>l){let f=n.slice(i,a).indexOf(t.slice(e,r));if(f>-1)return[new pt(e,e,i,i+f),new pt(r,r,i+f+l,a)]}if(l==1||c==1)return[new pt(e,r,i,a)];let u=qM(t,e,r,n,i,a);if(u){let[f,d,h]=u;return us(t,e,f,n,i,d).concat(us(t,f+h,r,n,d+h,a))}return GU(t,e,r,n,i,a)}var Yc=1e9,Xc=0,s1=!1;function GU(t,e,r,n,i,a){let s=r-e,o=a-i;if(Yc<1e9&&Math.min(s,o)>Yc*16||Xc>0&&Date.now()>Xc)return Math.min(s,o)>Yc*64?[new pt(e,r,i,a)]:TM(t,e,r,n,i,a);let l=Math.ceil((s+o)/2);e1.reset(l),t1.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==n.charCodeAt(i+p),u=(h,p)=>t.charCodeAt(r-h-1)==n.charCodeAt(a-p-1),f=(s-o)%2!=0?t1:null,d=f?null:e1;for(let h=0;h<l;h++){if(h>Yc||Xc>0&&!(h&63)&&Date.now()>Xc)return TM(t,e,r,n,i,a);let p=e1.advance(h,s,o,l,f,!1,c)||t1.advance(h,s,o,l,d,!0,u);if(p)return zU(t,e,r,e+p[0],n,i,a,i+p[1])}return[new pt(e,r,i,a)]}var Ch=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,n,i,a,s,o){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=i+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<r&&f<n&&o(u,f);)u++,f++;if(this.vec[c]=u,u>r)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-l;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}},e1=new Ch,t1=new Ch;function zU(t,e,r,n,i,a,s,o){let l=!1;return!Ko(t,n)&&++n==r&&(l=!0),!Ko(i,o)&&++o==s&&(l=!0),l?[new pt(e,r,a,s)]:us(t,e,n,i,a,o).concat(us(t,n,r,i,o,s))}function VM(t,e){let r=1,n=Math.min(t,e);for(;r<n;)r=r<<1;return r}function o1(t,e,r,n,i,a){if(e==r||e==a||t.charCodeAt(e)!=n.charCodeAt(i))return 0;let s=VM(r-e,a-i);for(let o=e,l=i;;){let c=o+s,u=l+s;if(c>r||u>a||t.slice(o,c)!=n.slice(l,u)){if(s==1)return o-e-(Ko(t,o)?0:1);s=s>>1}else{if(c==r||u==a)return c-e;o=c,l=u}}}function l1(t,e,r,n,i,a){if(e==r||i==a||t.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=VM(r-e,a-i);for(let o=r,l=a;;){let c=o-s,u=l-s;if(c<e||u<i||t.slice(c,o)!=n.slice(u,l)){if(s==1)return r-o-(Ko(t,o)?0:1);s=s>>1}else{if(c==e||u==i)return r-c;o=c,l=u}}}function r1(t,e,r,n,i,a,s,o){let l=n.slice(i,a),c=null;for(;;){if(c||s<o)return c;for(let u=e+s;;){Ko(t,u)||u++;let f=u+s;if(Ko(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=o1(t,f,r,n,i+h+d.length,a),g=l1(t,e,u,n,i,i+h),v=d.length+p+g;(!c||c[2]<v)&&(c=[u-g,i+h-g,v])}u=f}if(o<0)return c;s=s>>1}}function qM(t,e,r,n,i,a){let s=r-e,o=a-i;if(s<o){let l=qM(n,i,a,t,e,r);return l&&[l[1],l[0],l[2]]}return s<4||o*2<s?null:r1(t,e,r,n,i,a,Math.floor(s/4),-1)}function TM(t,e,r,n,i,a){s1=!0;let s=r-e,o=a-i,l;if(s<o){let d=r1(n,i,a,t,e,r,Math.floor(s/6),50);l=d&&[d[1],d[0],d[2]]}else l=r1(t,e,r,n,i,a,Math.floor(o/6),50);if(!l)return[new pt(e,r,i,a)];let[c,u,f]=l;return us(t,e,c,n,i,u).concat(us(t,c+f,r,n,u+f,a))}function WM(t,e){for(let r=1;r<t.length;r++){let n=t[r-1],i=t[r];n.toA>i.fromA-e&&n.toB>i.fromB-e&&(t[r-1]=new pt(n.fromA,i.toA,n.fromB,i.toB),t.splice(r--,1))}}function VU(t,e,r){for(;;){WM(r,1);let n=!1;for(let i=0;i<r.length;i++){let a=r[i],s,o;(s=o1(t,a.fromA,a.toA,e,a.fromB,a.toB))&&(a=r[i]=new pt(a.fromA+s,a.toA,a.fromB+s,a.toB)),(o=l1(t,a.fromA,a.toA,e,a.fromB,a.toB))&&(a=r[i]=new pt(a.fromA,a.toA-o,a.fromB,a.toB-o));let l=a.toA-a.fromA,c=a.toB-a.fromB;if(l&&c)continue;let u=a.fromA-(i?r[i-1].toA:0),f=(i<r.length-1?r[i+1].fromA:t.length)-a.toA;if(!u||!f)continue;let d=l?t.slice(a.fromA,a.toA):e.slice(a.fromB,a.toB);u<=d.length&&t.slice(a.fromA-u,a.fromA)==d.slice(d.length-u)?(r[i]=new pt(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),n=!0):f<=d.length&&t.slice(a.toA,a.toA+f)==d.slice(0,f)&&(r[i]=new pt(a.fromA+f,a.toA+f,a.fromB+f,a.toB+f),n=!0)}if(!n)break}return r}function qU(t,e,r){for(let n=0,i=0;i<t.length;i++){let a=t[i],s=a.toA-a.fromA,o=a.toB-a.fromB;if(s&&o||s>3||o>3){let l=i==t.length-1?e.length:t[i+1].fromA,c=a.fromA-n,u=l-a.toA,f=PM(e,a.fromA,c),d=CM(e,a.toA,u),h=a.fromA-f,p=d-a.toA;if((!s||!o)&&h&&p){let g=Math.max(s,o),[v,y,b]=s?[e,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&e.slice(f,a.fromA)==v.slice(b-h,b)?(a=t[i]=new pt(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=CM(e,a.toA,l-a.toA)):g>p&&e.slice(a.toA,d)==v.slice(y,y+p)&&(a=t[i]=new pt(d-s,d,a.fromB+p,a.toB+p),d=a.
Line truncated
|
||||
`)}}if(n){let a=this.parser.parseFromString(Uh(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}}}};p();var Mi=require("obsidian");var ul=require("@codemirror/commands");var Vh=require("@codemirror/search"),cl=require("@codemirror/state"),an=require("@codemirror/view");var bs=class extends Mi.ItemView{constructor(r,n){super(r);this.plugin=n;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",i=>{this.state.bRef==null&&i.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,a)=>{this.state.bRef==null&&(i.path===this.state.bFile||a===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Mi.debounce)(i=>{let a=this.state.bFile;a&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(a),i).catch(s=>this.plugin.displayError(s)))},1e3,!1)}getViewType(){return ma.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return ma.name}getIcon(){return ma.icon}async setState(r,n){this.state=r,Mi.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,n),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,n){try{return await this.plugin.gitManager.show(r,n,!1)}catch(i){if(i instanceof br&&(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: bad object")))return i.message.includes("fatal: bad object")&&this.plugin.displayError(i.message),"";throw i}}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 n=await this.app.vault.adapter.read(this.state.bFile);if(n!=r.state.doc.toString()){let i=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n},annotations:[cl.Transaction.remote.of(!0)]});r.dispatch(i)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,n=this.mergeView.b;this.refreshing=!0;let i=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null&&(a=await this.gitShow(this.state.bRef,this.state.bFile)),i!=r.state.doc.toString()){let s=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i}});r.dispatch(s)}if(a!=null&&a!=n.state.doc.toString()){let s=n.state.update({changes:{from:0,to:n.state.doc.length,insert:a}});n.dispatch(s)}this.refreshing=!1}renderButtons(){let r=document.createElement("div"),n=r.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Mi.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async i=>{var h;let a=this.mergeView.b,s=this.mergeView.a,o=g0(a.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),u=o.chunks[l],c=y0(u,s.state.doc,a.state.doc),f=w0(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[c])[0],d=Et.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(`
|
||||
`)+`
|
||||
`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let i=r.createDiv();i.addClass("clickable-icon"),i.setAttr("aria-label","Reset hunk"),(0,Mi.setIcon)(i,"undo"),i.onmousedown=a=>{var f;let s=this.mergeView.a,o=this.mergeView.b,l=g0(o.state),u=(f=r.parentElement)==null?void 0:f.indexOf(r),c=l.chunks[u];if(c){let d=c.fromA,h=c.toA,m=c.fromB,g=c.toB,v=s.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=s.state.lineBreak),o.dispatch({changes:{from:m,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=i=>{i.preventDefault(),i.stopPropagation()},r}async createMergeView(){var r,n,i;if((r=this.state)!=null&&r.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(i=this.mergeView)==null||i.destroy();let a=this.containerEl.children[1];a.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let s=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,an.lineNumbers)(),(0,Vh.highlightSelectionMatches)(),(0,an.drawSelection)(),an.keymap.of([...ul.standardKeymap,ul.indentWithTab]),(0,ul.history)(),(0,Vh.search)(),an.EditorView.lineWrapping],u=this,c=an.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(w=>w.annotation(cl.Transaction.remote))){let w=g.state.doc.toString();u.fileSaveDebouncer(w)}}})),f={doc:s,extensions:[...l,an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(c):d.push(an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};a.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let m=this.plugin.gitManager instanceof _e&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new $h({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:m?()=>this.renderButtons():void 0,revertControls:m?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:a}),this.refreshing=!1}}};p();var yM=require("obsidian");p();p();p();var XF="5";var ZF,KF,JF;typeof window!="undefined"&&((JF=(KF=(ZF=window.__svelte)!=null?ZF:window.__svelte={}).v)!=null?JF:KF.v=new Set).add(XF);p();p();p();var fl="[",Aa="[!",_s="]",Di={};var Ve=Symbol(),sn=Symbol("filename"),QF=Symbol("hmr"),eO="http://www.w3.org/1999/xhtml";p();p();p();p();var Wh=!0;p();var L=!1;p();var on=Array.isArray,tO=Array.prototype.indexOf,du=Array.from,N0=Object.keys,Wt=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,B0=Object.getOwnPropertyDescriptors,H0=Object.prototype,rO=Array.prototype,dl=Object.getPrototypeOf,U0=Object.isExtensible;function j0(t){return typeof t=="function"}var ar=()=>{};function hu(t){for(var e=0;e<t.length;e++)t[e]()}function nO(){var t,e,r=new Promise((n,i)=>{t=n,e=i});return{promise:r,resolve:t,reject:e}}p();p();var Er=Symbol("$state"),pu=Symbol("legacy props"),iO=Symbol(""),Yh=Symbol("proxy path"),hl=new class extends Error{constructor(){super(...arguments);vt(this,"name","StaleReactionError");vt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var mu=3,ln=8;p();p();function aO(){if(L){let t=new Error("await_outside_boundary\nCannot await outside a `<svelte:boundary>` with a `pending` snippet\nhttps://svelte.dev/e/await_outside_boundary");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/await_outside_boundary")}function gu(t){if(L){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 mO(){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 p1(){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 gO(){if(D){let t=new Error(`derived_references_self
|
||||
https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function sO(){if(L){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function G0(){if(L){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 oO(){if(L){let t=new Error(`derived_references_self
|
||||
A derived value cannot reference itself recursively
|
||||
https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function vO(t){if(D){let e=new Error(`effect_in_teardown
|
||||
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 lO(t){if(L){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 yO(){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 wO(t){if(D){let e=new Error(`effect_orphan
|
||||
https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function cO(){if(L){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 uO(t){if(L){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 bO(){if(D){let t=new Error(`effect_update_depth_exceeded
|
||||
https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function fO(){if(L){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 _O(){if(D){let t=new Error("flush_sync_in_effect\nCannot use `flushSync` inside an effect\nhttps://svelte.dev/e/flush_sync_in_effect");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/flush_sync_in_effect")}function xO(){if(D){let t=new Error(`hydration_failed
|
||||
https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function dO(){if(L){let t=new Error("flush_sync_in_effect\nCannot use `flushSync` inside an effect\nhttps://svelte.dev/e/flush_sync_in_effect");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/flush_sync_in_effect")}function hO(){if(L){let t=new Error(`hydration_failed
|
||||
Failed to hydrate the application
|
||||
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function SO(t){if(D){let e=new Error(`props_invalid_value
|
||||
https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function pO(t){if(L){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 EO(t){if(D){let e=new Error(`rune_outside_svelte
|
||||
https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function mO(t){if(L){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 AO(){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 kO(){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 TO(){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")}m();m();m();var hs="font-weight: bold",ps="font-weight: normal";function CO(t){D?console.warn(`%c[svelte] await_reactivity_loss
|
||||
https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function gO(){if(L){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 vO(){if(L){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 wO(){if(L){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")}p();p();p();var xs="font-weight: bold",Ss="font-weight: normal";function yO(t){L?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`,hs,ps):console.warn("https://svelte.dev/e/await_reactivity_loss")}function PO(t,e){D?console.warn(`%c[svelte] await_waterfall
|
||||
https://svelte.dev/e/await_reactivity_loss`,xs,Ss):console.warn("https://svelte.dev/e/await_reactivity_loss")}function bO(t,e){L?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`,hs,ps):console.warn("https://svelte.dev/e/await_waterfall")}function RO(t,e,r){D?console.warn(`%c[svelte] hydration_attribute_changed
|
||||
https://svelte.dev/e/await_waterfall`,xs,Ss):console.warn("https://svelte.dev/e/await_waterfall")}function _O(t,e,r){L?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`,hs,ps):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ms(t){D?console.warn(`%c[svelte] hydration_mismatch
|
||||
https://svelte.dev/e/hydration_attribute_changed`,xs,Ss):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Es(t){L?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`,hs,ps):console.warn("https://svelte.dev/e/hydration_mismatch")}function MO(){D?console.warn(`%c[svelte] lifecycle_double_unmount
|
||||
https://svelte.dev/e/hydration_mismatch`,xs,Ss):console.warn("https://svelte.dev/e/hydration_mismatch")}function xO(){L?console.warn(`%c[svelte] lifecycle_double_unmount
|
||||
%cTried to unmount a component that was not mounted
|
||||
https://svelte.dev/e/lifecycle_double_unmount`,hs,ps):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Fh(t){D?console.warn(`%c[svelte] state_proxy_equality_mismatch
|
||||
https://svelte.dev/e/lifecycle_double_unmount`,xs,Ss):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Xh(t){L?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`,hs,ps):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function OO(t){D?console.warn(`%c[svelte] transition_slide_display
|
||||
https://svelte.dev/e/state_proxy_equality_mismatch`,xs,Ss):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function SO(t){L?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`,hs,ps):console.warn("https://svelte.dev/e/transition_slide_display")}var se=!1;function Yt(t){se=t}var ge;function et(t){if(t===null)throw ms(),Ci;return ge=t}function Xt(){return et(jt(ge))}function H(t){if(se){if(jt(ge)!==null)throw ms(),Ci;ge=t}}function il(t=1){if(se){for(var e=t,r=ge;e--;)r=jt(r);ge=r}}function gs(){for(var t=0,e=ge;;){if(e.nodeType===an){var r=e.data;if(r===ds){if(t===0)return e;t-=1}else(r===tl||r===ya)&&(t+=1)}var n=jt(e);e.remove(),e=n}}function $h(t){if(!t||t.nodeType!==an)throw ms(),Ci;return t.data}m();m();m();m();function Dh(t){return t===this.v}function Lh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function jh(t){return!Lh(t,this.v)}m();var _n=!1,Pi=!1,Qn=!1;m();m();m();var ru=null;function ei(t){let e=Error(),r=e.stack;if(!r)return null;let n=r.split(`
|
||||
https://svelte.dev/e/transition_slide_display`,xs,Ss):console.warn("https://svelte.dev/e/transition_slide_display")}var ae=!1;function Xt(t){ae=t}var pe;function et(t){if(t===null)throw Es(),Di;return pe=t}function Zt(){return et(Bt(pe))}function j(t){if(ae){if(Bt(pe)!==null)throw Es(),Di;pe=t}}function pl(t=1){if(ae){for(var e=t,r=pe;e--;)r=Bt(r);pe=r}}function ks(){for(var t=0,e=pe;;){if(e.nodeType===ln){var r=e.data;if(r===_s){if(t===0)return e;t-=1}else(r===fl||r===Aa)&&(t+=1)}var n=Bt(e);e.remove(),e=n}}function Zh(t){if(!t||t.nodeType!==ln)throw Es(),Di;return t.data}p();p();p();p();function Kh(t){return t===this.v}function Jh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Qh(t){return!Jh(t,this.v)}p();var An=!1,Li=!1,ii=!1;p();p();p();var vu=null;function ai(t){let e=Error(),r=e.stack;if(!r)return null;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)}}return i.length===1?null:(qt(e,"stack",{value:i.join(`
|
||||
`)}),qt(e,"name",{value:`${t}Error`}),e)}function sn(t,e){return t.label=e,Nh(t.v,e),t}function Nh(t,e){var r;return(r=t==null?void 0:t[Ih])==null||r.call(t,e),t}m();var ye=null;function ba(t){ye=t}var Mi=null;function Bh(t){Mi=t}var xn=null;function nu(t){xn=t}function tt(t,e=!1,r){ye={p:ye,c:null,e:null,s:t,x:null,l:Pi&&!e?{s:null,u:null,$:[]}:null},D&&(ye.function=r,xn=r)}function rt(t){var i;var e=ye,r=e.e;if(r!==null){e.e=null;for(var n of r)g1(n)}return t!==void 0&&(e.x=t),ye=e.p,D&&(xn=(i=ye==null?void 0:ye.function)!=null?i:null),t!=null?t:{}}function on(){return!Pi||ye!==null&&ye.l===null}m();m();m();var v1=new WeakMap;function y1(t){var e=ee;if(e===null)return oe.f|=8388608,t;if(D&&t instanceof Error&&!v1.has(t)&&v1.set(t,cG(t,e)),e.f&32768)al(t,e);else{if(!(e.f&128))throw!e.parent&&t instanceof Error&&$O(t),t;e.b.error(t)}}function al(t,e){for(;e!==null;){if(e.f&128)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw t instanceof Error&&$O(t),t}function cG(t,e){var s,o,l;let r=_r(t,"message");if(!(r&&!r.configurable)){for(var n=iu?" ":" ",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)}}return i.length===1?null:(Wt(e,"stack",{value:i.join(`
|
||||
`)}),Wt(e,"name",{value:`${t}Error`}),e)}function cn(t,e){return t.label=e,ep(t.v,e),t}function ep(t,e){var r;return(r=t==null?void 0:t[Yh])==null||r.call(t,e),t}p();var ve=null;function Ca(t){ve=t}var Bi=null;function tp(t){Bi=t}var Tn=null;function wu(t){Tn=t}function tt(t,e=!1,r){ve={p:ve,c:null,e:null,s:t,x:null,l:Li&&!e?{s:null,u:null,$:[]}:null},L&&(ve.function=r,Tn=r)}function rt(t){var i;var e=ve,r=e.e;if(r!==null){e.e=null;for(var n of r)z0(n)}return t!==void 0&&(e.x=t),ve=e.p,L&&(Tn=(i=ve==null?void 0:ve.function)!=null?i:null),t!=null?t:{}}function un(){return!Li||ve!==null&&ve.l===null}p();p();p();var V0=new WeakMap;function W0(t){var e=Q;if(e===null)return se.f|=8388608,t;if(L&&t instanceof Error&&!V0.has(t)&&V0.set(t,iV(t,e)),e.f&32768)ml(t,e);else{if(!(e.f&128))throw!e.parent&&t instanceof Error&&AO(t),t;e.b.error(t)}}function ml(t,e){for(;e!==null;){if(e.f&128)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw t instanceof Error&&AO(t),t}function iV(t,e){var s,o,l;let r=Sr(t,"message");if(!(r&&!r.configurable)){for(var n=yu?" ":" ",i=`
|
||||
${n}in ${((s=e.fn)==null?void 0:s.name)||"<unknown>"}`,a=e.ctx;a!==null;)i+=`
|
||||
${n}in ${(o=a.function)==null?void 0:o[rn].split("/").pop()}`,a=a.p;return{message:t.message+`
|
||||
${n}in ${(o=a.function)==null?void 0:o[sn].split("/").pop()}`,a=a.p;return{message:t.message+`
|
||||
${i}
|
||||
`,stack:(l=t.stack)==null?void 0:l.split(`
|
||||
`).filter(c=>!c.includes("svelte/src/internal")).join(`
|
||||
`)}}}function $O(t){let e=v1.get(t);e&&(qt(t,"message",{value:e.message}),qt(t,"stack",{value:e.stack}))}m();var au=[],w1=[];function DO(){var t=au;au=[],Jc(t)}function uG(){var t=w1;w1=[],Jc(t)}function Lr(t){au.length===0&&queueMicrotask(DO),au.push(t)}function LO(){au.length>0&&DO(),w1.length>0&&uG()}m();var ane=589952;function Uh(){for(var t=ee.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&pO(),t}m();m();var Ii=null;function S1(t){Ii=t}var ou=new Set;function vs(t){var e=2050,r=oe!==null&&oe.f&2?oe:null;ee===null||r!==null&&r.f&256?e|=256:ee.f|=524288;let n={ctx:ye,deps:null,effects:null,equals:Dh,f:e,fn:t,reactions:null,rv:0,v:qe,wv:0,parent:r!=null?r:ee,ac:null};return D&&Qn&&(n.created=ei("CreatedAt")),n}function E1(t,e){let r=ee;r===null&&mO();var n=r.b,i=void 0,a=jr(qe),s=null,o=!oe;return jO(()=>{var h;D&&(Ii=ee);try{var l=t()}catch(p){l=Promise.reject(p)}D&&(Ii=null);var c=()=>l;i=(h=s==null?void 0:s.then(c,c))!=null?h:Promise.resolve(l),s=i;var u=xe,f=n.pending;o&&(n.update_pending_count(1),f||u.increment());let d=(p,g=void 0)=>{s=null,Ii=null,f||u.activate(),g?g!==nl&&(a.f|=8388608,ri(a,g)):(a.f&8388608&&(a.f^=8388608),ri(a,p),D&&e!==void 0&&(ou.add(a),setTimeout(()=>{ou.has(a)&&(PO(a.label,e),ou.delete(a))}))),o&&(n.update_pending_count(-1),f||u.decrement()),Vh()};if(i.then(d,p=>d(null,p||"unknown")),u)return()=>{queueMicrotask(()=>u.neuter())}}),D&&(a.f|=4194304),new Promise(l=>{function c(u){function f(){u===i?l(a):c(i)}u.then(f,f)}c(i)})}function Ct(t){let e=vs(t);return qh(e),e}function ys(t){let e=vs(t);return e.equals=jh,e}function Gh(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)At(e[r])}}var _1=[];function fG(t){for(var e=t.parent;e!==null;){if(!(e.f&2))return e;e=e.parent}return null}function lu(t){var e,r=ee;if(Nt(fG(t)),D){let n=ws;x1(new Set);try{_1.includes(t)&&gO(),_1.push(t),Gh(t),e=zh(t)}finally{Nt(r),x1(n),_1.pop()}}else try{Gh(t),e=zh(t)}finally{Nt(r)}return e}function A1(t){var e=lu(t);if(t.equals(e)||(t.v=e,t.wv=cu()),!Sn)if(_a!==null)_a.set(t,t.v);else{var r=(Fi||t.f&256)&&t.deps!==null?4096:1024;mt(t,r)}}function Wh(t,e,r){let n=on()?vs:ys;if(e.length===0){r(t.map(n));return}var i=xe,a=ee,s=dG(),o=Uh();Promise.all(e.map(l=>E1(l))).then(l=>{i==null||i.activate(),s();try{r([...t.map(n),...l])}catch(c){a.f&16384||al(c,a)}i==null||i.deactivate(),Vh()}).catch(l=>{o.error(l)})}function dG(){var t=ee,e=oe,r=ye;return function(){Nt(t),kt(e),ba(r),D&&S1(null)}}function Vh(){Nt(null),kt(null),ba(null),D&&S1(null)}var uu=new Set,xe=null,fu=null,_a=null,b1=new Set,Kh=[];function BO(){let t=Kh.shift();Kh.length>0&&queueMicrotask(BO),t()}var _s=[],Qh=null,k1=!1,Yh=!1,ol,ll,xa,du,hu,bs,cl,Sa,Ea,ul,pu,mu,An,HO,Xh,T1,Zh=class Zh{constructor(){yt(this,An);vt(this,"current",new Map);yt(this,ol,new Map);yt(this,ll,new Set);yt(this,xa,0);yt(this,du,null);yt(this,hu,!1);yt(this,bs,[]);yt(this,cl,[]);yt(this,Sa,[]);yt(this,Ea,[]);yt(this,ul,[]);yt(this,pu,[]);yt(this,mu,[]);vt(this,"skipped_effects",new Set)}process(e){var a;_s=[],fu=null;var r=null;if(uu.size>1){r=new Map,_a=new Map;for(let[s,o]of this.current)r.set(s,{v:s.v,wv:s.wv}),s.v=o;for(let s of uu)if(s!==this)for(let[o,l]of ue(s,ol))r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(let s of e)di(this,An,HO).call(this,s);if(ue(this,bs).length===0&&ue(this,xa)===0){di(this,An,T1).call(this);var n=ue(this,Sa),i=ue(this,Ea);It(this,Sa,[]),It(this,Ea,[]),It(this,ul,[]),fu=xe,xe=null,NO(n),NO(i),xe===null?xe=this:uu.delete(this),(a=ue(this,du))==null||a.resolve()}else di(this,An,Xh).call(this,ue(this,Sa)),di(this,An,Xh).call(this,ue(this,Ea)),di(this,An,Xh).call(this,ue(this,ul));if(r){for(let[s,{v:o,wv:l}]of r)s.wv<=l&&(s.v=o);_a=null}for(let s of ue(this,bs))$i(s);for(let s of ue(this,cl))$i(s);It(this,bs,[]),It(this,cl,[])}capture(e,r){ue(this,ol).has(e)||ue(this,ol).set(e,r),this.current.set(e,e.v)}activate(){xe=this}deactivate(){xe=null,fu=null;for(let e of b1)if(b1.delete(e),e(),xe!==null)break}neuter(){It(this,hu,!0)}flush(){_s.length>0?C1():di(this,An,T1).call(this),xe===this&&(ue(this,xa)===0&&uu.delete(this),this.deactivate())}increment(){It(this,xa,ue(this,xa)+1)}decrement(){if(It(this,xa,ue(this,xa)-1),ue(this,xa)===0){for(let e of ue(this,pu))mt(e,2048),ii(e);for(let e of ue(this,mu))mt(e,4096),ii(e);It(this,Sa,[]),It(this,Ea,[]),this.flush()}else this.deactivate()}add_callback(e){ue(this,ll).add(e)}settled(){var e;return((e=ue(this,du))!=null?e:It(this,du,dO())).promise}static ensure(){if(xe===null){let e=xe=new Zh;uu.add(xe),Yh||Zh.enqueue(()=>{xe===e&&e.flush()})}return xe}static enqueue(e){Kh.length===0&&queueMicrotask(BO),Kh.unshift(e)}};ol=new WeakMap,ll=new WeakMap,xa=new WeakMap,du=new WeakMap,hu=new WeakMap,bs=new WeakMap,cl=new WeakMap,Sa=new WeakMap,Ea=new WeakMap,ul=new WeakMap,pu=new WeakMap,mu=new WeakMap,An=new WeakSet,HO=function(e){var u;e.f^=1024;for(var r=e.first;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0,s=a||(n&8192)!==0||this.skipped_effects.has(r);if
Line truncated
|
||||
\r\f\xA0\v\uFEFF`];function b5(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i in r)if(r[i])n=n?n+" "+i:i;else if(n.length)for(var a=i.length,s=0;(s=n.indexOf(i,s))>=0;){var o=s+a;(s===0||w5.includes(n[s-1]))&&(o===n.length||w5.includes(n[o]))?n=(s===0?"":n.substring(0,s))+n.substring(o+1):s=o}}return n===""?null:n}m();function ot(t,e,r,n,i,a){var s=t.__className;if(se||s!==r||s===void 0){var o=b5(r,n,a);(!se||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(a&&i!==a)for(var l in a){var c=!!a[l];(i==null||c!==!!i[l])&&t.classList.toggle(l,c)}return a}m();m();var zG=Symbol("class"),VG=Symbol("style"),qG=Symbol("is custom element"),WG=Symbol("is html");function ve(t,e,r,n){var i=YG(t);if(se&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||KG(t,e,r!=null?r:"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[hO]=r),r==null?t.removeAttribute(e):typeof r!="string"&&XG(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function YG(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[qG]:t.nodeName.includes("-"),[WG]:t.namespaceURI===cO}}var _5=new Map;function XG(t){var e=_5.get(t.nodeName);if(e)return e;_5.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=u1(n);for(var a in r)r[a].set&&e.push(a);n=rl(n)}return e}function KG(t,e,r){var n;D&&(e==="srcset"&&ZG(t,r)||K1((n=t.getAttribute(e))!=null?n:"",r)||RO(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function K1(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function x5(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function ZG(t,e){var r=x5(t.srcset),n=x5(e);return n.length===r.length&&n.every(([i,a],s)=>a===r[s][1]&&(K1(r[s][0],i)||K1(i,r[s][0])))}m();m();m();var JG=Oh?()=>performance.now():()=>Date.now(),Cn={tick:t=>(Oh?requestAnimationFrame:ir)(t),now:()=>JG(),tasks:new Set};function S5(){let t=Cn.now();Cn.tasks.forEach(e=>{e.c(t)||(Cn.tasks.delete(e),e.f())}),Cn.tasks.size!==0&&Cn.tick(S5)}function E5(t){let e;return Cn.tasks.size===0&&Cn.tick(S5),{promise:new Promise(r=>{Cn.tasks.add(e={c:t,f:r})}),abort(){Cn.tasks.delete(e)}}}function up(t,e){ks(()=>{t.dispatchEvent(new CustomEvent(e))})}function rz(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function A5(t){let e={},r=t.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let s=rz(i.trim());e[s]=a.trim()}return e}var nz=t=>t;function Pn(t,e,r,n){var E;var i=(t&1)!==0,a=(t&2)!==0,s=i&&a,o=(t&4)!==0,l=s?"both":i?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function p(){return ks(()=>{var S;return c!=null?c:c=r()(e,(S=n==null?void 0:n())!=null?S:{},{direction:l})})}var g={is_global:o,in(){var S;if(e.inert=u,!i){h==null||h.abort(),(S=h==null?void 0:h.reset)==null||S.call(h);return}a||d==null||d.abort(),up(e,"introstart"),d=Z1(e,p(),h,1,()=>{up(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(S){if(!a){S==null||S(),c=void 0;return}e.inert=!0,up(e,"outrostart"),h=Z1(e,p(),d,0,()=>{up(e,"outroend"),S==null||S()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=ee;if(((E=v.transitions)!=null?E:v.transitions=[]).push(g),i&&op){var y=o;if(!y){for(var b=v.parent;b&&b.f&65536;)for(;(b=b.parent)&&!(b.f&16););y=!b||(b.f&32768)!==0}y&&Tr(()=>{Ue(()=>g.in())})}}function Z1(t,e,r,n,i){var a=n===1;if(h1(e)){var s,o=!1;return Lr(()=>{if(!o){var v=e({direction:a?"in":"out"});s=Z1(t,v,r,n,i)}}),{abort:()=>{o=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration))return i(),{abort:ir,deactivate:ir,reset:ir,t:()=>n};let{delay:l=0,css:c,tick:u,easing:f=nz}=e;var d=[];if(a&&r===void 0&&(u&&u(0,1),c)){var h=A5(c(0,1));d.push(h,h)}var p=()=>1-n,g=t.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{var _;g.cancel();var v=(_=r==null?void 0:r.t())!=null?_:1-n;r==null||r.abort();var y=n-v,b=e.duration*Math.abs(y),E=[];if(b>0){var S=!1;if(c)for(var A=Math.ceil(b/16.666666666666668),k=0;k<=A;k+=1){var w=v+y*f(k/A),x=A5(c(w,1-w));E.push(x),S||(S=x.overflow==="hidden")}S&&(t.style.overflow="hidden"),p=()=>{var T=g.currentTime;return v+y*f(T/b)},u&&E5(()=>{if(g.playState!=="running")return!1;var T=p();return u(T,1-T),!0})}g=t.animate(E,{duration:b,fill:"forwards"}),g.onfinish=()=>{p=()=>n,u==null||u(n,1-n),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=ir)},deactivate:()=>{i=ir},reset:()=>{n===0&&(u==null||u(1,0))},t:()=>p()}}m();m();function ey(t,e,r=e){var n=on(),i=new WeakSet;G1(t,"input",a=>{D&&t.type==="checkbox"&&p1();var s=a?t.defaultValue:t.value;if(s=J1(t)?Q1(s):s,r(s),xe!==null&&i.add(xe),n&&s!==(s=e())){var o=t.selectionStart,l=t.selectionEnd;t.value=s!=null?s:"",l!==null&&(t.selectionStart=o,t.se
Line truncated
|
||||
`:""}${(x=e.log.author)==null?void 0:x.name}
|
||||
${(0,sy.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
|
||||
${e.log.message}`},()=>({"is-collapsed":R(i)})]),ae(t,o),rt()}gt(["click"]);function Dz(t,e){e().catch(console.error)}var Lz=(t,e,r,n)=>{ie(e,!R(e)),(0,ly.setIcon)(r[0],R(e)?"list":"folder"),n(n().settings.treeStructure=R(e),!0),n().saveSettings()},jz=fe('<div class="tree-item nav-folder mod-root"></div>'),Nz=fe('<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>'),Bz={hash:"svelte-45h",code:""};function cy(t,e){tt(e,!0),Tn(t,Bz);let r=cn(e,"plugin",15),n=Pe(!1),i=Ne([]),a=Pe(void 0),s=Pe(Ne(r().settings.treeStructure)),o,l;Zt(()=>{l&&l.empty()}),o=e.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)),Zt(()=>{i.forEach(S=>(0,ly.setIcon)(S,S.getAttr("data-icon")))}),d5(()=>{e.view.app.workspace.offref(o)}),W1(()=>{let S=new IntersectionObserver(k=>{k[0].isIntersecting&&!R(n)&&u().catch(console.error)}),A=document.querySelector("#sentinel");return A&&S.observe(A),()=>{S.disconnect()}}),c().catch(console.error);function c(){return Ts(this,void 0,void 0,function*(){var S;if(!r().gitReady){ie(a,void 0);return}ie(n,!0);let A=r().gitManager instanceof Ce,k;((S=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&S!==void 0?S:0)==0?k=A?50:10:k=R(a).length,ie(a,yield r().gitManager.log(void 0,!1,k),!0),ie(n,!1)})}function u(){return Ts(this,void 0,void 0,function*(){var S;if(!r().gitReady||R(a)===void 0)return;ie(n,!0);let k=r().gitManager instanceof Ce?50:10,w=yield r().gitManager.log(void 0,!1,k,(S=R(a).last())===null||S===void 0?void 0:S.hash);R(a).push(...w.slice(1)),ie(n,!1)})}var f=Nz(),d=G(f),h=G(d),p=G(h);p.__click=[Lz,s,i,r],Ze(p,S=>i[0]=S,()=>i==null?void 0:i[0]);var g=te(p,2);let v;g.__click=[Dz,c],Ze(g,S=>i[1]=S,()=>i==null?void 0:i[1]),H(h),H(d);var y=te(d,2),b=G(y);{var E=S=>{var A=jz();Vr(A,21,()=>R(a),zr,(k,w)=>{oy(k,{get view(){return e.view},get showTree(){return R(s)},get log(){return R(w)},get plugin(){return r()}})}),H(A),ae(S,A)};_e(b,S=>{R(a)&&S(E)})}il(4),H(y),H(f),Fe(S=>{ve(p,"data-icon",R(s)?"list":"folder"),v=ot(g,1,"clickable-icon nav-action-button",null,v,S)},[()=>({loading:R(n)})]),ae(t,f),rt()}gt(["click"]);var Su=class extends C5.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Zr.type}getDisplayText(){return Zr.name}getIcon(){return Zr.icon}onClose(){return this._view&&ji(this._view),super.onClose()}reload(){this._view&&ji(this._view),this._view=Ta(cy,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var P5=require("obsidian"),pp=class extends P5.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)})}};m();var $5=require("obsidian");m();var Ms=require("obsidian");m();var Au=require("obsidian");m();m();var Hz=Ot(R5()),Ca=require("obsidian");function Cs(t,e,r){let n=t.target;app.workspace.trigger("hover-link",{event:t,source:e.getViewType(),hoverParent:e,targetEl:n,linktext:r})}m();var M5=require("obsidian");var gl=class extends M5.Modal{constructor({app:r,path:n,filesToDeleteCount:i,filesToDiscardCount:a}){super(r);this.resolve=null;this.path=n,this.deleteCount=i,this.discardCount=a}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:n,titleEl:i}=this,a="";this.path!=""&&(r>1?a=`files in "${this.path}"`:a=`"${this.path}"`),i.setText(`${this.discardCount==0?"Delete":"Discard"} ${a}`),this.deleteCount>0&&n.createEl("p").setText(`Are you sure you want to DELETE the ${Ic(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&n.createEl("p").setText(`Are you sure you want to discard ALL changes in ${Ic(this.discardCount,"tracked file")}?`);let s=n.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${Ic(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=s.createEl("button",{cls:"mod-warning",text:`Discard all ${Ic(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.res
Line truncated
|
||||
`+a),this.refresh()}handleFileMenu(r,n,i,a){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let s;if(typeof n=="string"?s=n:s=n.path,i=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.stageFile(n):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(s,!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()=>{n instanceof we.TFile?await this.unstageFile(n):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(s,!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(s,n instanceof we.TFolder).catch(c=>this.displayError(c))})})),i=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;a==="obsidian-git:menu"&&o instanceof we.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(s)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(L5.join(o.getBasePath(),s))})}))}}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.statusBar=void 0,this.branchBar=void 0,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=gT(Xe,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return we.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new dh(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 Ce(this),await this.gitManager.setGitInstance()):this.gitManager=new wn(this);let i=await this.gitManager.checkRequirements(),a=this.localStorage.getPausedAutomatics();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new we.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}),we.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let s=this.addStatusBarItem();this.branchBar=new gp(s,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.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&&!a&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),a||await this.automaticsManager.init(),a&&new we.Notice("Automatic routines are currently paused.");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 we.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new ze(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new ze(this,{options:this.gitManager instanceof wn?[i]:[],placeholder:"E
Line truncated
|
||||
`).filter(u=>!u.includes("svelte/src/internal")).join(`
|
||||
`)}}}function AO(t){let e=V0.get(t);e&&(Wt(t,"message",{value:e.message}),Wt(t,"stack",{value:e.stack}))}p();var bu=[],Y0=[];function TO(){var t=bu;bu=[],hu(t)}function aV(){var t=Y0;Y0=[],hu(t)}function Br(t){bu.length===0&&queueMicrotask(TO),bu.push(t)}function CO(){bu.length>0&&TO(),Y0.length>0&&aV()}p();var Pie=589952;function np(){for(var t=Q.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&aO(),t}p();p();var Ui=null;function J0(t){Ui=t}var xu=new Set;function As(t){var e=2050,r=se!==null&&se.f&2?se:null;Q===null||r!==null&&r.f&256?e|=256:Q.f|=524288;let n={ctx:ve,deps:null,effects:null,equals:Kh,f:e,fn:t,reactions:null,rv:0,v:Ve,wv:0,parent:r!=null?r:Q,ac:null};return L&&ii&&(n.created=ai("CreatedAt")),n}function Q0(t,e){let r=Q;r===null&&sO();var n=r.b,i=void 0,a=Hr(Ve),s=null,o=!se;return PO(()=>{var h;L&&(Ui=Q);try{var l=t()}catch(m){l=Promise.reject(m)}L&&(Ui=null);var u=()=>l;i=(h=s==null?void 0:s.then(u,u))!=null?h:Promise.resolve(l),s=i;var c=Se,f=n.pending;o&&(n.update_pending_count(1),f||c.increment());let d=(m,g=void 0)=>{s=null,Ui=null,f||c.activate(),g?g!==hl&&(a.f|=8388608,oi(a,g)):(a.f&8388608&&(a.f^=8388608),oi(a,m),L&&e!==void 0&&(xu.add(a),setTimeout(()=>{xu.has(a)&&(bO(a.label,e),xu.delete(a))}))),o&&(n.update_pending_count(-1),f||c.decrement()),sp()};if(i.then(d,m=>d(null,m||"unknown")),c)return()=>{queueMicrotask(()=>c.neuter())}}),L&&(a.f|=4194304),new Promise(l=>{function u(c){function f(){c===i?l(a):u(i)}c.then(f,f)}u(i)})}function Rt(t){let e=As(t);return op(e),e}function Ts(t){let e=As(t);return e.equals=Qh,e}function ip(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r<e.length;r+=1)Tt(e[r])}}var Z0=[];function sV(t){for(var e=t.parent;e!==null;){if(!(e.f&2))return e;e=e.parent}return null}function Su(t){var e,r=Q;if(Ht(sV(t)),L){let n=Cs;K0(new Set);try{Z0.includes(t)&&oO(),Z0.push(t),ip(t),e=ap(t)}finally{Ht(r),K0(n),Z0.pop()}}else try{ip(t),e=ap(t)}finally{Ht(r)}return e}function ey(t){var e=Su(t);if(t.equals(e)||(t.v=e,t.wv=Eu()),!Cn)if(Pa!==null)Pa.set(t,t.v);else{var r=(ji||t.f&256)&&t.deps!==null?4096:1024;mt(t,r)}}function lp(t,e,r){let n=un()?As:Ts;if(e.length===0){r(t.map(n));return}var i=Se,a=Q,s=oV(),o=np();Promise.all(e.map(l=>Q0(l))).then(l=>{i==null||i.activate(),s();try{r([...t.map(n),...l])}catch(u){a.f&16384||ml(u,a)}i==null||i.deactivate(),sp()}).catch(l=>{o.error(l)})}function oV(){var t=Q,e=se,r=ve;return function(){Ht(t),Ct(e),Ca(r),L&&J0(null)}}function sp(){Ht(null),Ct(null),Ca(null),L&&J0(null)}var ku=new Set,Se=null,Au=null,Pa=null,X0=new Set,fp=[];function IO(){let t=fp.shift();fp.length>0&&queueMicrotask(IO),t()}var Rs=[],pp=null,ty=!1,cp=!1,vl,wl,Ra,Tu,Cu,Ps,yl,Ia,$a,bl,Pu,Ru,Rn,$O,up,ry,dp=class dp{constructor(){wt(this,Rn);vt(this,"current",new Map);wt(this,vl,new Map);wt(this,wl,new Set);wt(this,Ra,0);wt(this,Tu,null);wt(this,Cu,!1);wt(this,Ps,[]);wt(this,yl,[]);wt(this,Ia,[]);wt(this,$a,[]);wt(this,bl,[]);wt(this,Pu,[]);wt(this,Ru,[]);vt(this,"skipped_effects",new Set)}process(e){var a;Rs=[],Au=null;var r=null;if(ku.size>1){r=new Map,Pa=new Map;for(let[s,o]of this.current)r.set(s,{v:s.v,wv:s.wv}),s.v=o;for(let s of ku)if(s!==this)for(let[o,l]of le(s,vl))r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(let s of e)vi(this,Rn,$O).call(this,s);if(le(this,Ps).length===0&&le(this,Ra)===0){vi(this,Rn,ry).call(this);var n=le(this,Ia),i=le(this,$a);Ot(this,Ia,[]),Ot(this,$a,[]),Ot(this,bl,[]),Au=Se,Se=null,RO(n),RO(i),Se===null?Se=this:ku.delete(this),(a=le(this,Tu))==null||a.resolve()}else vi(this,Rn,up).call(this,le(this,Ia)),vi(this,Rn,up).call(this,le(this,$a)),vi(this,Rn,up).call(this,le(this,bl));if(r){for(let[s,{v:o,wv:l}]of r)s.wv<=l&&(s.v=o);Pa=null}for(let s of le(this,Ps))Gi(s);for(let s of le(this,yl))Gi(s);Ot(this,Ps,[]),Ot(this,yl,[])}capture(e,r){le(this,vl).has(e)||le(this,vl).set(e,r),this.current.set(e,e.v)}activate(){Se=this}deactivate(){Se=null,Au=null;for(let e of X0)if(X0.delete(e),e(),Se!==null)break}neuter(){Ot(this,Cu,!0)}flush(){Rs.length>0?ny():vi(this,Rn,ry).call(this),Se===this&&(le(this,Ra)===0&&ku.delete(this),this.deactivate())}increment(){Ot(this,Ra,le(this,Ra)+1)}decrement(){if(Ot(this,Ra,le(this,Ra)-1),le(this,Ra)===0){for(let e of le(this,Pu))mt(e,2048),ci(e);for(let e of le(this,Ru))mt(e,4096),ci(e);Ot(this,Ia,[]),Ot(this,$a,[]),this.flush()}else this.deactivate()}add_callback(e){le(this,wl).add(e)}settled(){var e;return((e=le(this,Tu))!=null?e:Ot(this,Tu,nO())).promise}static ensure(){if(Se===null){let e=Se=new dp;ku.add(Se),cp||dp.enqueue(()=>{Se===e&&e.flush()})}return Se}static enqueue(e){fp.length===0&&queueMicrotask(IO),fp.unshift(e)}};vl=new WeakMap,wl=new WeakMap,Ra=new WeakMap,Tu=new WeakMap,Cu=new WeakMap,Ps=new WeakMap,yl=new WeakMap,Ia=new WeakMap,$a=new WeakMap,bl=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Rn=new WeakSet,$O=function(e){var c;e.f^=1024;for(var r=e.first;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0,s=a||(n&8192)!==0||this.skipped_effects.has(r);if(!s&&r.fn
Line truncated
|
||||
\r\f\xA0\v\uFEFF`];function fM(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i in r)if(r[i])n=n?n+" "+i:i;else if(n.length)for(var a=i.length,s=0;(s=n.indexOf(i,s))>=0;){var o=s+a;(s===0||uM.includes(n[s-1]))&&(o===n.length||uM.includes(n[o]))?n=(s===0?"":n.substring(0,s))+n.substring(o+1):s=o}}return n===""?null:n}p();function ot(t,e,r,n,i,a){var s=t.__className;if(ae||s!==r||s===void 0){var o=fM(r,n,a);(!ae||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(a&&i!==a)for(var l in a){var u=!!a[l];(i==null||u!==!!i[l])&&t.classList.toggle(l,u)}return a}p();p();var BV=Symbol("class"),HV=Symbol("style"),UV=Symbol("is custom element"),jV=Symbol("is html");function ge(t,e,r,n){var i=GV(t);if(ae&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||zV(t,e,r!=null?r:"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[iO]=r),r==null?t.removeAttribute(e):typeof r!="string"&&qV(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function GV(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[UV]:t.nodeName.includes("-"),[jV]:t.namespaceURI===eO}}var dM=new Map;function qV(t){var e=dM.get(t.nodeName);if(e)return e;dM.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=B0(n);for(var a in r)r[a].set&&e.push(a);n=dl(n)}return e}function zV(t,e,r){var n;L&&(e==="srcset"&&VV(t,r)||ky((n=t.getAttribute(e))!=null?n:"",r)||_O(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function ky(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function hM(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function VV(t,e){var r=hM(t.srcset),n=hM(e);return n.length===r.length&&n.every(([i,a],s)=>a===r[s][1]&&(ky(r[s][0],i)||ky(i,r[s][0])))}p();p();p();var WV=Wh?()=>performance.now():()=>Date.now(),Fn={tick:t=>(Wh?requestAnimationFrame:ar)(t),now:()=>WV(),tasks:new Set};function pM(){let t=Fn.now();Fn.tasks.forEach(e=>{e.c(t)||(Fn.tasks.delete(e),e.f())}),Fn.tasks.size!==0&&Fn.tick(pM)}function mM(t){let e;return Fn.tasks.size===0&&Fn.tick(pM),{promise:new Promise(r=>{Fn.tasks.add(e={c:t,f:r})}),abort(){Fn.tasks.delete(e)}}}function kp(t,e){Ms(()=>{t.dispatchEvent(new CustomEvent(e))})}function KV(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function gM(t){let e={},r=t.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let s=KV(i.trim());e[s]=a.trim()}return e}var JV=t=>t;function On(t,e,r,n){var E;var i=(t&1)!==0,a=(t&2)!==0,s=i&&a,o=(t&4)!==0,l=s?"both":i?"in":"out",u,c=e.inert,f=e.style.overflow,d,h;function m(){return Ms(()=>{var x;return u!=null?u:u=r()(e,(x=n==null?void 0:n())!=null?x:{},{direction:l})})}var g={is_global:o,in(){var x;if(e.inert=c,!i){h==null||h.abort(),(x=h==null?void 0:h.reset)==null||x.call(h);return}a||d==null||d.abort(),kp(e,"introstart"),d=Ay(e,m(),h,1,()=>{kp(e,"introend"),d==null||d.abort(),d=u=void 0,e.style.overflow=f})},out(x){if(!a){x==null||x(),u=void 0;return}e.inert=!0,kp(e,"outrostart"),h=Ay(e,m(),d,0,()=>{kp(e,"outroend"),x==null||x()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=Q;if(((E=v.transitions)!=null?E:v.transitions=[]).push(g),i&&xp){var w=o;if(!w){for(var b=v.parent;b&&b.f&65536;)for(;(b=b.parent)&&!(b.f&16););w=!b||(b.f&32768)!==0}w&&Pr(()=>{je(()=>g.in())})}}function Ay(t,e,r,n,i){var a=n===1;if(j0(e)){var s,o=!1;return Br(()=>{if(!o){var v=e({direction:a?"in":"out"});s=Ay(t,v,r,n,i)}}),{abort:()=>{o=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration))return i(),{abort:ar,deactivate:ar,reset:ar,t:()=>n};let{delay:l=0,css:u,tick:c,easing:f=JV}=e;var d=[];if(a&&r===void 0&&(c&&c(0,1),u)){var h=gM(u(0,1));d.push(h,h)}var m=()=>1-n,g=t.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{var _;g.cancel();var v=(_=r==null?void 0:r.t())!=null?_:1-n;r==null||r.abort();var w=n-v,b=e.duration*Math.abs(w),E=[];if(b>0){var x=!1;if(u)for(var k=Math.ceil(b/16.666666666666668),A=0;A<=k;A+=1){var y=v+w*f(A/k),S=gM(u(y,1-y));E.push(S),x||(x=S.overflow==="hidden")}x&&(t.style.overflow="hidden"),m=()=>{var T=g.currentTime;return v+w*f(T/b)},c&&mM(()=>{if(g.playState!=="running")return!1;var T=m();return c(T,1-T),!0})}g=t.animate(E,{duration:b,fill:"forwards"}),g.onfinish=()=>{m=()=>n,c==null||c(n,1-n),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=ar)},deactivate:()=>{i=ar},reset:()=>{n===0&&(c==null||c(1,0))},t:()=>m()}}p();p();function Py(t,e,r=e){var n=un(),i=new WeakSet;wy(t,"input",a=>{L&&t.type==="checkbox"&&G0();var s=a?t.defaultValue:t.value;if(s=Ty(t)?Cy(s):s,r(s),Se!==null&&i.add(Se),n&&s!==(s=e())){var o=t.selectionStart,l=t.selectionEnd;t.value=s!=null?s:"",l!==null&&(t.selectionStart=o,t.sel
Line truncated
|
||||
`:""}${(S=e.log.author)==null?void 0:S.name}
|
||||
${(0,My.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
|
||||
${e.log.message}`},()=>({"is-collapsed":R(i)})]),ie(t,o),rt()}gt(["click"]);function IW(t,e){e().catch(console.error)}var $W=(t,e,r,n)=>{ne(e,!R(e)),(0,Ly.setIcon)(r[0],R(e)?"list":"folder"),n(n().settings.treeStructure=R(e),!0),n().saveSettings()},FW=ce('<div class="tree-item nav-folder mod-root"></div>'),OW=ce('<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>'),MW={hash:"svelte-45h",code:""};function Ny(t,e){tt(e,!0),$n(t,MW);let r=dn(e,"plugin",15),n=Ce(!1),i=Ne([]),a=Ce(void 0),s=Ce(Ne(r().settings.treeStructure)),o,l;Jt(()=>{l&&l.empty()}),o=e.view.app.workspace.on("obsidian-git:head-change",()=>void u().catch(console.error)),Jt(()=>{i.forEach(x=>(0,Ly.setIcon)(x,x.getAttr("data-icon")))}),nM(()=>{e.view.app.workspace.offref(o)}),xy(()=>{let x=new IntersectionObserver(A=>{A[0].isIntersecting&&!R(n)&&c().catch(console.error)}),k=document.querySelector("#sentinel");return k&&x.observe(k),()=>{x.disconnect()}}),u().catch(console.error);function u(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady){ne(a,void 0);return}ne(n,!0);let k=r().gitManager instanceof _e,A;((x=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&x!==void 0?x:0)==0?A=k?50:10:A=R(a).length,ne(a,yield r().gitManager.log(void 0,!1,A),!0),ne(n,!1)})}function c(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(a)===void 0)return;ne(n,!0);let A=r().gitManager instanceof _e?50:10,y=yield r().gitManager.log(void 0,!1,A,(x=R(a).last())===null||x===void 0?void 0:x.hash);R(a).push(...y.slice(1)),ne(n,!1)})}var f=OW(),d=q(f),h=q(d),m=q(h);m.__click=[$W,s,i,r],Ke(m,x=>i[0]=x,()=>i==null?void 0:i[0]);var g=ee(m,2);let v;g.__click=[IW,u],Ke(g,x=>i[1]=x,()=>i==null?void 0:i[1]),j(h),j(d);var w=ee(d,2),b=q(w);{var E=x=>{var k=FW();Wr(k,21,()=>R(a),Vr,(A,y)=>{Dy(A,{get view(){return e.view},get showTree(){return R(s)},get log(){return R(y)},get plugin(){return r()}})}),j(k),ie(x,k)};xe(b,x=>{R(a)&&x(E)})}pl(4),j(w),j(f),Fe(x=>{ge(m,"data-icon",R(s)?"list":"folder"),v=ot(g,1,"clickable-icon nav-action-button",null,v,x)},[()=>({loading:R(n)})]),ie(t,f),rt()}gt(["click"]);var Nu=class extends yM.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Qr.type}getDisplayText(){return Qr.name}getIcon(){return Qr.icon}onClose(){return this._view&&Vi(this._view),super.onClose()}reload(){this._view&&Vi(this._view),this._view=Ma(Ny,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var bM=require("obsidian"),Pp=class extends bM.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)})}};p();var kM=require("obsidian");p();var Bs=require("obsidian");p();var Bu=require("obsidian");p();var _M=require("obsidian");var Al=class extends _M.Modal{constructor({app:r,path:n,filesToDeleteCount:i,filesToDiscardCount:a}){super(r);this.resolve=null;this.path=n,this.deleteCount=i,this.discardCount=a}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:n,titleEl:i}=this,a="";this.path!=""&&(r>1?a=`files in "${this.path}"`:a=`"${this.path}"`),i.setText(`${this.discardCount==0?"Delete":"Discard"} ${a}`),this.deleteCount>0&&n.createEl("p").setText(`Are you sure you want to DELETE the ${Lc(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&n.createEl("p").setText(`Are you sure you want to discard ALL changes in ${Lc(this.discardCount,"tracked file")}?`);let s=n.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${Lc(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=s.createEl("button",{cls:"mod-warning",text:`Discard all ${Lc(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=s.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>
Line truncated
|
||||
`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(u+=`
|
||||
`),n.replaceRange(u,n.offsetToPos(o),n.offsetToPos(l)),n.setSelection(n.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,n=Sn.getHunk(r.state,!1,e),i=!1;if(n||(n=Sn.getHunk(r.state,!0,e),i=!0),!n)return;let a=r.state.field(AM.editorInfoField).file.path,s=Et.createPatch(a,[n],"100644",i).join(`
|
||||
`)+`
|
||||
`;await this.gitManager.applyPatch(s),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:n}=this.editor,i=Sn.getHunks(r.state,!1),a=n.getCursor().line+1,s=Et.findNearestHunk(a,i,e,!0);if(s==null)return;let o=i[s];if(o){let l=o.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};p();p();var Hs=require("obsidian");var Fp=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 Hs.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),a$(()=>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;m$(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new wh(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&&Hs.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof _e?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(A$),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(),u$(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var n;return e instanceof Hs.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof Hs.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",h$)}};p();var Tl=require("obsidian");p();p();var Us=require("@codemirror/state"),Mp=require("@codemirror/view");var Op=class extends Mp.GutterMarker{constructor(r,n){super();this.type=r;this.staged=n}toDOM(r){let n=document.createElement("div");return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},Hy=Us.StateField.define({create:()=>Us.RangeSet.empty,update:(t,e)=>{let r=e.state.field(xr,!1);if(!r)return Us
Line truncated
|
||||
`+a),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,n,i,a){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let s;if(typeof n=="string"?s=n:s=n.path,i=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.stageFile(n):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(s,!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()=>{n instanceof we.TFile?await this.unstageFile(n):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(s,!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(s,n instanceof we.TFolder).catch(u=>this.displayError(u))})})),i=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(u=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(c=>this.displayError(c))})});let o=this.app.vault.adapter;a==="obsidian-git:menu"&&o instanceof we.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(u=>{this.app.openWithDefaultApp(s)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(u=>{window.electron.shell.showItemInFolder(FM.join(o.getBasePath(),s))})}))}}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.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(n=this.statusBar)==null||n.remove(),this.statusBar=void 0,this.branchBar=void 0,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=oA(Xe,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return we.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new bh(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 _e(this),await this.gitManager.setGitInstance()):this.gitManager=new _n(this);let i=await this.gitManager.checkRequirements(),a=this.localStorage.getPausedAutomatics();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new we.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}),we.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let s=this.addStatusBarItem();this.branchBar=new Ip(s,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!a&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),a||await this.automaticsManager.init(),a&&new we.Notice("Automatic routines are currently paused.");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 we.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new ze(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new ze(this,{options:this.gitManager instanceof _n?[i]:[],placeholder
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.
|
||||
|
||||
@@ -385,7 +408,7 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
|
||||
File changes in remote repository
|
||||
>>>>>>> origin/main
|
||||
\`\`\``]),await this.tools.writeAndOpenFile(n==null?void 0:n.join(`
|
||||
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(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 ze(this,{initialValue:a,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,vv(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 ze(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),l=await new ze(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(a+"/")?l:`${a}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(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 ls||n instanceof fs))return;let i=this.app.workspace.getLeavesOfType($t.type).first(),a=this.app.workspace.getLeavesOfType(Zr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof ls||(r==null?void 0:r.view)instanceof fs){let l=r.view.state.bFile;this.lastDiffViewState=r.view.getState();let c;i&&r.view.state.aRef=="HEAD"?c=i.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path='${l}']`):i&&r.view.state.aRef==""?c=i.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path='${l}']`):a&&(c=a.view.containerEl.querySelector(`div.tree-item-self[data-path='${l}']`)),c==null||c.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 we.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof D5.Errors.UserCanceledError){new we.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new we.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)}};
|
||||
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(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 ze(this,{initialValue:a,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,ew(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 ze(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),l=await new ze(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(a+"/")?l:`${a}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(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 ys||n instanceof bs))return;let i=this.app.workspace.getLeavesOfType(Dt.type).first(),a=this.app.workspace.getLeavesOfType(Qr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof ys||(r==null?void 0:r.view)instanceof bs){let u=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let c;i&&r.view.state.aRef=="HEAD"?c=i.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${u}"]`):i&&r.view.state.aRef==""?c=i.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${u}"]`):a&&(c=a.view.containerEl.querySelector(`div.tree-item-self[data-path='${u}']`)),c==null||c.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 we.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof $M.Errors.UserCanceledError){new we.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new we.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),n)}log(...r){console.log(`${this.manifest.id}:`,...r)}};
|
||||
/*! Bundled license information:
|
||||
|
||||
ieee754/index.js:
|
||||
@@ -414,13 +437,6 @@ js-sha256/src/sha256.js:
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @license MIT
|
||||
*)
|
||||
|
||||
feather-icons/dist/feather.js:
|
||||
(*!
|
||||
Copyright (c) 2016 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*)
|
||||
*/
|
||||
|
||||
/* nosourcemap */
|
||||
@@ -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.35.2"
|
||||
"version": "2.36.1"
|
||||
}
|
||||
@@ -8,6 +8,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
.git-signs-gutter {
|
||||
.cm-gutterElement {
|
||||
/* Needed to align the sign properly for different line heigts. Such as
|
||||
* when having a heading or list item.
|
||||
*/
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="git-view"] .button-border {
|
||||
border: 2px solid var(--interactive-accent);
|
||||
border-radius: var(--radius-s);
|
||||
@@ -129,444 +138,401 @@
|
||||
color: var(--text-accent);
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-d-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header {
|
||||
background-color: var(--background-primary);
|
||||
border-bottom: 1px solid var(--interactive-accent);
|
||||
font-family: var(--font-monospace);
|
||||
height: 35px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-header,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats {
|
||||
font-size: 14px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added {
|
||||
border: 1px solid #b4e2b4;
|
||||
border-radius: 5px 0 0 5px;
|
||||
color: #399839;
|
||||
padding: 2px;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted {
|
||||
border: 1px solid #e9aeae;
|
||||
border-radius: 0 5px 5px 0;
|
||||
color: #c33;
|
||||
margin-left: 1px;
|
||||
padding: 2px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-name {
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper {
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse {
|
||||
-webkit-box-pack: end;
|
||||
-ms-flex-pack: end;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
justify-content: flex-end;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected {
|
||||
background-color: #c8e1ff;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input {
|
||||
margin: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table {
|
||||
border-collapse: collapse;
|
||||
font-family: Menlo, Consolas, monospace;
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff {
|
||||
display: inline-block;
|
||||
margin-bottom: -8px;
|
||||
margin-right: -4px;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line {
|
||||
padding: 0 8em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||
display: inline-block;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line {
|
||||
padding: 0 4.5em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
vertical-align: middle;
|
||||
white-space: pre;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
del {
|
||||
background-color: #ffb6ba;
|
||||
}
|
||||
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
del {
|
||||
background-color: #8d232881;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins {
|
||||
border-radius: 0.2em;
|
||||
display: inline-block;
|
||||
margin-top: -1px;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
ins {
|
||||
background-color: #97f295;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins,
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-code-side-line
|
||||
ins {
|
||||
background-color: #1d921996;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num1 {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num1,
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
padding: 0 0.5em;
|
||||
text-overflow: ellipsis;
|
||||
width: 3.5em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .line-num2 {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
width: 7.5em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding: 0 0.5em;
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
text-overflow: ellipsis;
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber,
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||
background-color: #fee8e9;
|
||||
border-color: #e9aeae;
|
||||
}
|
||||
|
||||
.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||
background-color: #dfd;
|
||||
border-color: #b4e2b4;
|
||||
}
|
||||
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del {
|
||||
background-color: #521b1d83;
|
||||
border-color: #691d1d73;
|
||||
}
|
||||
|
||||
.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins {
|
||||
background-color: rgba(30, 71, 30, 0.5);
|
||||
border-color: #13501381;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-info {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-del.d2h-change {
|
||||
background-color: #fdf2d0;
|
||||
}
|
||||
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-del.d2h-change {
|
||||
background-color: #55492480;
|
||||
}
|
||||
|
||||
.theme-light
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-ins.d2h-change {
|
||||
background-color: #ded;
|
||||
}
|
||||
|
||||
.theme-dark
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-diff
|
||||
.d2h-ins.d2h-change {
|
||||
background-color: rgba(37, 78, 37, 0.418);
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a {
|
||||
color: #3572b0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"]
|
||||
.d2h-file-list-wrapper
|
||||
a:visited {
|
||||
color: #3572b0;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list {
|
||||
display: block;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li {
|
||||
border-bottom: 1px solid var(--background-modifier-border);
|
||||
margin: 0;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-icon {
|
||||
fill: currentColor;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted {
|
||||
color: #c33;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-added {
|
||||
color: #399839;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-changed {
|
||||
color: #d0b44c;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-moved {
|
||||
color: #3572b0;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-tag {
|
||||
background-color: var(--background-primary);
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 10px;
|
||||
margin-left: 5px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag {
|
||||
border: 2px solid #c33;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag {
|
||||
border: 1px solid #399839;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag {
|
||||
border: 1px solid #d0b44c;
|
||||
}
|
||||
|
||||
.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag {
|
||||
border: 1px solid #3572b0;
|
||||
/* ====== diff2html ======
|
||||
The following styles are adapted from the obsidian-version-history plugin by
|
||||
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
|
||||
which itself is adapted from the diff2html library with the following original license:
|
||||
|
||||
https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md
|
||||
|
||||
Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
.theme-dark,
|
||||
.theme-light {
|
||||
--git-delete-bg: #ff475040;
|
||||
--git-delete-hl: #96050a75;
|
||||
--git-insert-bg: #68d36840;
|
||||
--git-insert-hl: #23c02350;
|
||||
--git-change-bg: #ffd55840;
|
||||
--git-selected: #3572b0;
|
||||
|
||||
--git-delete: #c33;
|
||||
--git-insert: #399839;
|
||||
--git-change: #d0b44c;
|
||||
--git-move: #3572b0;
|
||||
}
|
||||
|
||||
.git-diff {
|
||||
.d2h-d-none {
|
||||
display: none;
|
||||
}
|
||||
.d2h-wrapper {
|
||||
text-align: left;
|
||||
border-radius: 0.25em;
|
||||
overflow: auto;
|
||||
}
|
||||
.d2h-file-header.d2h-file-header {
|
||||
background-color: var(--background-secondary);
|
||||
border-bottom: 1px solid var(--background-modifier-border);
|
||||
font-family:
|
||||
Source Sans Pro,
|
||||
Helvetica Neue,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
height: 35px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.d2h-file-header,
|
||||
.d2h-file-stats {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
.d2h-file-header {
|
||||
display: none;
|
||||
}
|
||||
.d2h-file-stats {
|
||||
font-size: 14px;
|
||||
margin-left: auto;
|
||||
}
|
||||
.d2h-lines-added {
|
||||
border: 1px solid var(--color-green);
|
||||
border-radius: 5px 0 0 5px;
|
||||
color: var(--color-green);
|
||||
padding: 2px;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.d2h-lines-deleted {
|
||||
border: 1px solid var(--color-red);
|
||||
border-radius: 0 5px 5px 0;
|
||||
color: var(--color-red);
|
||||
margin-left: 1px;
|
||||
padding: 2px;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.d2h-file-name-wrapper {
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.d2h-file-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--text-normal);
|
||||
font-size: var(--h5-size);
|
||||
}
|
||||
.d2h-file-wrapper {
|
||||
border: 1px solid var(--background-secondary-alt);
|
||||
border-radius: 3px;
|
||||
margin-bottom: 1em;
|
||||
max-height: 100%;
|
||||
}
|
||||
.d2h-file-collapse {
|
||||
-webkit-box-pack: end;
|
||||
-ms-flex-pack: end;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
border: 1px solid var(--background-secondary-alt);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
justify-content: flex-end;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
.d2h-file-collapse.d2h-selected {
|
||||
background-color: var(--git-selected);
|
||||
}
|
||||
.d2h-file-collapse-input {
|
||||
margin: 0 4px 0 0;
|
||||
}
|
||||
.d2h-diff-table {
|
||||
border-collapse: collapse;
|
||||
font-family: var(--font-monospace);
|
||||
font-size: var(--code-size);
|
||||
width: 100%;
|
||||
}
|
||||
.d2h-files-diff {
|
||||
width: 100%;
|
||||
}
|
||||
.d2h-file-diff {
|
||||
/*
|
||||
overflow-y: scroll;
|
||||
*/
|
||||
border-radius: 5px;
|
||||
font-size: var(--font-text-size);
|
||||
line-height: var(--line-height-normal);
|
||||
}
|
||||
.d2h-file-side-diff {
|
||||
display: inline-block;
|
||||
margin-bottom: -8px;
|
||||
margin-right: -4px;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 50%;
|
||||
}
|
||||
.d2h-code-line {
|
||||
padding-left: 6em;
|
||||
padding-right: 1.5em;
|
||||
}
|
||||
.d2h-code-line,
|
||||
.d2h-code-side-line {
|
||||
display: inline-block;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
.d2h-code-side-line {
|
||||
/* needed to be changed */
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
.d2h-code-line-ctn {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
/* only works for line-by-line */
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.d2h-code-line del,
|
||||
.d2h-code-side-line del {
|
||||
background-color: var(--git-delete-hl);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
.d2h-code-line del,
|
||||
.d2h-code-line ins,
|
||||
.d2h-code-side-line del,
|
||||
.d2h-code-side-line ins {
|
||||
border-radius: 0.2em;
|
||||
display: inline-block;
|
||||
margin-top: -1px;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.d2h-code-line ins,
|
||||
.d2h-code-side-line ins {
|
||||
background-color: var(--git-insert-hl);
|
||||
text-align: left;
|
||||
}
|
||||
.d2h-code-line-prefix {
|
||||
word-wrap: normal;
|
||||
background: none;
|
||||
display: inline;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
}
|
||||
.line-num1 {
|
||||
float: left;
|
||||
}
|
||||
.line-num1,
|
||||
.line-num2 {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
/*
|
||||
padding: 0 0.5em;
|
||||
*/
|
||||
text-overflow: ellipsis;
|
||||
width: 2.5em;
|
||||
padding-left: 0;
|
||||
}
|
||||
.line-num2 {
|
||||
float: right;
|
||||
}
|
||||
.d2h-code-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-faint);
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
text-align: right;
|
||||
width: 5.5em;
|
||||
}
|
||||
.d2h-code-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
.d2h-code-side-linenumber {
|
||||
background-color: var(--background-primary);
|
||||
border: solid var(--background-modifier-border);
|
||||
border-width: 0 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
color: var(--text-faint);
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
padding: 0 0.5em;
|
||||
text-align: right;
|
||||
text-overflow: ellipsis;
|
||||
width: 4em;
|
||||
/* needed to be changed */
|
||||
display: table-cell;
|
||||
position: relative;
|
||||
}
|
||||
.d2h-code-side-linenumber:after {
|
||||
content: "\200b";
|
||||
}
|
||||
.d2h-code-side-emptyplaceholder,
|
||||
.d2h-emptyplaceholder {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
}
|
||||
.d2h-code-line-prefix,
|
||||
.d2h-code-linenumber,
|
||||
.d2h-code-side-linenumber,
|
||||
.d2h-emptyplaceholder {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.d2h-code-linenumber,
|
||||
.d2h-code-side-linenumber {
|
||||
direction: rtl;
|
||||
}
|
||||
.d2h-del {
|
||||
background-color: var(--git-delete-bg);
|
||||
border-color: var(--git-delete-hl);
|
||||
}
|
||||
.d2h-ins {
|
||||
background-color: var(--git-insert-bg);
|
||||
border-color: var(--git-insert-hl);
|
||||
}
|
||||
.d2h-info {
|
||||
background-color: var(--background-primary);
|
||||
border-color: var(--background-modifier-border);
|
||||
color: var(--text-faint);
|
||||
}
|
||||
.d2h-del,
|
||||
.d2h-ins,
|
||||
.d2h-file-diff .d2h-change {
|
||||
color: var(--text-normal);
|
||||
}
|
||||
.d2h-file-diff .d2h-del.d2h-change {
|
||||
background-color: var(--git-change-bg);
|
||||
}
|
||||
.d2h-file-diff .d2h-ins.d2h-change {
|
||||
background-color: var(--git-insert-bg);
|
||||
}
|
||||
.d2h-file-list-wrapper {
|
||||
a {
|
||||
text-decoration: none;
|
||||
cursor: default;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
svg {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.d2h-file-list-header {
|
||||
text-align: left;
|
||||
}
|
||||
.d2h-file-list-title {
|
||||
display: none;
|
||||
}
|
||||
.d2h-file-list-line {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
text-align: left;
|
||||
}
|
||||
.d2h-file-list {
|
||||
}
|
||||
.d2h-file-list > li {
|
||||
border-bottom: 1px solid var(--background-modifier-border);
|
||||
margin: 0;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.d2h-file-list > li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.d2h-file-switch {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
.d2h-icon {
|
||||
fill: currentColor;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.d2h-deleted {
|
||||
color: var(--git-delete);
|
||||
}
|
||||
.d2h-added {
|
||||
color: var(--git-insert);
|
||||
}
|
||||
.d2h-changed {
|
||||
color: var(--git-change);
|
||||
}
|
||||
.d2h-moved {
|
||||
color: var(--git-move);
|
||||
}
|
||||
.d2h-tag {
|
||||
background-color: var(--background-secondary);
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
font-size: 10px;
|
||||
margin-left: 5px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.d2h-deleted-tag {
|
||||
border: 1px solid var(--git-delete);
|
||||
}
|
||||
.d2h-added-tag {
|
||||
border: 1px solid var(--git-insert);
|
||||
}
|
||||
.d2h-changed-tag {
|
||||
border: 1px solid var(--git-change);
|
||||
}
|
||||
.d2h-moved-tag {
|
||||
border: 1px solid var(--git-move);
|
||||
}
|
||||
|
||||
/* needed for line-by-line*/
|
||||
|
||||
.d2h-diff-tbody {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
/* ====================== Line Authoring Information ====================== */
|
||||
@@ -627,3 +593,113 @@
|
||||
background: var(--interactive-hover);
|
||||
color: var(--text-accent-hover);
|
||||
}
|
||||
|
||||
.git-signs-gutter {
|
||||
.cm-gutterElement {
|
||||
display: grid;
|
||||
}
|
||||
}
|
||||
|
||||
.git-gutter-marker:hover {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.git-gutter-marker.git-add {
|
||||
background-color: var(--color-green);
|
||||
justify-self: center;
|
||||
height: inherit;
|
||||
width: 0.2rem;
|
||||
}
|
||||
|
||||
.git-gutter-marker.git-change {
|
||||
background-color: var(--color-yellow);
|
||||
justify-self: center;
|
||||
height: inherit;
|
||||
width: 0.2rem;
|
||||
}
|
||||
|
||||
.git-gutter-marker.git-changedelete {
|
||||
color: var(--color-yellow);
|
||||
font-weight: var(--font-bold);
|
||||
font-size: 1rem;
|
||||
justify-self: center;
|
||||
height: inherit;
|
||||
}
|
||||
|
||||
.git-gutter-marker.git-delete {
|
||||
background-color: var(--color-red);
|
||||
height: 0.2rem;
|
||||
width: 0.8rem;
|
||||
align-self: end;
|
||||
}
|
||||
|
||||
.git-gutter-marker.git-topdelete {
|
||||
background-color: var(--color-red);
|
||||
height: 0.2rem;
|
||||
width: 0.8rem;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
div:hover > .git-gutter-marker.git-change {
|
||||
width: 0.6rem;
|
||||
}
|
||||
|
||||
div:hover > .git-gutter-marker.git-add {
|
||||
width: 0.6rem;
|
||||
}
|
||||
|
||||
div:hover > .git-gutter-marker.git-delete {
|
||||
height: 0.6rem;
|
||||
}
|
||||
|
||||
div:hover > .git-gutter-marker.git-topdelete {
|
||||
height: 0.6rem;
|
||||
}
|
||||
|
||||
div:hover > .git-gutter-marker.git-changedelete {
|
||||
font-weight: var(--font-bold);
|
||||
}
|
||||
|
||||
.git-gutter-marker.staged {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.git-diff {
|
||||
.cm-merge-revert {
|
||||
width: 4em;
|
||||
}
|
||||
/* Ensure that merge revert markers are positioned correctly */
|
||||
.cm-merge-revert > * {
|
||||
position: absolute;
|
||||
background-color: var(--background-secondary);
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
/* Prevent shifting of the editor when git signs gutter is the only gutter present */
|
||||
.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) {
|
||||
margin-inline-end: 0;
|
||||
.git-signs-gutter {
|
||||
margin-inline-start: -1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.git-changes-status-bar-colored {
|
||||
.git-add {
|
||||
color: var(--color-green);
|
||||
}
|
||||
.git-change {
|
||||
color: var(--color-yellow);
|
||||
}
|
||||
.git-delete {
|
||||
color: var(--color-red);
|
||||
}
|
||||
}
|
||||
|
||||
.git-changes-status-bar .git-add {
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
.git-changes-status-bar .git-change {
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
@@ -3,24 +3,24 @@ THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var va=Object.create;var Rn=Object.defineProperty;var wa=Object.getOwnPropertyDescriptor;var ba=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var Vi=n=>Rn(n,"__esModule",{value:!0});var ka=(n,e)=>{Vi(n);for(var t in e)Rn(n,t,{get:e[t],enumerable:!0})},Sa=(n,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ba(e))!Ta.call(n,r)&&r!=="default"&&Rn(n,r,{get:()=>e[r],enumerable:!(t=wa(e,r))||t.enumerable});return n},X=n=>Sa(Vi(Rn(n!=null?va(Ea(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var zi=(()=>{for(var n=new Uint8Array(128),e=0;e<64;e++)n[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var r=t.length,i=new Uint8Array((r-(t[r-1]=="=")-(t[r-2]=="="))*3/4|0),o=0,a=0;o<r;){var l=n[t.charCodeAt(o++)],c=n[t.charCodeAt(o++)],d=n[t.charCodeAt(o++)],m=n[t.charCodeAt(o++)];i[a++]=l<<2|c>>4,i[a++]=c<<4|d>>2,i[a++]=d<<6|m}return i}})();ka(exports,{default:()=>Fi});var Er=X(require("obsidian"));var L=X(require("obsidian"));var Ji=X(require("obsidian"));function oe(n){let e=new Ji.Notice("",8e3),t=createFragment(r=>{r.createEl("b",{text:"Templater Error"}),r.createEl("span",{text:":"}),r.createEl("br"),r.createEl("span",{text:n.message}),n instanceof P&&n.console_msg&&(r.createEl("br"),r.createEl("span",{text:"Check console for more information"}),console.error("Templater Error:",n.message,`
|
||||
`,n.console_msg))});e.noticeEl.appendChild(t)}var P=class extends Error{constructor(e,t){super(e);this.console_msg=t;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function Se(n,e){try{return await n()}catch(t){return t instanceof P?oe(t):oe(new P(e,t.message)),null}}function Ce(n,e){try{return n()}catch(t){return oe(new P(e,t.message)),null}}var re=function(){function n(){}return n.explainIfInvalidTSDocTagName=function(e){if(e[0]!=="@")return'A TSDoc tag name must start with an "@" symbol';if(!n._tsdocTagNameRegExp.test(e))return"A TSDoc tag name must start with a letter and contain only letters and numbers"},n.validateTSDocTagName=function(e){var t=n.explainIfInvalidTSDocTagName(e);if(t)throw new Error(t)},n.explainIfInvalidLinkUrl=function(e){if(e.length===0)return"The URL cannot be empty";if(!n._urlSchemeRegExp.test(e))return'An @link URL must begin with a scheme comprised only of letters and numbers followed by "://". (For general URLs, use an HTML "<a>" tag instead.)';if(!n._urlSchemeAfterRegExp.test(e))return'An @link URL must have at least one character after "://"'},n.explainIfInvalidHtmlName=function(e){if(!n._htmlNameRegExp.test(e))return"An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens"},n.validateHtmlName=function(e){var t=n.explainIfInvalidHtmlName(e);if(t)throw new Error(t)},n.explainIfInvalidPackageName=function(e){if(e.length===0)return"The package name cannot be an empty string";if(!n._validPackageNameRegExp.test(e))return"The package name ".concat(JSON.stringify(e)," is not a valid package name")},n.explainIfInvalidImportPath=function(e,t){if(e.length>0){if(e.indexOf("//")>=0)return'An import path must not contain "//"';if(e[e.length-1]==="/")return'An import path must not end with "/"';if(!t&&e[0]==="/")return'An import path must not start with "/" unless prefixed by a package name'}},n.isSystemSelector=function(e){return n._systemSelectors.has(e)},n.explainIfInvalidUnquotedIdentifier=function(e){if(e.length===0)return"The identifier cannot be an empty string";if(n._identifierBadCharRegExp.test(e))return"The identifier cannot non-word characters";if(n._identifierNumberStartRegExp.test(e))return"The identifier must not start with a number"},n.explainIfInvalidUnquotedMemberIdentifier=function(e){var t=n.explainIfInvalidUnquotedIdentifier(e);if(t!==void 0)return t;if(n.isSystemSelector(e))return'The identifier "'.concat(e,'" must be quoted because it is a TSDoc system selector name')},n._tsdocTagNameRegExp=/^@[a-z][a-z0-9]*$/i,n._urlSchemeRegExp=/^[a-z][a-z0-9]*\:\/\//i,n._urlSchemeAfterRegExp=/^[a-z][a-z0-9]*\:\/\/./i,n._htmlNameRegExp=/^[a-z]+[a-z0-9\-]*$/i,n._identifierBadCharRegExp=/[^a-z0-9_$]/i,n._identifierNumberStartRegExp=/^[0-9]/,n._validPackageNameRegExp=/^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i,n._systemSelectors=new Set(["instance","static","constructor","class","enum","function","interface","namespace","type","variable"]),n}();var Pr=function(){function n(){this._docNodeDefinitionsByKind=new Map,this._docNodeDefinitionsByConstructor=new Map}return n.prototype.registerDocNodes=function(e,t){var r=re.explainIfInvalidPackageName(e);if(r)throw new Error("Invalid NPM package name: "+r);for(var i=0,o=t;i<o.length;i++){var a=o[i];if(!n._nodeKindRegExp.test(a.docNodeKind))throw new Error("The DocNode kind ".concat(JSON.stringify(a.docNodeKind)," is not a valid identifier.")+" It must start with an underscore or letter, and be comprised of letters, numbers, and underscores");var l=this._docNodeDefinitionsByKind.get(a.docNodeKind);if(l!==void 0)throw new Error('The DocNode kind "'.concat(a.docNodeKind,'" was already registered')+" by ".concat(l.packageName));if(l=this._docNodeDefinitionsByConstructor.get(a.constructor),l!==void 0)throw new Error("This DocNode constructor was already registered by ".concat(l.packageName)+" as ".concat(l.docNodeKind));var c={docNodeKind:a.docNodeKind,constructor:a.constructor,packageName:e,allowedChildKinds:new Set};this._docNodeDefinitionsByKind.set(a.docNodeKind,c),this._docNodeDefinitionsByConstructor.set(a.constructor,c)}},n.prototype.throwIfNotRegisteredKind=function(e){if(!this._docNodeDefinitionsByKind.has(e))throw new Error('The DocNode kind "'.concat(e,'" was not registered with this TSDocConfiguration'))},n.prototype.registerAllowableChildren=function(e,t){for(var r=this._getDefinition(e),i=0,o=t;i<o.length;i++){var a=o[i];this._getDefinition(a),r.allowedChildKinds.add(a)}},n.prototype.isAllowedChild=function(e,t){var r=this._getDefinition(e);return r.allowedChildKinds.has(t)},n.prototype._getDefinition=function(e){var t=this._docNodeDefinitionsByKind.get(e);if(t===void 0)throw new Error('The DocNode kind "'.concat(e,'" was not registered with this TSDocConfiguration'));return t},n._nodeKindRegExp=/^[_a-z][_a-z0-9]*$/i,n}();var U;(function(n){n.Core="Core",n.Extended="Extended",n.Discretionary="Discretionary",n.None="None"})(U||(U={}));var
Line truncated
|
||||
`:this.range.toString()},n}();var Oa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y;(function(n){n.Spacing="Spacing",n.BlockTag="BlockTag",n.CodeSpan_OpeningDelimiter="CodeSpan_OpeningDelimiter",n.CodeSpan_Code="CodeSpan_Code",n.CodeSpan_ClosingDelimiter="CodeSpan_ClosingDelimiter",n.DeclarationReference_PackageName="DeclarationReference_PackageName",n.DeclarationReference_ImportPath="DeclarationReference_ImportPath",n.DeclarationReference_ImportHash="DeclarationReference_ImportHash",n.ErrorText="ErrorText",n.NonstandardText="NonstandardText",n.EscapedText="EscapedText",n.FencedCode_OpeningFence="FencedCode_OpeningFence",n.FencedCode_Language="FencedCode_Language",n.FencedCode_Code="FencedCode_Code",n.FencedCode_ClosingFence="FencedCode_ClosingFence",n.HtmlAttribute_Name="HtmlAttribute_Name",n.HtmlAttribute_Equals="HtmlAttribute_Equals",n.HtmlAttribute_Value="HtmlAttribute_Value",n.HtmlEndTag_OpeningDelimiter="HtmlEndTag_OpeningDelimiter",n.HtmlEndTag_Name="HtmlEndTag_Name",n.HtmlEndTag_ClosingDelimiter="HtmlEndTag_ClosingDelimiter",n.HtmlStartTag_OpeningDelimiter="HtmlStartTag_OpeningDelimiter",n.HtmlStartTag_Name="HtmlStartTag_Name",n.HtmlStartTag_ClosingDelimiter="HtmlStartTag_ClosingDelimiter",n.InlineTag_OpeningDelimiter="InlineTag_OpeningDelimiter",n.InlineTag_TagName="InlineTag_TagName",n.InlineTag_TagContent="InlineTag_TagContent",n.InlineTag_ClosingDelimiter="InlineTag_ClosingDelimiter",n.LinkTag_UrlDestination="LinkTag_UrlDestination",n.LinkTag_Pipe="LinkTag_Pipe",n.LinkTag_LinkText="LinkTag_LinkText",n.MemberIdentifier_LeftQuote="MemberIdentifier_LeftQuote",n.MemberIdentifier_Identifier="MemberIdentifier_Identifier",n.MemberIdentifier_RightQuote="MemberIdentifier_RightQuote",n.MemberReference_Dot="MemberReference_Dot",n.MemberReference_LeftParenthesis="MemberReference_LeftParenthesis",n.MemberReference_Colon="MemberReference_Colon",n.MemberReference_RightParenthesis="MemberReference_RightParenthesis",n.MemberSelector="MemberSelector",n.DocMemberSymbol_LeftBracket="DocMemberSymbol_LeftBracket",n.DocMemberSymbol_RightBracket="DocMemberSymbol_RightBracket",n.ParamBlock_ParameterName="ParamBlock_ParameterName",n.ParamBlock_Hyphen="ParamBlock_Hyphen",n.PlainText="PlainText",n.SoftBreak="SoftBreak"})(y||(y={}));var j=function(n){Oa(e,n);function e(t){var r=n.call(this,t)||this;if(t.excerptKind===y.Spacing)for(var i=0,o=t.content.tokens;i<o.length;i++){var a=o[i];switch(a.kind){case u.Spacing:case u.Newline:case u.EndOfInput:break;default:throw new Error("The excerptKind=Spacing but the range contains a non-whitespace token")}}return r._excerptKind=t.excerptKind,r._content=t.content,r}return Object.defineProperty(e.prototype,"kind",{get:function(){return g.Excerpt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"excerptKind",{get:function(){return this._excerptKind},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),e}(T);var Ba=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Yn=function(n){Ba(e,n);function e(t){var r=n.call(this,t)||this;return re.validateTSDocTagName(t.tagName),r._tagName=t.tagName,r._tagNameWithUpperCase=t.tagName.toUpperCase(),T.isParsedParameters(t)&&(r._tagNameExcerpt=new j({configuration:r.configuration,excerptKind:y.BlockTag,content:t.tagNameExcerpt})),r}return Object.defineProperty(e.prototype,"kind",{get:function(){return g.BlockTag},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this._tagName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagNameWithUpperCase",{get:function(){return this._tagNameWithUpperCase},enumerable:!1,configurable:!0}),e.prototype.onGetChildNodes=function(){return[this._tagNameExcerpt]},e.prototype.getTokenSequence=function(){if(!this._tagNameExcerpt)throw new Error("DocBlockTag.getTokenSequence() failed because this object did not originate from a parsed input");return this._tagNameExcerpt.content},e}(T);var Ia=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}|
Line truncated
|
||||
`,this._emitCommentFraming=!0,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1}return n.prototype.renderComment=function(e,t){this._emitCommentFraming=!0,this._renderCompleteObject(e,t)},n.prototype.renderHtmlTag=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype.renderDeclarationReference=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype._renderCompleteObject=function(e,t){this._output=e,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1,this._renderNode(t),this._writeEnd()},n.prototype._renderNode=function(e){var t=this;if(e!==void 0)switch(e.kind){case g.Block:var r=e;this._ensureLineSkipped(),this._renderNode(r.blockTag),r.blockTag.tagNameWithUpperCase===G.returns.tagNameWithUpperCase&&(this._writeContent(" "),this._hangingParagraph=!0),this._renderNode(r.content);break;case g.BlockTag:var i=e;this._lineState===he.MiddleOfLine&&this._writeContent(" "),this._writeContent(i.tagName);break;case g.CodeSpan:var o=e;this._writeContent("`"),this._writeContent(o.code),this._writeContent("`");break;case g.Comment:var a=e;this._renderNodes(qr(qr(qr([a.summarySection,a.remarksBlock,a.privateRemarks,a.deprecatedBlock,a.params,a.typeParams,a.returnsBlock],a.customBlocks,!0),a.seeBlocks,!0),[a.inheritDocTag],!1)),a.modifierTagSet.nodes.length>0&&(this._ensureLineSkipped(),this._renderNodes(a.modifierTagSet.nodes));break;case g.DeclarationReference:var l=e;this._writeContent(l.packageName),this._writeContent(l.importPath),(l.packageName!==void 0||l.importPath!==void 0)&&this._writeContent("#"),this._renderNodes(l.memberReferences);break;case g.ErrorText:var c=e;this._writeContent(c.text);break;case g.EscapedText:var d=e;this._writeContent(d.encodedText);break;case g.FencedCode:var m=e;this._ensureAtStartOfLine(),this._writeContent("```"),this._writeContent(m.language),this._writeNewline(),this._writeContent(m.code),this._writeContent("```"),this._writeNewline(),this._writeNewline();break;case g.HtmlAttribute:var _=e;this._writeContent(_.name),this._writeContent(_.spacingAfterName),this._writeContent("="),this._writeContent(_.spacingAfterEquals),this._writeContent(_.value),this._writeContent(_.spacingAfterValue);break;case g.HtmlEndTag:var w=e;this._writeContent("</"),this._writeContent(w.name),this._writeContent(">");break;case g.HtmlStartTag:var b=e;this._writeContent("<"),this._writeContent(b.name),this._writeContent(b.spacingAfterName);for(var S=b.spacingAfterName===void 0||b.spacingAfterName.length===0,k=0,E=b.htmlAttributes;k<E.length;k++){var O=E[k];S&&this._writeContent(" "),this._renderNode(O),S=O.spacingAfterValue===void 0||O.spacingAfterValue.length===0}this._writeContent(b.selfClosingTag?"/>":">");break;case g.InheritDocTag:var $=e;this._renderInlineTag($,function(){$.declarationReference&&(t._writeContent(" "),t._renderNode($.declarationReference))});break;case g.InlineTag:var K=e;this._renderInlineTag(K,function(){K.tagContent.length>0&&(t._writeContent(" "),t._writeContent(K.tagContent))});break;case g.LinkTag:var D=e;this._renderInlineTag(D,function(){(D.urlDestination!==void 0||D.codeDestination!==void 0)&&(D.urlDestination!==void 0?(t._writeContent(" "),t._writeContent(D.urlDestination)):D.codeDestination!==void 0&&(t._writeContent(" "),t._renderNode(D.codeDestination))),D.linkText!==void 0&&(t._writeContent(" "),t._writeContent("|"),t._writeContent(" "),t._writeContent(D.linkText))});break;case g.MemberIdentifier:var H=e;H.hasQuotes?(this._writeContent('"'),this._writeContent(H.identifier),this._writeContent('"')):this._writeContent(H.identifier);break;case g.MemberReference:var F=e;F.hasDot&&this._writeContent("."),F.selector&&this._writeContent("("),F.memberSymbol?this._renderNode(F.memberSymbol):this._renderNode(F.memberIdentifier),F.selector&&(this._writeContent(":"),this._renderNode(F.selector),this._writeContent(")"));break;case g.MemberSelector:var J=e;this._writeContent(J.selector);break;case g.MemberSymbol:var te=e;this._writeContent("["),this._renderNode(te.symbolReference),this._writeContent("]");break;case g.Section:var ne=e;this._renderNodes(ne.nodes);break;case g.Paragraph:var Q=Fr.trimSpacesInParagraph(e);Q.nodes.length>0&&(this._hangingParagraph?this._hangingParagraph=!1:this._ensureLineSkipped(),this._renderNodes(Q.nodes),this._writeNewline());break;case g.ParamBlock:var h=e;this._ensureLineSkipped(),this._renderNode(h.blockTag),this._writeContent(" "),this._writeContent(h.parameterName),this._writeContent(" - "),this._hangingParagraph=!0,this._renderNode(h.content),this._hangingParagraph=!1;break;case g.ParamCollection:var C=e;this._renderNodes(C.blocks);break;case g.PlainText:var f=e;this._writeContent(f.text);break}},n.prototype._renderInlineTag=function(e,t){this._writeContent("{"),this._writeContent(e.tagName),t(),this._writeContent("}")},n.prototype._renderNodes=function(e){for(var t=0,r=e;t<r.length;t++){var i=r[t];this._renderNode(i)}},
Line truncated
|
||||
var ja=Object.create;var Rn=Object.defineProperty;var va=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var ba=Object.getPrototypeOf,Ea=Object.prototype.hasOwnProperty;var Vi=n=>Rn(n,"__esModule",{value:!0});var Ta=(n,e)=>{Vi(n);for(var t in e)Rn(n,t,{get:e[t],enumerable:!0})},ka=(n,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of wa(e))!Ea.call(n,r)&&r!=="default"&&Rn(n,r,{get:()=>e[r],enumerable:!(t=va(e,r))||t.enumerable});return n},X=n=>ka(Vi(Rn(n!=null?ja(ba(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var zi=(()=>{for(var n=new Uint8Array(128),e=0;e<64;e++)n[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var r=t.length,i=new Uint8Array((r-(t[r-1]=="=")-(t[r-2]=="="))*3/4|0),o=0,a=0;o<r;){var l=n[t.charCodeAt(o++)],c=n[t.charCodeAt(o++)],d=n[t.charCodeAt(o++)],m=n[t.charCodeAt(o++)];i[a++]=l<<2|c>>4,i[a++]=c<<4|d>>2,i[a++]=d<<6|m}return i}})();Ta(exports,{default:()=>Fi});var Er=X(require("obsidian"));var L=X(require("obsidian"));var Ji=X(require("obsidian"));function oe(n){let e=new Ji.Notice("",8e3),t=createFragment(r=>{r.createEl("b",{text:"Templater Error"}),r.createEl("span",{text:":"}),r.createEl("br"),r.createEl("span",{text:n.message}),n instanceof P&&n.console_msg&&(r.createEl("br"),r.createEl("span",{text:"Check console for more information"}),console.error("Templater Error:",n.message,`
|
||||
`,n.console_msg))});e.noticeEl.appendChild(t)}var P=class extends Error{constructor(e,t){super(e);this.console_msg=t;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function Se(n,e){try{return await n()}catch(t){return t instanceof P?oe(t):oe(new P(e,t.message)),null}}function Ce(n,e){try{return n()}catch(t){return oe(new P(e,t.message)),null}}var re=function(){function n(){}return n.explainIfInvalidTSDocTagName=function(e){if(e[0]!=="@")return'A TSDoc tag name must start with an "@" symbol';if(!n._tsdocTagNameRegExp.test(e))return"A TSDoc tag name must start with a letter and contain only letters and numbers"},n.validateTSDocTagName=function(e){var t=n.explainIfInvalidTSDocTagName(e);if(t)throw new Error(t)},n.explainIfInvalidLinkUrl=function(e){if(e.length===0)return"The URL cannot be empty";if(!n._urlSchemeRegExp.test(e))return'An @link URL must begin with a scheme comprised only of letters and numbers followed by "://". (For general URLs, use an HTML "<a>" tag instead.)';if(!n._urlSchemeAfterRegExp.test(e))return'An @link URL must have at least one character after "://"'},n.explainIfInvalidHtmlName=function(e){if(!n._htmlNameRegExp.test(e))return"An HTML name must be an ASCII letter followed by zero or more letters, digits, or hyphens"},n.validateHtmlName=function(e){var t=n.explainIfInvalidHtmlName(e);if(t)throw new Error(t)},n.explainIfInvalidPackageName=function(e){if(e.length===0)return"The package name cannot be an empty string";if(!n._validPackageNameRegExp.test(e))return"The package name ".concat(JSON.stringify(e)," is not a valid package name")},n.explainIfInvalidImportPath=function(e,t){if(e.length>0){if(e.indexOf("//")>=0)return'An import path must not contain "//"';if(e[e.length-1]==="/")return'An import path must not end with "/"';if(!t&&e[0]==="/")return'An import path must not start with "/" unless prefixed by a package name'}},n.isSystemSelector=function(e){return n._systemSelectors.has(e)},n.explainIfInvalidUnquotedIdentifier=function(e){if(e.length===0)return"The identifier cannot be an empty string";if(n._identifierBadCharRegExp.test(e))return"The identifier cannot non-word characters";if(n._identifierNumberStartRegExp.test(e))return"The identifier must not start with a number"},n.explainIfInvalidUnquotedMemberIdentifier=function(e){var t=n.explainIfInvalidUnquotedIdentifier(e);if(t!==void 0)return t;if(n.isSystemSelector(e))return'The identifier "'.concat(e,'" must be quoted because it is a TSDoc system selector name')},n._tsdocTagNameRegExp=/^@[a-z][a-z0-9]*$/i,n._urlSchemeRegExp=/^[a-z][a-z0-9]*\:\/\//i,n._urlSchemeAfterRegExp=/^[a-z][a-z0-9]*\:\/\/./i,n._htmlNameRegExp=/^[a-z]+[a-z0-9\-]*$/i,n._identifierBadCharRegExp=/[^a-z0-9_$]/i,n._identifierNumberStartRegExp=/^[0-9]/,n._validPackageNameRegExp=/^(?:@[a-z0-9\-_\.]+\/)?[a-z0-9\-_\.]+$/i,n._systemSelectors=new Set(["instance","static","constructor","class","enum","function","interface","namespace","type","variable"]),n}();var Pr=function(){function n(){this._docNodeDefinitionsByKind=new Map,this._docNodeDefinitionsByConstructor=new Map}return n.prototype.registerDocNodes=function(e,t){var r=re.explainIfInvalidPackageName(e);if(r)throw new Error("Invalid NPM package name: "+r);for(var i=0,o=t;i<o.length;i++){var a=o[i];if(!n._nodeKindRegExp.test(a.docNodeKind))throw new Error("The DocNode kind ".concat(JSON.stringify(a.docNodeKind)," is not a valid identifier.")+" It must start with an underscore or letter, and be comprised of letters, numbers, and underscores");var l=this._docNodeDefinitionsByKind.get(a.docNodeKind);if(l!==void 0)throw new Error('The DocNode kind "'.concat(a.docNodeKind,'" was already registered')+" by ".concat(l.packageName));if(l=this._docNodeDefinitionsByConstructor.get(a.constructor),l!==void 0)throw new Error("This DocNode constructor was already registered by ".concat(l.packageName)+" as ".concat(l.docNodeKind));var c={docNodeKind:a.docNodeKind,constructor:a.constructor,packageName:e,allowedChildKinds:new Set};this._docNodeDefinitionsByKind.set(a.docNodeKind,c),this._docNodeDefinitionsByConstructor.set(a.constructor,c)}},n.prototype.throwIfNotRegisteredKind=function(e){if(!this._docNodeDefinitionsByKind.has(e))throw new Error('The DocNode kind "'.concat(e,'" was not registered with this TSDocConfiguration'))},n.prototype.registerAllowableChildren=function(e,t){for(var r=this._getDefinition(e),i=0,o=t;i<o.length;i++){var a=o[i];this._getDefinition(a),r.allowedChildKinds.add(a)}},n.prototype.isAllowedChild=function(e,t){var r=this._getDefinition(e);return r.allowedChildKinds.has(t)},n.prototype._getDefinition=function(e){var t=this._docNodeDefinitionsByKind.get(e);if(t===void 0)throw new Error('The DocNode kind "'.concat(e,'" was not registered with this TSDocConfiguration'));return t},n._nodeKindRegExp=/^[_a-z][_a-z0-9]*$/i,n}();var U;(function(n){n.Core="Core",n.Extended="Extended",n.Discretionary="Discretionary",n.None="None"})(U||(U={}));var
Line truncated
|
||||
`:this.range.toString()},n}();var Ma=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),y;(function(n){n.Spacing="Spacing",n.BlockTag="BlockTag",n.CodeSpan_OpeningDelimiter="CodeSpan_OpeningDelimiter",n.CodeSpan_Code="CodeSpan_Code",n.CodeSpan_ClosingDelimiter="CodeSpan_ClosingDelimiter",n.DeclarationReference_PackageName="DeclarationReference_PackageName",n.DeclarationReference_ImportPath="DeclarationReference_ImportPath",n.DeclarationReference_ImportHash="DeclarationReference_ImportHash",n.ErrorText="ErrorText",n.NonstandardText="NonstandardText",n.EscapedText="EscapedText",n.FencedCode_OpeningFence="FencedCode_OpeningFence",n.FencedCode_Language="FencedCode_Language",n.FencedCode_Code="FencedCode_Code",n.FencedCode_ClosingFence="FencedCode_ClosingFence",n.HtmlAttribute_Name="HtmlAttribute_Name",n.HtmlAttribute_Equals="HtmlAttribute_Equals",n.HtmlAttribute_Value="HtmlAttribute_Value",n.HtmlEndTag_OpeningDelimiter="HtmlEndTag_OpeningDelimiter",n.HtmlEndTag_Name="HtmlEndTag_Name",n.HtmlEndTag_ClosingDelimiter="HtmlEndTag_ClosingDelimiter",n.HtmlStartTag_OpeningDelimiter="HtmlStartTag_OpeningDelimiter",n.HtmlStartTag_Name="HtmlStartTag_Name",n.HtmlStartTag_ClosingDelimiter="HtmlStartTag_ClosingDelimiter",n.InlineTag_OpeningDelimiter="InlineTag_OpeningDelimiter",n.InlineTag_TagName="InlineTag_TagName",n.InlineTag_TagContent="InlineTag_TagContent",n.InlineTag_ClosingDelimiter="InlineTag_ClosingDelimiter",n.LinkTag_UrlDestination="LinkTag_UrlDestination",n.LinkTag_Pipe="LinkTag_Pipe",n.LinkTag_LinkText="LinkTag_LinkText",n.MemberIdentifier_LeftQuote="MemberIdentifier_LeftQuote",n.MemberIdentifier_Identifier="MemberIdentifier_Identifier",n.MemberIdentifier_RightQuote="MemberIdentifier_RightQuote",n.MemberReference_Dot="MemberReference_Dot",n.MemberReference_LeftParenthesis="MemberReference_LeftParenthesis",n.MemberReference_Colon="MemberReference_Colon",n.MemberReference_RightParenthesis="MemberReference_RightParenthesis",n.MemberSelector="MemberSelector",n.DocMemberSymbol_LeftBracket="DocMemberSymbol_LeftBracket",n.DocMemberSymbol_RightBracket="DocMemberSymbol_RightBracket",n.ParamBlock_ParameterName="ParamBlock_ParameterName",n.ParamBlock_Hyphen="ParamBlock_Hyphen",n.PlainText="PlainText",n.SoftBreak="SoftBreak"})(y||(y={}));var j=function(n){Ma(e,n);function e(t){var r=n.call(this,t)||this;if(t.excerptKind===y.Spacing)for(var i=0,o=t.content.tokens;i<o.length;i++){var a=o[i];switch(a.kind){case u.Spacing:case u.Newline:case u.EndOfInput:break;default:throw new Error("The excerptKind=Spacing but the range contains a non-whitespace token")}}return r._excerptKind=t.excerptKind,r._content=t.content,r}return Object.defineProperty(e.prototype,"kind",{get:function(){return g.Excerpt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"excerptKind",{get:function(){return this._excerptKind},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),e}(T);var Oa=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Yn=function(n){Oa(e,n);function e(t){var r=n.call(this,t)||this;return re.validateTSDocTagName(t.tagName),r._tagName=t.tagName,r._tagNameWithUpperCase=t.tagName.toUpperCase(),T.isParsedParameters(t)&&(r._tagNameExcerpt=new j({configuration:r.configuration,excerptKind:y.BlockTag,content:t.tagNameExcerpt})),r}return Object.defineProperty(e.prototype,"kind",{get:function(){return g.BlockTag},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this._tagName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagNameWithUpperCase",{get:function(){return this._tagNameWithUpperCase},enumerable:!1,configurable:!0}),e.prototype.onGetChildNodes=function(){return[this._tagNameExcerpt]},e.prototype.getTokenSequence=function(){if(!this._tagNameExcerpt)throw new Error("DocBlockTag.getTokenSequence() failed because this object did not originate from a parsed input");return this._tagNameExcerpt.content},e}(T);var Ba=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}|
Line truncated
|
||||
`,this._emitCommentFraming=!0,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1}return n.prototype.renderComment=function(e,t){this._emitCommentFraming=!0,this._renderCompleteObject(e,t)},n.prototype.renderHtmlTag=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype.renderDeclarationReference=function(e,t){this._emitCommentFraming=!1,this._renderCompleteObject(e,t)},n.prototype._renderCompleteObject=function(e,t){this._output=e,this._lineState=he.Closed,this._previousLineHadContent=!1,this._hangingParagraph=!1,this._renderNode(t),this._writeEnd()},n.prototype._renderNode=function(e){var t=this;if(e!==void 0)switch(e.kind){case g.Block:var r=e;this._ensureLineSkipped(),this._renderNode(r.blockTag),r.blockTag.tagNameWithUpperCase===G.returns.tagNameWithUpperCase&&(this._writeContent(" "),this._hangingParagraph=!0),this._renderNode(r.content);break;case g.BlockTag:var i=e;this._lineState===he.MiddleOfLine&&this._writeContent(" "),this._writeContent(i.tagName);break;case g.CodeSpan:var o=e;this._writeContent("`"),this._writeContent(o.code),this._writeContent("`");break;case g.Comment:var a=e;this._renderNodes(qr(qr(qr([a.summarySection,a.remarksBlock,a.privateRemarks,a.deprecatedBlock,a.params,a.typeParams,a.returnsBlock],a.customBlocks,!0),a.seeBlocks,!0),[a.inheritDocTag],!1)),a.modifierTagSet.nodes.length>0&&(this._ensureLineSkipped(),this._renderNodes(a.modifierTagSet.nodes));break;case g.DeclarationReference:var l=e;this._writeContent(l.packageName),this._writeContent(l.importPath),(l.packageName!==void 0||l.importPath!==void 0)&&this._writeContent("#"),this._renderNodes(l.memberReferences);break;case g.ErrorText:var c=e;this._writeContent(c.text);break;case g.EscapedText:var d=e;this._writeContent(d.encodedText);break;case g.FencedCode:var m=e;this._ensureAtStartOfLine(),this._writeContent("```"),this._writeContent(m.language),this._writeNewline(),this._writeContent(m.code),this._writeContent("```"),this._writeNewline(),this._writeNewline();break;case g.HtmlAttribute:var _=e;this._writeContent(_.name),this._writeContent(_.spacingAfterName),this._writeContent("="),this._writeContent(_.spacingAfterEquals),this._writeContent(_.value),this._writeContent(_.spacingAfterValue);break;case g.HtmlEndTag:var w=e;this._writeContent("</"),this._writeContent(w.name),this._writeContent(">");break;case g.HtmlStartTag:var b=e;this._writeContent("<"),this._writeContent(b.name),this._writeContent(b.spacingAfterName);for(var S=b.spacingAfterName===void 0||b.spacingAfterName.length===0,k=0,E=b.htmlAttributes;k<E.length;k++){var O=E[k];S&&this._writeContent(" "),this._renderNode(O),S=O.spacingAfterValue===void 0||O.spacingAfterValue.length===0}this._writeContent(b.selfClosingTag?"/>":">");break;case g.InheritDocTag:var $=e;this._renderInlineTag($,function(){$.declarationReference&&(t._writeContent(" "),t._renderNode($.declarationReference))});break;case g.InlineTag:var K=e;this._renderInlineTag(K,function(){K.tagContent.length>0&&(t._writeContent(" "),t._writeContent(K.tagContent))});break;case g.LinkTag:var D=e;this._renderInlineTag(D,function(){(D.urlDestination!==void 0||D.codeDestination!==void 0)&&(D.urlDestination!==void 0?(t._writeContent(" "),t._writeContent(D.urlDestination)):D.codeDestination!==void 0&&(t._writeContent(" "),t._renderNode(D.codeDestination))),D.linkText!==void 0&&(t._writeContent(" "),t._writeContent("|"),t._writeContent(" "),t._writeContent(D.linkText))});break;case g.MemberIdentifier:var H=e;H.hasQuotes?(this._writeContent('"'),this._writeContent(H.identifier),this._writeContent('"')):this._writeContent(H.identifier);break;case g.MemberReference:var F=e;F.hasDot&&this._writeContent("."),F.selector&&this._writeContent("("),F.memberSymbol?this._renderNode(F.memberSymbol):this._renderNode(F.memberIdentifier),F.selector&&(this._writeContent(":"),this._renderNode(F.selector),this._writeContent(")"));break;case g.MemberSelector:var J=e;this._writeContent(J.selector);break;case g.MemberSymbol:var te=e;this._writeContent("["),this._renderNode(te.symbolReference),this._writeContent("]");break;case g.Section:var ne=e;this._renderNodes(ne.nodes);break;case g.Paragraph:var Q=Fr.trimSpacesInParagraph(e);Q.nodes.length>0&&(this._hangingParagraph?this._hangingParagraph=!1:this._ensureLineSkipped(),this._renderNodes(Q.nodes),this._writeNewline());break;case g.ParamBlock:var h=e;this._ensureLineSkipped(),this._renderNode(h.blockTag),this._writeContent(" "),this._writeContent(h.parameterName),this._writeContent(" - "),this._hangingParagraph=!0,this._renderNode(h.content),this._hangingParagraph=!1;break;case g.ParamCollection:var C=e;this._renderNodes(C.blocks);break;case g.PlainText:var f=e;this._writeContent(f.text);break}},n.prototype._renderInlineTag=function(e,t){this._writeContent("{"),this._writeContent(e.tagName),t(),this._writeContent("}")},n.prototype._renderNodes=function(e){for(var t=0,r=e;t<r.length;t++){var i=r[t];this._renderNode(i)}},
Line truncated
|
||||
`?(++t,r=1):++r)}return{line:t,column:r}},n.prototype._validateBounds=function(){if(this.pos<0)throw new Error("TextRange.pos cannot be negative");if(this.end<0)throw new Error("TextRange.end cannot be negative");if(this.end<this.pos)throw new Error("TextRange.end cannot be smaller than TextRange.pos");if(this.pos>this.buffer.length)throw new Error("TextRange.pos cannot exceed the associated text buffer length");if(this.end>this.buffer.length)throw new Error("TextRange.end cannot exceed the associated text buffer length")},n.empty=new n("",0,0),n}();var hn=function(){function n(e){this.messageId=e.messageId,this.unformattedText=e.messageText,this.textRange=e.textRange,this.tokenSequence=e.tokenSequence,this.docNode=e.docNode,this._text=void 0}return n._formatMessageText=function(e,t){if(e||(e="An unknown error occurred"),t.pos!==0||t.end!==0){var r=t.getLocation(t.pos);if(r.line)return"(".concat(r.line,",").concat(r.column,"): ")+e}return e},Object.defineProperty(n.prototype,"text",{get:function(){return this._text===void 0&&(this._text=n._formatMessageText(this.unformattedText,this.textRange)),this._text},enumerable:!1,configurable:!0}),n.prototype.toString=function(){return this.text},n}();var Lr=function(){function n(){this._messages=[]}return Object.defineProperty(n.prototype,"messages",{get:function(){return this._messages},enumerable:!1,configurable:!0}),n.prototype.addMessage=function(e){this._messages.push(e)},n.prototype.addMessageForTextRange=function(e,t,r){this.addMessage(new hn({messageId:e,messageText:t,textRange:r}))},n.prototype.addMessageForTokenSequence=function(e,t,r,i){this.addMessage(new hn({messageId:e,messageText:t,textRange:r.getContainingTextRange(),tokenSequence:r,docNode:i}))},n.prototype.addMessageForDocErrorText=function(e){var t;e.textExcerpt?t=e.textExcerpt:t=e.errorLocation,this.addMessage(new hn({messageId:e.messageId,messageText:e.errorMessage,textRange:t.getContainingTextRange(),tokenSequence:t,docNode:e}))},n}();var Hr=function(){function n(e,t){this.commentRange=ze.empty,this.lines=[],this.tokens=[],this.configuration=e,this.sourceRange=t,this.docComment=new Gn({configuration:this.configuration}),this.log=new Lr}return n}();var yt=function(){function n(e){this.parserContext=e.parserContext,this._startIndex=e.startIndex,this._endIndex=e.endIndex,this._validateBounds()}return n.createEmpty=function(e){return new n({parserContext:e,startIndex:0,endIndex:0})},Object.defineProperty(n.prototype,"startIndex",{get:function(){return this._startIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"endIndex",{get:function(){return this._endIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tokens",{get:function(){return this.parserContext.tokens.slice(this._startIndex,this._endIndex)},enumerable:!1,configurable:!0}),n.prototype.getNewSequence=function(e,t){return new n({parserContext:this.parserContext,startIndex:e,endIndex:t})},n.prototype.getContainingTextRange=function(){return this.isEmpty()?ze.empty:this.parserContext.sourceRange.getNewRange(this.parserContext.tokens[this._startIndex].range.pos,this.parserContext.tokens[this._endIndex-1].range.end)},n.prototype.isEmpty=function(){return this._startIndex===this._endIndex},n.prototype.toString=function(){return this.tokens.map(function(e){return e.toString()}).join("")},n.prototype._validateBounds=function(){if(this.startIndex<0)throw new Error("TokenSequence.startIndex cannot be negative");if(this.endIndex<0)throw new Error("TokenSequence.endIndex cannot be negative");if(this.endIndex<this.startIndex)throw new Error("TokenSequence.endIndex cannot be smaller than TokenSequence.startIndex");if(this.startIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.startIndex cannot exceed the associated token array");if(this.endIndex>this.parserContext.tokens.length)throw new Error("TokenSequence.endIndex cannot exceed the associated token array")},n}();var pe;(function(n){n[n.BeginComment1=0]="BeginComment1",n[n.BeginComment2=1]="BeginComment2",n[n.CollectingFirstLine=2]="CollectingFirstLine",n[n.CollectingLine=3]="CollectingLine",n[n.AdvancingLine=4]="AdvancingLine",n[n.Done=5]="Done"})(pe||(pe={}));var no=function(){function n(){}return n.extract=function(e){for(var t=e.sourceRange,r=t.buffer,i=0,o=0,a=0,l=0,c=t.pos,d=pe.BeginComment1,m=[];d!==pe.Done;){if(c>=t.end)switch(d){case pe.BeginComment1:case pe.BeginComment2:return e.log.addMessageForTextRange(v.CommentNotFound,'Expecting a "/**" comment',t),!1;default:return e.log.addMessageForTextRange(v.CommentMissingClosingDelimiter,"Unexpected end of input",t),!1}var _=r[c],w=c;++c;var b=c<t.end?r[c]:"";switch(d){case pe.BeginComment1:if(_==="/"&&b==="*")i=w,++c,d=pe.BeginComment2;else if(!n._whitespaceCharacterRegExp.test(_))return e.log.addMessageForTextRange(v.CommentOpeningDelimiterSyntax,'Expecting a leading "/**"',t.getNewRange(w,w+1)),!1;break;case pe.BeginComment2:if(_==="*")b===" "&&++c,a=c,l=c,d=pe.CollectingFirstLine
Line truncated
|
||||
`?((d!==pe.CollectingFirstLine||l>a)&&m.push(t.getNewRange(a,l)),a=c,l=c,d=pe.AdvancingLine):_==="*"&&b==="/"?(l>a&&m.push(t.getNewRange(a,l)),a=0,l=0,++c,o=c,d=pe.Done):n._whitespaceCharacterRegExp.test(_)||(l=c);break;case pe.AdvancingLine:_==="*"?b==="/"?(a=0,l=0,++c,o=c,d=pe.Done):(b===" "&&++c,a=c,l=c,d=pe.CollectingLine):_===`
|
||||
`?(m.push(t.getNewRange(w,w)),a=c):n._whitespaceCharacterRegExp.test(_)||(l=c,d=pe.CollectingLine);break}}return e.commentRange=t.getNewRange(i,o),e.lines=m,!0},n._whitespaceCharacterRegExp=/^\s$/,n}();var An=function(){function n(){}return n.readTokens=function(e){n._ensureInitialized();for(var t=[],r=void 0,i=0,o=e;i<o.length;i++){var a=o[i];n._pushTokensForLine(t,a),r=a}return r?t.push(new Pt(u.EndOfInput,r.getNewRange(r.end,r.end),r)):t.push(new Pt(u.EndOfInput,ze.empty,ze.empty)),t},n.isPunctuation=function(e){return n._ensureInitialized(),n._punctuationTokens[e]||!1},n._pushTokensForLine=function(e,t){for(var r=t.buffer,i=t.end,o=t.pos,a=void 0,l=o;o<i;){var c=r.charCodeAt(o),d=n._charCodeMap[c];d===void 0&&(d=u.Other),a!==void 0&&d===a&&n._isMultiCharacterToken(a)||(a!==void 0&&e.push(new Pt(a,t.getNewRange(l,o),t)),l=o,a=d),++o}a!==void 0&&e.push(new Pt(a,t.getNewRange(l,o),t)),e.push(new Pt(u.Newline,t.getNewRange(t.end,t.end),t))},n._isMultiCharacterToken=function(e){switch(e){case u.Spacing:case u.AsciiWord:case u.Other:return!0}return!1},n._ensureInitialized=function(){if(!n._charCodeMap){n._charCodeMap={},n._punctuationTokens={};for(var e=n._commonMarkPunctuationCharacters,t=0;t<e.length;++t){var r=e.charCodeAt(t);n._charCodeMap[r]=u.OtherPunctuation}for(var i={"\\":u.Backslash,"<":u.LessThan,">":u.GreaterThan,"=":u.Equals,"'":u.SingleQuote,'"':u.DoubleQuote,"/":u.Slash,"-":u.Hyphen,"@":u.AtSign,"{":u.LeftCurlyBracket,"}":u.RightCurlyBracket,"`":u.Backtick,".":u.Period,":":u.Colon,",":u.Comma,"[":u.LeftSquareBracket,"]":u.RightSquareBracket,"|":u.Pipe,"(":u.LeftParenthesis,")":u.RightParenthesis,"#":u.PoundSymbol,"+":u.Plus,$:u.DollarSign},o=0,a=Object.getOwnPropertyNames(i);o<a.length;o++){var l=a[o];n._charCodeMap[l.charCodeAt(0)]=i[l],n._punctuationTokens[i[l]]=!0}n._punctuationTokens[u.OtherPunctuation]=!0;for(var c=n._wordCharacters,t=0;t<c.length;++t){var r=c.charCodeAt(t);n._charCodeMap[r]=u.AsciiWord}n._charCodeMap[" ".charCodeAt(0)]=u.Spacing,n._charCodeMap[" ".charCodeAt(0)]=u.Spacing}},n._commonMarkPunctuationCharacters="!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~",n._wordCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",n}();var $r=function(){function n(e,t){if(this._parserContext=e,this.tokens=e.tokens,t){if(t.parserContext!==this._parserContext)throw new Error("The embeddedTokenSequence must use the same parser context");this._readerStartIndex=t.startIndex,this._readerEndIndex=t.endIndex}else this._readerStartIndex=0,this._readerEndIndex=this.tokens.length;this._currentIndex=this._readerStartIndex,this._accumulatedStartIndex=this._readerStartIndex}return n.prototype.extractAccumulatedSequence=function(){if(this._accumulatedStartIndex===this._currentIndex)throw new Error("Parser assertion failed: The queue should not be empty when extractAccumulatedSequence() is called");var e=new yt({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex});return this._accumulatedStartIndex=this._currentIndex,e},n.prototype.isAccumulatedSequenceEmpty=function(){return this._accumulatedStartIndex===this._currentIndex},n.prototype.tryExtractAccumulatedSequence=function(){if(!this.isAccumulatedSequenceEmpty())return this.extractAccumulatedSequence()},n.prototype.assertAccumulatedSequenceIsEmpty=function(){if(!this.isAccumulatedSequenceEmpty()){var e=new yt({parserContext:this._parserContext,startIndex:this._accumulatedStartIndex,endIndex:this._currentIndex}),t=e.tokens.map(function(r){return r.toString()});throw new Error(`Parser assertion failed: The queue should be empty, but it contains:
|
||||
`+JSON.stringify(t))}},n.prototype.peekToken=function(){return this.tokens[this._currentIndex]},n.prototype.peekTokenKind=function(){return this._currentIndex>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex].kind},n.prototype.peekTokenAfterKind=function(){return this._currentIndex+1>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+1].kind},n.prototype.peekTokenAfterAfterKind=function(){return this._currentIndex+2>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+2].kind},n.prototype.readToken=function(){if(this._currentIndex>=this._readerEndIndex)throw new Error("Cannot read past end of stream");var e=this.tokens[this._currentIndex];if(e.kind===u.EndOfInput)throw new Error("The EndOfInput token cannot be read");return this._currentIndex++,e},n.prototype.peekPreviousTokenKind=function(){return this._currentIndex===0?u.EndOfInput:this.tokens[this._currentIndex-1].kind},n.prototype.createMarker=function(){return this._currentIndex},n.prototype.backtrackToMarker=function(e){if(e>this._currentIndex)throw new Error("The marker has expired");this._currentIndex=e,e<this._accumulatedStartIndex&&(this._accumulatedStartIndex=e)},n}();var lr=function(){return lr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},lr.apply(this,arguments)};function _n(n){return n!==void 0&&Object.hasOwnProperty.call(n,"failureMessage")}var ro=function(){function n(e){this._parserContext=e,this._configuration=e.configuration,this._currentSection=e.docComment.summarySection}return n.prototype.parse=function(){for(var e=new $r(this._parserContext),t=!1;!t;)switch(e.peekTokenKind()){case u.EndOfInput:t=!0;break;case u.Newline:this._pushAccumulatedPlainText(e),e.readToken(),this._pushNode(new rr({parsed:!0,configuration:this._configuration,softBreakExcerpt:e.extractAccumulatedSequence()}));break;case u.Backslash:this._pushAccumulatedPlainText(e),this._pushNode(this._parseBackslashEscape(e));break;case u.AtSign:this._pushAccumulatedPlainText(e),this._parseAndPushBlock(e);break;case u.LeftCurlyBracket:{this._pushAccumulatedPlainText(e);var r=e.createMarker(),i=this._parseInlineTag(e),o=this._parserContext.docComment;if(i instanceof dn){var a=e.createMarker()-1;o.inheritDocTag===void 0?this._parserContext.docComment.inheritDocTag=i:this._pushNode(this._backtrackAndCreateErrorRange(e,r,a,v.ExtraInheritDocTag,"A doc comment cannot have more than one @inheritDoc tag"))}else this._pushNode(i);break}case u.RightCurlyBracket:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeRightBrace,'The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'));break;case u.LessThan:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Slash?this._pushNode(this._parseHtmlEndTag(e)):this._pushNode(this._parseHtmlStartTag(e));break;case u.GreaterThan:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeGreaterThan,'The ">" character should be escaped using a backslash to avoid confusion with an HTML tag'));break;case u.Backtick:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Backtick&&e.peekTokenAfterAfterKind()===u.Backtick?this._pushNode(this._parseFencedCode(e)):this._pushNode(this._parseCodeSpan(e));break;default:e.readToken();break}this._pushAccumulatedPlainText(e),this._performValidationChecks()},n.prototype._performValidationChecks=function(){var e=this._parserContext.docComment;e.deprecatedBlock&&(cr.hasAnyTextContent(e.deprecatedBlock)||this._parserContext.log.addMessageForTokenSequence(v.MissingDeprecationMessage,"The ".concat(e.deprecatedBlock.blockTag.tagName," block must include a deprecation message,")+" e.g. describing the recommended alternative",e.deprecatedBlock.blockTag.getTokenSequence(),e.deprecatedBlock)),e.inheritDocTag&&(e.remarksBlock&&this._parserContext.log.addMessageForTokenSequence(v.InheritDocIncompatibleTag,'A "'.concat(e.remarksBlock.blockTag.tagName,'" block must not be used, because that')+" content is provided by the @inheritDoc tag",e.remarksBlock.blockTag.getTokenSequence(),e.remarksBlock.blockTag),cr.hasAnyTextContent(e.summarySection)&&this._parserContext.log.addMessageForTextRange(v.InheritDocIncompatibleSummary,"The summary section must not have any content, because that content is provided by the @inheritDoc tag",this._parserContext.commentRange))},n.prototype._validateTagDefinition=function(e,t,r,i,o){if(e){var a=e.syntaxKind===R.InlineTag;a!==r?r?this._parserContext.log.addMessageForTokenSequence(v.TagShouldNotHaveBraces,'The TSDoc tag "'.concat(t,'" is not an inline tag; it must not be enclosed in "{ }" braces'),i,o):this._parserContext.log.addMessageForTokenSequence(v.InlineTagMissingBraces,'The TSDoc tag "'.concat(t,'" is an inline tag; it must be enclosed in "{ }" braces'),i,o):this._parserContext.configuration.validation.reportUnsupportedTags&&(this._
Line truncated
|
||||
`+JSON.stringify(t))}},n.prototype.peekToken=function(){return this.tokens[this._currentIndex]},n.prototype.peekTokenKind=function(){return this._currentIndex>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex].kind},n.prototype.peekTokenAfterKind=function(){return this._currentIndex+1>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+1].kind},n.prototype.peekTokenAfterAfterKind=function(){return this._currentIndex+2>=this._readerEndIndex?u.EndOfInput:this.tokens[this._currentIndex+2].kind},n.prototype.readToken=function(){if(this._currentIndex>=this._readerEndIndex)throw new Error("Cannot read past end of stream");var e=this.tokens[this._currentIndex];if(e.kind===u.EndOfInput)throw new Error("The EndOfInput token cannot be read");return this._currentIndex++,e},n.prototype.peekPreviousTokenKind=function(){return this._currentIndex===0?u.EndOfInput:this.tokens[this._currentIndex-1].kind},n.prototype.createMarker=function(){return this._currentIndex},n.prototype.backtrackToMarker=function(e){if(e>this._currentIndex)throw new Error("The marker has expired");this._currentIndex=e,e<this._accumulatedStartIndex&&(this._accumulatedStartIndex=e)},n}();var lr=function(){return lr=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},lr.apply(this,arguments)};function _n(n){return n!==void 0&&Object.hasOwnProperty.call(n,"failureMessage")}var ro=function(){function n(e){this._parserContext=e,this._configuration=e.configuration,this._currentSection=e.docComment.summarySection}return n.prototype.parse=function(){for(var e=new $r(this._parserContext),t=!1;!t;)switch(e.peekTokenKind()){case u.EndOfInput:t=!0;break;case u.Newline:this._pushAccumulatedPlainText(e),e.readToken(),this._pushNode(new rr({parsed:!0,configuration:this._configuration,softBreakExcerpt:e.extractAccumulatedSequence()}));break;case u.Backslash:this._pushAccumulatedPlainText(e),this._pushNode(this._parseBackslashEscape(e));break;case u.AtSign:this._pushAccumulatedPlainText(e),this._parseAndPushBlock(e);break;case u.LeftCurlyBracket:{this._pushAccumulatedPlainText(e);var r=e.createMarker(),i=this._parseInlineTag(e),o=this._parserContext.docComment;if(i instanceof dn){var a=e.createMarker()-1;o.inheritDocTag===void 0?this._parserContext.docComment.inheritDocTag=i:this._pushNode(this._backtrackAndCreateErrorRange(e,r,a,v.ExtraInheritDocTag,"A doc comment cannot have more than one @inheritDoc tag"))}else this._pushNode(i);break}case u.RightCurlyBracket:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeRightBrace,'The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag'));break;case u.LessThan:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Slash?this._pushNode(this._parseHtmlEndTag(e)):this._pushNode(this._parseHtmlStartTag(e));break;case u.GreaterThan:this._pushAccumulatedPlainText(e),this._pushNode(this._createError(e,v.EscapeGreaterThan,'The ">" character should be escaped using a backslash to avoid confusion with an HTML tag'));break;case u.Backtick:this._pushAccumulatedPlainText(e),e.peekTokenAfterKind()===u.Backtick&&e.peekTokenAfterAfterKind()===u.Backtick?this._pushNode(this._parseFencedCode(e)):this._pushNode(this._parseCodeSpan(e));break;default:e.readToken();break}this._pushAccumulatedPlainText(e),this._performValidationChecks()},n.prototype._performValidationChecks=function(){var e=this._parserContext.docComment;e.deprecatedBlock&&(cr.hasAnyTextContent(e.deprecatedBlock)||this._parserContext.log.addMessageForTokenSequence(v.MissingDeprecationMessage,"The ".concat(e.deprecatedBlock.blockTag.tagName," block must include a deprecation message,")+" e.g. describing the recommended alternative",e.deprecatedBlock.blockTag.getTokenSequence(),e.deprecatedBlock)),e.inheritDocTag&&(e.remarksBlock&&this._parserContext.log.addMessageForTokenSequence(v.InheritDocIncompatibleTag,'A "'.concat(e.remarksBlock.blockTag.tagName,'" block must not be used, because that')+" content is provided by the @inheritDoc tag",e.remarksBlock.blockTag.getTokenSequence(),e.remarksBlock.blockTag),cr.hasAnyTextContent(e.summarySection)&&this._parserContext.log.addMessageForTextRange(v.InheritDocIncompatibleSummary,"The summary section must not have any content, because that content is provided by the @inheritDoc tag",this._parserContext.commentRange))},n.prototype._validateTagDefinition=function(e,t,r,i,o){if(e){var a=e.syntaxKind===R.InlineTag;a!==r?r?this._parserContext.log.addMessageForTokenSequence(v.TagShouldNotHaveBraces,'The TSDoc tag "'.concat(t,'" is not an inline tag; it must not be enclosed in "{ }" braces'),i,o):this._parserContext.log.addMessageForTokenSequence(v.InlineTagMissingBraces,'The TSDoc tag "'.concat(t,'" is an inline tag; it must be enclosed in "{ }" braces'),i,o):this._parserContext.configuration.validation.reportUnsupportedTags&&(this._
Line truncated
|
||||
`)).join(`
|
||||
`)}catch{console.error("Failed to parse summary section")}}function ss(n){if(!n)return"";try{return n.content.nodes[0].getChildNodes()[0].text.trim()}catch{return""}}function cs(n){try{return n.blocks.map(r=>{let i=r.parameterName,o=r.content.getChildNodes()[0].getChildNodes().filter(a=>a instanceof Ve).map(a=>a.text).join(" ");return new Yr(i,o)})}catch{return[]}}function Mt(n,e,t){if(t<0||t===n.length)return;let r=n[e];n[e]=n[t],n[t]=r}function Xt(n){return n.workspace.activeEditor?.file??n.workspace.getActiveFile()}function lo(n){let e=n.lastIndexOf("/");return e!==-1?n.slice(0,e):""}function xn(n){return n!==null&&typeof n=="object"}function po(n){let e=n.toString(),t=e.indexOf("(");return e.substring(t+1,e.indexOf(")")).replace(/ /g,"").split(",")}function Ur(n,e,t){let r=n instanceof HTMLOListElement?"li":"p",i=n.createEl(r),o=n.createEl("b",{text:e});return i.appendChild(o),i.appendChild(document.createTextNode(`: ${t}`)),i}function pr(n,e){if(Object.keys(e).length!==0){for(let t in e)if(e.hasOwnProperty(t))if(n.hasOwnProperty(t)){let r=n[t],i=e[t];if(Array.isArray(r)||Array.isArray(i)){let o=Array.isArray(r)?r:[r],a=Array.isArray(i)?i:[i];n[t]=o.concat(a).unique()}else xn(r)&&xn(i)?pr(r,i):i!=null&&i!==""&&(n[t]=i)}else n[t]=e[t]}}function yn(n){let e={},t=(0,Te.getFrontMatterInfo)(n);return t.frontmatter&&(e=(0,Te.parseYaml)(t.frontmatter)),{frontmatter:e,content:n.slice(t.contentStart)}}var Bo=X(require("obsidian"));var Mo=X(require("obsidian"));var ie="top",ue="bottom",ce="right",ae="left",ur="auto",vt=[ie,ue,ce,ae],pt="start",Ot="end",uo="clippingParents",fr="viewport",Zt="popper",fo="reference",Gr=vt.reduce(function(n,e){return n.concat([e+"-"+pt,e+"-"+Ot])},[]),dr=[].concat(vt,[ur]).reduce(function(n,e){return n.concat([e,e+"-"+pt,e+"-"+Ot])},[]),ls="beforeRead",ps="read",us="afterRead",fs="beforeMain",ds="main",ms="afterMain",gs="beforeWrite",hs="write",As="afterWrite",mo=[ls,ps,us,fs,ds,ms,gs,hs,As];function me(n){return n?(n.nodeName||"").toLowerCase():null}function Z(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Me(n){var e=Z(n).Element;return n instanceof e||n instanceof Element}function fe(n){var e=Z(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function en(n){if(typeof ShadowRoot=="undefined")return!1;var e=Z(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function _s(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];!fe(o)||!me(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var l=i[a];l===!1?o.removeAttribute(a):o.setAttribute(a,l===!0?"":l)}))})}function xs(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=a.reduce(function(c,d){return c[d]="",c},{});!fe(i)||!me(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}var go={name:"applyStyles",enabled:!0,phase:"write",fn:_s,effect:xs,requires:["computeStyles"]};function ge(n){return n.split("-")[0]}var qe=Math.max,Bt=Math.min,ut=Math.round;function tn(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function jn(){return!/^((?!chrome|android).)*safari/i.test(tn())}function Oe(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,o=1;e&&fe(n)&&(i=n.offsetWidth>0&&ut(r.width)/n.offsetWidth||1,o=n.offsetHeight>0&&ut(r.height)/n.offsetHeight||1);var a=Me(n)?Z(n):window,l=a.visualViewport,c=!jn()&&t,d=(r.left+(c&&l?l.offsetLeft:0))/i,m=(r.top+(c&&l?l.offsetTop:0))/o,_=r.width/i,w=r.height/o;return{width:_,height:w,top:m,right:d+_,bottom:m+w,left:d,x:d,y:m}}function It(n){var e=Oe(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function vn(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&en(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function we(n){return Z(n).getComputedStyle(n)}function Wr(n){return["table","td","th"].indexOf(me(n))>=0}function Ae(n){return((Me(n)?n.ownerDocument:n.document)||window.document).documentElement}function ft(n){return me(n)==="html"?n:n.assignedSlot||n.parentNode||(en(n)?n.host:null)||Ae(n)}function ho(n){return!fe(n)||we(n).position==="fixed"?null:n.offsetParent}function ys(n){var e=/firefox/i.test(tn()),t=/Trident/i.test(tn());if(t&&fe(n)){var r=we(n);if(r.position==="fixed")return nu
Line truncated
|
||||
> \u2014 ${o}`}catch{return new P("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(e,t,r=!1)=>{try{let i=await this.getRequest(`https://templater-unsplash-2.fly.dev/${t?"?q="+t:""}`).then(a=>a.json),o=i.full;if(e&&!r)if(e.includes("x")){let[a,l]=e.split("x");o=o.concat(`&w=${a}&h=${l}`)}else o=o.concat(`&w=${e}`);return r?``:``}catch{return new P("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(e,t)=>{try{let i=await(await this.getRequest(e)).json;return t&&i?t.split(".").reduce((o,a)=>{if(o&&o.hasOwnProperty(a))return o[a];throw new Error(`Path ${t} not found in the JSON response`)},i):i}catch(r){throw console.error(r),new P("Error fetching and extracting value")}}}};var ui=class extends be{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(e=>{e.e.offref(e)}),this.event_refs=[]}generate_on_all_templates_executed(){return e=>{let t=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await jt(1),e()});t&&this.event_refs.push(t)}}};var fi=class extends be{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let e=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(e?.frontmatter||{}))}async teardown(){}};var Qe=X(require("obsidian"));var di=class extends Qe.Modal{constructor(e,t,r,i){super(e);this.prompt_text=t;this.default_value=r;this.multi_line=i;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new P("Cancelled prompt"))}createForm(){let e=this.contentEl.createDiv();e.addClass("templater-prompt-div");let t;if(this.multi_line){t=new Qe.TextAreaComponent(e);let r=this.contentEl.createDiv();r.addClass("templater-button-div");let i=new Qe.ButtonComponent(r);i.buttonEl.addClass("mod-cta"),i.setButtonText("Submit").onClick(o=>{this.resolveAndClose(o)})}else t=new Qe.TextComponent(e);this.value=this.default_value??"",t.inputEl.addClass("templater-prompt-input"),t.setPlaceholder("Type text here"),t.setValue(this.value),t.onChange(r=>this.value=r),t.inputEl.focus(),t.inputEl.addEventListener("keydown",r=>this.enterCallback(r))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Qe.Platform.isDesktop&&e.key==="Enter"&&!e.shiftKey&&this.resolveAndClose(e):e.key==="Enter"&&this.resolveAndClose(e))}resolveAndClose(e){this.submitted=!0,e.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Uo=X(require("obsidian")),mi=class extends Uo.FuzzySuggestModal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.setPlaceholder(i),o&&(this.limit=o)}getItems(){return this.items}onClose(){this.submitted||this.reject(new P("Cancelled prompt"))}selectSuggestion(e,t){this.submitted=!0,this.close(),this.onChooseSuggestion(e,t)}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.resolve(e)}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var De=X(require("obsidian")),gi=class extends De.Modal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.selectedItems=[];this.setTitle(i),this.listEl=this.contentEl.createDiv("templater-multisuggester-list");let a=this.contentEl.createDiv("templater-multisuggester-div"),l=new De.TextComponent(a);l.inputEl.addClass("templater-multisuggester-input"),this.suggester=new Go(e,l.inputEl,this.getItemText.bind(this),r,o).onSelect(this.onChooseItem.bind(this));let c=this.contentEl.createDiv("modal-button-container");new De.ButtonComponent(c).setButtonText("Save").setCta().onClick(()=>this.save()),new De.ButtonComponent(c).setButtonText("Cancel").onClick(()=>this.close())}onOpen(){this.display()}display(){this.listEl.empty(),this.selectedItems.forEach(e=>{let t=this.listEl.createDiv("mobile-option-setting-item");t.createSpan("mobile-option-setting-item-name").setText(this.getItemText(e)),t.createDiv("clickable-icon mobile-option-setting-item-option-icon",r=>{(0,De.setIcon)(r,"lucide-x"),r.addEventListener("click",()=>{this.onRemoveItem(e)})})})}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.selectedItems.push(e);let t=this.items.filter(r=>!this.selectedItems.some(i=>i===r));this.suggester.setItems(t),this.display()}onRemoveIt
Line truncated
|
||||
})`)(r,o,i)}catch(c){throw new P(`Failed to load user script at "${e.path}".`,c.message)}let l=i.default??o.exports;if(!l)throw new P(`Failed to load user script at "${e.path}". No exports detected.`);if(typeof l=="function")t.set(e.basename,l);else if(typeof l=="object"&&l!==null){if(!Object.values(l).every(d=>typeof d=="function"))throw new P(`Exported object in "${e.path}" must contain only functions.`);t.set(e.basename,l)}else throw new P(`Invalid export in "${e.path}". Must be a function or object of functions.`)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var ji=class{constructor(e){this.plugin=e;this.user_system_functions=new xi(e),this.user_script_functions=new yi(e)}async generate_object(e){let t={},r={};return this.plugin.settings.enable_system_commands&&(t=await this.user_system_functions.generate_object(e)),this.plugin.settings.user_scripts_folder&&(r=await this.user_script_functions.generate_object()),{...t,...r}}};var Rs=X(require("obsidian")),Xe;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(Xe||(Xe={}));var vi=class{constructor(e){this.plugin=e;this.internal_functions=new _i(this.plugin),this.user_functions=new ji(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:Rs}}async generate_object(e,t=1){let r={},i=this.additional_functions(),o=await this.internal_functions.generate_object(e),a={};switch(Object.assign(r,i),t){case 0:Object.assign(r,o);break;case 1:a=await this.user_functions.generate_object(e),Object.assign(r,{...o,user:a});break}return r}};var Zs={},M,Ke=new Array(32).fill(void 0);Ke.push(void 0,null,!0,!1);function Pe(n){return Ke[n]}var Dn=Ke.length;function Ys(n){n<36||(Ke[n]=Dn,Dn=n)}function wi(n){let e=Pe(n);return Ys(n),e}var Wo=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Wo.decode();var _r=new Uint8Array;function xr(){return _r.byteLength===0&&(_r=new Uint8Array(M.memory.buffer)),_r}function bt(n,e){return Wo.decode(xr().subarray(n,n+e))}function Et(n){Dn===Ke.length&&Ke.push(Ke.length+1);let e=Dn;return Dn=Ke[e],Ke[e]=n,e}var Re=0,yr=new TextEncoder("utf-8"),Us=typeof yr.encodeInto=="function"?function(n,e){return yr.encodeInto(n,e)}:function(n,e){let t=yr.encode(n);return e.set(t),{read:n.length,written:t.length}};function gt(n,e,t){if(t===void 0){let l=yr.encode(n),c=e(l.length);return xr().subarray(c,c+l.length).set(l),Re=l.length,c}let r=n.length,i=e(r),o=xr(),a=0;for(;a<r;a++){let l=n.charCodeAt(a);if(l>127)break;o[i+a]=l}if(a!==r){a!==0&&(n=n.slice(a)),i=t(i,r,r=a+n.length*3);let l=xr().subarray(i+a,i+r);a+=Us(n,l).written}return Re=a,i}function Gs(n){return n==null}var jr=new Int32Array;function Ne(){return jr.byteLength===0&&(jr=new Int32Array(M.memory.buffer)),jr}function bi(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){let i=n.length,o="[";i>0&&(o+=bi(n[0]));for(let a=1;a<i;a++)o+=", "+bi(n[a]);return o+="]",o}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
||||
${n.stack}`:r}function Ws(n,e){if(!(n instanceof e))throw new Error(`expected instance of ${e.name}`);return n.ptr}var vr=32;function Vs(n){if(vr==1)throw new Error("out of js stack");return Ke[--vr]=n,vr}function Ei(n,e){try{return n.apply(this,e)}catch(t){M.__wbindgen_exn_store(Et(t))}}var Kt=class{static __wrap(e){let t=Object.create(Kt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_parserconfig_free(e)}get interpolate(){let e=M.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(e)}set interpolate(e){M.__wbg_set_parserconfig_interpolate(this.ptr,e.codePointAt(0))}get execution(){let e=M.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(e)}set execution(e){M.__wbg_set_parserconfig_execution(this.ptr,e.codePointAt(0))}get single_whitespace(){let e=M.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(e)}set single_whitespace(e){M.__wbg_set_parserconfig_single_whitespace(this.ptr,e.codePointAt(0))}get multiple_whitespace(){let e=M.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(e)}set multiple_whitespace(e){M.__wbg_set_parserconfig_multiple_whitespace(this.ptr,e.codePointAt(0))}constructor(e,t,r,i,o,a,l){let c=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),d=Re,m=gt(t,M.__wbindgen_malloc,M.__wbindgen_realloc),_=Re,w=gt(l,M.__wbindgen_malloc,M.__wbindgen_realloc),b=Re,S=M.parserconfig_new(c,d,m,_,r.codePointAt(0),i.codePointAt(0),o.codePointAt(0),a.codePointAt(0),w,b);return Kt.__wrap(S)}get opening_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_opening_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set opening_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_opening_tag(this.ptr,t,r)}get closing_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_closing_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set closing_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_closing_tag(this.ptr,t,r)}get global_var(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_global_var(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set global_var(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_global_var(this.ptr,t,r)}},sn=class{static __wrap(e){let t=Object.create(sn.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_renderer_free(e)}constructor(e){Ws(e,Kt);var t=e.ptr;e.ptr=0;let r=M.renderer_new(t);return sn.__wrap(r)}render_content(e,t){try{let a=M.__wbindgen_add_to_stack_pointer(-16),l=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),c=Re;M.renderer_render_content(a,this.ptr,l,c,Vs(t));var r=Ne()[a/4+0],i=Ne()[a/4+1],o=Ne()[a/4+2];if(o)throw wi(i);return wi(r)}finally{M.__wbindgen_add_to_stack_pointer(16),Ke[vr++]=void 0}}};async function zs(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function Js(){let n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){wi(e)},n.wbg.__wbindgen_string_new=function(e,t){let r=bt(e,t);return Et(r)},n.wbg.__wbindgen_string_get=function(e,t){let r=Pe(t),i=typeof r=="string"?r:void 0;var o=Gs(i)?0:gt(i,M.__wbindgen_malloc,M.__wbindgen_realloc),a=Re;Ne()[e/4+1]=a,Ne()[e/4+0]=o},n.wbg.__wbg_call_97ae9d8645dc388b=function(){return Ei(function(e,t){let r=Pe(e).call(Pe(t));return Et(r)},arguments)},n.wbg.__wbg_new_8d2af00bc1e329ee=function(e,t){let r=new Error(bt(e,t));return Et(r)},n.wbg.__wbg_message_fe2af63ccc8985bc=function(e){let t=Pe(e).message;return Et(t)},n.wbg.__wbg_newwithargs_8fe23e3842840c8e=function(e,t,r,i){let o=new Function(bt(e,t),bt(r,i));return Et(o)},n.wbg.__wbg_call_168da88779e35f61=function(){return Ei(function(e,t,r){let i=Pe(e).call(Pe(t),Pe(r));return Et(i)},arguments)},n.wbg.__wbg_call_3999bee59e9f7719=function(){return Ei(function(e,t,r,i){let o=Pe(e).call(Pe(t),Pe(r),Pe(i));return Et(o)},arguments)},n.wbg.__wbindgen_debug_string=function(e,t){let r=bi(Pe(t)),i=gt(r,M.__wbindgen_malloc,M.__wbindgen_realloc),o=Re;Ne
Line truncated
|
||||
`)}catch{console.error("Failed to parse summary section")}}function as(n){if(!n)return"";try{return n.content.nodes[0].getChildNodes()[0].text.trim()}catch{return""}}function ss(n){try{return n.blocks.map(r=>{let i=r.parameterName,o=r.content.getChildNodes()[0].getChildNodes().filter(a=>a instanceof Ve).map(a=>a.text).join(" ");return new Yr(i,o)})}catch{return[]}}function Mt(n,e,t){if(t<0||t===n.length)return;let r=n[e];n[e]=n[t],n[t]=r}function Xt(n){return n.workspace.activeEditor?.file??n.workspace.getActiveFile()}function co(n){let e=n.lastIndexOf("/");return e!==-1?n.slice(0,e):""}function xn(n){return n!==null&&typeof n=="object"}function lo(n){let e=n.toString(),t=e.indexOf("(");return e.substring(t+1,e.indexOf(")")).replace(/ /g,"").split(",")}function Ur(n,e,t){let r=n instanceof HTMLOListElement?"li":"p",i=n.createEl(r),o=n.createEl("b",{text:e});return i.appendChild(o),i.appendChild(document.createTextNode(`: ${t}`)),i}function pr(n,e){if(Object.keys(e).length!==0){for(let t in e)if(e.hasOwnProperty(t))if(n.hasOwnProperty(t)){let r=n[t],i=e[t];if(Array.isArray(r)||Array.isArray(i)){let o=Array.isArray(r)?r:[r],a=Array.isArray(i)?i:[i];n[t]=o.concat(a).unique()}else xn(r)&&xn(i)?pr(r,i):i!=null&&i!==""&&(n[t]=i)}else n[t]=e[t]}}function yn(n){let e={},t=(0,Te.getFrontMatterInfo)(n);return t.frontmatter&&(e=(0,Te.parseYaml)(t.frontmatter)),{frontmatter:e,content:n.slice(t.contentStart)}}var Oo=X(require("obsidian"));var No=X(require("obsidian"));var ie="top",ue="bottom",ce="right",ae="left",ur="auto",vt=[ie,ue,ce,ae],pt="start",Ot="end",po="clippingParents",fr="viewport",Zt="popper",uo="reference",Gr=vt.reduce(function(n,e){return n.concat([e+"-"+pt,e+"-"+Ot])},[]),dr=[].concat(vt,[ur]).reduce(function(n,e){return n.concat([e,e+"-"+pt,e+"-"+Ot])},[]),cs="beforeRead",ls="read",ps="afterRead",us="beforeMain",fs="main",ds="afterMain",ms="beforeWrite",gs="write",hs="afterWrite",fo=[cs,ls,ps,us,fs,ds,ms,gs,hs];function me(n){return n?(n.nodeName||"").toLowerCase():null}function Z(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Me(n){var e=Z(n).Element;return n instanceof e||n instanceof Element}function fe(n){var e=Z(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function en(n){if(typeof ShadowRoot=="undefined")return!1;var e=Z(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function As(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},i=e.attributes[t]||{},o=e.elements[t];!fe(o)||!me(o)||(Object.assign(o.style,r),Object.keys(i).forEach(function(a){var l=i[a];l===!1?o.removeAttribute(a):o.setAttribute(a,l===!0?"":l)}))})}function _s(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],o=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),l=a.reduce(function(c,d){return c[d]="",c},{});!fe(i)||!me(i)||(Object.assign(i.style,l),Object.keys(o).forEach(function(c){i.removeAttribute(c)}))})}}var mo={name:"applyStyles",enabled:!0,phase:"write",fn:As,effect:_s,requires:["computeStyles"]};function ge(n){return n.split("-")[0]}var qe=Math.max,Bt=Math.min,ut=Math.round;function tn(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function jn(){return!/^((?!chrome|android).)*safari/i.test(tn())}function Oe(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=n.getBoundingClientRect(),i=1,o=1;e&&fe(n)&&(i=n.offsetWidth>0&&ut(r.width)/n.offsetWidth||1,o=n.offsetHeight>0&&ut(r.height)/n.offsetHeight||1);var a=Me(n)?Z(n):window,l=a.visualViewport,c=!jn()&&t,d=(r.left+(c&&l?l.offsetLeft:0))/i,m=(r.top+(c&&l?l.offsetTop:0))/o,_=r.width/i,w=r.height/o;return{width:_,height:w,top:m,right:d+_,bottom:m+w,left:d,x:d,y:m}}function It(n){var e=Oe(n),t=n.offsetWidth,r=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:r}}function vn(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&en(t)){var r=e;do{if(r&&n.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function we(n){return Z(n).getComputedStyle(n)}function Wr(n){return["table","td","th"].indexOf(me(n))>=0}function Ae(n){return((Me(n)?n.ownerDocument:n.document)||window.document).documentElement}function ft(n){return me(n)==="html"?n:n.assignedSlot||n.parentNode||(en(n)?n.host:null)||Ae(n)}function go(n){return!fe(n)||we(n).position==="fixed"?null:n.offsetParent}function xs(n){var e=/firefox/i.test(tn()),t=/Trident/i.test(tn());if(t&&fe(n)){var r=we(n);if(r.position==="fixed")return nu
Line truncated
|
||||
> \u2014 ${o}`}catch{return new P("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(e,t,r=!1)=>{try{let i=await this.getRequest(`https://templater-unsplash-2.fly.dev/${t?"?q="+t:""}`).then(a=>a.json),o=i.full;if(e&&!r)if(e.includes("x")){let[a,l]=e.split("x");o=o.concat(`&w=${a}&h=${l}`)}else o=o.concat(`&w=${e}`);return r?``:``}catch{return new P("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(e,t)=>{try{let i=await(await this.getRequest(e)).json;return t&&i?t.split(".").reduce((o,a)=>{if(o&&o.hasOwnProperty(a))return o[a];throw new Error(`Path ${t} not found in the JSON response`)},i):i}catch(r){throw console.error(r),new P("Error fetching and extracting value")}}}};var ui=class extends be{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(e=>{e.e.offref(e)}),this.event_refs=[]}generate_on_all_templates_executed(){return e=>{let t=this.plugin.app.workspace.on("templater:all-templates-executed",async()=>{await jt(1),e()});t&&this.event_refs.push(t)}}};var fi=class extends be{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let e=this.plugin.app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(e?.frontmatter||{}))}async teardown(){}};var Qe=X(require("obsidian"));var di=class extends Qe.Modal{constructor(e,t,r,i){super(e);this.prompt_text=t;this.default_value=r;this.multi_line=i;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new P("Cancelled prompt"))}createForm(){let e=this.contentEl.createDiv();e.addClass("templater-prompt-div");let t;this.multi_line?t=new Qe.TextAreaComponent(e):t=new Qe.TextComponent(e);let r=this.contentEl.createDiv();r.addClass("templater-button-div");let i=new Qe.ButtonComponent(r);i.buttonEl.addClass("mod-cta"),i.setButtonText("Submit").onClick(o=>{this.resolveAndClose(o)}),this.value=this.default_value??"",t.inputEl.addClass("templater-prompt-input"),t.setPlaceholder("Type text here"),t.setValue(this.value),t.onChange(o=>this.value=o),t.inputEl.focus(),t.inputEl.addEventListener("keydown",o=>this.enterCallback(o))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Qe.Platform.isDesktop&&e.key==="Enter"&&!e.shiftKey&&this.resolveAndClose(e):e.key==="Enter"&&this.resolveAndClose(e))}resolveAndClose(e){this.submitted=!0,e.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Yo=X(require("obsidian")),mi=class extends Yo.FuzzySuggestModal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.setPlaceholder(i),o&&(this.limit=o)}getItems(){return this.items}onClose(){this.submitted||this.reject(new P("Cancelled prompt"))}selectSuggestion(e,t){this.submitted=!0,this.close(),this.onChooseSuggestion(e,t)}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.resolve(e)}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var De=X(require("obsidian")),gi=class extends De.Modal{constructor(e,t,r,i,o){super(e);this.text_items=t;this.items=r;this.submitted=!1;this.selectedItems=[];this.setTitle(i),this.listEl=this.contentEl.createDiv("templater-multisuggester-list");let a=this.contentEl.createDiv("templater-multisuggester-div"),l=new De.TextComponent(a);l.inputEl.addClass("templater-multisuggester-input"),this.suggester=new Uo(e,l.inputEl,this.getItemText.bind(this),r,o).onSelect(this.onChooseItem.bind(this));let c=this.contentEl.createDiv("modal-button-container");new De.ButtonComponent(c).setButtonText("Save").setCta().onClick(()=>this.save()),new De.ButtonComponent(c).setButtonText("Cancel").onClick(()=>this.close())}onOpen(){this.display()}display(){this.listEl.empty(),this.selectedItems.forEach(e=>{let t=this.listEl.createDiv("mobile-option-setting-item");t.createSpan("mobile-option-setting-item-name").setText(this.getItemText(e)),t.createDiv("clickable-icon mobile-option-setting-item-option-icon",r=>{(0,De.setIcon)(r,"lucide-x"),r.addEventListener("click",()=>{this.onRemoveItem(e)})})})}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.selectedItems.push(e);let t=this.items.filter(r=>!this.selectedItems.some(i=>i===r));this.suggester.setItems(t),this.display()}onRemoveItem(e){thi
Line truncated
|
||||
})`)(r,o,i)}catch(c){throw new P(`Failed to load user script at "${e.path}".`,c.message)}let l=i.default??o.exports;if(!l)throw new P(`Failed to load user script at "${e.path}". No exports detected.`);if(typeof l=="function")t.set(e.basename,l);else if(typeof l=="object"&&l!==null){if(!Object.values(l).every(d=>typeof d=="function"))throw new P(`Exported object in "${e.path}" must contain only functions.`);t.set(e.basename,l)}else throw new P(`Invalid export in "${e.path}". Must be a function or object of functions.`)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var ji=class{constructor(e){this.plugin=e;this.user_system_functions=new xi(e),this.user_script_functions=new yi(e)}async generate_object(e){let t={},r={};return this.plugin.settings.enable_system_commands&&(t=await this.user_system_functions.generate_object(e)),this.plugin.settings.user_scripts_folder&&(r=await this.user_script_functions.generate_object()),{...t,...r}}};var Ks=X(require("obsidian")),Xe;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(Xe||(Xe={}));var vi=class{constructor(e){this.plugin=e;this.internal_functions=new _i(this.plugin),this.user_functions=new ji(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{app:this.plugin.app,obsidian:Ks}}async generate_object(e,t=1){let r={},i=this.additional_functions(),o=await this.internal_functions.generate_object(e),a={};switch(Object.assign(r,i),t){case 0:Object.assign(r,o);break;case 1:a=await this.user_functions.generate_object(e),Object.assign(r,{...o,user:a});break}return r}};var Xs={},M,Ke=new Array(32).fill(void 0);Ke.push(void 0,null,!0,!1);function Pe(n){return Ke[n]}var Dn=Ke.length;function Rs(n){n<36||(Ke[n]=Dn,Dn=n)}function wi(n){let e=Pe(n);return Rs(n),e}var Go=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Go.decode();var _r=new Uint8Array;function xr(){return _r.byteLength===0&&(_r=new Uint8Array(M.memory.buffer)),_r}function bt(n,e){return Go.decode(xr().subarray(n,n+e))}function Et(n){Dn===Ke.length&&Ke.push(Ke.length+1);let e=Dn;return Dn=Ke[e],Ke[e]=n,e}var Re=0,yr=new TextEncoder("utf-8"),Ys=typeof yr.encodeInto=="function"?function(n,e){return yr.encodeInto(n,e)}:function(n,e){let t=yr.encode(n);return e.set(t),{read:n.length,written:t.length}};function gt(n,e,t){if(t===void 0){let l=yr.encode(n),c=e(l.length);return xr().subarray(c,c+l.length).set(l),Re=l.length,c}let r=n.length,i=e(r),o=xr(),a=0;for(;a<r;a++){let l=n.charCodeAt(a);if(l>127)break;o[i+a]=l}if(a!==r){a!==0&&(n=n.slice(a)),i=t(i,r,r=a+n.length*3);let l=xr().subarray(i+a,i+r);a+=Ys(n,l).written}return Re=a,i}function Us(n){return n==null}var jr=new Int32Array;function Ne(){return jr.byteLength===0&&(jr=new Int32Array(M.memory.buffer)),jr}function bi(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){let i=n.length,o="[";i>0&&(o+=bi(n[0]));for(let a=1;a<i;a++)o+=", "+bi(n[a]);return o+="]",o}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
|
||||
${n.stack}`:r}function Gs(n,e){if(!(n instanceof e))throw new Error(`expected instance of ${e.name}`);return n.ptr}var vr=32;function Ws(n){if(vr==1)throw new Error("out of js stack");return Ke[--vr]=n,vr}function Ei(n,e){try{return n.apply(this,e)}catch(t){M.__wbindgen_exn_store(Et(t))}}var Kt=class{static __wrap(e){let t=Object.create(Kt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_parserconfig_free(e)}get interpolate(){let e=M.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(e)}set interpolate(e){M.__wbg_set_parserconfig_interpolate(this.ptr,e.codePointAt(0))}get execution(){let e=M.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(e)}set execution(e){M.__wbg_set_parserconfig_execution(this.ptr,e.codePointAt(0))}get single_whitespace(){let e=M.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(e)}set single_whitespace(e){M.__wbg_set_parserconfig_single_whitespace(this.ptr,e.codePointAt(0))}get multiple_whitespace(){let e=M.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(e)}set multiple_whitespace(e){M.__wbg_set_parserconfig_multiple_whitespace(this.ptr,e.codePointAt(0))}constructor(e,t,r,i,o,a,l){let c=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),d=Re,m=gt(t,M.__wbindgen_malloc,M.__wbindgen_realloc),_=Re,w=gt(l,M.__wbindgen_malloc,M.__wbindgen_realloc),b=Re,S=M.parserconfig_new(c,d,m,_,r.codePointAt(0),i.codePointAt(0),o.codePointAt(0),a.codePointAt(0),w,b);return Kt.__wrap(S)}get opening_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_opening_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set opening_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_opening_tag(this.ptr,t,r)}get closing_tag(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_closing_tag(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set closing_tag(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_closing_tag(this.ptr,t,r)}get global_var(){try{let r=M.__wbindgen_add_to_stack_pointer(-16);M.parserconfig_global_var(r,this.ptr);var e=Ne()[r/4+0],t=Ne()[r/4+1];return bt(e,t)}finally{M.__wbindgen_add_to_stack_pointer(16),M.__wbindgen_free(e,t)}}set global_var(e){let t=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),r=Re;M.parserconfig_set_global_var(this.ptr,t,r)}},sn=class{static __wrap(e){let t=Object.create(sn.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();M.__wbg_renderer_free(e)}constructor(e){Gs(e,Kt);var t=e.ptr;e.ptr=0;let r=M.renderer_new(t);return sn.__wrap(r)}render_content(e,t){try{let a=M.__wbindgen_add_to_stack_pointer(-16),l=gt(e,M.__wbindgen_malloc,M.__wbindgen_realloc),c=Re;M.renderer_render_content(a,this.ptr,l,c,Ws(t));var r=Ne()[a/4+0],i=Ne()[a/4+1],o=Ne()[a/4+2];if(o)throw wi(i);return wi(r)}finally{M.__wbindgen_add_to_stack_pointer(16),Ke[vr++]=void 0}}};async function Vs(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function zs(){let n={};return n.wbg={},n.wbg.__wbindgen_object_drop_ref=function(e){wi(e)},n.wbg.__wbindgen_string_new=function(e,t){let r=bt(e,t);return Et(r)},n.wbg.__wbindgen_string_get=function(e,t){let r=Pe(t),i=typeof r=="string"?r:void 0;var o=Us(i)?0:gt(i,M.__wbindgen_malloc,M.__wbindgen_realloc),a=Re;Ne()[e/4+1]=a,Ne()[e/4+0]=o},n.wbg.__wbg_call_97ae9d8645dc388b=function(){return Ei(function(e,t){let r=Pe(e).call(Pe(t));return Et(r)},arguments)},n.wbg.__wbg_new_8d2af00bc1e329ee=function(e,t){let r=new Error(bt(e,t));return Et(r)},n.wbg.__wbg_message_fe2af63ccc8985bc=function(e){let t=Pe(e).message;return Et(t)},n.wbg.__wbg_newwithargs_8fe23e3842840c8e=function(e,t,r,i){let o=new Function(bt(e,t),bt(r,i));return Et(o)},n.wbg.__wbg_call_168da88779e35f61=function(){return Ei(function(e,t,r){let i=Pe(e).call(Pe(t),Pe(r));return Et(i)},arguments)},n.wbg.__wbg_call_3999bee59e9f7719=function(){return Ei(function(e,t,r,i){let o=Pe(e).call(Pe(t),Pe(r),Pe(i));return Et(o)},arguments)},n.wbg.__wbindgen_debug_string=function(e,t){let r=bi(Pe(t)),i=gt(r,M.__wbindgen_malloc,M.__wbindgen_realloc),o=Re;Ne
Line truncated
|
||||
${(0,de.stringifyYaml)(b)}---
|
||||
`),_+=w+d,o.editor.setValue(_),o.editor.setSelection({line:0,ch:0},{line:0,ch:0}),await jt(100),await i.save()}else await this.plugin.app.vault.process(t,_=>{let w="",{content:b,frontmatter:S}=yn(_);return pr(S,m),Object.keys(S).length>0&&(w+=`---
|
||||
${(0,de.stringifyYaml)(S)}---
|
||||
`),w+=b+d,c=w,w});this.plugin.app.workspace.trigger("templater:new-note-from-template",{file:t,content:c}),await this.plugin.editor_handler.jump_to_next_cursor_location(t,!0),await this.end_templater_task(r)}overwrite_active_file_commands(){let e=this.plugin.app.workspace.activeEditor;if(!e||!e.file){oe(new P("Active editor is null, can't overwrite content"));return}this.overwrite_file_commands(e.file,!0)}async overwrite_file_commands(e,t=!1){let{path:r}=e;this.start_templater_task(r);let i=this.create_running_config(e,e,t?3:2),o=await Se(async()=>this.read_and_parse_template(i),"Template parsing error, aborting.");if(o==null){await this.end_templater_task(r);return}await this.plugin.app.vault.modify(e,o),this.plugin.app.workspace.trigger("templater:overwrite-file",{file:e,content:o}),await this.plugin.editor_handler.jump_to_next_cursor_location(e,!0),await this.end_templater_task(r)}async process_dynamic_templates(e,t){let r=so(),i=document.createNodeIterator(e,NodeFilter.SHOW_TEXT),o,a=!1,l;for(;o=i.nextNode();){let c=o.nodeValue;if(c!==null){let d=r.exec(c);if(d!==null){let m=this.plugin.app.metadataCache.getFirstLinkpathDest("",t.sourcePath);if(!m||!(m instanceof de.TFile))return;if(!a){a=!0;let _=this.create_running_config(m,m,4);l=await this.functions_generator.generate_object(_,Xe.USER_INTERNAL),this.current_functions_object=l}}for(;d!=null;){let m=d[1]+d[2],_=await Se(async()=>await this.parser.parse_commands(m,l),`Command Parsing error in dynamic command '${m}'`);if(_==null)return;let w=r.lastIndex-d[0].length,b=r.lastIndex;c=c.substring(0,w)+_+c.substring(b),r.lastIndex+=_.length-d[0].length,d=r.exec(c)}o.nodeValue=c}}}get_new_file_template_for_folder(e){do{let t=this.plugin.settings.folder_templates.find(r=>r.folder==e.path);if(t&&t.template)return t.template;e=e.parent}while(e)}get_new_file_template_for_file(e){let t=this.plugin.settings.file_templates.find(r=>new RegExp(r.regex).test(e.path));if(t&&t.template)return t.template}static async on_file_creation(e,t,r){if(!(r instanceof de.TFile)||r.extension!=="md")return;let i=(0,de.normalizePath)(e.plugin.settings.templates_folder);if(r.path.includes(i)&&i!=="/"||(await jt(300),e.files_with_pending_templates.has(r.path)))return;let o=await t.vault.read(r),a=(0,de.getFrontMatterInfo)(o),l=o.length-a.contentStart;if(l==0&&e.plugin.settings.enable_folder_templates){let c=e.get_new_file_template_for_folder(r.parent);if(!c)return;let d=await Se(async()=>Nt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else if(l==0&&e.plugin.settings.enable_file_templates){let c=e.get_new_file_template_for_file(r);if(!c)return;let d=await Se(async()=>Nt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else{let c=1e5;r.stat.size<=c?await e.overwrite_file_commands(r):console.log(`Templater skipped parsing ${r.path} because file size exceeds ${c}`)}}async execute_startup_scripts(){for(let e of this.plugin.settings.startup_templates){if(!e)continue;let t=Ce(()=>Nt(this.plugin.app,e),`Couldn't find startup template "${e}"`);if(!t)continue;let{path:r}=t;this.start_templater_task(r);let i=this.create_running_config(t,t,5);await Se(async()=>this.read_and_parse_template(i),"Startup Template parsing error, aborting."),await this.end_templater_task(r)}}};var Qo=X(require("obsidian")),wr=class{constructor(e,t,r){this.plugin=e;this.templater=t;this.settings=r}setup(){Array.isArray(this.plugin.app.workspace.onLayoutReadyCallbacks)?this.plugin.app.workspace.onLayoutReadyCallbacks.unshift({pluginId:this.plugin.manifest.id,callback:()=>{this.update_trigger_file_on_creation()}}):this.plugin.app.workspace.onLayoutReady(()=>{this.update_trigger_file_on_creation()}),this.update_syntax_highlighting(),this.update_file_menu()}update_syntax_highlighting(){let e=this.plugin.editor_handler.desktopShouldHighlight(),t=this.plugin.editor_handler.mobileShouldHighlight();e||t?this.plugin.editor_handler.enable_highlighter():this.plugin.editor_handler.disable_highlighter()}update_trigger_file_on_creation(){this.settings.trigger_on_file_creation?(this.trigger_on_file_creation_event=this.plugin.app.vault.on("create",e=>Pn.on_file_creation(this.templater,this.plugin.app,e)),this.plugin.registerEvent(this.trigger_on_file_creation_event)):this.trigger_on_file_creation_event&&(this.plugin.app.vault.offref(this.trigger_on_file_creation_event),this.trigger_on_file_creation_event=void 0)}update_file_menu(){this.plugin.registerEvent(this.plugin.app.workspace.on("file-menu",(e,t)=>{t instanceof Qo.TFolder&&e.addItem(r=>{r.setTitle("Create new note from template").setIcon("templater-icon").onClick(()=>{this.plugin.fuzzy_suggester.create_new_note_from_template(t)})})}))}};var br=X(require("obsidian"));var ki=class{constructor(e){this.plugin=e}setup(){this.plugin.addCommand({id:"insert-templater",name:"Open insert template modal",icon:"templater-icon",hotkeys:br.Platform.isMacOS?void 0:[{modifiers:["Alt"],key:"e"}],callback:()=>{thi
Line truncated
|
||||
`,a+1))!==-1;i++,o=a);o+=1;let l=e.slice(o,t).length;return{line:i,ch:l}}replace_and_get_cursor_positions(e){let t=[],r,i=new RegExp("<%\\s*tp.file.cursor\\((?<order>[0-9]*)\\)\\s*%>","g");for(;(r=i.exec(e))!=null;)t.push(r);if(t.length===0)return{};t.sort((c,d)=>Number(c.groups&&c.groups.order)-Number(d.groups&&d.groups.order));let o=t[0][0];t=t.filter(c=>c[0]===o);let a=[],l=0;for(let c of t){let d=c.index-l;if(a.push(this.get_editor_position_from_index(e,d)),e=e.replace(new RegExp(ao(c[0])),""),l+=c[0].length,c[1]==="")break}return{new_content:e,positions:a}}set_cursor_location(e){let t=this.app.workspace.activeEditor;if(!t||!t.editor)return;let r=t.editor,i=[];for(let a of e)i.push({from:a});let o={selections:i};r.transaction(o)}};var ta=X(require("obsidian"));var tc={app:{name:"app",description:"This module exposes the app instance. Prefer to use this over the global app instance."},user:{name:"user",description:"This module exposes custom made scripts, written by yourself within the script file folder location"},config:{name:"config",description:`This module exposes Templater's running configuration.
|
||||
`),w+=b+d,c=w,w});this.plugin.app.workspace.trigger("templater:new-note-from-template",{file:t,content:c}),await this.plugin.editor_handler.jump_to_next_cursor_location(t,!0),await this.end_templater_task(r)}overwrite_active_file_commands(){let e=this.plugin.app.workspace.activeEditor;if(!e||!e.file){oe(new P("Active editor is null, can't overwrite content"));return}this.overwrite_file_commands(e.file,!0)}async overwrite_file_commands(e,t=!1){let{path:r}=e;this.start_templater_task(r);let i=this.create_running_config(e,e,t?3:2),o=await Se(async()=>this.read_and_parse_template(i),"Template parsing error, aborting.");if(o==null){await this.end_templater_task(r);return}await this.plugin.app.vault.modify(e,o),this.plugin.app.workspace.trigger("templater:overwrite-file",{file:e,content:o}),await this.plugin.editor_handler.jump_to_next_cursor_location(e,!0),await this.end_templater_task(r)}async process_dynamic_templates(e,t){let r=ao(),i=document.createNodeIterator(e,NodeFilter.SHOW_TEXT),o,a=!1,l;for(;o=i.nextNode();){let c=o.nodeValue;if(c!==null){let d=r.exec(c);if(d!==null){let m=this.plugin.app.metadataCache.getFirstLinkpathDest("",t.sourcePath);if(!m||!(m instanceof de.TFile))return;if(!a){a=!0;let _=this.create_running_config(m,m,4);l=await this.functions_generator.generate_object(_,Xe.USER_INTERNAL),this.current_functions_object=l}}for(;d!=null;){let m=d[1]+d[2],_=await Se(async()=>await this.parser.parse_commands(m,l),`Command Parsing error in dynamic command '${m}'`);if(_==null)return;let w=r.lastIndex-d[0].length,b=r.lastIndex;c=c.substring(0,w)+_+c.substring(b),r.lastIndex+=_.length-d[0].length,d=r.exec(c)}o.nodeValue=c}}}get_new_file_template_for_folder(e){do{let t=this.plugin.settings.folder_templates.find(r=>r.folder==e.path);if(t&&t.template)return t.template;e=e.parent}while(e)}get_new_file_template_for_file(e){let t=this.plugin.settings.file_templates.find(r=>new RegExp(r.regex).test(e.path));if(t&&t.template)return t.template}static async on_file_creation(e,t,r){if(!(r instanceof de.TFile)||r.extension!=="md")return;let i=(0,de.normalizePath)(e.plugin.settings.templates_folder);if(r.path.includes(i)&&i!=="/"||(await jt(300),e.files_with_pending_templates.has(r.path)))return;let o=await t.vault.read(r),a=(0,de.getFrontMatterInfo)(o),l=o.length-a.contentStart;if(l==0&&e.plugin.settings.enable_folder_templates){let c=e.get_new_file_template_for_folder(r.parent);if(!c)return;let d=await Se(async()=>Nt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else if(l==0&&e.plugin.settings.enable_file_templates){let c=e.get_new_file_template_for_file(r);if(!c)return;let d=await Se(async()=>Nt(t,c),`Couldn't find template ${c}`);if(d==null)return;await e.write_template_to_file(d,r)}else{let c=1e5;r.stat.size<=c?await e.overwrite_file_commands(r):console.log(`Templater skipped parsing ${r.path} because file size exceeds ${c}`)}}async execute_startup_scripts(){for(let e of this.plugin.settings.startup_templates){if(!e)continue;let t=Ce(()=>Nt(this.plugin.app,e),`Couldn't find startup template "${e}"`);if(!t)continue;let{path:r}=t;this.start_templater_task(r);let i=this.create_running_config(t,t,5);await Se(async()=>this.read_and_parse_template(i),"Startup Template parsing error, aborting."),await this.end_templater_task(r)}}};var Jo=X(require("obsidian")),wr=class{constructor(e,t,r){this.plugin=e;this.templater=t;this.settings=r}setup(){Array.isArray(this.plugin.app.workspace.onLayoutReadyCallbacks)?this.plugin.app.workspace.onLayoutReadyCallbacks.unshift({pluginId:this.plugin.manifest.id,callback:()=>{this.update_trigger_file_on_creation()}}):this.plugin.app.workspace.onLayoutReady(()=>{this.update_trigger_file_on_creation()}),this.update_syntax_highlighting(),this.update_file_menu()}update_syntax_highlighting(){let e=this.plugin.editor_handler.desktopShouldHighlight(),t=this.plugin.editor_handler.mobileShouldHighlight();e||t?this.plugin.editor_handler.enable_highlighter():this.plugin.editor_handler.disable_highlighter()}update_trigger_file_on_creation(){this.settings.trigger_on_file_creation?(this.trigger_on_file_creation_event=this.plugin.app.vault.on("create",e=>Pn.on_file_creation(this.templater,this.plugin.app,e)),this.plugin.registerEvent(this.trigger_on_file_creation_event)):this.trigger_on_file_creation_event&&(this.plugin.app.vault.offref(this.trigger_on_file_creation_event),this.trigger_on_file_creation_event=void 0)}update_file_menu(){this.plugin.registerEvent(this.plugin.app.workspace.on("file-menu",(e,t)=>{t instanceof Jo.TFolder&&e.addItem(r=>{r.setTitle("Create new note from template").setIcon("templater-icon").onClick(()=>{this.plugin.fuzzy_suggester.create_new_note_from_template(t)})})}))}};var br=X(require("obsidian"));var ki=class{constructor(e){this.plugin=e}setup(){this.plugin.addCommand({id:"insert-templater",name:"Open insert template modal",icon:"templater-icon",hotkeys:br.Platform.isMacOS?void 0:[{modifiers:["Alt"],key:"e"}],callback:()=>{thi
Line truncated
|
||||
`,a+1))!==-1;i++,o=a);o+=1;let l=e.slice(o,t).length;return{line:i,ch:l}}get_cursor_matches_and_positions(e){let t=/<%\s*tp\.file\.cursor\((?<order>[0-9]*)\)\s*%>/g,r=Array.from(e.matchAll(t));if(r.length===0)return{};r.sort((d,m)=>Number(d.groups?.order||0)-Number(m.groups?.order||0));let i=r[0][0],o=r.filter(d=>d[0]===i),a=o[0][1]===""?[o[0]]:o,l=[],c=0;for(let d of a){let m=d.index-c;l.push(this.get_editor_position_from_index(e,m)),e=e.slice(0,m)+e.slice(m+d[0].length),c+=d[0].length}return{cursor_matches:a,positions:l}}};var ea=X(require("obsidian"));var ec={app:{name:"app",description:"This module exposes the app instance. Prefer to use this over the global app instance."},user:{name:"user",description:"This module exposes custom made scripts, written by yourself within the script file folder location"},config:{name:"config",description:`This module exposes Templater's running configuration.
|
||||
|
||||
This is mostly useful when writing scripts requiring some context information.
|
||||
`,functions:{template_file:{name:"template_file",description:"The `TFile` object representing the template file.",definition:"tp.config.template_file"},target_file:{name:"target_file",description:"The `TFile` object representing the target file where the template will be inserted.",definition:"tp.config.target_file"},run_mode:{name:"run_mode",description:"The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...).",definition:"tp.config.run_mode"},active_file:{name:"active_file",description:"The active file (if existing) when launching Templater.",definition:"tp.config.active_file?"}}},date:{name:"date",description:"This module contains every internal function related to dates.",functions:{now:{name:"now",description:"Retrieves the date.",definition:'tp.date.now(format: string = "YYYY-MM-DD", offset?: number\u23AEstring, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"offset",description:"Duration to offset the date from. If a number is provided, duration will be added to the date in days. You can also specify the offset as a string using the ISO 8601 format."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"Date now",example:"<% tp.date.now() %>"},{name:"Date now with format",example:'<% tp.date.now("Do MMMM YYYY") %>'},{name:"Last week",example:'<% tp.date.now("YYYY-MM-DD", -7) %>'},{name:"Next week",example:'<% tp.date.now("YYYY-MM-DD", 7) %>'},{name:"Last month",example:'<% tp.date.now("YYYY-MM-DD", "P-1M") %>'},{name:"Next year",example:'<% tp.date.now("YYYY-MM-DD", "P1Y") %>'},{name:"File's title date + 1 day (tomorrow)",example:'<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title date - 1 day (yesterday)",example:'<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>'}]},tomorrow:{name:"tomorrow",description:"Retrieves tomorrow's date.",definition:'tp.date.tomorrow(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date tomorrow",example:"<% tp.date.tomorrow() %>"},{name:"Date tomorrow with format",example:'<% tp.date.tomorrow("Do MMMM YYYY") %>'}]},yesterday:{name:"yesterday",description:"Retrieves yesterday's date.",definition:'tp.date.yesterday(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date yesterday",example:"<% tp.date.yesterday() %>"},{name:"Date yesterday with format",example:'<% tp.date.yesterday("Do MMMM YYYY") %>'}]},weekday:{name:"weekday",description:"",definition:'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"weekday",description:"Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"This week's Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0) %>'},{name:"Next Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 7) %>'},{name:"File's title Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title previous Monday",example:'<% tp.date.weekday("YYYY-MM-DD", -7, tp.file.title, "YYYY-MM-DD") %>'}]}},momentjs:{examples:[{name:"Date now",example:'<% moment(tp.file.title, "YYYY-MM-DD").format("YYYY-MM-DD") %>'},{name:"Get start of month from note title",example:'<% moment(tp.file.title, "YYYY-MM-DD").startOf("month").format("YYYY-MM-DD") %>'},{name:"Get end of month from note title",example:'<% moment(tp.file.title, "YYYY-MM-DD").endOf("month").format("YYYY-MM-DD") %>'}]}},file:{name:"file",description:"This module contains every internal function related to files.",functions:{content:{name:"content",description:"The string contents of the file at the time that Templater was executed. Manipulating this string will *not* update the current file.",definition:"tp.file.content",examples:[{name:"Retrieve file content",example:"<% tp.file.content %>"}]},create_new:{name:"create_new
Line truncated
|
||||
@@ -40,6 +40,6 @@ selected value: <% selectedValue %>`}]},multi_suggester:{name:"multi_suggester",
|
||||
let selectedValues = await tp.system.multi_suggester(["Happy", "Sad", "Confused"], ["Happy", "Sad", "Confused"]);
|
||||
%>
|
||||
# <% selectedValues %>
|
||||
selected values: <% selectedValues %>`}]}}},web:{name:"web",description:"This modules contains every internal function related to the web (making web requests).",functions:{daily_quote:{name:"daily_quote",description:"Retrieves and parses the daily quote from `https://github.com/Zachatoo/quotes-database` as a callout.",definition:"tp.web.daily_quote()",examples:[{name:"Daily quote",example:"<% await tp.web.daily_quote() %>"}]},random_picture:{name:"random_picture",description:"Gets a random image from `https://unsplash.com/`.",definition:"tp.web.random_picture(size?: string, query?: string, include_size?: boolean)",args:[{name:"size",description:"Image size in the format `<width>x<height>`."},{name:"query",description:"Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma."},{name:"include_size",description:"Optional argument to include the specified size in the image link markdown. Defaults to false."}],examples:[{name:"Random picture",example:"<% await tp.web.random_picture() %>"},{name:"Random picture with size",example:'<% await tp.web.random_picture("200x200") %>'},{name:"Random picture with size and query",example:'<% await tp.web.random_picture("200x200", "landscape,water") %>'}]},request:{name:"request",description:"Makes a HTTP request to the specified URL. Optionally, you can specify a path to extract specific data from the response.",definition:"tp.web.request(url: string, path?: string)",args:[{name:"url",description:"The URL to which the HTTP request will be made."},{name:"path",description:"A path within the response JSON to extract specific data."}],examples:[{name:"Simple request",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos/1") %>'},{name:"Request with path",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos", "0.title") %>'}]}}}},Zo={tp:tc};var nc=["app","config","date","file","frontmatter","hooks","obsidian","system","user","web"],rc=new Set(nc);function ea(n){return typeof n=="string"&&rc.has(n)}function Di(n){return!!(n.definition||n.returns||n.args)}var Pi=class{constructor(e){this.plugin=e;this.documentation=Zo}get_all_modules_documentation(){let e=this.documentation.tp;return(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)&&(e=Object.values(e).filter(t=>t.name!=="user")),Object.values(e).map(t=>(t.queryKey=t.name,t))}async get_all_functions_documentation(e,t){if(e==="app")return this.get_app_functions_documentation(this.plugin.app,t);if(e==="user"){if(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)return;let r=await Se(async()=>{let i=Je(this.plugin.app,this.plugin.settings.user_scripts_folder).filter(a=>a.extension=="js");return await co(this.plugin.app,i)},"User Scripts folder doesn't exist");return!r||r.length===0?void 0:r.reduce((i,o)=>o.extension!=="js"?i:[...i,{name:o.basename,queryKey:o.basename,definition:"",description:o.description,returns:o.returns,args:o.arguments.reduce((l,c)=>(l[c.name]={name:c.name,description:c.description},l),{}),example:""}],[])}if(!!this.documentation.tp[e].functions)return Object.values(this.documentation.tp[e].functions).map(r=>(r.queryKey=r.name,r))}get_app_functions_documentation(e,t){if(!xn(e))return[];let r=t.split(".");if(r.length===0)return[];let i=e;for(let c=0;c<r.length-1;c++){let d=r[c];if(d in i){if(!xn(i[d]))return[];i=i[d]}}let o=["tp","app",...r.slice(0,r.length-1)].join("."),a=r.slice(0,r.length-1).join("."),l=[];for(let c in i){let d=`${o}.${c}`,m=a?`${a}.${c}`:c;l.push({name:c,queryKey:m,definition:typeof i[c]=="function"?`${d}(${po(i[c])})`:d,description:"",returns:"",example:""})}return l}get_module_documentation(e){return this.documentation.tp[e]}get_function_documentation(e,t){return this.documentation.tp[e].functions[t]}get_argument_documentation(e,t,r){let i=this.get_function_documentation(e,t);return!i||!i.args?null:i.args[r]}};var Ni=class extends ta.EditorSuggest{constructor(e){super(e.app);this.tp_keyword_regex=/tp\.(?<module>[a-z]*)?(?<fn_trigger>\.(?<fn>[a-zA-Z_.]*)?)?$/;this.documentation=new Pi(e),this.intellisense_render_setting=e.settings.intellisense_render}onTrigger(e,t,r){let i=t.getRange({line:e.line,ch:0},{line:e.line,ch:e.ch}),o=this.tp_keyword_regex.exec(i);if(!o)return null;let a,l=o.groups&&o.groups.module||"";if(this.module_name=l,o.groups&&o.groups.fn_trigger){if(l==""||!ea(l))return null;this.function_trigger=!0,this.function_name=o.groups.fn||"",a=this.function_name}else this.function_trigger=!1,a=this.module_name;let c={start:{line:e.line,ch:e.ch-a.length},end:{line:e.line,ch:e.ch},query:a};return this.latest_trigger_info=c,c}async getSuggestions(e){let t;return this.module_name&&this.function_trigger?t=await this.documentation.get_all_functions_documentation(this.module_name,this.function_name):t=this.documentation.get_all_modules_documentation(),t?t.filter(r=>r.queryKey.toLowerCase().startsWith(e.query.toLowerCase())):[]}renderSuggestion(e,t){if(t.crea
Line truncated
|
||||
selected values: <% selectedValues %>`}]}}},web:{name:"web",description:"This modules contains every internal function related to the web (making web requests).",functions:{daily_quote:{name:"daily_quote",description:"Retrieves and parses the daily quote from `https://github.com/Zachatoo/quotes-database` as a callout.",definition:"tp.web.daily_quote()",examples:[{name:"Daily quote",example:"<% await tp.web.daily_quote() %>"}]},random_picture:{name:"random_picture",description:"Gets a random image from `https://unsplash.com/`.",definition:"tp.web.random_picture(size?: string, query?: string, include_size?: boolean)",args:[{name:"size",description:"Image size in the format `<width>x<height>`."},{name:"query",description:"Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma."},{name:"include_size",description:"Optional argument to include the specified size in the image link markdown. Defaults to false."}],examples:[{name:"Random picture",example:"<% await tp.web.random_picture() %>"},{name:"Random picture with size",example:'<% await tp.web.random_picture("200x200") %>'},{name:"Random picture with size and query",example:'<% await tp.web.random_picture("200x200", "landscape,water") %>'}]},request:{name:"request",description:"Makes a HTTP request to the specified URL. Optionally, you can specify a path to extract specific data from the response.",definition:"tp.web.request(url: string, path?: string)",args:[{name:"url",description:"The URL to which the HTTP request will be made."},{name:"path",description:"A path within the response JSON to extract specific data."}],examples:[{name:"Simple request",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos/1") %>'},{name:"Request with path",example:'<% await tp.web.request("https://jsonplaceholder.typicode.com/todos", "0.title") %>'}]}}}},Xo={tp:ec};var tc=["app","config","date","file","frontmatter","hooks","obsidian","system","user","web"],nc=new Set(tc);function Zo(n){return typeof n=="string"&&nc.has(n)}function Di(n){return!!(n.definition||n.returns||n.args)}var Pi=class{constructor(e){this.plugin=e;this.documentation=Xo}get_all_modules_documentation(){let e=this.documentation.tp;return(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)&&(e=Object.values(e).filter(t=>t.name!=="user")),Object.values(e).map(t=>(t.queryKey=t.name,t))}async get_all_functions_documentation(e,t){if(e==="app")return this.get_app_functions_documentation(this.plugin.app,t);if(e==="user"){if(!this.plugin.settings||!this.plugin.settings.user_scripts_folder)return;let r=await Se(async()=>{let i=Je(this.plugin.app,this.plugin.settings.user_scripts_folder).filter(a=>a.extension=="js");return await so(this.plugin.app,i)},"User Scripts folder doesn't exist");return!r||r.length===0?void 0:r.reduce((i,o)=>o.extension!=="js"?i:[...i,{name:o.basename,queryKey:o.basename,definition:"",description:o.description,returns:o.returns,args:o.arguments.reduce((l,c)=>(l[c.name]={name:c.name,description:c.description},l),{}),example:""}],[])}if(!!this.documentation.tp[e].functions)return Object.values(this.documentation.tp[e].functions).map(r=>(r.queryKey=r.name,r))}get_app_functions_documentation(e,t){if(!xn(e))return[];let r=t.split(".");if(r.length===0)return[];let i=e;for(let c=0;c<r.length-1;c++){let d=r[c];if(d in i){if(!xn(i[d]))return[];i=i[d]}}let o=["tp","app",...r.slice(0,r.length-1)].join("."),a=r.slice(0,r.length-1).join("."),l=[];for(let c in i){let d=`${o}.${c}`,m=a?`${a}.${c}`:c;l.push({name:c,queryKey:m,definition:typeof i[c]=="function"?`${d}(${lo(i[c])})`:d,description:"",returns:"",example:""})}return l}get_module_documentation(e){return this.documentation.tp[e]}get_function_documentation(e,t){return this.documentation.tp[e].functions[t]}get_argument_documentation(e,t,r){let i=this.get_function_documentation(e,t);return!i||!i.args?null:i.args[r]}};var Ni=class extends ea.EditorSuggest{constructor(e){super(e.app);this.tp_keyword_regex=/tp\.(?<module>[a-z]*)?(?<fn_trigger>\.(?<fn>[a-zA-Z_.]*)?)?$/;this.documentation=new Pi(e),this.intellisense_render_setting=e.settings.intellisense_render}onTrigger(e,t,r){let i=t.getRange({line:e.line,ch:0},{line:e.line,ch:e.ch}),o=this.tp_keyword_regex.exec(i);if(!o)return null;let a,l=o.groups&&o.groups.module||"";if(this.module_name=l,o.groups&&o.groups.fn_trigger){if(l==""||!Zo(l))return null;this.function_trigger=!0,this.function_name=o.groups.fn||"",a=this.function_name}else this.function_trigger=!1,a=this.module_name;let c={start:{line:e.line,ch:e.ch-a.length},end:{line:e.line,ch:e.ch},query:a};return this.latest_trigger_info=c,c}async getSuggestions(e){let t;return this.module_name&&this.function_trigger?t=await this.documentation.get_all_functions_documentation(this.module_name,this.function_name):t=this.documentation.get_all_modules_documentation(),t?t.filter(r=>r.queryKey.toLowerCase().startsWith(e.query.toLowerCase())):[]}renderSuggestion(e,t){if(t.crea
Line truncated
|
||||
|
||||
/* nosourcemap */
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "templater-obsidian",
|
||||
"name": "Templater",
|
||||
"version": "2.16.2",
|
||||
"version": "2.17.0",
|
||||
"description": "Create and use templates",
|
||||
"minAppVersion": "1.5.0",
|
||||
"author": "SilentVoid",
|
||||
|
||||
Reference in new issue
Block a user