|
|
@@ -1,442 +0,0 @@
|
|
|
|
/*
|
|
|
|
|
|
|
|
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 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}}};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(`
|
|
|
|
|
|
|
|
`)+`
|
|
|
|
|
|
|
|
`}},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 ${Ag(e.tagger)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
${e.message}
|
|
|
|
|
|
|
|
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
|
|
|
|
|
|
|
`),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=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 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 $3(t){return t.split(`
|
|
|
|
|
|
|
|
`).map(e=>e.replace(/^ /,"")).join(`
|
|
|
|
|
|
|
|
`)}var mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new 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=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 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 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 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 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 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}
|
|
|
|
|
|
|
|
`+(e?"":` logallrefupdates = true
|
|
|
|
|
|
|
|
`)+` symlinks = false
|
|
|
|
|
|
|
|
ignorecase = true
|
|
|
|
|
|
|
|
`),await t.write(n+"/HEAD",`ref: refs/heads/${i}
|
|
|
|
|
|
|
|
`)}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 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)}},$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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
|
|
|
|
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$PROMPT" > "$TEMP_FILE"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while [ ! -e "$TEMP_FILE.response" ]; do
|
|
|
|
|
|
|
|
if [ ! -e "$TEMP_FILE" ]; then
|
|
|
|
|
|
|
|
echo "Trigger file got removed: Abort" >&2
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 0.1
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RESPONSE=$(cat "$TEMP_FILE.response")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$RESPONSE"
|
|
|
|
|
|
|
|
`,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}};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(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(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.
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
With <i>all commits</i>, cut-copy-paste-ing text inbetween multiple commits will be detected.
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
It uses <a href="https://git-scm.com/docs/git-blame">git-blame</a> and
|
|
|
|
|
|
|
|
for matches (at least ${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 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
|
|
|
|
|
|
|
|
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">
|
|
|
|
|
|
|
|
CSS variables</a>
|
|
|
|
|
|
|
|
defined by themes
|
|
|
|
|
|
|
|
(e.g. <pre style="display:inline">var(--text-muted)</pre> or
|
|
|
|
|
|
|
|
<pre style="display:inline">var(--text-on-accent)</pre>,
|
|
|
|
|
|
|
|
because they automatically adapt to theme changes.<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See: <a href="https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css">
|
|
|
|
|
|
|
|
List of available CSS variables in Obsidian
|
|
|
|
|
|
|
|
<a/>
|
|
|
|
|
|
|
|
`,new 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).
|
|
|
|
|
|
|
|
This makes the last line being shown as 'changed'
|
|
|
|
|
|
|
|
when a new subsequent line is added,
|
|
|
|
|
|
|
|
even if the previously last line's text is the same.
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
If you don't care about purely-whitespace changes
|
|
|
|
|
|
|
|
(e.g. list nesting / quote indentation changes),
|
|
|
|
|
|
|
|
then activating this will provide more meaningful change detection.
|
|
|
|
|
|
|
|
`}}createColorSetting(r){let n=new 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,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 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(`
|
|
|
|
|
|
|
|
`+r),n.b(' <span class="d2h-lines-added">'),n.b(n.v(n.f("addedLines",t,e,0))),n.b("</span>"),n.b(`
|
|
|
|
|
|
|
|
`+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 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(`
|
|
|
|
|
|
|
|
`+r),n.b(' <a class="d2h-file-switch d2h-show">show</a>'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <ol class="d2h-file-list">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" "),n.b(n.t(n.f("files",t,e,0))),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </ol>"),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 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 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 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(`
|
|
|
|
|
|
|
|
`+r),n.b(' <td class="'),n.b(n.v(n.f("type",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.s(n.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' <span class="d2h-code-line-prefix">'),s.b(s.t(s.f("prefix",i,a,0))),s.b("</span>"),s.b(`
|
|
|
|
|
|
|
|
`+r)}),t.pop()),n.s(n.f("prefix",t,e,1),t,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-prefix"> </span>'),n.b(`
|
|
|
|
|
|
|
|
`+r)),n.s(n.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' <span class="d2h-code-line-ctn">'),s.b(s.t(s.f("content",i,a,0))),s.b("</span>"),s.b(`
|
|
|
|
|
|
|
|
`+r)}),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 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 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 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 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 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 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 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(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-file-diff">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" "),n.b(n.t(n.f("diffs",t,e,0))),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </tbody>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </table>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});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(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-files-diff">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-file-side-diff">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" "),n.b(n.t(n.d("diffs.left",t,e,0))),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </tbody>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </table>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-file-side-diff">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <div class="d2h-code-wrapper">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <table class="d2h-diff-table">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" "),n.b(n.t(n.d("diffs.right",t,e,0))),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </tbody>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </table>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b(" </div>"),n.b(`
|
|
|
|
|
|
|
|
`+r),n.b("</div>"),n.fl()},partials:{},subs:{}});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(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 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 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 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 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 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 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 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 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`,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`,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`,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`,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`,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`,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`,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:(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[sn].split("/").pop()}`,a=a.p;return{message:t.message+`
|
|
|
|
|
|
|
|
${i}
|
|
|
|
|
|
|
|
`,stack:(l=t.stack)==null?void 0:l.split(`
|
|
|
|
|
|
|
|
`).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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\`\`\`diff
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
File changes in local repository
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
File changes in remote repository
|
|
|
|
|
|
|
|
>>>>>>> origin/main
|
|
|
|
|
|
|
|
\`\`\``]),await this.tools.writeAndOpenFile(n==null?void 0:n.join(`
|
|
|
|
|
|
|
|
`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new 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:
|
|
|
|
|
|
|
|
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buffer/index.js:
|
|
|
|
|
|
|
|
(*!
|
|
|
|
|
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
|
|
|
|
|
|
* @license MIT
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
safe-buffer/index.js:
|
|
|
|
|
|
|
|
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crc-32/crc32.js:
|
|
|
|
|
|
|
|
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js-sha256/src/sha256.js:
|
|
|
|
|
|
|
|
(**
|
|
|
|
|
|
|
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @version 0.9.0
|
|
|
|
|
|
|
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
|
|
|
|
|
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
|
|
|
|
|
|
* @license MIT
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* nosourcemap */
|
|
|
|
|