From c402fb11619e957cd138b6a7075623910aca97d9 Mon Sep 17 00:00:00 2001 From: AlexAI Date: Tue, 24 Feb 2026 09:46:07 -0600 Subject: [PATCH] Add vault content - WORK folder, Tasks, Projects, Summaries, Templates --- .obsidian/app.json | 1 + .obsidian/appearance.json | 1 + .obsidian/community-plugins.json | 3 + .obsidian/core-plugins.json | 33 + .obsidian/graph.json | 22 + .obsidian/plugins/obsidian-git/main.js | 452 +++++++++++ .obsidian/plugins/obsidian-git/manifest.json | 10 + .../plugins/obsidian-git/obsidian_askpass.sh | 23 + .obsidian/plugins/obsidian-git/styles.css | 705 ++++++++++++++++++ Home Assistant/Automations.md | 140 ++++ OpenClaw/Dataview Query Examples.md | 209 ++++++ OpenClaw/Discord Config.md | 93 +++ OpenClaw/MEMORY Index.md | 91 +++ OpenClaw/Memory System.md | 188 +++++ OpenClaw/Sync History 2026-02-24.md | 10 + OpenClaw/System Overview.md | 98 +++ OpenClaw/Tools Reference.md | 196 +++++ Projects/Coding Workflow.md | 86 +++ Projects/Discord Voice Bot.md | 90 +++ Projects/Home Assistant.md | 100 +++ Projects/Memory System.md | 144 ++++ .../Memory System Architecture.md | 261 +++++++ .../Mission Control Dashboard (Python).md | 40 + Projects/Multi-User Agent Architecture.md | 203 +++++ Projects/Projects-Index.md | 70 ++ Projects/Proton Mail Bridge.md | 84 +++ Summaries/7 Best Apify Alternatives 2026.md | 148 ++++ Summaries/Anthropic - Distillation Attacks.md | 90 +++ .../Home Assistant - 4 Automation Mistakes.md | 66 ++ Summaries/Homelab MCP Server.md | 88 +++ .../Khoj AI - Self-Hostable Research Tool.md | 106 +++ ...Syncthing - Note-Taking Without Account.md | 58 ++ Summaries/Obsidian Dataview.md | 146 ++++ ...ti-Agent Workflows - 4 Levels Explained.md | 105 +++ Tasks/All Tasks.md | 27 + Templates/Weekly Review.md | 18 + .../2026-02-24 - Make Amazon order today.md | 22 + ...026-02-24 - Setup Asset Keeper for Sean.md | 22 + ...ugar truck card for Early pina truck 62.md | 22 + WORK/Tasks/Task Tracker.md | 22 + WORK/Work Canvas.canvas | 6 + 41 files changed, 4299 insertions(+) create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/core-plugins.json create mode 100644 .obsidian/graph.json create mode 100644 .obsidian/plugins/obsidian-git/main.js create mode 100644 .obsidian/plugins/obsidian-git/manifest.json create mode 100644 .obsidian/plugins/obsidian-git/obsidian_askpass.sh create mode 100644 .obsidian/plugins/obsidian-git/styles.css create mode 100644 Home Assistant/Automations.md create mode 100644 OpenClaw/Dataview Query Examples.md create mode 100644 OpenClaw/Discord Config.md create mode 100644 OpenClaw/MEMORY Index.md create mode 100644 OpenClaw/Memory System.md create mode 100644 OpenClaw/Sync History 2026-02-24.md create mode 100644 OpenClaw/System Overview.md create mode 100644 OpenClaw/Tools Reference.md create mode 100644 Projects/Coding Workflow.md create mode 100644 Projects/Discord Voice Bot.md create mode 100644 Projects/Home Assistant.md create mode 100644 Projects/Memory System.md create mode 100644 Projects/Memory System/Memory System Architecture.md create mode 100644 Projects/Mission Control Dashboard (Python).md create mode 100644 Projects/Multi-User Agent Architecture.md create mode 100644 Projects/Projects-Index.md create mode 100644 Projects/Proton Mail Bridge.md create mode 100644 Summaries/7 Best Apify Alternatives 2026.md create mode 100644 Summaries/Anthropic - Distillation Attacks.md create mode 100644 Summaries/Home Assistant - 4 Automation Mistakes.md create mode 100644 Summaries/Homelab MCP Server.md create mode 100644 Summaries/Khoj AI - Self-Hostable Research Tool.md create mode 100644 Summaries/Obsidian + Syncthing - Note-Taking Without Account.md create mode 100644 Summaries/Obsidian Dataview.md create mode 100644 Summaries/OpenClaw Multi-Agent Workflows - 4 Levels Explained.md create mode 100644 Tasks/All Tasks.md create mode 100644 Templates/Weekly Review.md create mode 100644 WORK/Tasks/2026-02-24 - Make Amazon order today.md create mode 100644 WORK/Tasks/2026-02-24 - Setup Asset Keeper for Sean.md create mode 100644 WORK/Tasks/2026-02-24 - Sugar truck card for Early pina truck 62.md create mode 100644 WORK/Tasks/Task Tracker.md create mode 100644 WORK/Work Canvas.canvas diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..d3f66fa --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,3 @@ +[ + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..639b90d --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..42a46ec --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": true +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js new file mode 100644 index 0000000..2a78f5b --- /dev/null +++ b/.obsidian/plugins/obsidian-git/main.js @@ -0,0 +1,452 @@ +/* +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 $D=Object.create;var pc=Object.defineProperty;var ID=Object.getOwnPropertyDescriptor;var FD=Object.getOwnPropertyNames;var OD=Object.getPrototypeOf,MD=Object.prototype.hasOwnProperty;var Bb=t=>{throw TypeError(t)};var DD=(t,e,r)=>e in t?pc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var LD=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),BD=(t,e)=>{for(var r in e)pc(t,r,{get:e[r],enumerable:!0})},Nb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of FD(e))!MD.call(t,n)&&n!==r&&pc(t,n,{get:()=>e[n],enumerable:!(i=ID(e,n))||i.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?$D(OD(t)):{},Nb(e||!t||!t.__esModule?pc(r,"default",{value:t,enumerable:!0}):r,t)),ND=t=>Nb(pc({},"__esModule",{value:!0}),t);var ze=(t,e,r)=>DD(t,typeof e!="symbol"?e+"":e,r),Am=(t,e,r)=>e.has(t)||Bb("Cannot "+r);var $=(t,e,r)=>(Am(t,e,"read from private field"),r?r.call(t):e.get(t)),pe=(t,e,r)=>e.has(t)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fe=(t,e,r,i)=>(Am(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),bt=(t,e,r)=>(Am(t,e,"access private method"),r);var Gb=I(Tf=>{"use strict";p();Tf.byteLength=UD;Tf.toByteArray=jD;Tf.fromByteArray=VD;var Qi=[],fi=[],HD=typeof Uint8Array!="undefined"?Uint8Array:Array,Tm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(oa=0,Hb=Tm.length;oa0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function UD(t){var e=Ub(t),r=e[0],i=e[1];return(r+i)*3/4-i}function GD(t,e,r){return(e+r)*3/4-r}function jD(t){var e,r=Ub(t),i=r[0],n=r[1],s=new HD(GD(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=fi[t.charCodeAt(l)]<<2|fi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=fi[t.charCodeAt(l)]<<10|fi[t.charCodeAt(l+1)]<<4|fi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function qD(t){return Qi[t>>18&63]+Qi[t>>12&63]+Qi[t>>6&63]+Qi[t&63]}function zD(t,e,r){for(var i,n=[],s=e;so?o:a+s));return i===1?(e=t[r-1],n.push(Qi[e>>2]+Qi[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Qi[e>>10]+Qi[e>>4&63]+Qi[e<<2&63]+"=")),n.join("")}});var jb=I(Cm=>{p();Cm.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};Cm.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,m=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=m,o/=256,n-=8);for(a=a<0;t[r+h]=a&255,h+=m,a/=256,c-=8);t[r+h-m]|=g*128}});var Lm=I(Ao=>{"use strict";p();var Pm=Gb(),Eo=jb(),qb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ao.Buffer=F;Ao.SlowBuffer=QD;Ao.INSPECT_MAX_BYTES=50;var Cf=2147483647;Ao.kMaxLength=Cf;F.TYPED_ARRAY_SUPPORT=WD();!F.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 WD(){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(F.prototype,"parent",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.buffer}});Object.defineProperty(F.prototype,"offset",{enumerable:!0,get:function(){if(F.isBuffer(this))return this.byteOffset}});function Ln(t){if(t>Cf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,F.prototype),e}function F(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 Fm(t)}return Yb(t,e,r)}F.poolSize=8192;function Yb(t,e,r){if(typeof t=="string")return XD(t,e);if(ArrayBuffer.isView(t))return ZD(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ji(t,ArrayBuffer)||t&&Ji(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ji(t,SharedArrayBuffer)||t&&Ji(t.buffer,SharedArrayBuffer)))return $m(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return F.from(i,e,r);let n=KD(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return F.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}F.from=function(t,e,r){return Yb(t,e,r)};Object.setPrototypeOf(F.prototype,Uint8Array.prototype);Object.setPrototypeOf(F,Uint8Array);function Xb(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function YD(t,e,r){return Xb(t),t<=0?Ln(t):e!==void 0?typeof r=="string"?Ln(t).fill(e,r):Ln(t).fill(e):Ln(t)}F.alloc=function(t,e,r){return YD(t,e,r)};function Fm(t){return Xb(t),Ln(t<0?0:Om(t)|0)}F.allocUnsafe=function(t){return Fm(t)};F.allocUnsafeSlow=function(t){return Fm(t)};function XD(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!F.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Zb(t,e)|0,i=Ln(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Rm(t){let e=t.length<0?0:Om(t.length)|0,r=Ln(e);for(let i=0;i=Cf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Cf.toString(16)+" bytes");return t|0}function QD(t){return+t!=t&&(t=0),F.alloc(+t)}F.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==F.prototype};F.compare=function(e,r){if(Ji(e,Uint8Array)&&(e=F.from(e,e.offset,e.byteLength)),Ji(r,Uint8Array)&&(r=F.from(r,r.offset,r.byteLength)),!F.isBuffer(e)||!F.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,a=Math.min(i,n);sn.length?(F.isBuffer(a)||(a=F.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(F.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n};function Zb(t,e){if(F.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ji(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Im(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return s_(t).length;default:if(n)return i?-1:Im(t).length;e=(""+e).toLowerCase(),n=!0}}F.byteLength=Zb;function JD(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return cL(this,e,r);case"utf8":case"utf-8":return Qb(this,e,r);case"ascii":return oL(this,e,r);case"latin1":case"binary":return lL(this,e,r);case"base64":return sL(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uL(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}F.prototype._isBuffer=!0;function la(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}F.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};qb&&(F.prototype[qb]=F.prototype.inspect);F.prototype.compare=function(e,r,i,n,s){if(Ji(e,Uint8Array)&&(e=F.from(e,e.offset,e.byteLength)),!F.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,o=i-r,l=Math.min(a,o),c=this.slice(n,s),u=e.slice(r,i);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Dm(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=F.from(e,i)),F.isBuffer(e))return e.length===0?-1:zb(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):zb(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function zb(t,e,r,i,n){let s=1,a=t.length,o=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(n){let u=-1;for(c=r;ca&&(r=a-o),c=r;c>=0;c--){let u=!0;for(let f=0;fn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let a;for(a=0;a>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return eL(this,e,r,i);case"utf8":case"utf-8":return tL(this,e,r,i);case"ascii":case"latin1":case"binary":return rL(this,e,r,i);case"base64":return iL(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nL(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function sL(t,e,r){return e===0&&r===t.length?Pm.fromByteArray(t):Pm.fromByteArray(t.slice(e,r))}function Qb(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+o<=r){let l,c,u,f;switch(o){case 1:s<128&&(a=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(a=f));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:l=t[n+1],c=t[n+2],u=t[n+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=o}return aL(i)}var Vb=4096;function aL(t){let e=t.length;if(e<=Vb)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii)&&(r=i);let n="";for(let s=e;si&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),rr)throw new RangeError("Trying to access beyond buffer length")}F.prototype.readUintLE=F.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||Dt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a>>0,r=r>>>0,i||Dt(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};F.prototype.readUint8=F.prototype.readUInt8=function(e,r){return e=e>>>0,r||Dt(e,1,this.length),this[e]};F.prototype.readUint16LE=F.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Dt(e,2,this.length),this[e]|this[e+1]<<8};F.prototype.readUint16BE=F.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Dt(e,2,this.length),this[e]<<8|this[e+1]};F.prototype.readUint32LE=F.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Dt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};F.prototype.readUint32BE=F.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Dt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};F.prototype.readBigUInt64LE=ws(function(e){e=e>>>0,ko(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&mc(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,ko(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&mc(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<>>0,r=r>>>0,i||Dt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a=s&&(n-=Math.pow(2,8*r)),n};F.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||Dt(e,r,this.length);let n=r,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};F.prototype.readInt8=function(e,r){return e=e>>>0,r||Dt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};F.prototype.readInt16LE=function(e,r){e=e>>>0,r||Dt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};F.prototype.readInt16BE=function(e,r){e=e>>>0,r||Dt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};F.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Dt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};F.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Dt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};F.prototype.readBigInt64LE=ws(function(e){e=e>>>0,ko(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&mc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,ko(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&mc(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,r||Dt(e,4,this.length),Eo.read(this,e,!0,23,4)};F.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Dt(e,4,this.length),Eo.read(this,e,!1,23,4)};F.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Dt(e,8,this.length),Eo.read(this,e,!0,52,8)};F.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Dt(e,8,this.length),Eo.read(this,e,!1,52,8)};function br(t,e,r,i,n,s){if(!F.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}F.prototype.writeUintLE=F.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;br(this,e,r,i,o,0)}let s=1,a=0;for(this[r]=e&255;++a>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;br(this,e,r,i,o,0)}let s=i-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+i};F.prototype.writeUint8=F.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,1,255,0),this[r]=e&255,r+1};F.prototype.writeUint16LE=F.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};F.prototype.writeUint16BE=F.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};F.prototype.writeUint32LE=F.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};F.prototype.writeUint32BE=F.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Jb(t,e,r,i,n){n_(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function e_(t,e,r,i,n){n_(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}F.prototype.writeBigUInt64LE=ws(function(e,r=0){return Jb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});F.prototype.writeBigUInt64BE=ws(function(e,r=0){return e_(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});F.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);br(this,e,r,i,l-1,-l)}let s=0,a=1,o=0;for(this[r]=e&255;++s>0)-o&255;return r+i};F.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);br(this,e,r,i,l-1,-l)}let s=i-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+i};F.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};F.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};F.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};F.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};F.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||br(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};F.prototype.writeBigInt64LE=ws(function(e,r=0){return Jb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});F.prototype.writeBigInt64BE=ws(function(e,r=0){return e_(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function t_(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function r_(t,e,r,i,n){return e=+e,r=r>>>0,n||t_(t,e,r,4,34028234663852886e22,-34028234663852886e22),Eo.write(t,e,r,i,23,4),r+4}F.prototype.writeFloatLE=function(e,r,i){return r_(this,e,r,!0,i)};F.prototype.writeFloatBE=function(e,r,i){return r_(this,e,r,!1,i)};function i_(t,e,r,i,n){return e=+e,r=r>>>0,n||t_(t,e,r,8,17976931348623157e292,-17976931348623157e292),Eo.write(t,e,r,i,52,8),r+8}F.prototype.writeDoubleLE=function(e,r,i){return i_(this,e,r,!0,i)};F.prototype.writeDoubleBE=function(e,r,i){return i_(this,e,r,!1,i)};F.prototype.copy=function(e,r,i,n){if(!F.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?n=Wb(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Wb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Wb(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function fL(t,e,r){ko(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&mc(e,t.length-(r+1))}function n_(t,e,r,i,n,s){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new So.ERR_OUT_OF_RANGE("value",o,t)}fL(i,n,s)}function ko(t,e){if(typeof t!="number")throw new So.ERR_INVALID_ARG_TYPE(e,"number",t)}function mc(t,e,r){throw Math.floor(t)!==t?(ko(t,r),new So.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new So.ERR_BUFFER_OUT_OF_BOUNDS:new So.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var dL=/[^+/0-9A-Za-z-_]/g;function hL(t){if(t=t.split("=")[0],t=t.trim().replace(dL,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Im(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function pL(t){let e=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(i);return s}function s_(t){return Pm.toByteArray(hL(t))}function Pf(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Ji(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Dm(t){return t!==t}var gL=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function ws(t){return typeof BigInt=="undefined"?vL:t}function vL(){throw new Error("BigInt not supported")}});var a_,Bm,Buffer,p=LD(()=>{a_=require("obsidian");a_.Platform.isMobileApp?Bm=Lm().Buffer:Bm=global.Buffer;Buffer=Bm});var l_=I((l7,o_)=>{"use strict";p();var Yr=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process=="undefined"||typeof process.domain=="undefined")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Yr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Yr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Yr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Yr.DEFAULT_MAX_PENDING};Yr.DEFAULT_TIMEOUT=0;Yr.DEFAULT_MAX_OCCUPATION_TIME=0;Yr.DEFAULT_MAX_EXECUTION_TIME=0;Yr.DEFAULT_MAX_PENDING=1e3;Yr.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(b,k){n=b,s=k})),i=i||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,k,x){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(a?k?s(k):n(x):typeof r=="function"&&r(k,x),o=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},h=function(b){if(o)return d(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var k=i.maxExecutionTime||f.maxExecutionTime;if(k&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},k)),e.length===1){var x=!1;try{e(function(E,A){x||(x=!0,d(b,E,A))})}catch(E){x||(x=!0,d(b,E))}}else f._promiseTry(function(){return e()}).then(function(E){d(b,void 0,E)},function(E){d(b,E)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var m=i.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])h(!1);else if(f.queues[t].length>=m)d(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){h(!0)};i.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var v=i.timeout||f.timeout;v&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},v))}var w=i.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),a)return a};Yr.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=function(o,l){return function(c){n.acquire(o,l,c,i)}},a=t.reduceRight(function(o,l){return s(l,o)},e);if(typeof r=="function")a(r);else return new this.Promise(function(o,l){a.length===1?a(function(c,u){c?l(c):o(u)}):o(a())})};Yr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Yr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};o_.exports=Yr});var u_=I((u7,c_)=>{"use strict";p();c_.exports=l_()});var f_=I((d7,Nm)=>{p();typeof Object.create=="function"?Nm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Nm.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $f=I((Hm,h_)=>{p();var Rf=Lm(),en=Rf.Buffer;function d_(t,e){for(var r in t)e[r]=t[r]}en.from&&en.alloc&&en.allocUnsafe&&en.allocUnsafeSlow?h_.exports=Rf:(d_(Rf,Hm),Hm.Buffer=ca);function ca(t,e,r){return en(t,e,r)}ca.prototype=Object.create(en.prototype);d_(en,ca);ca.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return en(t,e,r)};ca.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=en(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};ca.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return en(t)};ca.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Rf.SlowBuffer(t)}});var If=I((m7,p_)=>{p();var wL={}.toString;p_.exports=Array.isArray||function(t){return wL.call(t)=="[object Array]"}});var _r=I((v7,m_)=>{"use strict";p();m_.exports=TypeError});var Ff=I((y7,g_)=>{"use strict";p();g_.exports=Object});var Um=I((_7,v_)=>{"use strict";p();v_.exports=Error});var y_=I((S7,w_)=>{"use strict";p();w_.exports=EvalError});var __=I((k7,b_)=>{"use strict";p();b_.exports=RangeError});var S_=I((T7,x_)=>{"use strict";p();x_.exports=ReferenceError});var Of=I((P7,E_)=>{"use strict";p();E_.exports=SyntaxError});var A_=I(($7,k_)=>{"use strict";p();k_.exports=URIError});var C_=I((F7,T_)=>{"use strict";p();T_.exports=Math.abs});var R_=I((M7,P_)=>{"use strict";p();P_.exports=Math.floor});var I_=I((L7,$_)=>{"use strict";p();$_.exports=Math.max});var O_=I((N7,F_)=>{"use strict";p();F_.exports=Math.min});var D_=I((U7,M_)=>{"use strict";p();M_.exports=Math.pow});var B_=I((j7,L_)=>{"use strict";p();L_.exports=Math.round});var H_=I((z7,N_)=>{"use strict";p();N_.exports=Number.isNaN||function(e){return e!==e}});var G_=I((W7,U_)=>{"use strict";p();var yL=H_();U_.exports=function(e){return yL(e)||e===0?e:e<0?-1:1}});var q_=I((X7,j_)=>{"use strict";p();j_.exports=Object.getOwnPropertyDescriptor});var ys=I((K7,z_)=>{"use strict";p();var Mf=q_();if(Mf)try{Mf([],"length")}catch(t){Mf=null}z_.exports=Mf});var gc=I((J7,V_)=>{"use strict";p();var Df=Object.defineProperty||!1;if(Df)try{Df({},"a",{value:1})}catch(t){Df=!1}V_.exports=Df});var vc=I((tY,W_)=>{"use strict";p();W_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var Lf=I((iY,X_)=>{"use strict";p();var Y_=typeof Symbol!="undefined"&&Symbol,bL=vc();X_.exports=function(){return typeof Y_!="function"||typeof Symbol!="function"||typeof Y_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:bL()}});var Gm=I((sY,Z_)=>{"use strict";p();Z_.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var jm=I((oY,K_)=>{"use strict";p();var _L=Ff();K_.exports=_L.getPrototypeOf||null});var ex=I((cY,J_)=>{"use strict";p();var xL="Function.prototype.bind called on incompatible ",SL=Object.prototype.toString,EL=Math.max,kL="[object Function]",Q_=function(e,r){for(var i=[],n=0;n{"use strict";p();var CL=ex();tx.exports=Function.prototype.bind||CL});var Bf=I((hY,rx)=>{"use strict";p();rx.exports=Function.prototype.call});var Nf=I((mY,ix)=>{"use strict";p();ix.exports=Function.prototype.apply});var sx=I((vY,nx)=>{"use strict";p();nx.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var qm=I((yY,ax)=>{"use strict";p();var PL=To(),RL=Nf(),$L=Bf(),IL=sx();ax.exports=IL||PL.call($L,RL)});var Hf=I((_Y,ox)=>{"use strict";p();var FL=To(),OL=_r(),ML=Bf(),DL=qm();ox.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new OL("a function is required");return DL(FL,ML,e)}});var hx=I((SY,dx)=>{"use strict";p();var LL=Hf(),lx=ys(),ux;try{ux=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var zm=!!ux&&lx&&lx(Object.prototype,"__proto__"),fx=Object,cx=fx.getPrototypeOf;dx.exports=zm&&typeof zm.get=="function"?LL([zm.get]):typeof cx=="function"?function(e){return cx(e==null?e:fx(e))}:!1});var Uf=I((kY,vx)=>{"use strict";p();var px=Gm(),mx=jm(),gx=hx();vx.exports=px?function(e){return px(e)}:mx?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return mx(e)}:gx?function(e){return gx(e)}:null});var Gf=I((TY,wx)=>{"use strict";p();var BL=Function.prototype.call,NL=Object.prototype.hasOwnProperty,HL=To();wx.exports=HL.call(BL,NL)});var tn=I((PY,Ex)=>{"use strict";p();var Ee,UL=Ff(),GL=Um(),jL=y_(),qL=__(),zL=S_(),$o=Of(),Ro=_r(),VL=A_(),WL=C_(),YL=R_(),XL=I_(),ZL=O_(),KL=D_(),QL=B_(),JL=G_(),xx=Function,Vm=function(t){try{return xx('"use strict"; return ('+t+").constructor;")()}catch(e){}},wc=ys(),eB=gc(),Wm=function(){throw new Ro},tB=wc?function(){try{return arguments.callee,Wm}catch(t){try{return wc(arguments,"callee").get}catch(e){return Wm}}}():Wm,Co=Lf()(),Lt=Uf(),rB=jm(),iB=Gm(),Sx=Nf(),yc=Bf(),Po={},nB=typeof Uint8Array=="undefined"||!Lt?Ee:Lt(Uint8Array),ua={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Ee:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Ee:ArrayBuffer,"%ArrayIteratorPrototype%":Co&&Lt?Lt([][Symbol.iterator]()):Ee,"%AsyncFromSyncIteratorPrototype%":Ee,"%AsyncFunction%":Po,"%AsyncGenerator%":Po,"%AsyncGeneratorFunction%":Po,"%AsyncIteratorPrototype%":Po,"%Atomics%":typeof Atomics=="undefined"?Ee:Atomics,"%BigInt%":typeof BigInt=="undefined"?Ee:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Ee:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Ee:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Ee:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":GL,"%eval%":eval,"%EvalError%":jL,"%Float16Array%":typeof Float16Array=="undefined"?Ee:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Ee:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Ee:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Ee:FinalizationRegistry,"%Function%":xx,"%GeneratorFunction%":Po,"%Int8Array%":typeof Int8Array=="undefined"?Ee:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Ee:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Ee:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Co&&Lt?Lt(Lt([][Symbol.iterator]())):Ee,"%JSON%":typeof JSON=="object"?JSON:Ee,"%Map%":typeof Map=="undefined"?Ee:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Co||!Lt?Ee:Lt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":UL,"%Object.getOwnPropertyDescriptor%":wc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Ee:Promise,"%Proxy%":typeof Proxy=="undefined"?Ee:Proxy,"%RangeError%":qL,"%ReferenceError%":zL,"%Reflect%":typeof Reflect=="undefined"?Ee:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Ee:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Co||!Lt?Ee:Lt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Ee:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Co&&Lt?Lt(""[Symbol.iterator]()):Ee,"%Symbol%":Co?Symbol:Ee,"%SyntaxError%":$o,"%ThrowTypeError%":tB,"%TypedArray%":nB,"%TypeError%":Ro,"%Uint8Array%":typeof Uint8Array=="undefined"?Ee:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Ee:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Ee:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Ee:Uint32Array,"%URIError%":VL,"%WeakMap%":typeof WeakMap=="undefined"?Ee:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Ee:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Ee:WeakSet,"%Function.prototype.call%":yc,"%Function.prototype.apply%":Sx,"%Object.defineProperty%":eB,"%Object.getPrototypeOf%":rB,"%Math.abs%":WL,"%Math.floor%":YL,"%Math.max%":XL,"%Math.min%":ZL,"%Math.pow%":KL,"%Math.round%":QL,"%Math.sign%":JL,"%Reflect.getPrototypeOf%":iB};if(Lt)try{null.error}catch(t){yx=Lt(Lt(t)),ua["%Error.prototype%"]=yx}var yx,sB=function t(e){var r;if(e==="%AsyncFunction%")r=Vm("async function () {}");else if(e==="%GeneratorFunction%")r=Vm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Vm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Lt&&(r=Lt(n.prototype))}return ua[e]=r,r},bx={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bc=To(),jf=Gf(),aB=bc.call(yc,Array.prototype.concat),oB=bc.call(Sx,Array.prototype.splice),_x=bc.call(yc,String.prototype.replace),qf=bc.call(yc,String.prototype.slice),lB=bc.call(yc,RegExp.prototype.exec),cB=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,uB=/\\(\\)?/g,fB=function(e){var r=qf(e,0,1),i=qf(e,-1);if(r==="%"&&i!=="%")throw new $o("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new $o("invalid intrinsic syntax, expected opening `%`");var n=[];return _x(e,cB,function(s,a,o,l){n[n.length]=o?_x(l,uB,"$1"):a||s}),n},dB=function(e,r){var i=e,n;if(jf(bx,i)&&(n=bx[i],i="%"+n[0]+"%"),jf(ua,i)){var s=ua[i];if(s===Po&&(s=sB(i)),typeof s=="undefined"&&!r)throw new Ro("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new $o("intrinsic "+e+" does not exist!")};Ex.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ro("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ro('"allowMissing" argument must be a boolean');if(lB(/^%?[^%]*%?$/,e)===null)throw new $o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=fB(e),n=i.length>0?i[0]:"",s=dB("%"+n+"%",r),a=s.name,o=s.value,l=!1,c=s.alias;c&&(n=c[0],oB(i,aB([0,1],c)));for(var u=1,f=!0;u=i.length){var g=wc(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=jf(o,d),o=o[d];f&&!l&&(ua[a]=o)}}return o}});var Bt=I(($Y,Tx)=>{"use strict";p();var kx=tn(),Ax=Hf(),hB=Ax([kx("%String.prototype.indexOf%")]);Tx.exports=function(e,r){var i=kx(e,!!r);return typeof i=="function"&&hB(e,".prototype.")>-1?Ax([i]):i}});var $x=I((FY,Rx)=>{"use strict";p();var Px=Function.prototype.toString,Io=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Xm,zf;if(typeof Io=="function"&&typeof Object.defineProperty=="function")try{Xm=Object.defineProperty({},"length",{get:function(){throw zf}}),zf={},Io(function(){throw 42},null,Xm)}catch(t){t!==zf&&(Io=null)}else Io=null;var pB=/^\s*class\b/,Zm=function(e){try{var r=Px.call(e);return pB.test(r)}catch(i){return!1}},Ym=function(e){try{return Zm(e)?!1:(Px.call(e),!0)}catch(r){return!1}},Vf=Object.prototype.toString,mB="[object Object]",gB="[object Function]",vB="[object GeneratorFunction]",wB="[object HTMLAllCollection]",yB="[object HTML document.all class]",bB="[object HTMLCollection]",_B=typeof Symbol=="function"&&!!Symbol.toStringTag,xB=!(0 in[,]),Km=function(){return!1};typeof document=="object"&&(Cx=document.all,Vf.call(Cx)===Vf.call(document.all)&&(Km=function(e){if((xB||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=Vf.call(e);return(r===wB||r===yB||r===bB||r===mB)&&e("")==null}catch(i){}return!1}));var Cx;Rx.exports=Io?function(e){if(Km(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Io(e,null,Xm)}catch(r){if(r!==zf)return!1}return!Zm(e)&&Ym(e)}:function(e){if(Km(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(_B)return Ym(e);if(Zm(e))return!1;var r=Vf.call(e);return r!==gB&&r!==vB&&!/^\[object HTML/.test(r)?!1:Ym(e)}});var Ox=I((MY,Fx)=>{"use strict";p();var SB=$x(),EB=Object.prototype.toString,Ix=Object.prototype.hasOwnProperty,kB=function(e,r,i){for(var n=0,s=e.length;n=3&&(n=i),CB(e)?kB(e,r,n):typeof e=="string"?AB(e,r,n):TB(e,r,n)}});var Dx=I((LY,Mx)=>{"use strict";p();Mx.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Bx=I((NY,Lx)=>{"use strict";p();var Qm=Dx(),PB=typeof globalThis=="undefined"?global:globalThis;Lx.exports=function(){for(var e=[],r=0;r{"use strict";p();var Nx=gc(),RB=Of(),Fo=_r(),Hx=ys();Ux.exports=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Fo("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Fo("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Fo("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Fo("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Fo("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Fo("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Hx&&Hx(e,r);if(Nx)Nx(e,r,{configurable:a===null&&l?l.configurable:!a,enumerable:n===null&&l?l.enumerable:!n,value:i,writable:s===null&&l?l.writable:!s});else if(o||!n&&!s&&!a)e[r]=i;else throw new RB("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Yf=I((jY,jx)=>{"use strict";p();var Jm=gc(),Gx=function(){return!!Jm};Gx.hasArrayLengthDefineBug=function(){if(!Jm)return null;try{return Jm([],"length",{value:1}).length!==1}catch(e){return!0}};jx.exports=Gx});var Yx=I((zY,Wx)=>{"use strict";p();var $B=tn(),qx=Wf(),IB=Yf()(),zx=ys(),Vx=_r(),FB=$B("%Math.floor%");Wx.exports=function(e,r){if(typeof e!="function")throw new Vx("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||FB(r)!==r)throw new Vx("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&zx){var a=zx(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(IB?qx(e,"length",r,!0,!0):qx(e,"length",r)),e}});var Zx=I((WY,Xx)=>{"use strict";p();var OB=To(),MB=Nf(),DB=qm();Xx.exports=function(){return DB(OB,MB,arguments)}});var fa=I((XY,Xf)=>{"use strict";p();var LB=Yx(),Kx=gc(),BB=Hf(),Qx=Zx();Xf.exports=function(e){var r=BB(arguments),i=e.length-(arguments.length-1);return LB(r,1+(i>0?i:0),!0)};Kx?Kx(Xf.exports,"apply",{value:Qx}):Xf.exports.apply=Qx});var bs=I((KY,Jx)=>{"use strict";p();var NB=vc();Jx.exports=function(){return NB()&&!!Symbol.toStringTag}});var ig=I((JY,i1)=>{"use strict";p();var Qf=Ox(),HB=Bx(),e1=fa(),tg=Bt(),Kf=ys(),Zf=Uf(),UB=tg("Object.prototype.toString"),r1=bs()(),t1=typeof globalThis=="undefined"?global:globalThis,eg=HB(),rg=tg("String.prototype.slice"),GB=tg("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i-1?r:r!=="Object"?!1:qB(e)}return Kf?jB(e):null}});var s1=I((tX,n1)=>{"use strict";p();var zB=ig();n1.exports=function(e){return!!zB(e)}});var o1=I((iX,a1)=>{"use strict";p();var VB=_r(),WB=Bt(),YB=WB("TypedArray.prototype.buffer",!0),XB=s1();a1.exports=YB||function(e){if(!XB(e))throw new VB("Not a Typed Array");return e.buffer}});var u1=I((sX,c1)=>{"use strict";p();var Ci=$f().Buffer,ZB=If(),KB=o1(),QB=ArrayBuffer.isView||function(e){try{return KB(e),!0}catch(r){return!1}},JB=typeof Uint8Array!="undefined",l1=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",eN=l1&&(Ci.prototype instanceof Uint8Array||Ci.TYPED_ARRAY_SUPPORT);c1.exports=function(e,r){if(Ci.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Ci.from(e):e;if(typeof e=="string")return Ci.from(e,r);if(l1&&QB(e)){if(e.byteLength===0)return Ci.alloc(0);if(eN){var i=Ci.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Ci.from(n);if(s.length===e.byteLength)return s}if(JB&&e instanceof Uint8Array)return Ci.from(e);var a=ZB(e);if(a)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||Ci.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Ci.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var d1=I((oX,f1)=>{"use strict";p();var tN=$f().Buffer,rN=u1();function td(t,e){this._block=tN.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}td.prototype.update=function(t,e){t=rN(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};td.prototype._update=function(){throw new Error("_update must be implemented by subclass")};f1.exports=td});var m1=I((cX,p1)=>{"use strict";p();var iN=f_(),h1=d1(),nN=$f().Buffer,sN=[1518500249,1859775393,-1894007588,-899497514],aN=new Array(80);function _c(){this.init(),this._w=aN,h1.call(this,64,56)}iN(_c,h1);_c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function oN(t){return t<<1|t>>>31}function lN(t){return t<<5|t>>>27}function cN(t){return t<<30|t>>>2}function uN(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}_c.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=oN(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=lN(r)+uN(c,i,n,s)+a+e[l]+sN[c]|0;a=s,s=n,n=cN(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};_c.prototype._hash=function(){var t=nN.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};p1.exports=_c});var v1=I(ng=>{p();var g1;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof ng=="object"?t(ng):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(g1={}):t(g1={})})(function(t){t.version="1.2.2";function e(){for(var y=0,S=new Array(256),_=0;_!=256;++_)y=_,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,S[_]=y;return typeof Int32Array!="undefined"?new Int32Array(S):S}var r=e();function i(y){var S=0,_=0,T=0,P=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(T=0;T!=256;++T)P[T]=y[T];for(T=0;T!=256;++T)for(_=y[T],S=256+T;S<4096;S+=256)_=P[S]=_>>>8^y[_&255];var D=[];for(T=1;T!=16;++T)D[T-1]=typeof Int32Array!="undefined"?P.subarray(T*256,T*256+256):P.slice(T*256,T*256+256);return D}var n=i(r),s=n[0],a=n[1],o=n[2],l=n[3],c=n[4],u=n[5],f=n[6],d=n[7],h=n[8],m=n[9],g=n[10],v=n[11],w=n[12],b=n[13],k=n[14];function x(y,S){for(var _=S^-1,T=0,P=y.length;T>>8^r[(_^y.charCodeAt(T++))&255];return~_}function E(y,S){for(var _=S^-1,T=y.length-15,P=0;P>8&255]^w[y[P++]^_>>16&255]^v[y[P++]^_>>>24]^g[y[P++]]^m[y[P++]]^h[y[P++]]^d[y[P++]]^f[y[P++]]^u[y[P++]]^c[y[P++]]^l[y[P++]]^o[y[P++]]^a[y[P++]]^s[y[P++]]^r[y[P++]];for(T+=15;P>>8^r[(_^y[P++])&255];return~_}function A(y,S){for(var _=S^-1,T=0,P=y.length,D=0,B=0;T>>8^r[(_^D)&255]:D<2048?(_=_>>>8^r[(_^(192|D>>6&31))&255],_=_>>>8^r[(_^(128|D&63))&255]):D>=55296&&D<57344?(D=(D&1023)+64,B=y.charCodeAt(T++)&1023,_=_>>>8^r[(_^(240|D>>8&7))&255],_=_>>>8^r[(_^(128|D>>2&63))&255],_=_>>>8^r[(_^(128|B>>6&15|(D&3)<<4))&255],_=_>>>8^r[(_^(128|B&63))&255]):(_=_>>>8^r[(_^(224|D>>12&15))&255],_=_>>>8^r[(_^(128|D>>6&63))&255],_=_>>>8^r[(_^(128|D&63))&255]);return~_}t.table=r,t.bstr=x,t.buf=E,t.str=A})});var Bn=I(fr=>{"use strict";p();var fN=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function dN(t,e){return Object.prototype.hasOwnProperty.call(t,e)}fr.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)dN(r,i)&&(t[i]=r[i])}}return t};fr.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var hN={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s{"use strict";p();var mN=Bn(),gN=4,w1=0,y1=1,vN=2;function Mo(t){for(var e=t.length;--e>=0;)t[e]=0}var wN=0,k1=1,yN=2,bN=3,_N=258,fg=29,Tc=256,Sc=Tc+1+fg,Oo=30,dg=19,A1=2*Sc+1,da=15,sg=16,xN=7,hg=256,T1=16,C1=17,P1=18,cg=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],rd=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],SN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],EN=512,Nn=new Array((Sc+2)*2);Mo(Nn);var xc=new Array(Oo*2);Mo(xc);var Ec=new Array(EN);Mo(Ec);var kc=new Array(_N-bN+1);Mo(kc);var pg=new Array(fg);Mo(pg);var id=new Array(Oo);Mo(id);function ag(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var $1,I1,F1;function og(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function O1(t){return t<256?Ec[t]:Ec[256+(t>>>7)]}function Ac(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function xr(t,e,r){t.bi_valid>sg-r?(t.bi_buf|=e<>sg-t.bi_valid,t.bi_valid+=r-sg):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function kN(t){t.bi_valid===16?(Ac(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function AN(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,m,g=0;for(d=0;d<=da;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,g++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,h=0,u>=o&&(h=a[u-o]),m=r[u*2],t.opt_len+=m*(d+h),s&&(t.static_len+=m*(n[u*2+1]+h)));if(g!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>i)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function D1(t,e,r){var i=new Array(da+1),n=0,s,a;for(s=1;s<=da;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var o=t[a*2+1];o!==0&&(t[a*2]=M1(i[o]++,o))}}function TN(){var t,e,r,i,n,s=new Array(da+1);for(r=0,i=0;i>=7;i8?Ac(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function CN(t,e,r,i){B1(t),i&&(Ac(t,r),Ac(t,~r)),mN.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function b1(t,e,r,i){var n=e*2,s=r*2;return t[n]>1;a>=1;a--)lg(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],lg(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,r[c*2]=r[a*2]+r[o*2],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,r[a*2+1]=r[o*2+1]=c,t.heap[1]=c++,lg(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],AN(t,e),D1(r,l,t.bl_count)}function x1(t,e,r){var i,n=-1,s,a=e[0*2+1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++o=3&&t.bl_tree[R1[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function RN(t,e,r,i){var n;for(xr(t,e-257,5),xr(t,r-1,5),xr(t,i-4,4),n=0;n>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return w1;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return y1;for(r=32;r0?(t.strm.data_type===vN&&(t.strm.data_type=$N(t)),ug(t,t.l_desc),ug(t,t.d_desc),a=PN(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?N1(t,e,r,i):t.strategy===gN||s===n?(xr(t,(k1<<1)+(i?1:0),3),_1(t,Nn,xc)):(xr(t,(yN<<1)+(i?1:0),3),RN(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),_1(t,t.dyn_ltree,t.dyn_dtree)),L1(t),i&&B1(t)}function MN(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(kc[r]+Tc+1)*2]++,t.dyn_dtree[O1(e)*2]++),t.last_lit===t.lit_bufsize-1}Do._tr_init=IN;Do._tr_stored_block=N1;Do._tr_flush_block=ON;Do._tr_tally=MN;Do._tr_align=FN});var mg=I((vX,U1)=>{"use strict";p();function DN(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}U1.exports=DN});var gg=I((yX,G1)=>{"use strict";p();function LN(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var BN=LN();function NN(t,e,r,i){var n=BN,s=i+r;t^=-1;for(var a=i;a>>8^n[(t^e[a])&255];return t^-1}G1.exports=NN});var nd=I((_X,j1)=>{"use strict";p();j1.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Q1=I(an=>{"use strict";p();var dr=Bn(),di=H1(),W1=mg(),_s=gg(),HN=nd(),ga=0,UN=1,GN=3,As=4,q1=5,sn=0,z1=1,hi=-2,jN=-3,vg=-5,qN=-1,zN=1,sd=2,VN=3,WN=4,YN=0,XN=2,cd=8,ZN=9,KN=15,QN=8,JN=29,eH=256,yg=eH+1+JN,tH=30,rH=19,iH=2*yg+1,nH=15,Ce=3,Es=258,Pi=Es+Ce+1,sH=32,ud=42,bg=69,ad=73,od=91,ld=103,ha=113,Pc=666,Ct=1,Rc=2,pa=3,No=4,aH=3;function ks(t,e){return t.msg=HN[e],e}function V1(t){return(t<<1)-(t>4?9:0)}function Ss(t){for(var e=t.length;--e>=0;)t[e]=0}function xs(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(dr.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}function qt(t,e){di._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xs(t.strm)}function Fe(t,e){t.pending_buf[t.pending++]=e}function Cc(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function oH(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,dr.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=W1(t.adler,e,n,r):t.state.wrap===2&&(t.adler=_s(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}function Y1(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-Pi?t.strstart-(t.w_size-Pi):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+Es,h=c[i+a-1],m=c[i+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(n=e,!(c[n+a]!==m||c[n+a-1]!==h||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&ia){if(t.match_start=e,a=s,s>=o)break;h=c[i+a-1],m=c[i+a]}}while((e=f[e&u])>l&&--r!==0);return a<=t.lookahead?a:t.lookahead}function ma(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Pi)){dr.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=oH(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Ce)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ma(t),t.lookahead===0&&e===ga)return Ct;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,qt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Pi&&(qt(t,!1),t.strm.avail_out===0))return Ct}return t.insert=0,e===As?(qt(t,!0),t.strm.avail_out===0?pa:No):(t.strstart>t.block_start&&(qt(t,!1),t.strm.avail_out===0),Ct)}function wg(t,e){for(var r,i;;){if(t.lookahead=Ce&&(t.ins_h=(t.ins_h<=Ce)if(i=di._tr_tally(t,t.strstart-t.match_start,t.match_length-Ce),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Ce){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=Ce&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=Ce-1)),t.prev_length>=Ce&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Ce,i=di._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Ce),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<=Ce&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Es;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Ce?(r=di._tr_tally(t,1,t.match_length-Ce),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=di._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(qt(t,!1),t.strm.avail_out===0))return Ct}return t.insert=0,e===As?(qt(t,!0),t.strm.avail_out===0?pa:No):t.last_lit&&(qt(t,!1),t.strm.avail_out===0)?Ct:Rc}function uH(t,e){for(var r;;){if(t.lookahead===0&&(ma(t),t.lookahead===0)){if(e===ga)return Ct;break}if(t.match_length=0,r=di._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(qt(t,!1),t.strm.avail_out===0))return Ct}return t.insert=0,e===As?(qt(t,!0),t.strm.avail_out===0?pa:No):t.last_lit&&(qt(t,!1),t.strm.avail_out===0)?Ct:Rc}function nn(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var Bo;Bo=[new nn(0,0,0,0,lH),new nn(4,4,8,4,wg),new nn(4,5,16,8,wg),new nn(4,6,32,32,wg),new nn(4,4,16,16,Lo),new nn(8,16,32,32,Lo),new nn(8,16,128,128,Lo),new nn(8,32,128,256,Lo),new nn(32,128,258,1024,Lo),new nn(32,258,258,4096,Lo)];function fH(t){t.window_size=2*t.w_size,Ss(t.head),t.max_lazy_match=Bo[t.level].max_lazy,t.good_match=Bo[t.level].good_length,t.nice_match=Bo[t.level].nice_length,t.max_chain_length=Bo[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Ce-1,t.match_available=0,t.ins_h=0}function dH(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=cd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new dr.Buf16(iH*2),this.dyn_dtree=new dr.Buf16((2*tH+1)*2),this.bl_tree=new dr.Buf16((2*rH+1)*2),Ss(this.dyn_ltree),Ss(this.dyn_dtree),Ss(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new dr.Buf16(nH+1),this.heap=new dr.Buf16(2*yg+1),Ss(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new dr.Buf16(2*yg+1),Ss(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function X1(t){var e;return!t||!t.state?ks(t,hi):(t.total_in=t.total_out=0,t.data_type=XN,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ud:ha,t.adler=e.wrap===2?0:1,e.last_flush=ga,di._tr_init(e),sn)}function Z1(t){var e=X1(t);return e===sn&&fH(t.state),e}function hH(t,e){return!t||!t.state||t.state.wrap!==2?hi:(t.state.gzhead=e,sn)}function K1(t,e,r,i,n,s){if(!t)return hi;var a=1;if(e===qN&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>ZN||r!==cd||i<8||i>15||e<0||e>9||s<0||s>WN)return ks(t,hi);i===8&&(i=9);var o=new dH;return t.state=o,o.strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<q1||e<0)return t?ks(t,hi):hi;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Pc&&e!==As)return ks(t,t.avail_out===0?vg:hi);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===ud)if(i.wrap===2)t.adler=0,Fe(i,31),Fe(i,139),Fe(i,8),i.gzhead?(Fe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Fe(i,i.gzhead.time&255),Fe(i,i.gzhead.time>>8&255),Fe(i,i.gzhead.time>>16&255),Fe(i,i.gzhead.time>>24&255),Fe(i,i.level===9?2:i.strategy>=sd||i.level<2?4:0),Fe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Fe(i,i.gzhead.extra.length&255),Fe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=_s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=bg):(Fe(i,0),Fe(i,0),Fe(i,0),Fe(i,0),Fe(i,0),Fe(i,i.level===9?2:i.strategy>=sd||i.level<2?4:0),Fe(i,aH),i.status=ha);else{var a=cd+(i.w_bits-8<<4)<<8,o=-1;i.strategy>=sd||i.level<2?o=0:i.level<6?o=1:i.level===6?o=2:o=3,a|=o<<6,i.strstart!==0&&(a|=sH),a+=31-a%31,i.status=ha,Cc(i,a),i.strstart!==0&&(Cc(i,t.adler>>>16),Cc(i,t.adler&65535)),t.adler=1}if(i.status===bg)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),xs(t),n=i.pending,i.pending===i.pending_buf_size));)Fe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=ad)}else i.status=ad;if(i.status===ad)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),xs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=od)}else i.status=od;if(i.status===od)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),xs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=_s(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=ld)}else i.status=ld;if(i.status===ld&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&xs(t),i.pending+2<=i.pending_buf_size&&(Fe(i,t.adler&255),Fe(i,t.adler>>8&255),t.adler=0,i.status=ha)):i.status=ha),i.pending!==0){if(xs(t),t.avail_out===0)return i.last_flush=-1,sn}else if(t.avail_in===0&&V1(e)<=V1(r)&&e!==As)return ks(t,vg);if(i.status===Pc&&t.avail_in!==0)return ks(t,vg);if(t.avail_in!==0||i.lookahead!==0||e!==ga&&i.status!==Pc){var l=i.strategy===sd?uH(i,e):i.strategy===VN?cH(i,e):Bo[i.level].func(i,e);if((l===pa||l===No)&&(i.status=Pc),l===Ct||l===pa)return t.avail_out===0&&(i.last_flush=-1),sn;if(l===Rc&&(e===UN?di._tr_align(i):e!==q1&&(di._tr_stored_block(i,0,0,!1),e===GN&&(Ss(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),xs(t),t.avail_out===0))return i.last_flush=-1,sn}return e!==As?sn:i.wrap<=0?z1:(i.wrap===2?(Fe(i,t.adler&255),Fe(i,t.adler>>8&255),Fe(i,t.adler>>16&255),Fe(i,t.adler>>24&255),Fe(i,t.total_in&255),Fe(i,t.total_in>>8&255),Fe(i,t.total_in>>16&255),Fe(i,t.total_in>>24&255)):(Cc(i,t.adler>>>16),Cc(i,t.adler&65535)),xs(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?sn:z1)}function gH(t){var e;return!t||!t.state?hi:(e=t.state.status,e!==ud&&e!==bg&&e!==ad&&e!==od&&e!==ld&&e!==ha&&e!==Pc?ks(t,hi):(t.state=null,e===ha?ks(t,jN):sn))}function vH(t,e){var r=e.length,i,n,s,a,o,l,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==ud||i.lookahead))return hi;for(a===1&&(t.adler=W1(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(Ss(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new dr.Buf8(i.w_size),dr.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,ma(i);i.lookahead>=Ce;){n=i.strstart,s=i.lookahead-(Ce-1);do i.ins_h=(i.ins_h<{"use strict";p();var fd=Bn(),J1=!0,eS=!0;try{String.fromCharCode.apply(null,[0])}catch(t){J1=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){eS=!1}var $c=new fd.Buf8(256);for(Hn=0;Hn<256;Hn++)$c[Hn]=Hn>=252?6:Hn>=248?5:Hn>=240?4:Hn>=224?3:Hn>=192?2:1;var Hn;$c[254]=$c[254]=1;Ho.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function tS(t,e){if(e<65534&&(t.subarray&&eS||!t.subarray&&J1))return String.fromCharCode.apply(null,fd.shrinkBuf(t,e));for(var r="",i=0;i4){o[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|n&1023)}return tS(o,i)};Ho.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+$c[t[r]]>e?r:e}});var xg=I((TX,rS)=>{"use strict";p();function wH(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}rS.exports=wH});var aS=I(Oc=>{"use strict";p();var Ic=Q1(),Fc=Bn(),Eg=_g(),kg=nd(),yH=xg(),sS=Object.prototype.toString,bH=0,Sg=4,Uo=0,iS=1,nS=2,_H=-1,xH=0,SH=8;function va(t){if(!(this instanceof va))return new va(t);this.options=Fc.assign({level:_H,method:SH,chunkSize:16384,windowBits:15,memLevel:8,strategy:xH,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yH,this.strm.avail_out=0;var r=Ic.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Uo)throw new Error(kg[r]);if(e.header&&Ic.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Eg.string2buf(e.dictionary):sS.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Ic.deflateSetDictionary(this.strm,i),r!==Uo)throw new Error(kg[r]);this._dict_set=!0}}va.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Sg:bH,typeof t=="string"?r.input=Eg.string2buf(t):sS.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Fc.Buf8(i),r.next_out=0,r.avail_out=i),n=Ic.deflate(r,s),n!==iS&&n!==Uo)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Sg||s===nS))&&(this.options.to==="string"?this.onData(Eg.buf2binstring(Fc.shrinkBuf(r.output,r.next_out))):this.onData(Fc.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==iS);return s===Sg?(n=Ic.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Uo):(s===nS&&(this.onEnd(Uo),r.avail_out=0),!0)};va.prototype.onData=function(t){this.chunks.push(t)};va.prototype.onEnd=function(t){t===Uo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Ag(t,e){var r=new va(e);if(r.push(t,!0),r.err)throw r.msg||kg[r.err];return r.result}function EH(t,e){return e=e||{},e.raw=!0,Ag(t,e)}function kH(t,e){return e=e||{},e.gzip=!0,Ag(t,e)}Oc.Deflate=va;Oc.deflate=Ag;Oc.deflateRaw=EH;Oc.gzip=kH});var lS=I(($X,oS)=>{"use strict";p();var dd=30,AH=12;oS.exports=function(e,r){var i,n,s,a,o,l,c,u,f,d,h,m,g,v,w,b,k,x,E,A,y,S,_,T,P;i=e.state,n=e.next_in,T=e.input,s=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(r-e.avail_out),l=a+(e.avail_out-257),c=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,h=i.window,m=i.hold,g=i.bits,v=i.lencode,w=i.distcode,b=(1<>>24,m>>>=E,g-=E,E=x>>>16&255,E===0)P[a++]=x&65535;else if(E&16){A=x&65535,E&=15,E&&(g>>=E,g-=E),g<15&&(m+=T[n++]<>>24,m>>>=E,g-=E,E=x>>>16&255,E&16){if(y=x&65535,E&=15,gc){e.msg="invalid distance too far back",i.mode=dd;break e}if(m>>>=E,g-=E,E=a-o,y>E){if(E=y-E,E>f&&i.sane){e.msg="invalid distance too far back",i.mode=dd;break e}if(S=0,_=h,d===0){if(S+=u-E,E2;)P[a++]=_[S++],P[a++]=_[S++],P[a++]=_[S++],A-=3;A&&(P[a++]=_[S++],A>1&&(P[a++]=_[S++]))}else{S=a-y;do P[a++]=P[S++],P[a++]=P[S++],P[a++]=P[S++],A-=3;while(A>2);A&&(P[a++]=P[S++],A>1&&(P[a++]=P[S++]))}}else if(E&64){e.msg="invalid distance code",i.mode=dd;break e}else{x=w[(x&65535)+(m&(1<>3,n-=A,g-=A<<3,m&=(1<{"use strict";p();var cS=Bn(),Go=15,uS=852,fS=592,dS=0,Tg=1,hS=2,TH=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],CH=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],PH=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],RH=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];pS.exports=function(e,r,i,n,s,a,o,l){var c=l.bits,u=0,f=0,d=0,h=0,m=0,g=0,v=0,w=0,b=0,k=0,x,E,A,y,S,_=null,T=0,P,D=new cS.Buf16(Go+1),B=new cS.Buf16(Go+1),N=null,ce=0,Pe,ve,se;for(u=0;u<=Go;u++)D[u]=0;for(f=0;f=1&&D[h]===0;h--);if(m>h&&(m=h),h===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===dS||h!==1))return-1;for(B[1]=0,u=1;uuS||e===hS&&b>fS)return 1;for(;;){Pe=u-v,o[f]P?(ve=N[ce+o[f]],se=_[T+o[f]]):(ve=96,se=0),x=1<>v)+E]=Pe<<24|ve<<16|se|0;while(E!==0);for(x=1<>=1;if(x!==0?(k&=x-1,k+=x):k=0,f++,--D[u]===0){if(u===h)break;u=r[i+o[f]]}if(u>m&&(k&y)!==A){for(v===0&&(v=m),S+=d,g=u-v,w=1<uS||e===hS&&b>fS)return 1;A=k&y,s[A]=m<<24|g<<16|S-a|0}}return k!==0&&(s[S+k]=u-v<<24|64<<16|0),l.bits=m,0}});var ZS=I(Ri=>{"use strict";p();var Xr=Bn(),Fg=mg(),on=gg(),$H=lS(),Mc=mS(),IH=0,US=1,GS=2,gS=4,FH=5,hd=6,wa=0,OH=1,MH=2,pi=-2,jS=-3,Og=-4,DH=-5,vS=8,qS=1,wS=2,yS=3,bS=4,_S=5,xS=6,SS=7,ES=8,kS=9,AS=10,gd=11,Un=12,Cg=13,TS=14,Pg=15,CS=16,PS=17,RS=18,$S=19,pd=20,md=21,IS=22,FS=23,OS=24,MS=25,DS=26,Rg=27,LS=28,BS=29,tt=30,Mg=31,LH=32,BH=852,NH=592,HH=15,UH=HH;function NS(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function GH(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Xr.Buf16(320),this.work=new Xr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function zS(t){var e;return!t||!t.state?pi:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=qS,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Xr.Buf32(BH),e.distcode=e.distdyn=new Xr.Buf32(NH),e.sane=1,e.back=-1,wa)}function VS(t){var e;return!t||!t.state?pi:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,zS(t))}function WS(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?pi:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,VS(t))}function YS(t,e){var r,i;return t?(i=new GH,t.state=i,i.window=null,r=WS(t,e),r!==wa&&(t.state=null),r):pi}function jH(t){return YS(t,UH)}var HS=!0,$g,Ig;function qH(t){if(HS){var e;for($g=new Xr.Buf32(512),Ig=new Xr.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Mc(US,t.lens,0,288,$g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Mc(GS,t.lens,0,32,Ig,0,t.work,{bits:5}),HS=!1}t.lencode=$g,t.lenbits=9,t.distcode=Ig,t.distbits=5}function XS(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<=s.wsize?(Xr.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),Xr.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(Xr.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=on(r.check,_,2,0),c=0,u=0,r.mode=wS;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=tt;break}if((c&15)!==vS){t.msg="unknown compression method",r.mode=tt;break}if(c>>>=4,u-=4,y=(c&15)+8,r.wbits===0)r.wbits=y;else if(y>r.wbits){t.msg="invalid window size",r.mode=tt;break}r.dmax=1<>8&1),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=on(r.check,_,2,0)),c=0,u=0,r.mode=yS;case yS:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>8&255,_[2]=c>>>16&255,_[3]=c>>>24&255,r.check=on(r.check,_,4,0)),c=0,u=0,r.mode=bS;case bS:for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>8),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=on(r.check,_,2,0)),c=0,u=0,r.mode=_S;case _S:if(r.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>>8&255,r.check=on(r.check,_,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=xS;case xS:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Xr.arraySet(r.head.extra,i,s,h,y)),r.flags&512&&(r.check=on(r.check,i,h,s)),o-=h,s+=h,r.length-=h),r.length))break e;r.length=0,r.mode=SS;case SS:if(r.flags&2048){if(o===0)break e;h=0;do y=i[s+h++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y));while(y&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Un;break;case AS:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>=u&7,u-=u&7,r.mode=Rg;break}for(;u<3;){if(o===0)break e;o--,c+=i[s++]<>>=1,u-=1,c&3){case 0:r.mode=TS;break;case 1:if(qH(r),r.mode=pd,e===hd){c>>>=2,u-=2;break e}break;case 2:r.mode=PS;break;case 3:t.msg="invalid block type",r.mode=tt}c>>>=2,u-=2;break;case TS:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=tt;break}if(r.length=c&65535,c=0,u=0,r.mode=Pg,e===hd)break e;case Pg:r.mode=CS;case CS:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Xr.arraySet(n,i,s,h,a),o-=h,s+=h,l-=h,a+=h,r.length-=h;break}r.mode=Un;break;case PS:for(;u<14;){if(o===0)break e;o--,c+=i[s++]<>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=tt;break}r.have=0,r.mode=RS;case RS:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[D[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},S=Mc(IH,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid code lengths set",r.mode=tt;break}r.have=0,r.mode=$S;case $S:for(;r.have>>24,b=v>>>16&255,k=v&65535,!(w<=u);){if(o===0)break e;o--,c+=i[s++]<>>=w,u-=w,r.lens[r.have++]=k;else{if(k===16){for(P=w+2;u>>=w,u-=w,r.have===0){t.msg="invalid bit length repeat",r.mode=tt;break}y=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(k===17){for(P=w+3;u>>=w,u-=w,y=0,h=3+(c&7),c>>>=3,u-=3}else{for(P=w+7;u>>=w,u-=w,y=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=tt;break}for(;h--;)r.lens[r.have++]=y}}if(r.mode===tt)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=tt;break}if(r.lenbits=9,T={bits:r.lenbits},S=Mc(US,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid literal/lengths set",r.mode=tt;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},S=Mc(GS,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,S){t.msg="invalid distances set",r.mode=tt;break}if(r.mode=pd,e===hd)break e;case pd:r.mode=md;case md:if(o>=6&&l>=258){t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,r.hold=c,r.bits=u,$H(t,d),a=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,c=r.hold,u=r.bits,r.mode===Un&&(r.back=-1);break}for(r.back=0;v=r.lencode[c&(1<>>24,b=v>>>16&255,k=v&65535,!(w<=u);){if(o===0)break e;o--,c+=i[s++]<>x)],w=v>>>24,b=v>>>16&255,k=v&65535,!(x+w<=u);){if(o===0)break e;o--,c+=i[s++]<>>=x,u-=x,r.back+=x}if(c>>>=w,u-=w,r.back+=w,r.length=k,b===0){r.mode=DS;break}if(b&32){r.back=-1,r.mode=Un;break}if(b&64){t.msg="invalid literal/length code",r.mode=tt;break}r.extra=b&15,r.mode=IS;case IS:if(r.extra){for(P=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=FS;case FS:for(;v=r.distcode[c&(1<>>24,b=v>>>16&255,k=v&65535,!(w<=u);){if(o===0)break e;o--,c+=i[s++]<>x)],w=v>>>24,b=v>>>16&255,k=v&65535,!(x+w<=u);){if(o===0)break e;o--,c+=i[s++]<>>=x,u-=x,r.back+=x}if(c>>>=w,u-=w,r.back+=w,b&64){t.msg="invalid distance code",r.mode=tt;break}r.offset=k,r.extra=b&15,r.mode=OS;case OS:if(r.extra){for(P=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=tt;break}r.mode=MS;case MS:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=tt;break}h>r.wnext?(h-=r.wnext,m=r.wsize-h):m=r.wnext-h,h>r.length&&(h=r.length),g=r.window}else g=n,m=a-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do n[a++]=g[m++];while(--h);r.length===0&&(r.mode=md);break;case DS:if(l===0)break e;n[a++]=r.length,l--,r.mode=md;break;case Rg:if(r.wrap){for(;u<32;){if(o===0)break e;o--,c|=i[s++]<{"use strict";p();KS.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var JS=I((NX,QS)=>{"use strict";p();function XH(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}QS.exports=XH});var tE=I(Lc=>{"use strict";p();var jo=ZS(),Dc=Bn(),vd=_g(),pt=Dg(),Lg=nd(),ZH=xg(),KH=JS(),eE=Object.prototype.toString;function ya(t){if(!(this instanceof ya))return new ya(t);this.options=Dc.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZH,this.strm.avail_out=0;var r=jo.inflateInit2(this.strm,e.windowBits);if(r!==pt.Z_OK)throw new Error(Lg[r]);if(this.header=new KH,jo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=vd.string2buf(e.dictionary):eE.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=jo.inflateSetDictionary(this.strm,e.dictionary),r!==pt.Z_OK)))throw new Error(Lg[r])}ya.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,o,l,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?pt.Z_FINISH:pt.Z_NO_FLUSH,typeof t=="string"?r.input=vd.binstring2buf(t):eE.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Dc.Buf8(i),r.next_out=0,r.avail_out=i),s=jo.inflate(r,pt.Z_NO_FLUSH),s===pt.Z_NEED_DICT&&n&&(s=jo.inflateSetDictionary(this.strm,n)),s===pt.Z_BUF_ERROR&&u===!0&&(s=pt.Z_OK,u=!1),s!==pt.Z_STREAM_END&&s!==pt.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===pt.Z_STREAM_END||r.avail_in===0&&(a===pt.Z_FINISH||a===pt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=vd.utf8border(r.output,r.next_out),l=r.next_out-o,c=vd.buf2string(r.output,o),r.next_out=l,r.avail_out=i-l,l&&Dc.arraySet(r.output,r.output,o,l,0),this.onData(c)):this.onData(Dc.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==pt.Z_STREAM_END);return s===pt.Z_STREAM_END&&(a=pt.Z_FINISH),a===pt.Z_FINISH?(s=jo.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===pt.Z_OK):(a===pt.Z_SYNC_FLUSH&&(this.onEnd(pt.Z_OK),r.avail_out=0),!0)};ya.prototype.onData=function(t){this.chunks.push(t)};ya.prototype.onEnd=function(t){t===pt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Dc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Bg(t,e){var r=new ya(e);if(r.push(t,!0),r.err)throw r.msg||Lg[r.err];return r.result}function QH(t,e){return e=e||{},e.raw=!0,Bg(t,e)}Lc.Inflate=ya;Lc.inflate=Bg;Lc.inflateRaw=QH;Lc.ungzip=Bg});var nE=I((jX,iE)=>{"use strict";p();var JH=Bn().assign,e3=aS(),t3=tE(),r3=Dg(),rE={};JH(rE,e3,t3,r3);iE.exports=rE});var oE=I((zX,aE)=>{"use strict";p();var sE=(t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,o)=>{a?s(a):n(o)}):r.push(n),t.apply(this,r)})};aE.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=s=>{let a=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(a):!e.exclude.some(a)},n;r==="function"?n=function(...s){return e.excludeMain?t(...s):sE(t,e).apply(this,s)}:n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?sE(a,e):a}return n}});var gE=I((WX,mE)=>{p();function lE(t){return Array.isArray(t)?t:[t]}var Ug="",cE=" ",Ng="\\",i3=/^\s+$/,n3=/(?:[^\\]|^)\\$/,s3=/^\\!/,a3=/^\\#/,o3=/\r?\n/g,l3=/^\.*\/|^\.+$/,Hg="/",dE="node-ignore";typeof Symbol!="undefined"&&(dE=Symbol.for("node-ignore"));var uE=dE,c3=(t,e,r)=>Object.defineProperty(t,e,{value:r}),u3=/([0-z])-([0-z])/g,hE=()=>!1,f3=t=>t.replace(u3,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:Ug),d3=t=>{let{length:e}=t;return t.slice(0,e-e%2)},h3=[[/^\uFEFF/,()=>Ug],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?cE:Ug)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+cE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Ng],[/\\\\/g,()=>Ng],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Ng?`\\[${r}${d3(i)}${n}`:n==="]"&&i.length%2===0?`[${f3(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],fE=Object.create(null),p3=(t,e)=>{let r=fE[t];return r||(r=h3.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),fE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},qg=t=>typeof t=="string",m3=t=>t&&qg(t)&&!i3.test(t)&&!n3.test(t)&&t.indexOf("#")!==0,g3=t=>t.split(o3),Gg=class{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}},v3=(t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(s3,"!").replace(a3,"#");let n=p3(t,e);return new Gg(r,t,i,n)},w3=(t,e)=>{throw new e(t)},Gn=(t,e,r)=>qg(t)?t?Gn.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),pE=t=>l3.test(t);Gn.isNotRelative=pE;Gn.convert=t=>t;var jg=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){c3(this,uE,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[uE]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(m3(e)){let r=v3(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,lE(qg(e)?g3(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&Gn.convert(e);return Gn(s,e,this._allowRelativePaths?hE:w3),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Hg)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(Hg)+Hg,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return lE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},wd=t=>new jg(t),y3=t=>Gn(t&&Gn.convert(t),t,hE);wd.isPathValid=y3;wd.default=wd;mE.exports=wd;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Gn.convert=t;let e=/^[a-z]:\//i;Gn.isNotRelative=r=>e.test(r)||pE(r)}});var wE=I((XX,vE)=>{"use strict";p();function b3(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ln(t,e,r){return e=e instanceof RegExp?e:new RegExp(b3(e),"g"),t.replace(e,r)}var _3={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=ln(e,"./","/"),e=ln(e,"..","."),e=ln(e," ","-"),e=ln(e,/^[~^:?*\\\-]/g,""),e=ln(e,/[~^:?*\\]/g,"-"),e=ln(e,/[~^:?*\\\-]$/g,""),e=ln(e,"@{","-"),e=ln(e,/\.$/g,""),e=ln(e,/\/$/g,""),e=ln(e,/\.lock$/g,""),e}};vE.exports=_3});var bE=I((KX,yE)=>{p();yE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=null,l=n+1,c=[],u=[],f=[],d="",h=-1,m=0,g=1,v,w,b=function(){n>=s&&(v=r,w=n,r=i,i=v,n=s,s=w,a=!0,l=n+1)},k=function(y,S,_){return{x:y,y:S,k:_}},x=function(y,S){return{elem:y,t:S}},E=function(y,S,_){var T,P,D;for(S>_?T=c[y-1+l]:T=c[y+1+l],D=Math.max(S,_),P=D-y;P=0;--D)for(;TP-T?(a?f[f.length]=new x(i[P],h):f[f.length]=new x(i[P],g),++_,++P):y[D].y-y[D].x=y+1;--N)_[N+l]=E(N,_[N-1+l]+1,_[N+1+l]);_[y+l]=E(y,_[y-1+l]+1,_[y+1+l])}while(_[y+l]!==s);for(o=y+2*T,P=c[y+l],D=[];P!==-1;)D[D.length]=new k(u[P].x,u[P].y,null),P=u[P].k;A(D)}}}});var SE=I((JX,xE)=>{p();var x3=bE();function S3(t,e){var r=new x3(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,o=e.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:o,chain:null},s=s.chain):(n={file1index:a,file2index:o,chain:null},s=n),a--,o--):i[l].t===r.SES_DELETE?a--:i[l].t===r.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}function _E(t,e){for(var r=[],i=t.length,n=e.length,s=S3(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,o=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||o)&&r.push({file1:[i+1,a],file2:[n+1,o]})}return r.reverse(),r}function E3(t,e,r){var i,n=_E(e,t),s=_E(e,r),a=[];function o(B,N){a.push([B.file1[0],N,B.file1[1],B.file2[0],B.file2[1]])}for(i=0;ic&&(l.push([1,c,B-c]),c=B)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(u(m),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var k=h[1],x=b[k],E=h[0],A=E+h[2],y=h[3],S=y+h[4];x[0]=Math.min(y,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(E,x[2]),x[3]=Math.max(A,x[3])}var _=b[0][0]+(m-b[0][2]),T=b[0][1]+(g-b[0][3]),P=b[2][0]+(m-b[2][2]),D=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,D-P])}c=g}return u(e.length),l}function k3(t,e,r){var i=[],n=[t,e,r],s=E3(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var m=0;m{"use strict";p();Object.defineProperty(X,"__esModule",{value:!0});function Ms(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Nc=Ms(u_()),VE=Ms(m1()),A3=Ms(v1()),mv=Ms(nE()),yd=Ms(oE()),T3=Ms(gE()),Hc=Ms(wE()),C3=Ms(SE()),Re=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let r=new t(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},Uc=class t extends Re{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=t.code,this.data={filepaths:e}}};Uc.code="UnmergedPathsError";var he=class t extends Re{constructor(e){super(`An internal error caused this command to fail. + +If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment. + +Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};he.code="InternalError";var zo=class t extends Re{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var mi=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Id(t,e){return-(te)}function WE(t,e){return Id(t.path,e.path)}function YE(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var cn=2**32;function EE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Vo(t){let[e,r]=EE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=EE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%cn,ctimeNanoseconds:r%cn,mtimeSeconds:i%cn,mtimeNanoseconds:n%cn,dev:t.dev%cn,ino:t.ino%cn,mode:YE(t.mode%cn),uid:t.uid%cn,gid:t.gid%cn,size:t.size>-1?t.size%cn:0}}function P3(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var zg=null;async function qn(t){return zg===null&&(zg=await $3()),zg?XE(t):R3(t)}function R3(t){return new VE().update(t).digest("hex")}async function XE(t){let e=await crypto.subtle.digest("SHA-1",t);return P3(e)}async function $3(){try{return await XE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function I3(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function F3(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var iv=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new he("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new he("Index file is empty (.git/index)");let r=new t,i=new mi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new he(`Invalid dircache magic file number: ${n}`);let s=await qn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new he(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new he(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&ce.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Vo(r);let s=Buffer.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` +`)}static async _entryToBuffer(e){let r=Buffer.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=Buffer.alloc(i),s=new mi(n),a=Vo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(F3(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=Buffer.alloc(12),r=new mi(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=Buffer.concat(i),s=Buffer.concat([e,n]),a=await qn(s);return Buffer.concat([s,Buffer.from(a,"hex")])}};function xd(t,e,r=!0,i=!0){let n=Vo(t),s=Vo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var Vg=null,Wg=Symbol("IndexCache");function O3(){return{map:new Map,stats:new Map}}async function M3(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await iv.from(n);r.map.set(e,s),r.stats.set(e,i)}async function D3(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:xd(i,n)}var mt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Wg]||(i[Wg]=O3());let a=`${r}/index`;Vg===null&&(Vg=new Nc({maxPending:1/0}));let o,l=[];return await Vg.acquire(a,async()=>{let c=i[Wg];await D3(e,a,c)&&await M3(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new Uc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function Sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function xa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function ZE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(xa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Sd(n),metadata:s,parent:r(xa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function L3(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new he(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var nv=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=mt.acquire({fs:e,gitdir:r,cache:i},async function(s){return ZE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Id),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Vo(i.metadata);e._type=i.type==="tree"?"tree":L3(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},Fd=Symbol("GitWalkSymbol");function Aa(){let t=Object.create(null);return Object.defineProperty(t,Fd,{value:function({fs:e,gitdir:r,cache:i}){return new nv({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var He=class t extends Re{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};He.code="NotFoundError";var hr=class t extends Re{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};hr.code="ObjectTypeError";var Ps=class t extends Re{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ps.code="InvalidOidError";var Gc=class t extends Re{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}}};Gc.code="NoRefspecError";var Ed=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(` +`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},kd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new he("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},sv=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(kd.from(i));return new t(r)}add(e){let r=kd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function B3(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(ri);return n===0?t.endsWith("^{}")?1:-1:n}function N3(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function H3(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=N3(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function O(...t){if(t.length===0)return".";let e;for(let r=0;r0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":H3(e)}var U3=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},Bc=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},kE={core:{filemode:Bc,bare:Bc,logallrefupdates:Bc,symlinks:Bc,ignorecase:Bc,bigFileThreshold:U3}},G3=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,j3=/^[A-Za-z0-9-.]+$/,q3=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,z3=/^[A-Za-z][A-Za-z-]*$/,V3=/^(.*?)( *[#;].*)$/,W3=t=>{let e=G3.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},Y3=t=>{let e=q3.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=X3(i),s=Z3(n);return[r,s]}return null},X3=t=>{let e=V3.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return AE(r)&&AE(i)?`${r}${i}`:r},AE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,Z3=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),TE=t=>t!=null?t.toLowerCase():null,av=(t,e,r)=>[TE(t),e,TE(r)].filter(i=>i!=null).join("."),CE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:av(r,n,i),sectionPath:av(r,n,null),isSection:!!r}},K3=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),ov=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(` +`).map(n=>{let s=null,a=null,o=n.trim(),l=W3(o),c=l!=null;if(c)[r,i]=l;else{let f=Y3(o);f!=null&&([s,a]=f)}let u=av(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=CE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=kE[s]&&kE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=CE(e),u=K3(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(j3.test(n)&&z3.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(` +`)}},ct=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return ov.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},bd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],Q3=["config","description","index","shallow","commondir"],Yg;async function Ts(t,e){return Yg===void 0&&(Yg=new Nc),Yg.acquire(t,e)}var W=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new Ps(v);let u=await ct.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Gc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=sv.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(w=>`refs/tags/${w}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let w=n.get(v);d.set(v,w)}}let h=f.translate([...n.keys()]);for(let[v,w]of h){let b=n.get(v);d.set(w,b)}let m=f.translate([...s.keys()]);for(let[v,w]of m){let b=s.get(v),k=f.translateOne(b);k&&d.set(w,`ref: ${k}`)}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 Ts(v,async()=>e.write(O(r,v),`${w.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Ps(n);await Ts(i,async()=>e.write(O(r,i),`${n.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ts(i,async()=>e.write(O(r,i),`ref: ${n.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(O(r,o))));let n=await Ts("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=Ed.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.sizee.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=bd(i).filter(o=>!Q3.includes(o));for(let o of a){let l=await Ts(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new He(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=bd(i);for(let a of s)if(await Ts(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new He(i)}static async expandAgainstMap({ref:e,map:r}){let i=bd(e);for(let n of i)if(await r.has(n))return n;throw new He(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=bd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new He(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ts("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Ed.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(B3),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function J3(t,e){return Id(PE(t),PE(e))}function PE(t){return t.mode==="040000"?t.path+"/":t.path}function KE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new he(`Unexpected GitTree entry mode: ${t}`)}function e8(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(J3),Buffer.concat(e.map(r=>{let i=Buffer.from(r.mode.replace(/^0/,"")),n=Buffer.from(" "),s=Buffer.from(r.path,"utf8"),a=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Rs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o>=1,n+=8;return i}function IE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=$E(t,r&n,4),o=$E(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function n8(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function JE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:n8(t)}var Ad=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=JE(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>s8(r);){let i=await this._next();if(this._ended)break;r.push(i)}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 s8(t){return t.reduce((e,r)=>e+r.length,0)}async function a8(t,e){let r=new Ad(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new he(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new he(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await o8(r),f=new mv.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new he(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new he("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function o8(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<n+1<<7|s,-1)}function f8(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<2048*1024*1024)throw new he("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+4*255);let a=i.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=x);let E=Math.floor((u-x)*100/u);E!==f&&i&&await i({phase:"Receiving objects",loaded:u-x,total:u}),f=E,w=n[w],["commit","tree","blob","tag"].includes(w)?s[k]={type:w,offset:k}:w==="ofs-delta"?s[k]={type:w,offset:k}:w==="ref-delta"&&(s[k]={type:w,offset:k})});let d=Object.keys(s).map(Number);for(let[v,w]of d.entries()){let b=v+1===d.length?e.byteLength-20:d[v+1],k=s[w],x=A3.buf(e.slice(w,b))>>>0;k.end=b,k.crc=x}let h=new t({pack:Promise.resolve(e),packfileSha:a,crcs:l,hashes:o,offsets:c,getExternalRefDelta:r});f=null;let m=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in s){v=Number(v);let w=Math.floor(m*100/u);w!==f&&i&&await i({phase:"Resolving deltas",loaded:m,total:u}),m++,f=w;let b=s[v];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:k,object:x}=await h.readSlice({start:v});g[h.readDepth]+=1;let E=await qn(Rs.wrap({type:k,object:x}));b.oid=E,o.push(E),c.set(E,v),l[E]=b.crc}catch(k){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(c,u)=>{e.push(Buffer.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let i=new mi(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new mi(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new mi(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=Buffer.concat(e),o=await qn(a),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([a,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new he(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new he("Tried to read from a GitPackIndex with no packfile loaded into memory");let i=(await this.pack).slice(e),n=new mi(i),s=n.readUInt8(),a=s&112,o=r[a];if(o===void 0)throw new he("Unrecognized type: 0b"+a.toString(2));let l=s&15,c=l;s&128&&(c=f8(n,l));let f=null,d=null;if(o==="ofs_delta"){let m=u8(n),g=e-m;({object:f,type:o}=await this.readSlice({start:g}))}if(o==="ref_delta"){let m=n.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:m}))}let h=i.slice(n.tell());if(d=Buffer.from(await ek(h)),d.byteLength!==c)throw new he(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(i8(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:d}),{type:o,format:"content",object:d}}},_d=Symbol("PackfileCache");async function d8({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return jc.fromIdx({idx:s,getExternalRefDelta:r})}function gv({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[_d]||(e[_d]=new Map);let a=e[_d].get(r);return a||(a=d8({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[_d].set(r,a)),a}async function h8({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(O(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await gv({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new he(c.error);if(c.offsets.has(i)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:i,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function Ke({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u=>Ke({fs:t,cache:e,gitdir:r,oid:u}),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:Buffer.from("tree 0\0")}),a||(a=await QE({fs:t,gitdir:r,oid:i})),!a){if(a=await h8({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new He(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=Buffer.from(await ek(a.object)),a.format="wrapped"),n==="wrapped"))return a;let o=await qn(a.object);if(o!==i)throw new he(`SHA check failed! Expected ${i}, computed ${o}`);let{object:l,type:c}=Rs.unwrap(a.object);if(a.type=c,a.object=l,a.format="content",n==="content")return a;throw new he(`invalid requested format "${n}"`)}var $i=class t extends Re{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:i}}};$i.code="AlreadyExistsError";var qc=class t extends Re{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:i}}};qc.code="AmbiguousError";var zc=class t extends Re{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};zc.code="CheckoutConflictError";var Vc=class t extends Re{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:r}}};Vc.code="CommitNotFetchedError";var Wc=class t extends Re{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Wc.code="EmptyServerResponseError";var Yc=class t extends Re{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Yc.code="FastForwardError";var Xc=class t extends Re{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};Xc.code="GitPushError";var Wo=class t extends Re{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:i}}};Wo.code="HttpError";var $s=class t extends Re{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=t.code,this.data={reason:e}}};$s.code="InvalidFilepathError";var Ii=class t extends Re{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};Ii.code="InvalidRefNameError";var Zc=class t extends Re{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};Zc.code="MaxDepthError";var Yo=class t extends Re{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Yo.code="MergeNotSupportedError";var Xo=class t extends Re{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};Xo.code="MergeConflictError";var Jt=class t extends Re{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};Jt.code="MissingNameError";var Sr=class t extends Re{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Sr.code="MissingParameterError";var Kc=class t extends Re{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=t.code,this.data={errors:e},this.errors=e}};Kc.code="MultipleGitError";var Sa=class t extends Re{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};Sa.code="ParseError";var Zo=class t extends Re{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Zo.code="PushRejectedError";var Cs=class t extends Re{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};Cs.code="RemoteCapabilityError";var Qc=class t extends Re{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:r}}};Qc.code="SmartHttpError";var Jc=class t extends Re{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:i}}};Jc.code="UnknownTransportError";var eu=class t extends Re{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};eu.code="UrlParseError";var Ko=class t extends Re{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Ko.code="UserCanceledError";var tu=class t extends Re{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=t.code,this.data={filepath:e}}};tu.code="IndexResetError";var ru=class t extends Re{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=t.code,this.data={ref:e}}};ru.code="NoCommitError";var tk=Object.freeze({__proto__:null,AlreadyExistsError:$i,AmbiguousError:qc,CheckoutConflictError:zc,CommitNotFetchedError:Vc,EmptyServerResponseError:Wc,FastForwardError:Yc,GitPushError:Xc,HttpError:Wo,InternalError:he,InvalidFilepathError:$s,InvalidOidError:Ps,InvalidRefNameError:Ii,MaxDepthError:Zc,MergeNotSupportedError:Yo,MergeConflictError:Xo,MissingNameError:Jt,MissingParameterError:Sr,MultipleGitError:Kc,NoRefspecError:Gc,NotFoundError:He,ObjectTypeError:hr,ParseError:Sa,PushRejectedError:Zo,RemoteCapabilityError:Cs,SmartHttpError:Qc,UnknownTransportError:Jc,UnsafeFilepathError:zo,UrlParseError:eu,UserCanceledError:Ko,UnmergedPathsError:Uc,IndexResetError:tu,NoCommitError:ru});function lv({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=p8(i),`${t} <${e}> ${r} ${i}`}function p8(t){let e=m8(g8(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}function m8(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function g8(t){return t===0?t:-t}function jn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function Td(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:v8(n)}}function v8(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),w8(i)}function w8(t){return t===0?t:-t}var Kr=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 he("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} +type ${e.type} +tag ${e.tag} +tagger ${lv(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 n of e)n[0]===" "?r[r.length-1]+=` +`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=Td(i.tagger)),i.committer&&(i.committer=Td(i.committer)),i}withoutSignature(){let e=jn(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 jn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=jn(s);let a=n+s;return t.from(a)}};function Zg(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function y8(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var kr=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 he("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=jn(i+` +gpgsig`+Zg(r)+` +`+n);return new t(s)}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 jn(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 n of e)n[0]===" "?r[r.length-1]+=` +`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=Td(i.author)),i.committer&&(i.committer=Td(i.committer)),i}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 he("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s} +`}let i=e.author;r+=`author ${lv(i)} +`;let n=e.committer||e.author;return r+=`committer ${lv(n)} +`,e.gpgsig&&(r+="gpgsig"+Zg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` +`+jn(e.message)}render(){return this._commit}withoutSignature(){let e=jn(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(` +gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return jn(r+` +`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return y8(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=jn(a);let l=t.justHeaders(e._commit)+` +gpgsig`+Zg(a)+` +`+s;return t.from(l)}};async function Qo({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Er.from([]),oid:i};let{type:n,object:s}=await Ke({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,Qo({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=kr.from(s).parse().tree,Qo({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new hr(i,n,"tree");return{tree:Er.from(s),oid:i}}var cv=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await W.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof He&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Qo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Ke({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new hr(l,c,o.type);let f=Er.from(u);for(let d of f)a.set(O(r,d.path),d);return f.entries().map(d=>O(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=YE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await Ke({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Zr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Fd,{value:function({fs:r,gitdir:i,cache:n}){return new cv({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var uv=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(O(n,r));return s===null?null:s.map(a=>O(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Vo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await mt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||xd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await qn(Rs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&xd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await ct.get({fs:e,gitdir:r}),this.config)}};function nl(){let t=Object.create(null);return Object.defineProperty(t,Fd,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new uv({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function b8(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var rk=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),fv=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:a=async(l,c)=>{let u=rk(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=n.map(h=>h[Fd]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(l.length).fill("."),u=b8(0,l.length),f=async h=>{u.forEach(v=>{let w=h[v];h[v]=w&&new l[v].ConstructEntry(w)});let g=(await Promise.all(u.map(v=>{let w=h[v];return w?l[v].readdir(w):[]}))).map(v=>(v===null?[]:v)[Symbol.iterator]());return{entries:h,children:_8(g)}},d=async h=>{let{entries:m,children:g}=await f(h),v=m.find(b=>b&&b._fullpath)._fullpath,w=await s(v,m);if(w!==null){let b=await o(d,g);return b=b.filter(k=>k!==void 0),a(w,b)}};return d(c)}async function dv(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=O(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?dv(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function x8(t){return S8(t)&&FE(t.then)&&FE(t.catch)}function S8(t){return t&&typeof t=="object"}function FE(t){return typeof t=="function"}function OE(t){return x8((r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}})(t))}var ME=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function DE(t,e){if(OE(e))for(let r of ME)t[`_${r}`]=e[r].bind(e);else for(let r of ME)t[`_${r}`]=yd(e[r].bind(e));OE(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=dv.bind(null,t)):(e.cp&&(t._cp=yd(e.cp.bind(e))),e.rm?t._rm=yd(e.rm.bind(e)):e.rmdir.length>2?t._rm=yd(e.rmdir.bind(e)):t._rm=dv.bind(null,t))}var J=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?DE(this,e.promises):DE(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,` +`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=Buffer.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(xa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=xa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Id),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return Buffer.isBuffer(i)?i:Buffer.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function C(t,e){if(e===void 0)throw new Sr(t)}async function ee({fsp:t,dotgit:e}){C("fsp",t),C("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>O(xa(e),i)):e}async function Cd(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 ik({fs:t,dir:e,gitdir:r=O(e,".git"),commit:i="HEAD",cache:n={}}){try{C("fs",t),C("dir",e),C("gitdir",r);let s=new J(t),a=[Zr({ref:i}),nl(),Aa()],o=[],l=await ee({fsp:s,dotgit:r});await mt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Is({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let m=!await Cd(d,h),g=o.includes(u),v=!await Cd(h,f);if(m||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new tu(u)}});await mt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Fs=class{static async isIgnored({fs:e,dir:r,gitdir:i=O(r,".git"),filepath:n}){if(Sd(n)===".git")return!0;if(n===".")return!1;let s="",a=O(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:O(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u{let f=await(await ct.get({fs:o,gitdir:l})).get("core.autocrlf");return hv({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function hv({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:o}){i=Array.isArray(i)?i:[i];let l=i.map(async d=>{if(!s&&await Fs.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(O(t,d));if(!h)throw new He(d);if(h.isDirectory()){let m=await r.readdir(O(t,d));if(a){let g=m.map(v=>hv({dir:t,gitdir:e,fs:r,filepath:[O(d,v)],index:n,force:s,parallel:a,autocrlf:o}));await Promise.all(g)}else for(let g of m)await hv({dir:t,gitdir:e,fs:r,filepath:[O(d,g)],index:n,force:s,parallel:a,autocrlf:o})}else{let m=h.isSymbolicLink()?await r.readlink(O(t,d)).then(sk):await r.read(O(t,d),{autocrlf:o});if(m===null)throw new He(d);let g=await Ar({fs:r,gitdir:e,type:"blob",object:m});n.insert({filepath:d,stats:h,oid:g})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new Kc(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function iu({fs:t,gitdir:e,path:r}){return(await ct.get({fs:t,gitdir:e})).get(r)}function ok(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}async function Os({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await iu({fs:t,gitdir:e,path:"user.name"}),email:await iu({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=ok({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}async function Jo({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await iu({fs:t,gitdir:e,path:"user.name"}),email:await iu({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},o=ok({},a,n?n.committer:void 0,r,i);if(o.name!==void 0)return o}async function lk({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Ke({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,lk({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new hr(i,n,"commit");return{commit:kr.from(s),oid:i}}async function el({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await lk({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}async function Od({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let m=!1,g=!1;f||(g=!(await t.read(`${i}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),f=await W.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let v,w;try{v=await W.resolve({fs:t,gitdir:i,ref:f}),w=await el({fs:t,gitdir:i,oid:v,cache:{}})}catch(x){m=!0}if(l&&m)throw new ru(f);let b=l?await Os({fs:t,gitdir:i,author:s,commit:w.commit}):await Os({fs:t,gitdir:i,author:s});if(!b)throw new Jt("author");let k=l?await Jo({fs:t,gitdir:i,author:b,committer:a,commit:w.commit}):await Jo({fs:t,gitdir:i,author:b,committer:a});if(!k)throw new Jt("committer");return mt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(x){let A=ZE(x.entries).get(".");if(h||(h=await ck({fs:t,gitdir:i,inode:A,dryRun:c})),d?d=await Promise.all(d.map(_=>W.resolve({fs:t,gitdir:i,ref:_}))):l?d=w.commit.parent:d=v?[v]:[],!n)if(l)n=w.commit.message;else throw new Sr("message");let y=kr.from({tree:h,parent:d,author:b,committer:k,message:n});o&&(y=await kr.sign(y,r,o));let S=await Ar({fs:t,gitdir:i,type:"commit",object:y.toObject(),dryRun:c});return!u&&!c&&await W.writeRef({fs:t,gitdir:i,ref:g?"HEAD":f,value:S}),S})}async function ck({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let l of n)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await ck({fs:t,gitdir:e,inode:l,dryRun:i}));let s=n.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),a=Er.from(s);return await Ar({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}async function su({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new $s("leading-slash");if(n.endsWith("/"))throw new $s("trailing-slash");let s=i,a=await Qo({fs:t,cache:e,gitdir:r,oid:i}),o=a.tree;if(n==="")i=a.oid;else{let l=n.split("/");i=await uk({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:s,filepath:n})}return i}async function uk({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let o=n.shift();for(let l of i)if(l.path===o){if(n.length===0)return l.oid;{let{type:c,object:u}=await Ke({fs:t,cache:e,gitdir:r,oid:l.oid});if(c!=="tree")throw new hr(s,c,"tree",a);return i=Er.from(u),uk({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new He(`file or directory found at "${s}:${a}"`)}async function sl({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await su({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await Qo({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}async function au({fs:t,gitdir:e,tree:r}){let i=Er.from(r).toObject();return await Ar({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}async function T8({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await W.resolve({gitdir:i,fs:t,ref:n})}catch(w){if(!(w instanceof He))throw w}let h=(await sl({fs:t,cache:e,gitdir:i,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(w=>w.path!==s);else for(let w of h)if(w.path===s)throw new $i("note",s);typeof a=="string"&&(a=Buffer.from(a,"utf8"));let m=await Ar({fs:t,gitdir:i,type:"blob",object:a,format:"content"});h.push({mode:"100644",path:s,oid:m,type:"blob"});let g=await au({fs:t,gitdir:i,tree:h});return await Od({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function fk({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{C("fs",t),C("gitdir",i),C("oid",s),C("note",a),u&&C("onSign",e);let d=new J(t),h=await Os({fs:d,gitdir:i,author:l});if(!h)throw new Jt("author");let m=await Jo({fs:d,gitdir:i,author:h,committer:c});if(!m)throw new Jt("committer");let g=await ee({fsp:d,dotgit:i});return await T8({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:m,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var C8=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function nu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!C8.test(t)&&(!!e||t.includes("/"))}async function dk({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!nu(r,!0))throw new Ii(r,Hc.clean(r));let s=await ct.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new $i("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await ct.save({fs:t,gitdir:e,config:s})}async function hk({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i,url:n,force:s=!1}){try{C("fs",t),C("gitdir",r),C("remote",i),C("url",n);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await dk({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function P8({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await W.exists({fs:t,gitdir:i,ref:n}))throw new $i("tag",n);let f=await W.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await Ke({fs:t,cache:e,gitdir:i,oid:f}),h=Kr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Kr.sign(h,r,c));let m=await Ar({fs:t,gitdir:i,type:"tag",object:h.toObject()});await W.writeRef({fs:t,gitdir:i,ref:n,value:m})}async function pk({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{C("fs",t),C("gitdir",i),C("ref",n),c&&C("onSign",e);let d=new J(t),h=await ee({fsp:d,dotgit:i}),m=await Os({fs:d,gitdir:h,author:s});if(!m)throw new Jt("tagger");return await P8({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:m,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function R8({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!nu(r,!0))throw new Ii(r,Hc.clean(r));let a=`refs/heads/${r}`;if(!s&&await W.exists({fs:t,gitdir:e,ref:a}))throw new $i("branch",r,!1);let o;try{o=await W.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await W.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function mk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{C("fs",t),C("gitdir",r),C("ref",i);let o=new J(t),l=await ee({fsp:o,dotgit:r});return await R8({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var gk=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function vv({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:m=!1,batchSize:g=100}){let v;if(i)try{v=await W.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let w;try{w=await W.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let k=`${a}/${o}`;if(w=await W.resolve({fs:t,gitdir:s,ref:k}),h){let x=await ct.get({fs:t,gitdir:s});await x.set(`branch.${o}.remote`,a),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await ct.save({fs:t,gitdir:s,config:x})}await W.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:w})}if(!c){let b;try{b=await $8({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(y){throw y instanceof He&&y.data.what===w?new Vc(o,w):y}let k=b.filter(([y])=>y==="conflict").map(([y,S])=>S);if(k.length>0)throw new zc(k);let x=b.filter(([y])=>y==="error").map(([y,S])=>S);if(x.length>0)throw new he(x.join(", "));if(f){i&&await i({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=b.length;if(await mt.acquire({fs:t,gitdir:s,cache:e},async function(y){await Promise.all(b.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,_]){let T=`${n}/${_}`;S==="delete"&&await t.rm(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await mt.acquire({fs:t,gitdir:s,cache:e},async function(y){for(let[S,_]of b)if(S==="rmdir"||S==="rmdir-index"){let T=`${n}/${_}`;try{S==="rmdir"&&await t.rmdir(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++E,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 _=`${n}/${S}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++E,total:A})})),m){let y=b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index"),S=await LE("Update Working Dir",y.map(([_,T,P,D,B])=>()=>F8({fs:t,cache:e,gitdir:s,dir:n},[_,T,P,D,B])),r,g);await mt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(_){await LE("Update Index",S.map(([T,P,D])=>()=>I8({index:_,fullpath:T,oid:P,stats:D})),r,g)})}else await mt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(y){await Promise.all(b.filter(([S])=>S==="create"||S==="create-index"||S==="update"||S==="mkdir-index").map(async function([S,_,T,P,D]){let B=`${n}/${_}`;try{if(S!=="create-index"&&S!=="mkdir-index"){let{object:ce}=await Ke({fs:t,cache:e,gitdir:s,oid:T});if(D&&await t.rm(B),P===33188)await t.write(B,ce);else if(P===33261)await t.write(B,ce,{mode:511});else if(P===40960)await t.writelink(B,ce);else throw new he(`Invalid mode 0o${P.toString(8)} detected in blob ${T}`)}let N=await t.lstat(B);P===33261&&(N.mode=493),S==="mkdir-index"&&(N.mode=57344),y.insert({filepath:_,stats:N,oid:T}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}catch(N){console.log(N)}}))});i&&await i({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let b=await W.expand({fs:t,gitdir:s,ref:o});b.startsWith("refs/heads")?await W.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:b}):await W.writeRef({fs:t,gitdir:s,ref:"HEAD",value:w})}}async function $8({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:o}){let l=0;return Is({fs:t,cache:e,dir:i,gitdir:n,trees:[Zr({ref:s}),nl(),Aa()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(m=>gk(c,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return a&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await f.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!a)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=rk(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function I8({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}async function F8({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,o,l]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:f}=await Ke({fs:t,cache:e,gitdir:r,oid:a});if(l&&await t.rm(c),o===33188)await t.write(c,f);else if(o===33261)await t.write(c,f,{mode:511});else if(o===40960)await t.writelink(c,f);else throw new he(`Invalid mode 0o${o.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return o===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}async function LE(t,e,r,i){let n=[];try{for(let s=0;sl());(await Promise.allSettled(a)).forEach(l=>{l.status==="fulfilled"&&n.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:s+a.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}async function wv({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=O(i,".git"),remote:s="origin",ref:a,filepaths:o,noCheckout:l=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:m=!1,batchSize:g=100}){try{C("fs",t),C("dir",i),C("gitdir",n);let v=a||"HEAD",w=new J(t),b=await ee({fsp:w,dotgit:n});return await vv({fs:w,cache:h,onProgress:e,onPostCheckout:r,dir:i,gitdir:b,remote:s,ref:v,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,nonBlocking:m,batchSize:g})}catch(v){throw v.caller="git.checkout",v}}var O8=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function _a(t){let e=O8.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Ds({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await W.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await W.resolve({fs:t,gitdir:e,ref:n})}catch(s){return}if(n.startsWith("refs/"))return r?n:_a(n)}function M8(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function vk({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function ou(t,e){let r=JE(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}async function Pd(t){let e=0,r=[];await ou(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}function BE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}function pv(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var at=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let r=e.length+4,i=pv(4,r);return Buffer.concat([Buffer.from(i,"utf8"),e])}static streamReader(e){let r=new Ad(e);return async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s==null?!0:s}catch(n){return e.error=n,!0}}}};async function NE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function HE(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=at.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Wc;if(a.includes("version 2"))return NE(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Sa(`# service=${e}\\n`,a.toString("utf8"));let o=await s();for(;o===null;)o=await s();if(o===!0)return{capabilities:r,refs:i,symrefs:n};if(o=o.toString("utf8"),o.includes("version 2"))return NE(s);let[l,c]=Qg(o,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Qg(l," "," ");for(i.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,m]=Qg(d.toString("utf8")," "," ");i.set(m,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&n.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}function Qg(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Sa(`Two strings separated by '${r}'`,t.toString("utf8"));return i}var UE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,GE=(t,e)=>{(e.username||e.password)&&(t.Authorization=vk(e)),e.headers&&Object.assign(t,e.headers)},Jg=async t=>{try{let e=Buffer.from(await Pd(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},tl=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=BE(l),h=a?UE(a,f):f;(d.username||d.password)&&(c.Authorization=vk(d)),u===2&&(c["Git-Protocol"]="version=2");let m,g,v=!1;do if(m=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),g=!1,m.statusCode===401||m.statusCode===203){let w=v?s:i;if(w){if(d=await w(f,{...d,headers:{...c}}),d&&d.cancel)throw new Ko;d&&(GE(c,d),v=!0,g=!0)}}else m.statusCode===200&&v&&n&&await n(f,d);while(g);if(m.statusCode!==200){let{response:w}=await Jg(m);throw new Wo(m.statusCode,m.statusMessage,w)}if(m.headers["content-type"]===`application/x-${o}-advertisement`){let w=await HE(m.body,{service:o});return w.auth=d,w}else{let{preview:w,response:b,data:k}=await Jg(m);try{let x=await HE([k],{service:o});return x.auth=d,x}catch(x){throw new Qc(w,b)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:o,headers:l}){let c=BE(s);c&&(s=c.url),i&&(s=UE(i,s)),l["content-type"]=`application/x-${n}-request`,l.accept=`application/x-${n}-result`,GE(l,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=Jg(u);throw new Wo(u.statusCode,u.statusMessage,f)}return u}},rl=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",tl),r.set("https",tl);let i=D8({url:e});if(!i)throw new eu(e);if(r.has(i.transport))return r.get(i.transport);throw new Jc(e,i.transport,i.transport==="ssh"?M8(e):void 0)}};function D8({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}var ba=null,Ea=class{static async read({fs:e,gitdir:r}){ba===null&&(ba=new Nc);let i=O(r,"shallow"),n=new Set;return await ba.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(` +`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ba===null&&(ba=new Nc);let n=O(r,"shallow");if(i.size>0){let s=[...i].join(` +`)+` +`;await ba.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ba.acquire(n,async function(){await e.rm(n)})}};async function L8({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function B8({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(O(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await gv({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new he(l.error);if(l.offsets.has(i))return!0}return!1}async function jE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>Ke({fs:t,cache:e,gitdir:r,oid:o}),a=await L8({fs:t,gitdir:r,oid:i});return a||(a=await B8({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function N8(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function wk(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Md={name:"isomorphic-git",version:"1.36.3",agent:"git/isomorphic-git@1.36.3"},qo=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 H8(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 yk(t){let e=new qo,r="";return(async()=>(await ou(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=H8(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var Rd=class{static demux(e){let r=at.streamReader(e),i=new qo,n=new qo,s=new qo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function U8(t){let{packetlines:e,packfile:r,progress:i}=Rd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{ou(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ps(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ps(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,m]=d.split(" ");a.push({oid:h,status:m}),m||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function G8({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(at.encode(`want ${c}${l} +`)),l="";for(let c of i)o.push(at.encode(`shallow ${c} +`));n!==null&&o.push(at.encode(`deepen ${n} +`)),s!==null&&o.push(at.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)} +`));for(let c of a)o.push(at.encode(`deepen-not ${c} +`));o.push(at.flush());for(let c of r)o.push(at.encode(`have ${c} +`));return o.push(at.encode(`done +`)),o}async function yv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:k=!1,headers:x={},prune:E=!1,pruneTags:A=!1}){let y=c||await Ds({fs:t,gitdir:l,test:!0}),S=await ct.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 Sr("remote OR url");let P=u||y&&await S.get(`branch.${y}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let D=rl.getRemoteHelperFor({url:T}),B=await D.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:x,protocolVersion:1}),N=B.auth,ce=B.refs;if(ce.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!B.capabilities.has("shallow"))throw new Cs("shallow","depth");if(g!==null&&!B.capabilities.has("deepen-since"))throw new Cs("deepen-since","since");if(v.length>0&&!B.capabilities.has("deepen-not"))throw new Cs("deepen-not","exclude");if(w===!0&&!B.capabilities.has("deepen-relative"))throw new Cs("deepen-relative","relative");let{oid:Pe,fullref:ve}=W.resolveAgainstMap({ref:P,map:ce});for(let q of ce.keys())q===ve||q==="HEAD"||q.startsWith("refs/heads/")||b&&q.startsWith("refs/tags/")||ce.delete(q);let se=wk([...B.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Md.agent}`]);w&&se.push("deepen-relative");let xe=k?[Pe]:ce.values(),we=k?[y]:await W.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let q of we)try{q=await W.expand({fs:t,gitdir:l,ref:q});let Z=await W.resolve({fs:t,gitdir:l,ref:q});await jE({fs:t,cache:e,gitdir:l,oid:Z})&&z.push(Z)}catch(Z){}z=[...new Set(z)];let Q=await Ea.read({fs:t,gitdir:l}),j=B.capabilities.has("shallow")?[...Q]:[],Le=G8({capabilities:se,wants:xe,haves:z,shallows:j,depth:m,since:g,exclude:v}),lr=Buffer.from(await Pd(Le)),Ft=await D.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:T,auth:N,body:[lr],headers:x}),Ie=await U8(Ft.body);Ft.headers&&(Ie.headers=Ft.headers);for(let q of Ie.shallows)if(!Q.has(q))try{let{object:Z}=await Ke({fs:t,cache:e,gitdir:l,oid:q}),L=new kr(Z),V=await Promise.all(L.headers().parent.map(qe=>jE({fs:t,cache:e,gitdir:l,oid:qe})));V.length===0||V.every(qe=>qe)||Q.add(q)}catch(Z){Q.add(q)}for(let q of Ie.unshallows)Q.delete(q);if(await Ea.write({fs:t,gitdir:l,oids:Q}),k){let q=new Map([[ve,Pe]]),Z=new Map,L=10,V=ve;for(;L--;){let Ot=B.symrefs.get(V);if(Ot===void 0)break;Z.set(V,Ot),V=Ot}let Te=ce.get(V);Te&&q.set(V,Te);let{pruned:qe}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:q,symrefs:Z,tags:b,prune:E});E&&(Ie.pruned=qe)}else{let{pruned:q}=await W.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:ce,symrefs:B.symrefs,tags:b,prune:E,pruneTags:A});E&&(Ie.pruned=q)}if(Ie.HEAD=B.symrefs.get("HEAD"),Ie.HEAD===void 0){let{oid:q}=W.resolveAgainstMap({ref:"HEAD",map:ce});for(let[Z,L]of ce.entries())if(Z!=="HEAD"&&L===q){Ie.HEAD=Z;break}}let At=ve.startsWith("refs/tags")?"tag":"branch";if(Ie.FETCH_HEAD={oid:Pe,description:`${At} '${_a(ve)}' of ${T}`},i||n){let q=yk(Ie.progress);ou(q,async Z=>{if(n&&await n(Z),i){let L=Z.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);L&&await i({phase:L[1].trim(),loaded:parseInt(L[2],10),total:parseInt(L[3],10)})}})}let Tt=Buffer.from(await Pd(Ie.packfile));if(Ft.body.error)throw Ft.body.error;let jt=Tt.slice(-20).toString("hex"),Ze={defaultBranch:Ie.HEAD,fetchHead:Ie.FETCH_HEAD.oid,fetchHeadDescription:Ie.FETCH_HEAD.description};if(Ie.headers&&(Ze.headers=Ie.headers),E&&(Ze.pruned=Ie.pruned),jt!==""&&!N8(Tt)){Ze.packfile=`objects/pack/pack-${jt}.pack`;let q=O(l,Ze.packfile);await t.write(q,Tt);let Z=V=>Ke({fs:t,cache:e,gitdir:l,oid:V}),L=await jc.fromPack({pack:Tt,getExternalRefDelta:Z,onProgress:i});await t.write(q.replace(/\.pack$/,".idx"),await L.toBuffer())}return Ze}async function bk({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:O(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(i+"/HEAD",`ref: refs/heads/${n} +`)}async function j8({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:m,depth:g,since:v,exclude:w,relative:b,singleBranch:k,noCheckout:x,noTags:E,headers:A,nonBlocking:y,batchSize:S=100}){try{if(await bk({fs:t,gitdir:u}),await dk({fs:t,gitdir:u,remote:m,url:f,force:!1}),d){let P=await ct.get({fs:t,gitdir:u});await P.set("http.corsProxy",d),await ct.save({fs:t,gitdir:u,config:P})}let{defaultBranch:_,fetchHead:T}=await yv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:m,corsProxy:d,depth:g,since:v,exclude:w,relative:b,singleBranch:k,headers:A,tags:!E});if(T===null)return;h=h||_,h=h.replace("refs/heads/",""),await vv({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:m,noCheckout:x,nonBlocking:y,batchSize:S})}catch(_){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function _k({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=O(l,".git"),url:u,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:k=!1,noTags:x=!1,headers:E={},cache:A={},nonBlocking:y=!1,batchSize:S=100}){try{C("fs",t),C("http",e),C("gitdir",c),k||C("dir",l),C("url",u);let _=new J(t),T=await ee({fsp:_,dotgit:c});return await j8({fs:_,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:T,url:u,corsProxy:f,ref:d,remote:h,depth:m,since:g,exclude:v,relative:w,singleBranch:b,noCheckout:k,noTags:x,headers:E,nonBlocking:y,batchSize:S})}catch(_){throw _.caller="git.clone",_}}async function xk({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:m={}}){try{C("fs",t),l||C("message",n),o&&C("onSign",e);let g=new J(t),v=await ee({fsp:g,dotgit:i});return await Od({fs:g,cache:m,onSign:e,gitdir:v,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function Sk({fs:t,dir:e,gitdir:r=O(e,".git"),fullname:i=!1,test:n=!1}){try{C("fs",t),C("gitdir",r);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await Ds({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function q8({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:t,gitdir:e,ref:r}))throw new He(r);let n=await W.expand({fs:t,gitdir:e,ref:r}),s=await Ds({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await W.resolve({fs:t,gitdir:e,ref:n});await W.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await W.deleteRef({fs:t,gitdir:e,ref:n});let a=_a(r),o=await ct.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await ct.save({fs:t,gitdir:e,config:o})}async function Ek({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{C("fs",t),C("ref",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await q8({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function kk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{C("fs",t),C("ref",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});await W.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function z8({fs:t,gitdir:e,remote:r}){let i=await ct.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await ct.save({fs:t,gitdir:e,config:i})}async function Ak({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i}){try{C("fs",t),C("remote",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await z8({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function V8({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:t,gitdir:e,ref:r})}async function Tk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{C("fs",t),C("ref",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await V8({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function W8({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function Y8({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(O(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await gv({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new he(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function X8({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>Ke({fs:t,cache:e,gitdir:r,oid:o}),s=await W8({fs:t,gitdir:r,oid:i}),a=await Y8({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new qc("oids",i,s):new He(`an object matching "${i}"`)}async function Ck({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await X8({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.expandOid",s}}async function Pk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i}){try{C("fs",t),C("gitdir",r),C("ref",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await W.expand({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.expandRef",n}}async function bv({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((o,l)=>({index:l,oid:o}));for(;a.length;){let o=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of a)try{let{object:f}=await Ke({fs:t,cache:e,gitdir:r,oid:c}),d=kr.from(f),{parent:h}=d.parseHeaders();for(let m of h)(!n[m]||!n[m].has(u))&&l.set(m+":"+u,{oid:m,index:u})}catch(f){}a=Array.from(l.values())}return[]}var ev=/^.*(\r?\n|$)/gm;function Z8({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],o=s.match(ev),l=n.match(ev),c=a.match(ev),u=C3(o,l,c),f=7,d="",h=!0;for(let m of u)m.ok&&(d+=m.ok.join("")),m.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} +`,d+=m.conflict.a.join(""),d+=`${"=".repeat(f)} +`,d+=m.conflict.b.join(""),d+=`${">".repeat(f)} ${i} +`);return{cleanMerge:h,mergedText:d}}async function K8({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let m=Zr({ref:s}),g=Zr({ref:a}),v=Zr({ref:o}),w=[],b=[],k=[],x=[],E=await Is({fs:t,cache:e,dir:r,gitdir:i,trees:[m,g,v],map:async function(A,[y,S,_]){let T=Sd(A),P=await Cd(y,S),D=await Cd(_,S);switch(`${P}-${D}`){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 Q8({fs:t,gitdir:i,path:T,ours:y,base:S,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async B=>{if(B.cleanMerge)d||n.insert({filepath:A,oid:B.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!d){let N="";S&&await S.type()==="blob"&&(N=await S.oid());let ce=await y.oid(),Pe=await _.oid();n.delete({filepath:A}),N&&n.insert({filepath:A,oid:N,stage:1}),n.insert({filepath:A,oid:ce,stage:2}),n.insert({filepath:A,oid:Pe,stage:3})}return B.mergeResult});if(S&&!y&&_&&await S.type()==="blob"&&await _.type()==="blob"){if(w.push(A),k.push(A),!d){let B=await S.oid(),N=await _.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:N,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 B=await S.oid(),N=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:N,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 Yo}}},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 Er(S).toObject(),P=await Ar({fs:t,gitdir:i,type:"tree",object:T,dryRun:f});A.oid=P}return A}}});return w.length!==0?(r&&!d&&await Is({fs:t,cache:e,dir:r,gitdir:i,trees:[Zr({ref:E.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 Xo(w,b,k,x)):E.oid}async function Q8({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=Z8}){let f="blob",d="100755",h="",m="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),m=Buffer.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=Buffer.from(await i.content()).toString("utf8"),w=Buffer.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:k}=await u({branches:[l,a,o],contents:[m,v,w],path:r}),x=await Ar({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:c});return{cleanMerge:k,mergeResult:{mode:g,path:r,oid:x,type:f}}}async function Rk({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:m,onSign:g,mergeDriver:v,allowUnrelatedHistories:w=!1}){n===void 0&&(n=await Ds({fs:t,gitdir:i,fullname:!0})),n=await W.expand({fs:t,gitdir:i,ref:n}),s=await W.expand({fs:t,gitdir:i,ref:s});let b=await W.resolve({fs:t,gitdir:i,ref:n}),k=await W.resolve({fs:t,gitdir:i,ref:s}),x=await bv({fs:t,cache:e,gitdir:i,oids:[b,k]});if(x.length!==1)if(x.length===0&&w)x.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Yo;let E=x[0];if(E===k)return{oid:b,alreadyMerged:!0};if(a&&E===b)return!l&&!c&&await W.writeRef({fs:t,gitdir:i,ref:n,value:k}),{oid:k,fastForward:!0};{if(o)throw new Yc;let A=await mt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async S=>K8({fs:t,cache:e,dir:r,gitdir:i,index:S,ourOid:b,theirOid:k,baseOid:E,ourName:_a(n),baseName:"base",theirName:_a(s),dryRun:l,abortOnConflict:u,mergeDriver:v}));if(A instanceof Xo)throw A;return f||(f=`Merge branch '${_a(s)}' into ${_a(n)}`),{oid:await Od({fs:t,cache:e,gitdir:i,message:f,ref:n,tree:A,parent:[b,k],author:d,committer:h,signingKey:m,onSign:g,dryRun:l,noUpdateBranch:c}),tree:A,mergeCommit:!0}}}async function $k({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:m,pruneTags:g,fastForward:v,fastForwardOnly:w,corsProxy:b,singleBranch:k,headers:x,author:E,committer:A,signingKey:y}){try{if(!u){let T=await Ds({fs:t,gitdir:c});if(!T)throw new Sr("ref");u=T}let{fetchHead:S,fetchHeadDescription:_}=await yv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:k,headers:x,prune:m,pruneTags:g});await Rk({fs:t,cache:e,gitdir:c,ours:u,theirs:S,fastForward:v,fastForwardOnly:w,message:`Merge ${_}`,author:E,committer:A,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await vv({fs:t,cache:e,onProgress:i,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function Ik({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=O(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:m,headers:g={},cache:v={}}){try{C("fs",t),C("http",e),C("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},b=new J(t),k=await ee({fsp:b,dotgit:l});return await $k({fs:b,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:k,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:m,headers:g,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function Fk({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=O(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:k=!1,headers:x={},prune:E=!1,pruneTags:A=!1,cache:y={}}){try{C("fs",t),C("http",e),C("gitdir",l);let S=new J(t),_=await ee({fsp:S,dotgit:l});return await yv({fs:S,cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:_,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:m,since:g,exclude:v,relative:w,tags:b,singleBranch:k,headers:x,prune:E,pruneTags:A})}catch(S){throw S.caller="git.fetch",S}}async function Ok({fs:t,dir:e,gitdir:r=O(e,".git"),oids:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("oids",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await bv({fs:s,cache:n,gitdir:a,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}async function Mk({fs:t,filepath:e}){if(await t.exists(O(e,".git")))return e;{let r=xa(e);if(r===e)throw new He(`git root for ${e}`);return Mk({fs:t,filepath:r})}}async function Dk({fs:t,filepath:e}){try{return C("fs",t),C("filepath",e),await Mk({fs:new J(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function Lk({fs:t,dir:e,gitdir:r=O(e,".git"),path:i}){try{C("fs",t),C("gitdir",r),C("path",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await iu({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfig",n}}async function J8({fs:t,gitdir:e,path:r}){return(await ct.get({fs:t,gitdir:e})).getall(r)}async function Bk({fs:t,dir:e,gitdir:r=O(e,".git"),path:i}){try{C("fs",t),C("gitdir",r),C("path",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await J8({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}async function Nk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1}){try{C("http",t),C("url",s);let c=await rl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),m=h.pop(),g=u;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),m=h.pop(),g=u;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function Hk(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let l=s.replace("^{}",""),c=n[n.length-1],u=c.ref===l?c:n.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let o={ref:s,oid:a};r&&t.symrefs.has(s)&&(o.target=t.symrefs.get(s)),n.push(o)}return n}async function Uk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2}){try{C("http",t),C("url",s);let u=await rl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,m]=d.split("=");m?f[h]=m:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:Hk(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function e6({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Rs.wrap({type:t,object:e})),i=await qn(e)),{oid:i,object:e}}async function Gk({object:t}){try{C("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await e6({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function t6({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=O(i,s);let a=await t.read(s),o=c=>Ke({fs:t,cache:e,gitdir:n,oid:c}),l=await jc.fromPack({pack:a,getExternalRefDelta:o,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(a){throw a.caller="git.indexPack",a}}async function jk({fs:t,onProgress:e,dir:r,gitdir:i=O(r,".git"),filepath:n,cache:s={}}){try{C("fs",t),C("dir",r),C("gitdir",r),C("filepath",n);let a=new J(t),o=await ee({fsp:a,dotgit:i});return await t6({fs:a,cache:s,onProgress:e,dir:r,gitdir:o,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}async function qk({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:O(r,".git"),defaultBranch:n="master"}){try{C("fs",t),C("gitdir",i),e||C("dir",r);let s=new J(t),a=await ee({fsp:s,dotgit:i});return await bk({fs:s,bare:e,dir:r,gitdir:a,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}async function zk({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await Ea.read({fs:t,gitdir:r});if(!i)throw new Sr("oid");if(!n)throw new Sr("ancestor");if(i===n)return!1;let o=[i],l=new Set,c=0;for(;o.length;){if(c++===s)throw new Zc(s);let u=o.shift(),{type:f,object:d}=await Ke({fs:t,cache:e,gitdir:r,oid:u});if(f!=="commit")throw new hr(u,f,"commit");let h=kr.from(d).parse();for(let m of h.parent)if(m===n)return!0;if(!a.has(u))for(let m of h.parent)l.has(m)||(o.push(m),l.add(m))}return!1}async function Vk({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{C("fs",t),C("gitdir",r),C("oid",i),C("ancestor",n);let o=new J(t),l=await ee({fsp:o,dotgit:r});return await zk({fs:o,cache:a,gitdir:l,oid:i,ancestor:n,depth:s})}catch(o){throw o.caller="git.isDescendent",o}}async function Wk({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i}){try{C("fs",t),C("dir",e),C("gitdir",r),C("filepath",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return Fs.isIgnored({fs:n,dir:e,gitdir:s,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}async function Yk({fs:t,dir:e,gitdir:r=O(e,".git"),remote:i}){try{C("fs",t),C("gitdir",r);let n=new J(t),s=await ee({fsp:n,dotgit:r});return W.listBranches({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.listBranches",n}}async function r6({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await W.resolve({gitdir:e,fs:t,ref:r}),s=[];return await Xk({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return mt.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}async function Xk({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await sl({fs:t,cache:e,gitdir:r,oid:i});for(let o of a)o.type==="tree"?await Xk({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:n,prefix:O(s,o.path)}):n.push(O(s,o.path))}async function Zk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,cache:n={}}){try{C("fs",t),C("gitdir",r);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await r6({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listFiles",s}}async function i6({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await W.resolve({gitdir:r,fs:t,ref:i})}catch(o){if(o instanceof He)return[]}return(await sl({fs:t,cache:e,gitdir:r,oid:n})).tree.map(o=>({target:o.path,note:o.oid}))}async function Kk({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{C("fs",t),C("gitdir",r),C("ref",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await i6({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listNotes",s}}async function Qk({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i}){try{C("fs",t),C("gitdir",r);let n=new J(t),s=await ee({fsp:n,dotgit:r});return W.listRefs({fs:n,gitdir:s,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}async function n6({fs:t,gitdir:e}){let r=await ct.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}async function Jk({fs:t,dir:e,gitdir:r=O(e,".git")}){try{C("fs",t),C("gitdir",r);let i=new J(t),n=await ee({fsp:i,dotgit:r});return await n6({fs:i,gitdir:n})}catch(i){throw i.caller="git.listRemotes",i}}async function s6(t){let e=at.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),o={ref:s,oid:n};for(let l of a){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}r.push(o)}return r}async function a6({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(at.encode(`command=ls-refs +`)),i.push(at.encode(`agent=${Md.agent} +`)),(r||e||t)&&i.push(at.delim()),r&&i.push(at.encode("peel")),e&&i.push(at.encode("symrefs")),t&&i.push(at.encode(`ref-prefix ${t}`)),i.push(at.flush()),i}async function eA({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{C("http",t),C("url",s);let d=await tl.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return Hk(d,c,u,f);let h=await a6({prefix:c,symrefs:u,peelTags:f}),m=await tl.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return s6(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function tA({fs:t,dir:e,gitdir:r=O(e,".git")}){try{C("fs",t),C("gitdir",r);let i=new J(t),n=await ee({fsp:i,dotgit:r});return W.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function o6(t,e){return t.committer.timestamp-e.committer.timestamp}var l6="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function qE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===l6)return;let s=i,a,o=await Qo({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await rA({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function rA({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=O(o,c.path),a.push(u)):c.type==="tree"&&(u=Ke({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return rA({fs:t,cache:e,gitdir:r,tree:Er.from(f),fileId:n,oid:s,filepaths:a,parentPath:O(o,c.path)})})),u});return await Promise.all(l),a}async function c6({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await Ea.read({fs:t,gitdir:r}),d=await W.resolve({fs:t,gitdir:r,ref:n}),h=[await el({fs:t,cache:e,gitdir:r,oid:d})],m,g,v;function w(b){v&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let k;try{k=await su({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&m!==k&&u.push(g),m=k,g=b,v=!0}catch(x){if(x instanceof He){let E=l&&m;if(E&&(E=await qE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:m}),E))if(Array.isArray(E)){if(g){let A=await qE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:m});if(Array.isArray(A))if(E=E.filter(y=>A.indexOf(y)===-1),E.length===1)E=E[0],i=E,g&&u.push(g);else{E=!1,g&&u.push(g);break}}}else i=E,g&&u.push(g);if(!E){if(v&&m&&(u.push(g),!o))break;if(!o&&!l)throw x}g=b,v=!1}else throw x}}else u.push(b);if(s!==void 0&&u.length===s){w(b);break}if(!f.has(b.oid))for(let k of b.commit.parent){let x=await el({fs:t,cache:e,gitdir:r,oid:k});h.map(E=>E.oid).includes(x.oid)||h.push(x)}h.length===0&&w(b),h.sort((k,x)=>o6(k.commit,x.commit))}return u}async function iA({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{C("fs",t),C("gitdir",r),C("ref",n);let u=new J(t),f=await ee({fsp:u,dotgit:r});return await c6({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function nA({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:m,cache:g={},mergeDriver:v,allowUnrelatedHistories:w=!1}){try{C("fs",t),m&&C("onSign",e);let b=new J(t),k=await ee({fsp:b,dotgit:i}),x=await Os({fs:b,gitdir:k,author:d});if(!x&&(!o||!a))throw new Jt("author");let E=await Jo({fs:b,gitdir:k,author:x,committer:h});if(!E&&(!o||!a))throw new Jt("committer");return await Rk({fs:b,cache:g,dir:r,gitdir:k,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:x,committer:E,signingKey:m,onSign:e,mergeDriver:v,allowUnrelatedHistories:w})}catch(b){throw b.caller="git.merge",b}}var u6={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function sA({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),oids:n}){let s=new VE,a=[];function o(u,f){let d=Buffer.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=u6[u],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(pv(2,v),"hex"),h=h>>>7;o(Buffer.from(await nk(f)))}o("PACK"),o("00000002","hex"),o(pv(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await Ke({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function f6({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await sA({fs:t,cache:e,gitdir:r,oids:i}),a=Buffer.from(await Pd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(O(r,`objects/pack/${l}`),a),{filename:l}):{filename:l,packfile:new Uint8Array(a)}}async function aA({fs:t,dir:e,gitdir:r=O(e,".git"),oids:i,write:n=!1,cache:s={}}){try{C("fs",t),C("gitdir",r),C("oids",i);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await f6({fs:a,cache:s,gitdir:o,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}async function oA({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=O(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:m=!1,fastForward:g=!0,fastForwardOnly:v=!1,corsProxy:w,singleBranch:b,headers:k={},author:x,committer:E,signingKey:A,cache:y={}}){try{C("fs",t),C("gitdir",l);let S=new J(t),_=await ee({fsp:S,dotgit:l}),T=await Os({fs:S,gitdir:_,author:x});if(!T)throw new Jt("author");let P=await Jo({fs:S,gitdir:_,author:T,committer:E});if(!P)throw new Jt("committer");return await $k({fs:S,cache:y,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:_,ref:c,url:u,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:v,corsProxy:w,singleBranch:b,headers:k,author:T,committer:P,signingKey:A,prune:h,pruneTags:m})}catch(S){throw S.caller="git.pull",S}}async function d6({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),start:n,finish:s}){let a=await Ea.read({fs:t,gitdir:i}),o=new Set,l=new Set;for(let f of n)o.add(await W.resolve({fs:t,gitdir:i,ref:f}));for(let f of s)try{let d=await W.resolve({fs:t,gitdir:i,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await Ke({fs:t,cache:e,gitdir:i,oid:f});if(d==="tag"){let g=Kr.from(h).headers().object;return u(g)}if(d!=="commit")throw new hr(f,d,"commit");if(!a.has(f)){let g=kr.from(h).headers().parent;for(f of g)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function tv({fs:t,cache:e,dir:r,gitdir:i=O(r,".git"),oids:n}){let s=new Set;async function a(o){if(s.has(o))return;s.add(o);let{type:l,object:c}=await Ke({fs:t,cache:e,gitdir:i,oid:o});if(l==="tag"){let f=Kr.from(c).headers().object;await a(f)}else if(l==="commit"){let f=kr.from(c).headers().tree;await a(f)}else if(l==="tree"){let u=Er.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await a(f.oid)}}for(let o of n)await a(o);return s}async function h6(t){let e={},r="",i=at.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+` +`),n=await i();let s=r.toString("utf8").split(` +`);if(n=s.shift(),!n.startsWith("unpack "))throw new Sa('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function p6({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(at.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i} +`)),i="";return r.push(at.flush()),r}async function m6({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={}}){let b=u||await Ds({fs:t,gitdir:c});if(typeof b=="undefined")throw new Sr("ref");let k=await ct.get({fs:t,gitdir:c});d=d||await k.get(`branch.${b}.pushRemote`)||await k.get("remote.pushDefault")||await k.get(`branch.${b}.remote`)||"origin";let x=h||await k.get(`remote.${d}.pushurl`)||await k.get(`remote.${d}.url`);if(typeof x=="undefined")throw new Sr("remote OR url");let E=f||await k.get(`branch.${b}.merge`);if(typeof x=="undefined")throw new Sr("remoteRef");v===void 0&&(v=await k.get("http.corsProxy"));let A=await W.expand({fs:t,gitdir:c,ref:b}),y=g?"0000000000000000000000000000000000000000":await W.resolve({fs:t,gitdir:c,ref:A}),S=rl.getRemoteHelperFor({url:x}),_=await S.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:x,headers:w,protocolVersion:1}),T=_.auth,P;if(!E)P=A;else try{P=await W.expandAgainstMap({ref:E,map:_.refs})}catch(Q){if(Q instanceof He)P=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw Q}let D=_.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:P,oid:D}}))throw new Ko;let B=!_.capabilities.has("no-thin"),N=new Set;if(!g){let Q=[..._.refs.values()],j=new Set;if(D!=="0000000000000000000000000000000000000000"){let Le=await bv({fs:t,cache:e,gitdir:c,oids:[y,D]});for(let lr of Le)Q.push(lr);B&&(j=await tv({fs:t,cache:e,gitdir:c,oids:Le}))}if(!Q.includes(y)){let Le=await d6({fs:t,cache:e,gitdir:c,start:[y],finish:Q});N=await tv({fs:t,cache:e,gitdir:c,oids:Le})}if(B){try{let Le=await W.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:lr}=await W.resolveAgainstMap({ref:Le.replace(`refs/remotes/${d}/`,""),fullref:Le,map:_.refs}),Ft=[lr];for(let Ie of await tv({fs:t,cache:e,gitdir:c,oids:Ft}))j.add(Ie)}catch(Le){}for(let Le of j)N.delete(Le)}if(y===D&&(m=!0),!m){if(A.startsWith("refs/tags")&&D!=="0000000000000000000000000000000000000000")throw new Zo("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&D!=="0000000000000000000000000000000000000000"&&!await zk({fs:t,cache:e,gitdir:c,oid:y,ancestor:D,depth:-1}))throw new Zo("not-fast-forward")}}let ce=wk([..._.capabilities],["report-status","side-band-64k",`agent=${Md.agent}`]),Pe=await p6({capabilities:ce,triplets:[{oldoid:D,oid:y,fullRef:P}]}),ve=g?[]:await sA({fs:t,cache:e,gitdir:c,oids:[...N]}),se=await S.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:x,auth:T,headers:w,body:[...Pe,...ve]}),{packfile:xe,progress:we}=await Rd.demux(se.body);if(n){let Q=yk(we);ou(Q,async j=>{await n(j)})}let z=await h6(xe);if(se.headers&&(z.headers=se.headers),d&&z.ok&&z.refs[P].ok&&!A.startsWith("refs/tags")){let Q=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await W.deleteRef({fs:t,gitdir:c,ref:Q}):await W.writeRef({fs:t,gitdir:c,ref:Q,value:y})}if(z.ok&&Object.values(z.refs).every(Q=>Q.ok))return z;{let Q=Object.entries(z.refs).filter(([j,Le])=>!Le.ok).map(([j,Le])=>` + - ${j}: ${Le.error}`).join("");throw new Xc(Q,z)}}async function lA({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=O(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={},cache:b={}}){try{C("fs",t),C("http",e),C("gitdir",c);let k=new J(t),x=await ee({fsp:k,dotgit:c});return await m6({fs:k,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:x,ref:u,remoteRef:f,remote:d,url:h,force:m,delete:g,corsProxy:v,headers:w})}catch(k){throw k.caller="git.push",k}}async function cA({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Ke({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Kr.from(s).parse().object,cA({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new hr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function uA({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await su({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await cA({fs:t,cache:e,gitdir:r,oid:i})}async function fA({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n,cache:s={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await uA({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function _v({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await el({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function g6({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await W.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await uA({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function dA({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{C("fs",t),C("gitdir",r),C("ref",i),C("oid",n);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await g6({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function hA({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let l=new J(t),c=await ee({fsp:l,dotgit:r});s!==void 0&&(i=await su({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await Ke({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=kr.from(f.object).parse();break;case"tree":f.object=Er.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Kr.from(f.object).parse();break;default:throw new hr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function v6({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await Ke({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new hr(i,n,"tag");let a=Kr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function pA({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await v6({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function mA({fs:t,dir:e,gitdir:r=O(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{C("fs",t),C("gitdir",r),C("oid",i);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await sl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function gA({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("filepath",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});await mt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function w6({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:i,fs:t,ref:n})}catch(m){if(!(m instanceof He))throw m}let f=(await sl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(m=>m.path!==s);let d=await au({fs:t,gitdir:i,tree:f});return await Od({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' +`,author:a,committer:o,signingKey:l})}async function vA({fs:t,onSign:e,dir:r,gitdir:i=O(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{C("fs",t),C("gitdir",i),C("oid",s);let u=new J(t),f=await ee({fsp:u,dotgit:i}),d=await Os({fs:u,gitdir:f,author:a});if(!d)throw new Jt("author");let h=await Jo({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Jt("committer");return await w6({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function y6({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!nu(i,!0))throw new Ii(i,Hc.clean(i));if(!nu(r,!0))throw new Ii(r,Hc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await W.exists({fs:t,gitdir:e,ref:a}))throw new $i("branch",i,!1);let l=await W.resolve({fs:t,gitdir:e,ref:s,depth:1});await W.writeRef({fs:t,gitdir:e,ref:a,value:l}),await W.deleteRef({fs:t,gitdir:e,ref:s});let u=await Ds({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await W.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function wA({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{C("fs",t),C("gitdir",r),C("ref",i),C("oldref",n);let a=new J(t),o=await ee({fsp:a,dotgit:r});return await y6({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function yA({gitdir:t,type:e,object:r}){return qn(Rs.wrap({type:e,object:r}))}async function bA({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,ref:n,cache:s={}}){try{C("fs",t),C("gitdir",r),C("filepath",i);let a=new J(t),o=await ee({fsp:a,dotgit:r}),l,c;try{l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await su({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(O(e,i));f&&(c=await yA({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(O(e,i)))),await mt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function _A({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,depth:n}){try{C("fs",t),C("gitdir",r),C("ref",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});return await W.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function xA({fs:t,dir:e,gitdir:r=O(e,".git"),path:i,value:n,append:s=!1}){try{C("fs",t),C("gitdir",r),C("path",i);let a=new J(t),o=await ee({fsp:a,dotgit:r}),l=await ct.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await ct.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function SA({fs:t,gitdir:e,commit:r}){let i=kr.from(r).toObject();return await Ar({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var $d=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i} +`}static getStashReflogEntry(e,r=!1){return e.split(` +`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},b6={stage:Aa,workdir:nl},rv;async function il(t,e){return rv===void 0&&(rv=new Nc),rv.acquire(t,e)}async function _6(t,e,r,i,n=null){let s=O(r,i),a=await t.lstat(s);if(!a)throw new He(s);if(a.isDirectory())throw new he(`${s}: file expected, but found directory`);let o=n?await QE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await il({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(sk):await t.read(s);if(c===null)throw new He(s);l=await Ar({fs:t,gitdir:e,type:"blob",object:c})}),l}async function x6({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await au({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await _6(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function zE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?b6[h]():h),a=[],u=await Is({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[m,g])=>{if(!(h==="."||await Fs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!m||await m.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.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;n?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(v):a.push([null,b])):w&&(b?g.push(v):a.push([w,null]))}return g.length?Promise.all(g.map(h)):[]}});if(a.length===0||u.length===0)return null;let d=(await x6({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return au({fs:t,gitdir:r,tree:d})}async function S6({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],o=[],l=await Is({fs:t,cache:{},dir:e,gitdir:r,trees:[Zr({ref:n}),Zr({ref:i})],map:async(c,[u,f])=>{if(c==="."||await Fs.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&o.push({filepath:c,oid:await u.oid()}),{method:m,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(s&&o.push({filepath:c,oid:h,stats:await t.lstat(O(e,c))}),{method:"write",filepath:c,oid:h})}});await il({fs:t,gitdir:r,dirRemoved:a,ops:l},async()=>{for(let c of l){let u=O(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(f=>u.startsWith(f))){let{object:f}=await Ke({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await mt.acquire({fs:t,gitdir:r,cache:{}},async c=>{o.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}var ka=class t{constructor({fs:e,dir:r,gitdir:i=O(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O(this.gitdir,t.refStash)}get refLogsStashPath(){return O(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Os({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Jt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return SA({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Ii(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?el({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return W.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=$d.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await il({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return $d.getStashReflogEntry(r,e)}};async function EA({fs:t,dir:e,gitdir:r,message:i=""}){let n=new ka({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Ds({fs:t,gitdir:r,fullname:!1}),a=await W.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await _v({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Zr({ref:"HEAD"}),d=await zE({fs:t,dir:e,gitdir:r,treePair:[Zr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=Aa()}let h=await zE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new He("changes, nothing to stash");let m=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:m,tree:u,parent:c}),stashMsg:m,branch:s,stashMgr:n}}async function E6({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await EA({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await wv({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function k6({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await EA({fs:t,dir:e,gitdir:r,message:i});return n}async function kA({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new ka({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await il({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(` +`)+` +`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function A6({fs:t,dir:e,gitdir:r}){return new ka({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function T6({fs:t,dir:e,gitdir:r}){let i=new ka({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await il(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function C6({fs:t,dir:e,gitdir:r,refIdx:i=0}){await kA({fs:t,dir:e,gitdir:r,refIdx:i}),await AA({fs:t,dir:e,gitdir:r,refIdx:i})}async function TA({fs:t,dir:e,gitdir:r=O(e,".git"),op:i="push",message:n="",refIdx:s=0}){C("fs",t),C("dir",e),C("gitdir",r),C("op",i);let a={push:E6,apply:kA,drop:AA,list:A6,clear:T6,pop:C6,create:k6},o=["apply","drop","pop"];try{let l=new J(t),c=await ee({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>O(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Ii(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function CA({fs:t,dir:e,gitdir:r=O(e,".git"),filepath:i,cache:n={}}){try{C("fs",t),C("gitdir",r),C("filepath",i);let s=new J(t),a=await ee({fsp:s,dotgit:r});if(await Fs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await P6({fs:s,cache:n,gitdir:a}),c=await PA({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await mt.acquire({fs:s,gitdir:a,cache:n},async function(v){for(let w of v)if(w.path===i)return w;return null}),f=await s.lstat(O(e,i)),d=c!==null,h=u!==null,m=f!==null,g=async()=>{if(h&&!xd(u,f))return u.oid;{let v=await s.read(O(e,i)),w=await yA({gitdir:a,type:"blob",object:v});return h&&u.oid===w&&f.size!==-1&&mt.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:w})}),w}};if(!d&&!m&&!h)return"absent";if(!d&&!m&&h)return"*absent";if(!d&&m&&!h)return"*added";if(!d&&m&&h)return await g()===u.oid?"added":"*added";if(d&&!m&&!h)return"deleted";if(d&&!m&&h)return c===u.oid,"*deleted";if(d&&m&&!h)return await g()===c?"*undeleted":"*undeletemodified";if(d&&m&&h){let v=await g();return v===c?v===u.oid?"unmodified":"*unmodified":v===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function PA({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await Ke({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Er.from(l);return PA({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new hr(a.oid,o,"blob",n.join("/"))}return null}async function P6({fs:t,cache:e,gitdir:r}){let i;try{i=await W.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof He)return[]}let{tree:n}=await sl({fs:t,cache:e,gitdir:r,oid:i});return n}async function RA({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{C("fs",t),C("gitdir",r),C("ref",i);let l=new J(t),c=await ee({fsp:l,dotgit:r});return await Is({fs:l,cache:a,dir:e,gitdir:c,trees:[Zr({ref:i}),nl(),Aa()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Fs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(y=>gk(u,y)))return null;if(s&&!s(u))return;let[m,g,v]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),w=[m,g,v].includes("blob");if((m==="tree"||m==="special")&&!w)return;if(m==="commit")return null;if((g==="tree"||g==="special")&&!w)return;if(v==="commit")return null;if((v==="tree"||v==="special")&&!w)return;let b=m==="blob"?await f.oid():void 0,k=v==="blob"?await h.oid():void 0,x;m!=="blob"&&g==="blob"&&v!=="blob"?x="42":g==="blob"&&(x=await d.oid());let E=[void 0,b,x,k],A=E.map(y=>E.indexOf(y));return A.shift(),[u,...A]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function $A({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,object:n,force:s=!1}){try{C("fs",t),C("gitdir",r),C("ref",i);let a=new J(t);if(i===void 0)throw new Sr("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ee({fsp:a,dotgit:r}),l=await W.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await W.exists({fs:a,gitdir:o,ref:i}))throw new $i("tag",i);await W.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function IA({fs:t,dir:e,gitdir:r=O(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{C("fs",t),C("gitdir",r),C("filepath",n);let u=new J(t),f=await ee({fsp:u,dotgit:r});if(l)return await mt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let m=await u.lstat(O(e,n));if(m){if(m.isDirectory())throw new $s("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(O(e,n)),!d)throw new He(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new $s("directory")}return await mt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new He(`file at "${n}" in index and "add" not set`);let m;if(s)m={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{m=d;let g=m.isSymbolicLink()?await u.readlink(O(e,n)):await u.read(O(e,n));s=await Ar({fs:u,gitdir:f,type:"blob",format:"content",object:g})}return h.insert({filepath:n,oid:s,stats:m}),s})}catch(u){throw u.caller="git.updateIndex",u}}function FA(){try{return Md.version}catch(t){throw t.caller="git.version",t}}async function OA({fs:t,dir:e,gitdir:r=O(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:o={}}){try{C("fs",t),C("gitdir",r),C("trees",i);let l=new J(t),c=await ee({fsp:l,dotgit:r});return await Is({fs:l,cache:o,dir:e,gitdir:c,trees:i,map:n,reduce:s,iterate:a})}catch(l){throw l.caller="git.walk",l}}async function MA({fs:t,dir:e,gitdir:r=O(e,".git"),blob:i}){try{C("fs",t),C("gitdir",r),C("blob",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await Ar({fs:n,gitdir:s,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}async function DA({fs:t,dir:e,gitdir:r=O(e,".git"),commit:i}){try{C("fs",t),C("gitdir",r),C("commit",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await SA({fs:n,gitdir:s,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}async function LA({fs:t,dir:e,gitdir:r=O(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:o=void 0}){try{let l=new J(t),c=await ee({fsp:l,dotgit:r});if(s==="parsed"){switch(i){case"commit":n=kr.from(n).toObject();break;case"tree":n=Er.from(n).toObject();break;case"blob":n=Buffer.from(n,o);break;case"tag":n=Kr.from(n).toObject();break;default:throw new hr(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await Ar({fs:l,gitdir:c,type:i,object:n,oid:a,format:s}),a}catch(l){throw l.caller="git.writeObject",l}}async function BA({fs:t,dir:e,gitdir:r=O(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{C("fs",t),C("gitdir",r),C("ref",i),C("value",n);let o=new J(t);if(!nu(i,!0))throw new Ii(i,Hc.clean(i));let l=await ee({fsp:o,dotgit:r});if(!s&&await W.exists({fs:o,gitdir:l,ref:i}))throw new $i("ref",i);a?await W.writeSymbolicRef({fs:o,gitdir:l,ref:i,value:n}):(n=await W.resolve({fs:o,gitdir:l,ref:n}),await W.writeRef({fs:o,gitdir:l,ref:i,value:n}))}catch(o){throw o.caller="git.writeRef",o}}async function R6({fs:t,gitdir:e,tag:r}){let i=Kr.from(r).toObject();return await Ar({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}async function NA({fs:t,dir:e,gitdir:r=O(e,".git"),tag:i}){try{C("fs",t),C("gitdir",r),C("tag",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await R6({fs:n,gitdir:s,tag:i})}catch(n){throw n.caller="git.writeTag",n}}async function HA({fs:t,dir:e,gitdir:r=O(e,".git"),tree:i}){try{C("fs",t),C("gitdir",r),C("tree",i);let n=new J(t),s=await ee({fsp:n,dotgit:r});return await au({fs:n,gitdir:s,tree:i})}catch(n){throw n.caller="git.writeTree",n}}var $6={Errors:tk,STAGE:Aa,TREE:Zr,WORKDIR:nl,add:ak,abortMerge:ik,addNote:fk,addRemote:hk,annotatedTag:pk,branch:mk,checkout:wv,clone:_k,commit:xk,getConfig:Lk,getConfigAll:Bk,setConfig:xA,currentBranch:Sk,deleteBranch:Ek,deleteRef:kk,deleteRemote:Ak,deleteTag:Tk,expandOid:Ck,expandRef:Pk,fastForward:Ik,fetch:Fk,findMergeBase:Ok,findRoot:Dk,getRemoteInfo:Nk,getRemoteInfo2:Uk,hashBlob:Gk,indexPack:jk,init:qk,isDescendent:Vk,isIgnored:Wk,listBranches:Yk,listFiles:Zk,listNotes:Kk,listRefs:Qk,listRemotes:Jk,listServerRefs:eA,listTags:tA,log:iA,merge:nA,packObjects:aA,pull:oA,push:lA,readBlob:fA,readCommit:_v,readNote:dA,readObject:hA,readTag:pA,readTree:mA,remove:gA,removeNote:vA,renameBranch:wA,resetIndex:bA,updateIndex:IA,resolveRef:_A,status:CA,statusMatrix:RA,tag:$A,version:FA,walk:OA,writeBlob:MA,writeCommit:DA,writeObject:LA,writeRef:BA,writeTag:NA,writeTree:HA,stash:TA};X.Errors=tk;X.STAGE=Aa;X.TREE=Zr;X.WORKDIR=nl;X.abortMerge=ik;X.add=ak;X.addNote=fk;X.addRemote=hk;X.annotatedTag=pk;X.branch=mk;X.checkout=wv;X.clone=_k;X.commit=xk;X.currentBranch=Sk;X.default=$6;X.deleteBranch=Ek;X.deleteRef=kk;X.deleteRemote=Ak;X.deleteTag=Tk;X.expandOid=Ck;X.expandRef=Pk;X.fastForward=Ik;X.fetch=Fk;X.findMergeBase=Ok;X.findRoot=Dk;X.getConfig=Lk;X.getConfigAll=Bk;X.getRemoteInfo=Nk;X.getRemoteInfo2=Uk;X.hashBlob=Gk;X.indexPack=jk;X.init=qk;X.isDescendent=Vk;X.isIgnored=Wk;X.listBranches=Yk;X.listFiles=Zk;X.listNotes=Kk;X.listRefs=Qk;X.listRemotes=Jk;X.listServerRefs=eA;X.listTags=tA;X.log=iA;X.merge=nA;X.packObjects=aA;X.pull=oA;X.push=lA;X.readBlob=fA;X.readCommit=_v;X.readNote=dA;X.readObject=hA;X.readTag=pA;X.readTree=mA;X.remove=gA;X.removeNote=vA;X.renameBranch=wA;X.resetIndex=bA;X.resolveRef=_A;X.setConfig=xA;X.stash=TA;X.status=CA;X.statusMatrix=RA;X.tag=$A;X.updateIndex=IA;X.version=FA;X.walk=OA;X.writeBlob=MA;X.writeCommit=DA;X.writeObject=LA;X.writeRef=BA;X.writeTag=NA;X.writeTree=HA});var QA=I((HZ,KA)=>{"use strict";p();KA.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var eT=I((GZ,JA)=>{p();var Dv={px:{px:1,cm:37.79527559055118,mm:3.7795275590551185,in:96,pt:1.3333333333333333,pc:16},cm:{px:.026458333333333334,cm:1,mm:.1,in:2.54,pt:.035277777777777776,pc:.42333333333333334},mm:{px:.26458333333333334,cm:10,mm:1,in:25.4,pt:.35277777777777775,pc:4.233333333333333},in:{px:.010416666666666666,cm:.39370078740157477,mm:.03937007874015748,in:1,pt:.013888888888888888,pc:.16666666666666666},pt:{px:.75,cm:28.346456692913385,mm:2.834645669291339,in:72,pt:1,pc:12},pc:{px:.0625,cm:2.3622047244094486,mm:.2362204724409449,in:6,pt:.08333333333333333,pc:1},deg:{deg:1,grad:.9,rad:180/Math.PI,turn:360},grad:{deg:1.1111111111111112,grad:1,rad:200/Math.PI,turn:400},rad:{deg:Math.PI/180,grad:Math.PI/200,rad:1,turn:Math.PI*2},turn:{deg:.002777777777777778,grad:.0025,rad:.5/Math.PI,turn:1},s:{s:1,ms:.001},ms:{s:1e3,ms:1},Hz:{Hz:1,kHz:1e3},kHz:{Hz:.001,kHz:1},dpi:{dpi:1,dpcm:.39370078740157477,dppx:.010416666666666666},dpcm:{dpi:2.54,dpcm:1,dppx:.026458333333333334},dppx:{dpi:96,dpcm:37.79527559055118,dppx:1}};JA.exports=function(t,e,r,i){if(!Dv.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!Dv[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var n=Dv[r][e]*t;return i!==!1?(i=Math.pow(10,parseInt(i)||5),Math.round(n*i)/i):n}});var pT=I(Vn=>{"use strict";p();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.fromRgba=ul;Vn.fromRgb=Lv;Vn.fromHsla=zd;Vn.fromHsl=dT;Vn.fromString=hT;Vn.default=void 0;var tT=nT(QA()),H6=nT(eT());function nT(t){return t&&t.__esModule?t:{default:t}}function U6(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rT(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r-1}function W6(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}}();return[f*60,u*100,c*100]}function Y6(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]}(),u=pr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var X6=function(){function t(e){var r=pr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];U6(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return G6(t,[{key:"toRgbString",value:function(){var r=pr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=pr(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=pr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=pr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=W6(i,n,s),l=pr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t}();function ul(t){var e=pr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new X6([r,i,n,s])}function Lv(t){var e=pr(t,3),r=e[0],i=e[1],n=e[2];return ul([r,i,n,1])}function zd(t){var e=pr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=Y6(r,i,n),o=pr(a,3),l=o[0],c=o[1],u=o[2];return ul([l,c,u,s])}function dT(t){var e=pr(t,3),r=e[0],i=e[1],n=e[2];return zd([r,i,n,1])}function Z6(t){var e=sT.exec(t)||aT.exec(t),r=pr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,ul([i,n,s,a])}function K6(t){var e=oT.exec(t)||cT.exec(t)||lT.exec(t)||uT.exec(t),r=pr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=uu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=uu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=uu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(uu(a,"%")?100:1),ul([i,n,s,a])}function Q6(t){var e=fT.exec(t),r=pr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,H6.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(uu(o,"%")?100:1),zd([i,s,a,o])}function hT(t){return tT.default[t]?Lv(tT.default[t]):sT.test(t)||aT.test(t)?Z6(t):oT.test(t)||cT.test(t)||lT.test(t)||uT.test(t)?K6(t):fT.test(t)?Q6(t):null}var J6={fromString:hT,fromRgb:Lv,fromRgba:ul,fromHsl:dT,fromHsla:zd};Vn.default=J6});var Bv=I((VZ,gT)=>{"use strict";p();var mT=Object.prototype.toString;gT.exports=function(e){var r=mT.call(e),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&mT.call(e.callee)==="[object Function]"),i}});var kT=I((YZ,ET)=>{"use strict";p();var ST;Object.keys||(fu=Object.prototype.hasOwnProperty,Nv=Object.prototype.toString,vT=Bv(),Hv=Object.prototype.propertyIsEnumerable,wT=!Hv.call({toString:null},"toString"),yT=Hv.call(function(){},"prototype"),du=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Vd=function(t){var e=t.constructor;return e&&e.prototype===t},bT={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},_T=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!bT["$"+t]&&fu.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{Vd(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),xT=function(t){if(typeof window=="undefined"||!_T)return Vd(t);try{return Vd(t)}catch(e){return!1}},ST=function(e){var r=e!==null&&typeof e=="object",i=Nv.call(e)==="[object Function]",n=vT(e),s=r&&Nv.call(e)==="[object String]",a=[];if(!r&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var o=yT&&i;if(s&&e.length>0&&!fu.call(e,0))for(var l=0;l0)for(var c=0;c{"use strict";p();var e5=Array.prototype.slice,t5=Bv(),AT=Object.keys,Wd=AT?function(e){return AT(e)}:kT(),TT=Object.keys;Wd.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(i){return t5(i)?TT(e5.call(i)):TT(i)})}else Object.keys=Wd;return Object.keys||Wd};CT.exports=Wd});var Ns=I((QZ,IT)=>{"use strict";p();var r5=Yd(),i5=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",n5=Object.prototype.toString,s5=Array.prototype.concat,PT=Wf(),a5=function(t){return typeof t=="function"&&n5.call(t)==="[object Function]"},RT=Yf()(),o5=function(t,e,r,i){if(e in t){if(i===!0){if(t[e]===r)return}else if(!a5(i)||!i())return}RT?PT(t,e,r,!0):PT(t,e,r)},$T=function(t,e){var r=arguments.length>2?arguments[2]:{},i=r5(e);i5&&(i=s5.call(i,Object.getOwnPropertySymbols(e)));for(var n=0;n{"use strict";p();var l5=Yd(),OT=vc()(),MT=Bt(),Xd=Ff(),c5=MT("Array.prototype.push"),FT=MT("Object.prototype.propertyIsEnumerable"),u5=OT?Xd.getOwnPropertySymbols:null;DT.exports=function(e,r){if(e==null)throw new TypeError("target must be an object");var i=Xd(e);if(arguments.length===1)return i;for(var n=1;n{"use strict";p();var Gv=Uv(),f5=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},i=0;i{"use strict";p();var h5=Ns(),p5=jv();BT.exports=function(){var e=p5();return h5(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var jT=I((aK,GT)=>{"use strict";p();var m5=Ns(),g5=fa(),v5=Uv(),HT=jv(),w5=NT(),y5=g5.apply(HT()),UT=function(e,r){return y5(Object,arguments)};m5(UT,{getPolyfill:HT,implementation:v5,shim:w5});GT.exports=UT});var qv=I((lK,VT)=>{"use strict";p();var qT=tn(),zT=fa(),b5=zT(qT("String.prototype.indexOf"));VT.exports=function(e,r){var i=qT(e,!!r);return typeof i=="function"&&b5(e,".prototype.")>-1?zT(i):i}});var YT=I((uK,WT)=>{"use strict";p();var pu=function(){return typeof function(){}.name=="string"},hu=Object.getOwnPropertyDescriptor;if(hu)try{hu([],"length")}catch(t){hu=null}pu.functionsHaveConfigurableNames=function(){if(!pu()||!hu)return!1;var e=hu(function(){},"name");return!!e&&!!e.configurable};var _5=Function.prototype.bind;pu.boundFunctionsHaveNames=function(){return pu()&&typeof _5=="function"&&function(){}.bind().name!==""};WT.exports=pu});var KT=I((dK,ZT)=>{"use strict";p();var XT=Wf(),x5=Yf()(),S5=YT().functionsHaveConfigurableNames(),E5=_r();ZT.exports=function(e,r){if(typeof e!="function")throw new E5("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||S5)&&(x5?XT(e,"name",r,!0,!0):XT(e,"name",r)),e}});var zv=I((pK,QT)=>{"use strict";p();var k5=KT(),A5=_r(),T5=Object;QT.exports=k5(function(){if(this==null||this!==T5(this))throw new A5("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var Vv=I((gK,JT)=>{"use strict";p();var C5=zv(),P5=Ns().supportsDescriptors,R5=Object.getOwnPropertyDescriptor;JT.exports=function(){if(P5&&/a/mig.flags==="gim"){var e=R5(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(i,"sticky",{get:function(){r+="y"}}),e.get.call(i),r==="dy")return e.get}}return C5}});var rC=I((wK,tC)=>{"use strict";p();var $5=Ns().supportsDescriptors,I5=Vv(),F5=ys(),O5=Object.defineProperty,M5=Um(),eC=Uf(),D5=/a/;tC.exports=function(){if(!$5||!eC)throw new M5("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=I5(),r=eC(D5),i=F5(r,"flags");return(!i||i.get!==e)&&O5(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var aC=I((bK,sC)=>{"use strict";p();var L5=Ns(),B5=fa(),N5=zv(),iC=Vv(),H5=rC(),nC=B5(iC());L5(nC,{getPolyfill:iC,implementation:N5,shim:H5});sC.exports=nC});var Yv=I((xK,lC)=>{"use strict";p();var U5=bs()(),G5=Bt(),Wv=G5("Object.prototype.toString"),Zd=function(e){return U5&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Wv(e)==="[object Arguments]"},oC=function(e){return Zd(e)?!0:e!==null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&Wv(e)!=="[object Array]"&&"callee"in e&&Wv(e.callee)==="[object Function]"},j5=function(){return Zd(arguments)}();Zd.isLegacyArguments=oC;lC.exports=j5?Zd:oC});var cC=I(()=>{p()});var yu=I((TK,PC)=>{p();var nw=typeof Map=="function"&&Map.prototype,Xv=Object.getOwnPropertyDescriptor&&nw?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Qd=nw&&Xv&&typeof Xv.get=="function"?Xv.get:null,uC=nw&&Map.prototype.forEach,sw=typeof Set=="function"&&Set.prototype,Zv=Object.getOwnPropertyDescriptor&&sw?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Jd=sw&&Zv&&typeof Zv.get=="function"?Zv.get:null,fC=sw&&Set.prototype.forEach,q5=typeof WeakMap=="function"&&WeakMap.prototype,gu=q5?WeakMap.prototype.has:null,z5=typeof WeakSet=="function"&&WeakSet.prototype,vu=z5?WeakSet.prototype.has:null,V5=typeof WeakRef=="function"&&WeakRef.prototype,dC=V5?WeakRef.prototype.deref:null,W5=Boolean.prototype.valueOf,Y5=Object.prototype.toString,X5=Function.prototype.toString,Z5=String.prototype.match,aw=String.prototype.slice,Hs=String.prototype.replace,K5=String.prototype.toUpperCase,hC=String.prototype.toLowerCase,xC=RegExp.prototype.test,pC=Array.prototype.concat,fn=Array.prototype.join,Q5=Array.prototype.slice,mC=Math.floor,Jv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Kv=Object.getOwnPropertySymbols,ew=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,fl=typeof Symbol=="function"&&typeof Symbol.iterator=="object",wu=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===fl||!0)?Symbol.toStringTag:null,SC=Object.prototype.propertyIsEnumerable,gC=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function vC(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||xC.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var i=t<0?-mC(-t):mC(t);if(i!==t){var n=String(i),s=aw.call(e,n.length+1);return Hs.call(n,r,"$&_")+"."+Hs.call(Hs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Hs.call(e,r,"$&_")}var tw=cC(),wC=tw.custom,yC=AC(wC)?wC:null,EC={__proto__:null,double:'"',single:"'"},J5={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};PC.exports=function t(e,r,i,n){var s=r||{};if(Wn(s,"quoteStyle")&&!Wn(EC,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Wn(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=Wn(s,"customInspect")?s.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Wn(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Wn(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=s.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return CC(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?vC(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?vC(e,c):c}var u=typeof s.depth=="undefined"?5:s.depth;if(typeof i=="undefined"&&(i=0),i>=u&&u>0&&typeof e=="object")return rw(e)?"[Array]":"[Object]";var f=v4(s,i);if(typeof n=="undefined")n=[];else if(TC(n,e)>=0)return"[Circular]";function d(B,N,ce){if(N&&(n=Q5.call(n),n.push(N)),ce){var Pe={depth:s.depth};return Wn(s,"quoteStyle")&&(Pe.quoteStyle=s.quoteStyle),t(B,Pe,i+1,n)}return t(B,s,i+1,n)}if(typeof e=="function"&&!bC(e)){var h=l4(e),m=Kd(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(m.length>0?" { "+fn.call(m,", ")+" }":"")}if(AC(e)){var g=fl?Hs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ew.call(e);return typeof e=="object"&&!fl?mu(g):g}if(p4(e)){for(var v="<"+hC.call(String(e.nodeName)),w=e.attributes||[],b=0;b",v}if(rw(e)){if(e.length===0)return"[]";var k=Kd(e,d);return f&&!g4(k)?"["+iw(k,f)+"]":"[ "+fn.call(k,", ")+" ]"}if(r4(e)){var x=Kd(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!SC.call(e,"cause")?"{ ["+String(e)+"] "+fn.call(pC.call("[cause]: "+d(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+fn.call(x,", ")+" }"}if(typeof e=="object"&&a){if(yC&&typeof e[yC]=="function"&&tw)return tw(e,{depth:u-i});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(c4(e)){var E=[];return uC&&uC.call(e,function(B,N){E.push(d(N,e,!0)+" => "+d(B,e))}),_C("Map",Qd.call(e),E,f)}if(d4(e)){var A=[];return fC&&fC.call(e,function(B){A.push(d(B,e))}),_C("Set",Jd.call(e),A,f)}if(u4(e))return Qv("WeakMap");if(h4(e))return Qv("WeakSet");if(f4(e))return Qv("WeakRef");if(n4(e))return mu(d(Number(e)));if(a4(e))return mu(d(Jv.call(e)));if(s4(e))return mu(W5.call(e));if(i4(e))return mu(d(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof global!="undefined"&&e===global)return"{ [object globalThis] }";if(!t4(e)&&!bC(e)){var y=Kd(e,d),S=gC?gC(e)===Object.prototype:e instanceof Object||e.constructor===Object,_=e instanceof Object?"":"null prototype",T=!S&&wu&&Object(e)===e&&wu in e?aw.call(Us(e),8,-1):_?"Object":"",P=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",D=P+(T||_?"["+fn.call(pC.call([],T||[],_||[]),": ")+"] ":"");return y.length===0?D+"{}":f?D+"{"+iw(y,f)+"}":D+"{ "+fn.call(y,", ")+" }"}return String(e)};function kC(t,e,r){var i=r.quoteStyle||e,n=EC[i];return n+t+n}function e4(t){return Hs.call(String(t),/"/g,""")}function Ca(t){return!wu||!(typeof t=="object"&&(wu in t||typeof t[wu]!="undefined"))}function rw(t){return Us(t)==="[object Array]"&&Ca(t)}function t4(t){return Us(t)==="[object Date]"&&Ca(t)}function bC(t){return Us(t)==="[object RegExp]"&&Ca(t)}function r4(t){return Us(t)==="[object Error]"&&Ca(t)}function i4(t){return Us(t)==="[object String]"&&Ca(t)}function n4(t){return Us(t)==="[object Number]"&&Ca(t)}function s4(t){return Us(t)==="[object Boolean]"&&Ca(t)}function AC(t){if(fl)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!ew)return!1;try{return ew.call(t),!0}catch(e){}return!1}function a4(t){if(!t||typeof t!="object"||!Jv)return!1;try{return Jv.call(t),!0}catch(e){}return!1}var o4=Object.prototype.hasOwnProperty||function(t){return t in this};function Wn(t,e){return o4.call(t,e)}function Us(t){return Y5.call(t)}function l4(t){if(t.name)return t.name;var e=Z5.call(X5.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function TC(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,i=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return CC(aw.call(t,0,e.maxStringLength),e)+i}var n=J5[e.quoteStyle||"single"];n.lastIndex=0;var s=Hs.call(Hs.call(t,n,"\\$1"),/[\x00-\x1f]/g,m4);return kC(s,"single",e)}function m4(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+K5.call(e.toString(16))}function mu(t){return"Object("+t+")"}function Qv(t){return t+" { ? }"}function _C(t,e,r,i){var n=i?iw(r,i):fn.call(r,", ");return t+" ("+e+") {"+n+"}"}function g4(t){for(var e=0;e=0)return!1;return!0}function v4(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=fn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:fn.call(Array(e+1),r)}}function iw(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+fn.call(t,","+r)+` +`+e.prev}function Kd(t,e){var r=rw(t),i=[];if(r){i.length=t.length;for(var n=0;n{"use strict";p();var w4=yu(),y4=_r(),eh=function(t,e,r){for(var i=t,n;(n=i.next)!=null;i=n)if(n.key===e)return i.next=n.next,r||(n.next=t.next,t.next=n),n},b4=function(t,e){if(t){var r=eh(t,e);return r&&r.value}},_4=function(t,e,r){var i=eh(t,e);i?i.value=r:t.next={key:e,next:t.next,value:r}},x4=function(t,e){return t?!!eh(t,e):!1},S4=function(t,e){if(t)return eh(t,e,!0)};RC.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new y4("Side channel does not contain "+w4(i))},delete:function(i){var n=e&&e.next,s=S4(e,i);return s&&n&&n===s&&(e=void 0),!!s},get:function(i){return b4(e,i)},has:function(i){return x4(e,i)},set:function(i,n){e||(e={next:void 0}),_4(e,i,n)}};return r}});var ow=I(($K,FC)=>{"use strict";p();var E4=tn(),bu=Bt(),k4=yu(),A4=_r(),IC=E4("%Map%",!0),T4=bu("Map.prototype.get",!0),C4=bu("Map.prototype.set",!0),P4=bu("Map.prototype.has",!0),R4=bu("Map.prototype.delete",!0),$4=bu("Map.prototype.size",!0);FC.exports=!!IC&&function(){var e,r={assert:function(i){if(!r.has(i))throw new A4("Side channel does not contain "+k4(i))},delete:function(i){if(e){var n=R4(e,i);return $4(e)===0&&(e=void 0),n}return!1},get:function(i){if(e)return T4(e,i)},has:function(i){return e?P4(e,i):!1},set:function(i,n){e||(e=new IC),C4(e,i,n)}};return r}});var MC=I((FK,OC)=>{"use strict";p();var I4=tn(),rh=Bt(),F4=yu(),th=ow(),O4=_r(),dl=I4("%WeakMap%",!0),M4=rh("WeakMap.prototype.get",!0),D4=rh("WeakMap.prototype.set",!0),L4=rh("WeakMap.prototype.has",!0),B4=rh("WeakMap.prototype.delete",!0);OC.exports=dl?function(){var e,r,i={assert:function(n){if(!i.has(n))throw new O4("Side channel does not contain "+F4(n))},delete:function(n){if(dl&&n&&(typeof n=="object"||typeof n=="function")){if(e)return B4(e,n)}else if(th&&r)return r.delete(n);return!1},get:function(n){return dl&&n&&(typeof n=="object"||typeof n=="function")&&e?M4(e,n):r&&r.get(n)},has:function(n){return dl&&n&&(typeof n=="object"||typeof n=="function")&&e?L4(e,n):!!r&&r.has(n)},set:function(n,s){dl&&n&&(typeof n=="object"||typeof n=="function")?(e||(e=new dl),D4(e,n,s)):th&&(r||(r=th()),r.set(n,s))}};return i}:th});var lw=I((MK,DC)=>{"use strict";p();var N4=_r(),H4=yu(),U4=$C(),G4=ow(),j4=MC(),q4=j4||G4||U4;DC.exports=function(){var e,r={assert:function(i){if(!r.has(i))throw new N4("Side channel does not contain "+H4(i))},delete:function(i){return!!e&&e.delete(i)},get:function(i){return e&&e.get(i)},has:function(i){return!!e&&e.has(i)},set:function(i,n){e||(e=q4()),e.set(i,n)}};return r}});var BC=I((LK,LC)=>{"use strict";p();var z4=Gf(),_u=lw()(),Yn=_r(),cw={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Yn("`O` is not an object");if(typeof e!="string")throw new Yn("`slot` must be a string");if(_u.assert(t),!cw.has(t,e))throw new Yn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Yn("`O` is not an object");if(typeof e!="string")throw new Yn("`slot` must be a string");var r=_u.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Yn("`O` is not an object");if(typeof e!="string")throw new Yn("`slot` must be a string");var r=_u.get(t);return!!r&&z4(r,"$"+e)},set:function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Yn("`O` is not an object");if(typeof e!="string")throw new Yn("`slot` must be a string");var i=_u.get(t);i||(i={},_u.set(t,i)),i["$"+e]=r}};Object.freeze&&Object.freeze(cw);LC.exports=cw});var UC=I((NK,HC)=>{"use strict";p();var xu=BC(),V4=Of(),NC=typeof StopIteration=="object"?StopIteration:null;HC.exports=function(e){if(!NC)throw new V4("this environment lacks StopIteration");xu.set(e,"[[Done]]",!1);var r={next:function(){var n=xu.get(this,"[[Iterator]]"),s=!!xu.get(n,"[[Done]]");try{return{done:s,value:s?void 0:n.next()}}catch(a){if(xu.set(n,"[[Done]]",!0),a!==NC)throw a;return{done:!0,value:void 0}}}};return xu.set(r,"[[Iterator]]",e),r}});var uw=I((UK,jC)=>{"use strict";p();var GC=Bt(),W4=GC("String.prototype.valueOf"),Y4=function(e){try{return W4(e),!0}catch(r){return!1}},X4=GC("Object.prototype.toString"),Z4="[object String]",K4=bs()();jC.exports=function(e){return typeof e=="string"?!0:!e||typeof e!="object"?!1:K4?Y4(e):X4(e)===Z4}});var dw=I((jK,VC)=>{"use strict";p();var fw=typeof Map=="function"&&Map.prototype?Map:null,Q4=typeof Set=="function"&&Set.prototype?Set:null,ih;fw||(ih=function(e){return!1});var zC=fw?Map.prototype.has:null,qC=Q4?Set.prototype.has:null;!ih&&!zC&&(ih=function(e){return!1});VC.exports=ih||function(e){if(!e||typeof e!="object")return!1;try{if(zC.call(e),qC)try{qC.call(e)}catch(r){return!0}return e instanceof fw}catch(r){}return!1}});var pw=I((zK,XC)=>{"use strict";p();var J4=typeof Map=="function"&&Map.prototype?Map:null,hw=typeof Set=="function"&&Set.prototype?Set:null,nh;hw||(nh=function(e){return!1});var WC=J4?Map.prototype.has:null,YC=hw?Set.prototype.has:null;!nh&&!YC&&(nh=function(e){return!1});XC.exports=nh||function(e){if(!e||typeof e!="object")return!1;try{if(YC.call(e),WC)try{WC.call(e)}catch(r){return!0}return e instanceof hw}catch(r){}return!1}});var o2=I((WK,oh)=>{"use strict";p();var ZC=Yv(),KC=UC();Lf()()||vc()()?(sh=Symbol.iterator,oh.exports=function(e){if(e!=null&&typeof e[sh]!="undefined")return e[sh]();if(ZC(e))return Array.prototype[sh].call(e)}):(QC=If(),JC=uw(),mw=tn(),e2=mw("%Map%",!0),t2=mw("%Set%",!0),vi=qv(),gw=vi("Array.prototype.push"),vw=vi("String.prototype.charCodeAt"),r2=vi("String.prototype.slice"),i2=function(e,r){var i=e.length;if(r+1>=i)return r+1;var n=vw(e,r);if(n<55296||n>56319)return r+1;var s=vw(e,r+1);return s<56320||s>57343?r+1:r+2},ah=function(e){var r=0;return{next:function(){var n=r>=e.length,s;return n||(s=e[r],r+=1),{done:n,value:s}}}},ww=function(e,r){if(QC(e)||ZC(e))return ah(e);if(JC(e)){var i=0;return{next:function(){var s=i2(e,i),a=r2(e,i,s);return i=s,{done:s>e.length,value:a}}}}if(r&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!e2&&!t2?oh.exports=function(e){if(e!=null)return ww(e,!0)}:(n2=dw(),s2=pw(),yw=vi("Map.prototype.forEach",!0),bw=vi("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(_w=vi("Map.prototype.iterator",!0),xw=vi("Set.prototype.iterator",!0)),Sw=vi("Map.prototype.@@iterator",!0)||vi("Map.prototype._es6-shim iterator_",!0),Ew=vi("Set.prototype.@@iterator",!0)||vi("Set.prototype._es6-shim iterator_",!0),a2=function(e){if(n2(e)){if(_w)return KC(_w(e));if(Sw)return Sw(e);if(yw){var r=[];return yw(e,function(n,s){gw(r,[s,n])}),ah(r)}}if(s2(e)){if(xw)return KC(xw(e));if(Ew)return Ew(e);if(bw){var i=[];return bw(e,function(n){gw(i,n)}),ah(i)}}},oh.exports=function(e){return a2(e)||ww(e)}));var sh,QC,JC,mw,e2,t2,vi,gw,vw,r2,i2,ah,ww,n2,s2,yw,bw,_w,xw,Sw,Ew,a2});var kw=I((XK,c2)=>{"use strict";p();var l2=function(t){return t!==t};c2.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||l2(e)&&l2(r))}});var Aw=I((KK,u2)=>{"use strict";p();var eU=kw();u2.exports=function(){return typeof Object.is=="function"?Object.is:eU}});var d2=I((JK,f2)=>{"use strict";p();var tU=Aw(),rU=Ns();f2.exports=function(){var e=tU();return rU(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var g2=I((tQ,m2)=>{"use strict";p();var iU=Ns(),nU=fa(),sU=kw(),h2=Aw(),aU=d2(),p2=nU(h2(),Object);iU(p2,{getPolyfill:h2,implementation:sU,shim:aU});m2.exports=p2});var Cw=I((iQ,b2)=>{"use strict";p();var oU=fa(),y2=Bt(),lU=tn(),Tw=lU("%ArrayBuffer%",!0),lh=y2("ArrayBuffer.prototype.byteLength",!0),cU=y2("Object.prototype.toString"),v2=!!Tw&&!lh&&new Tw(0).slice,w2=!!v2&&oU(v2);b2.exports=lh||w2?function(e){if(!e||typeof e!="object")return!1;try{return lh?lh(e):w2(e,0),!0}catch(r){return!1}}:Tw?function(e){return cU(e)==="[object ArrayBuffer]"}:function(e){return!1}});var S2=I((sQ,x2)=>{"use strict";p();var _2=Bt(),uU=_2("Date.prototype.getDay"),fU=function(e){try{return uU(e),!0}catch(r){return!1}},dU=_2("Object.prototype.toString"),hU="[object Date]",pU=bs()();x2.exports=function(e){return typeof e!="object"||e===null?!1:pU?fU(e):dU(e)===hU}});var Iw=I((oQ,C2)=>{"use strict";p();var E2=Bt(),mU=bs()(),gU=Gf(),vU=ys(),$w;mU?(k2=E2("RegExp.prototype.exec"),Pw={},ch=function(){throw Pw},Rw={toString:ch,valueOf:ch},typeof Symbol.toPrimitive=="symbol"&&(Rw[Symbol.toPrimitive]=ch),$w=function(e){if(!e||typeof e!="object")return!1;var r=vU(e,"lastIndex"),i=r&&gU(r,"value");if(!i)return!1;try{k2(e,Rw)}catch(n){return n===Pw}}):(A2=E2("Object.prototype.toString"),T2="[object RegExp]",$w=function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:A2(e)===T2});var k2,Pw,ch,Rw,A2,T2;C2.exports=$w});var $2=I((cQ,R2)=>{"use strict";p();var wU=Bt(),P2=wU("SharedArrayBuffer.prototype.byteLength",!0);R2.exports=P2?function(e){if(!e||typeof e!="object")return!1;try{return P2(e),!0}catch(r){return!1}}:function(e){return!1}});var O2=I((fQ,F2)=>{"use strict";p();var I2=Bt(),yU=I2("Number.prototype.toString"),bU=function(e){try{return yU(e),!0}catch(r){return!1}},_U=I2("Object.prototype.toString"),xU="[object Number]",SU=bs()();F2.exports=function(e){return typeof e=="number"?!0:!e||typeof e!="object"?!1:SU?bU(e):_U(e)===xU}});var L2=I((hQ,D2)=>{"use strict";p();var M2=Bt(),EU=M2("Boolean.prototype.toString"),kU=M2("Object.prototype.toString"),AU=function(e){try{return EU(e),!0}catch(r){return!1}},TU="[object Boolean]",CU=bs()();D2.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:CU?AU(e):kU(e)===TU}});var N2=I((mQ,B2)=>{"use strict";p();var PU=Bt(),RU=Iw(),$U=PU("RegExp.prototype.exec"),IU=_r();B2.exports=function(e){if(!RU(e))throw new IU("`regex` must be a RegExp");return function(i){return $U(e,i)!==null}}});var q2=I((vQ,Fw)=>{"use strict";p();var j2=Bt(),FU=j2("Object.prototype.toString"),OU=Lf()(),MU=N2();OU?(H2=j2("Symbol.prototype.toString"),U2=MU(/^Symbol\(.*\)$/),G2=function(e){return typeof e.valueOf()!="symbol"?!1:U2(H2(e))},Fw.exports=function(e){if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||FU(e)!=="[object Symbol]")return!1;try{return G2(e)}catch(r){return!1}}):Fw.exports=function(e){return!1};var H2,U2,G2});var W2=I((yQ,V2)=>{"use strict";p();var z2=typeof BigInt!="undefined"&&BigInt;V2.exports=function(){return typeof z2=="function"&&typeof BigInt=="function"&&typeof z2(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var Z2=I((_Q,Ow)=>{"use strict";p();var DU=W2()();DU?(Y2=BigInt.prototype.valueOf,X2=function(e){try{return Y2.call(e),!0}catch(r){}return!1},Ow.exports=function(e){return e===null||typeof e=="undefined"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:X2(e)}):Ow.exports=function(e){return!1};var Y2,X2});var Q2=I((SQ,K2)=>{"use strict";p();var LU=uw(),BU=O2(),NU=L2(),HU=q2(),UU=Z2();K2.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(LU(e))return"String";if(BU(e))return"Number";if(NU(e))return"Boolean";if(HU(e))return"Symbol";if(UU(e))return"BigInt"}});var tP=I((kQ,eP)=>{"use strict";p();var uh=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,J2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,fh;uh||(fh=function(e){return!1});var Dw=uh?uh.prototype.has:null,Mw=J2?J2.prototype.has:null;!fh&&!Dw&&(fh=function(e){return!1});eP.exports=fh||function(e){if(!e||typeof e!="object")return!1;try{if(Dw.call(e,Dw),Mw)try{Mw.call(e,Mw)}catch(r){return!0}return e instanceof uh}catch(r){}return!1}});var iP=I((TQ,Bw)=>{"use strict";p();var GU=tn(),rP=Bt(),jU=GU("%WeakSet%",!0),Lw=rP("WeakSet.prototype.has",!0);Lw?(dh=rP("WeakMap.prototype.has",!0),Bw.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Lw(e,Lw),dh)try{dh(e,dh)}catch(r){return!0}return e instanceof jU}catch(r){}return!1}):Bw.exports=function(e){return!1};var dh});var sP=I((PQ,nP)=>{"use strict";p();var qU=dw(),zU=pw(),VU=tP(),WU=iP();nP.exports=function(e){if(e&&typeof e=="object"){if(qU(e))return"Map";if(zU(e))return"Set";if(VU(e))return"WeakMap";if(WU(e))return"WeakSet"}return!1}});var lP=I(($Q,oP)=>{"use strict";p();var YU=Bt(),aP=YU("ArrayBuffer.prototype.byteLength",!0),XU=Cw();oP.exports=function(e){return XU(e)?aP?aP(e):e.byteLength:NaN}});var FP=I((FQ,IP)=>{"use strict";p();var PP=jT(),dn=qv(),cP=aC(),ZU=tn(),hl=o2(),KU=lw(),uP=g2(),fP=Yv(),dP=If(),hP=Cw(),pP=S2(),mP=Iw(),gP=$2(),vP=Yd(),wP=Q2(),yP=sP(),bP=ig(),_P=lP(),xP=dn("SharedArrayBuffer.prototype.byteLength",!0),SP=dn("Date.prototype.getTime"),Nw=Object.getPrototypeOf,EP=dn("Object.prototype.toString"),ph=ZU("%Set%",!0),Hw=dn("Map.prototype.has",!0),mh=dn("Map.prototype.get",!0),kP=dn("Map.prototype.size",!0),gh=dn("Set.prototype.add",!0),RP=dn("Set.prototype.delete",!0),vh=dn("Set.prototype.has",!0),hh=dn("Set.prototype.size",!0);function AP(t,e,r,i){for(var n=hl(t),s;(s=n.next())&&!s.done;)if(Oi(e,s.value,r,i))return RP(t,s.value),!0;return!1}function $P(t){if(typeof t=="undefined")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function QU(t,e,r,i,n,s){var a=$P(r);if(a!=null)return a;var o=mh(e,a),l=PP({},n,{strict:!1});return typeof o=="undefined"&&!Hw(e,a)||!Oi(i,o,l,s)?!1:!Hw(t,a)&&Oi(i,o,l,s)}function JU(t,e,r){var i=$P(r);return i!=null?i:vh(e,i)&&!vh(t,i)}function TP(t,e,r,i,n,s){for(var a=hl(t),o,l;(o=a.next())&&!o.done;)if(l=o.value,Oi(r,l,n,s)&&Oi(i,mh(e,l),n,s))return RP(t,l),!0;return!1}function Oi(t,e,r,i){var n=r||{};if(n.strict?uP(t,e):t===e)return!0;var s=wP(t),a=wP(e);if(s!==a)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return n.strict?uP(t,e):t==e;var o=i.has(t),l=i.has(e),c;if(o&&l){if(i.get(t)===i.get(e))return!0}else c={};return o||i.set(t,c),l||i.set(e,c),rG(t,e,n,i)}function CP(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function eG(t,e,r,i){if(hh(t)!==hh(e))return!1;for(var n=hl(t),s=hl(e),a,o,l;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")l||(l=new ph),gh(l,a.value);else if(!vh(e,a.value)){if(r.strict||!JU(t,e,a.value))return!1;l||(l=new ph),gh(l,a.value)}if(l){for(;(o=s.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!AP(l,o.value,r.strict,i))return!1}else if(!r.strict&&!vh(t,o.value)&&!AP(l,o.value,r.strict,i))return!1;return hh(l)===0}return!0}function tG(t,e,r,i){if(kP(t)!==kP(e))return!1;for(var n=hl(t),s=hl(e),a,o,l,c,u,f;(a=n.next())&&!a.done;)if(c=a.value[0],u=a.value[1],c&&typeof c=="object")l||(l=new ph),gh(l,c);else if(f=mh(e,c),typeof f=="undefined"&&!Hw(e,c)||!Oi(u,f,r,i)){if(r.strict||!QU(t,e,c,u,r,i))return!1;l||(l=new ph),gh(l,c)}if(l){for(;(o=s.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!TP(l,t,c,f,r,i))return!1}else if(!r.strict&&(!t.has(c)||!Oi(mh(t,c),f,r,i))&&!TP(l,t,c,f,PP({},r,{strict:!1}),i))return!1;return hh(l)===0}return!0}function rG(t,e,r,i){var n,s;if(typeof t!=typeof e||t==null||e==null||EP(t)!==EP(e)||fP(t)!==fP(e))return!1;var a=dP(t),o=dP(e);if(a!==o)return!1;var l=t instanceof Error,c=e instanceof Error;if(l!==c||(l||c)&&(t.name!==e.name||t.message!==e.message))return!1;var u=mP(t),f=mP(e);if(u!==f||(u||f)&&(t.source!==e.source||cP(t)!==cP(e)))return!1;var d=pP(t),h=pP(e);if(d!==h||(d||h)&&SP(t)!==SP(e)||r.strict&&Nw&&Nw(t)!==Nw(e))return!1;var m=bP(t),g=bP(e);if(m!==g)return!1;if(m||g){if(t.length!==e.length)return!1;for(n=0;n=0;n--)if(A[n]!=y[n])return!1;for(n=A.length-1;n>=0;n--)if(s=A[n],!Oi(t[s],e[s],r,i))return!1;var S=yP(t),_=yP(e);return S!==_?!1:S==="Set"||_==="Set"?eG(t,e,r,i):S==="Map"?tG(t,e,r,i):!0}IP.exports=function(e,r,i){return Oi(e,r,i,KU())}});var WP=I((GQ,VP)=>{p();VP.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,w,b,k){return{startX:g,startY:v,endX:w,endY:b,r:k}},m=function(g,v,w){var b,k,x,E,A;for(v>w?b=l[g-1+o]:b=l[g+1+o],A=x=Math.max(v,w),E=k=x-g;k=g+1;--E)w[E+o]=m(E,w[E-1+o]+1,w[E+1+o]);w[g+o]=m(g,w[g-1+o]+1,w[g+1+o])}while(w[g+o]!==s);for(ed=g+2*b,k=l[g+o],A=n,y=s,S=[];k!==-1;){let _=c[k];(n!=_.endX||s!=_.endY)&&S.push({file1:[a?_.endY:_.endX,a?y-_.endY:A-_.endX],file2:[a?_.endX:_.endY,a?A-_.endX:y-_.endY]}),A=_.startX,y=_.startY,k=c[k].r}return(A!=0||y!=0)&&S.push({file1:[0,a?y:A],file2:[0,a?A:y]}),S.reverse(),S}}}});var ZP=I((qQ,XP)=>{p();var YP=WP();function nG(t,e,r){var i,n=new YP(e,t).compose(),s=new YP(e,r).compose(),a=[];function o(B,N){a.push([B.file1[0],N,B.file1[1],B.file2[0],B.file2[1]])}for(i=0;ic&&(l.push([1,c,B-c]),c=B)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(u(m),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var k=h[1],x=b[k],E=h[0],A=E+h[2],y=h[3],S=y+h[4];x[0]=Math.min(y,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(E,x[2]),x[3]=Math.max(A,x[3])}var _=b[0][0]+(m-b[0][2]),T=b[0][1]+(g-b[0][3]),P=b[2][0]+(m-b[2][2]),D=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,D-P])}c=g}return u(e.length),l}function sG(t,e,r){var i=[],n=[t,e,r],s=nG(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var m=0;m{p();var wl=1e3,yl=wl*60,bl=yl*60,Ra=bl*24,lG=Ra*7,cG=Ra*365.25;QP.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return uG(t);if(r==="number"&&isFinite(t))return e.long?dG(t):fG(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function uG(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*cG;case"weeks":case"week":case"w":return r*lG;case"days":case"day":case"d":return r*Ra;case"hours":case"hour":case"hrs":case"hr":case"h":return r*bl;case"minutes":case"minute":case"mins":case"min":case"m":return r*yl;case"seconds":case"second":case"secs":case"sec":case"s":return r*wl;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function fG(t){var e=Math.abs(t);return e>=Ra?Math.round(t/Ra)+"d":e>=bl?Math.round(t/bl)+"h":e>=yl?Math.round(t/yl)+"m":e>=wl?Math.round(t/wl)+"s":t+"ms"}function dG(t){var e=Math.abs(t);return e>=Ra?bh(t,e,Ra,"day"):e>=bl?bh(t,e,bl,"hour"):e>=yl?bh(t,e,yl,"minute"):e>=wl?bh(t,e,wl,"second"):t+" ms"}function bh(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var tR=I((rJ,eR)=>{p();function hG(t){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=n,r.enabled=o,r.humanize=JP(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let f=0;for(let d=0;d{if(A==="%%")return"%";x++;let S=r.formatters[y];if(typeof S=="function"){let _=v[x];A=S.call(w,_),v.splice(x,1),x--}return A}),r.formatArgs.call(w,v),(w.log||r.log).apply(w,v)}return g.namespace=u,g.useColors=r.useColors(),g.color=r.selectColor(u),g.extend=i,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(u)),m),set:v=>{d=v}}),typeof r.init=="function"&&r.init(g),g}function i(u,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function n(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(u,f){let d=0,h=0,m=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),u}function o(u){for(let f of r.skips)if(s(u,f))return!1;for(let f of r.names)if(s(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}eR.exports=hG});var xh=I((Tr,_h)=>{p();Tr.formatArgs=mG;Tr.save=gG;Tr.load=vG;Tr.useColors=pG;Tr.storage=wG();Tr.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Tr.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function pG(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function mG(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+_h.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Tr.log=console.debug||console.log||(()=>{});function gG(t){try{t?Tr.storage.setItem("debug",t):Tr.storage.removeItem("debug")}catch(e){}}function vG(){let t;try{t=Tr.storage.getItem("debug")||Tr.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function wG(){try{return localStorage}catch(t){}}_h.exports=tR()(Tr);var{formatters:yG}=_h.exports;yG.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var rR=I(Qr=>{"use strict";p();var bG=Qr&&Qr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qr,"__esModule",{value:!0});var _G=require("fs"),xG=bG(xh()),_l=xG.default("@kwsites/file-exists");function SG(t,e,r){_l("checking %s",t);try{let i=_G.statSync(t);return i.isFile()&&e?(_l("[OK] path represents a file"),!0):i.isDirectory()&&r?(_l("[OK] path represents a directory"),!0):(_l("[FAIL] path represents something other than a file or directory"),!1)}catch(i){if(i.code==="ENOENT")return _l("[FAIL] path is not accessible: %o",i),!1;throw _l("[FATAL] %o",i),i}}function EG(t,e=Qr.READABLE){return SG(t,(e&Qr.FILE)>0,(e&Qr.FOLDER)>0)}Qr.exists=EG;Qr.FILE=1;Qr.FOLDER=2;Qr.READABLE=Qr.FILE+Qr.FOLDER});var iR=I(Sh=>{"use strict";p();function kG(t){for(var e in t)Sh.hasOwnProperty(e)||(Sh[e]=t[e])}Object.defineProperty(Sh,"__esModule",{value:!0});kG(rR())});var Ww=I($a=>{"use strict";p();Object.defineProperty($a,"__esModule",{value:!0});$a.createDeferred=$a.deferred=void 0;function Vw(){let t,e,r="pending";return{promise:new Promise((n,s)=>{t=n,e=s}),done(n){r==="pending"&&(r="resolved",t(n))},fail(n){r==="pending"&&(r="rejected",e(n))},get fulfilled(){return r!=="pending"},get status(){return r}}}$a.deferred=Vw;$a.createDeferred=Vw;$a.default=Vw});var B0=I((exports,module)=>{p();(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(r){return new Sha256(e,!0).update(r)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(n){return e.create().update(n)};for(var r=0;r>2]|=t[n]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|i&63)<=57344?(o[s>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|i&63)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|i&63)<=64?(this.block=o[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,a=this.h6,o=this.h7,l=this.blocks,c,u,f,d,h,m,g,v,w,b,k;for(c=16;c<64;++c)h=l[c-15],u=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[c-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(k=e&r,c=0;c<64;c+=4)this.first?(this.is224?(v=300032,h=l[0]-1413257819,o=h-150054599<<0,i=h+24177077<<0):(v=704751109,h=l[0]-210244248,o=h-1521486534<<0,i=h+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),v=t&e,d=v^t&r^k,g=n&s^~n&a,h=o+f+g+K[c]+l[c],m=u+d,o=i+h<<0,i=h+m<<0),u=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=i&t,d=w^i&e^v,g=o&n^~o&s,h=a+f+g+K[c+1]+l[c+1],m=u+d,a=r+h<<0,r=h+m<<0,u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),b=r&i,d=b^r&t^w,g=a&o^~a&n,h=s+f+g+K[c+2]+l[c+2],m=u+d,s=e+h<<0,e=h+m<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),k=e&r,d=k^e&i^b,g=s&a^~s&o,h=n+f+g+K[c+3]+l[c+3],m=u+d,n=t+h<<0,t=h+m<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+i<<0,this.h4=this.h4+n<<0,this.h5=this.h5+s<<0,this.h6=this.h6+a<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,a=this.h6,o=this.h7,l=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15];return this.is224||(l+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,i=this.h3,n=this.h4,s=this.h5,a=this.h6,o=this.h7,l=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,n>>24&255,n>>16&255,n>>8&255,n&255,s>>24&255,s>>16&255,s>>8&255,s&255,a>>24&255,a>>16&255,a>>8&255,a&255];return this.is224||l.push(o>>24&255,o>>16&255,o>>8&255,o&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,r){var i,n=typeof t;if(n==="string"){var s=[],a=t.length,o=0,l;for(i=0;i>6,s[o++]=128|l&63):l<55296||l>=57344?(s[o++]=224|l>>12,s[o++]=128|l>>6&63,s[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++i)&1023),s[o++]=240|l>>18,s[o++]=128|l>>12&63,s[o++]=128|l>>6&63,s[o++]=128|l&63);t=s}else if(n==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var c=[],u=[];for(i=0;i<64;++i){var f=t[i]||0;c[i]=92^f,u[i]=54^f}Sha256.call(this,e,r),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=r}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var wO=I(vy=>{p();(function(t){var e=/\S/,r=/\"/g,i=/\n/g,n=/\r/g,s=/\\/g,a=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(S,_){var T=S.length,P=0,D=1,B=2,N=P,ce=null,Pe=null,ve="",se=[],xe=!1,we=0,z=0,Q="{{",j="}}";function Le(){ve.length>0&&(se.push({tag:"_t",text:new String(ve)}),ve="")}function lr(){for(var At=!0,Tt=z;Tt"&&(Ze.indent=se[jt].text.toString()),se.splice(jt,1));else Tt||se.push({tag:` +`});xe=!1,z=se.length}function Ie(At,Tt){var jt="="+j,Ze=At.indexOf(jt,Tt),q=c(At.substring(At.indexOf("=",Tt)+1,Ze)).split(" ");return Q=q[0],j=q[q.length-1],Ze+jt.length-1}for(_&&(_=_.split(" "),Q=_[0],j=_[1]),we=0;we0;){if(N=y.shift(),B&&B.tag=="<"&&!(N.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[N.tag]<=t.tags.$||h(N,T))_.push(N),N.nodes=d(y,N.tag,_,T);else if(N.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+N.n);if(D=_.pop(),N.n!=D.n&&!m(N.n,D.n,T))throw new Error("Nesting error: "+D.n+" vs. "+N.n);return D.end=N.i,P}else N.tag==` +`&&(N.last=y.length==0||y[0].tag==` +`);P.push(N)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return P}function h(y,S){for(var _=0,T=S.length;_":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."+k(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=A('"'+b(y.text)+'"')},"{":E,"&":E};function E(y,S){S.code+="t.b(t.t(t."+k(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();var UV={};(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:u,t:c,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=0;x--)if(w=h[x],v=e(d,w,k),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,w){var b=this.options.delimiters;return this.options.delimiters=w,this.b(this.ct(c(d.call(h,v,m)),h,g)),this.options.delimiters=b,!1},ct:function(d,h,m){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,m)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,m,g,v,w,b){var k,x=h[h.length-1],E=d.call(x);return typeof E=="function"?g?!0:(k=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(E,x,h,m,k.substring(v,w),b)):E},mv:function(d,h,m){var g=h[h.length-1],v=d.call(g);return typeof v=="function"?this.ct(c(v.call(g)),g,m):v},sub:function(d,h,m,g){var v=this.subs[d];v&&(this.activeSub=d,v(h,m,this,g),this.activeSub=!1)}};function e(d,h,m){var g;return h&&typeof h=="object"&&(h[d]!==void 0?g=h[d]:m&&h.get&&typeof h.get=="function"&&(g=h.get(d))),g}function r(d,h,m,g,v,w){function b(){}b.prototype=d;function k(){}k.prototype=d.subs;var x,E=new b;E.subs=new k,E.subsText={},E.buf="",g=g||{},E.stackSubs=g,E.subsText=w;for(x in h)g[x]||(g[x]=h[x]);for(x in g)E.subs[x]=g[x];v=v||{},E.stackPartials=v;for(x in m)v[x]||(v[x]=m[x]);for(x in v)E.partials[x]=v[x];return E}var i=/&/g,n=//g,a=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(i,"&").replace(n,"<").replace(s,">").replace(a,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof wy!="undefined"?wy:UV)});var yy=I((vre,bO)=>{p();var yp=wO();yp.Template=yO().Template;yp.template=yp.Template;bO.exports=yp});var SO=I(bi=>{"use strict";p();Object.defineProperty(bi,"__esModule",{value:!0});bi.ColorSchemeType=bi.DiffStyleType=bi.LineMatchingType=bi.OutputFormatType=bi.LineType=void 0;var _O;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(_O||(bi.LineType=_O={}));bi.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};bi.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};bi.DiffStyleType={WORD:"word",CHAR:"char"};var xO;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(xO||(bi.ColorSchemeType=xO={}))});var Q9={};BD(Q9,{default:()=>Sm});module.exports=ND(Q9);p();var gD=Mt(xv()),_e=require("obsidian"),vD=Mt(require("path"));p();var Fi={};p();var Dd=class{constructor(e){this.plugin=e;this.tasks=[]}addTask(e,r){this.tasks.push({task:e,onFinished:r!=null?r:()=>{}}),this.tasks.length===1&&this.handleTask()}handleTask(){if(this.tasks.length>0){let e=this.tasks[0];e.task().then(r=>{e.onFinished(r),this.tasks.shift(),this.handleTask()},r=>{this.plugin.displayError(r),e.onFinished(void 0),this.tasks.shift(),this.handleTask()})}}clear(){this.tasks=[]}};p();var U=require("obsidian");p();var UA=require("obsidian"),Ld="YYYY-MM-DD",Sv=`${Ld} HH:mm`,Ev=`${Ld} HH:mm:ss`,Bd=40,al="conflict-files-obsidian-git.md",rt={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:Ev,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,autoCommitOnlyStaged:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",mergeStrategy:"none",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:UA.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,diffStyle:"split",hunks:{showSigns:!1,hunkCommands:!1,statusBar:"disabled"},lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:Sv,dateTimeTimezone:"viewer-local",coloringMaxAge:"1y",colorNew:{r:255,g:150,b:150},colorOld:{r:120,g:160,b:255},textColorCss:"var(--text-muted)",ignoreWhitespace:!1,gutterSpacingFallbackLength:5}},zt={type:"git-view",name:"Source Control",icon:"git-pull-request"},gi={type:"git-history-view",name:"History",icon:"history"},Ls={type:"split-diff-view",name:"Diff view",icon:"diff"},Bs={type:"diff-view",name:"Diff View",icon:"git-pull-request"},Nd="C:\\Program Files\\Git\\cmd\\git.exe",Hd=".git_credentials_input",Ta="obsidian_askpass.sh",GA=`#!/bin/sh + +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" +`,jA=["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 un=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&m+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,w=()=>{for(let b=Math.max(g,-c);b<=Math.min(v,c);b+=2){let k,x=h[b-1],E=h[b+1];x&&(h[b-1]=void 0);let A=!1;if(E){let S=E.oldPos-b;A=E&&0<=S&&S=l&&m+1>=o)return a(this.buildValues(k.lastComponent,r,e))||!0;h[b]=k,k.oldPos+1>=l&&(v=Math.min(v,b-1)),m+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);w()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=w();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.length?m:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};p();var kv=class extends un{},qA=new kv;function Av(t,e,r){return qA.diff(t,e,r)}p();p();function Tv(t,e){let r;for(r=0;re.length&&(r=t.length-e.length);let i=e.length;t.length0&&e[a]!=e[s];)s=n[s];e[a]==e[s]&&s++}s=0;for(let a=r;a0&&t[a]!=e[s];)s=n[s];t[a]==e[s]&&s++}return s}function ll(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function zn(t){let e=t.match(/^\s*/);return e?e[0]:""}var jd="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",F6=new RegExp(`[${jd}]+|\\s+|[^${jd}]`,"ug"),Rv=class extends un{equals(e,r,i){return i.ignoreCase&&(e=e.toLowerCase(),r=r.toLowerCase()),e.trim()===r.trim()}tokenize(e,r={}){let i;if(r.intlSegmenter){let a=r.intlSegmenter;if(a.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=[];for(let o of Array.from(a.segment(e))){let l=o.segment;i.length&&/\s/.test(i[i.length-1])&&/\s/.test(l)?i[i.length-1]+=l:i.push(l)}}else i=e.match(F6)||[];let n=[],s=null;return i.forEach(a=>{/\s/.test(a)?s==null?n.push(a):n.push(n.pop()+a):s!=null&&/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+a):n.push(s+a):n.push(a),s=a}),n}join(e){return e.map((r,i)=>i==0?r:r.replace(/^\s+/,"")).join("")}postProcess(e,r){if(!e||r.oneChangePerToken)return e;let i=null,n=null,s=null;return e.forEach(a=>{a.added?n=a:a.removed?s=a:((n||s)&&zA(i,s,n,a),i=a,n=null,s=null)}),(n||s)&&zA(i,s,n,null),e}},O6=new Rv;function zA(t,e,r,i){if(e&&r){let n=zn(e.value),s=ll(e.value),a=zn(r.value),o=ll(r.value);if(t){let l=Tv(n,a);t.value=Gd(t.value,a,l),e.value=ol(e.value,l),r.value=ol(r.value,l)}if(i){let l=Cv(s,o);i.value=Ud(i.value,o,l),e.value=lu(e.value,l),r.value=lu(r.value,l)}}else if(r){if(t){let n=zn(r.value);r.value=r.value.substring(n.length)}if(i){let n=zn(i.value);i.value=i.value.substring(n.length)}}else if(t&&i){let n=zn(i.value),s=zn(e.value),a=ll(e.value),o=Tv(n,s);e.value=ol(e.value,o);let l=Cv(ol(n,o),a);e.value=lu(e.value,l),i.value=Ud(i.value,n,l),t.value=Gd(t.value,n,n.slice(0,n.length-l.length))}else if(i){let n=zn(i.value),s=ll(e.value),a=Pv(s,n);e.value=lu(e.value,a)}else if(t){let n=ll(t.value),s=zn(e.value),a=Pv(n,s);e.value=ol(e.value,a)}}var $v=class extends un{tokenize(e){let r=new RegExp(`(\\r?\\n)|[${jd}]+|[^\\S\\n\\r]+|[^${jd}]`,"ug");return e.match(r)||[]}},VA=new $v;function Iv(t,e,r){return VA.diff(t,e,r)}p();var Fv=class extends un{constructor(){super(...arguments),this.tokenize=D6}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(` +`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),r.endsWith(` +`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},M6=new Fv;function Ov(t,e,r){return M6.diff(t,e,r)}function D6(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n{let d=c(f);u(d)}}))}else return c(Ov(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(k){return" "+k})}let d=[],h=0,m=0,g=[],v=1,w=1;for(let b=0;b0?f(E.lines.slice(-l)):[],h-=g.length,m-=g.length)}for(let E of x)g.push((k.added?"+":"-")+E);k.added?w+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&b1&&!e.includeFileHeaders)throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(i=>qd(i,e)).join(` +`)}let r=[];e.includeIndex&&t.oldFileName==t.newFileName&&r.push("Index: "+t.oldFileName),e.includeUnderline&&r.push("==================================================================="),e.includeFileHeaders&&(r.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),r.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader)));for(let i=0;i{o(l?qd(l,a.headerOptions):void 0)}}))}else{let o=Mv(t,e,r,i,n,s,a);return o?qd(o,a==null?void 0:a.headerOptions):void 0}}function cu(t,e,r,i,n,s){return YA(t,t,e,r,i,n,s)}function L6(t){let e=t.endsWith(` +`),r=t.split(` +`).map(i=>i+` +`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var re=Mt(xv()),Pa=require("obsidian");p();function XA(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var cl=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};p();var ZA=require("obsidian"),N6={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},Qe=class extends ZA.SuggestModal{constructor(e,r){if(super(e.app),this.config={...N6,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};p();var OP=Mt(pT()),MP=require("child_process"),DP=Mt(FP()),Xn=require("obsidian");function wh(t){throw new Error(`Unexpected object: ${t}`)}function Su(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var Uw=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Mi(t,e){let r;if(e){if(e.button===0||e.button===1){let i=Xn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function hn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new Xn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new Xn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Gs(t){throw new Error("Impossible branch: "+t)}function Gw(t){return`rgb(${t.r},${t.g},${t.b})`}function LP(t){var s;let e=(s=OP.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function BP(t){return t.diff(Xn.moment.unix(0),"seconds")}function NP(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function HP(t,e){return(0,DP.default)(t,e,{strict:!0})}function Eu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function UP(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function GP(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function jw(t,e,r){return t<=e&&e<=r}function Zn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function pn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function jP(t){return t===1?"1 minute":`${t} minutes`}function iG(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function pl(t){if(t.endsWith(".md"))return!1;let e=iG(t);return jA.includes(e)}function qw(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function ml(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Xn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function qP({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function gl(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function ku(t,e,r={}){return new Promise((i,n)=>{let s=(0,MP.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}p();var zP=require("obsidian"),vl=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 i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/")),o=e.filter(c=>c.path.substring(r).startsWith(a+"/"));o.forEach(c=>e.remove(c));let l=n.path.substring(0,s.indexOf("/")+r);i.push({title:a,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+a.length:a.length)+1)})}else i.push({title:s,data:n,path:n.path,vaultPath:this.getRelativeVaultPath(n.path)}),e.remove(n)}return i}simplify(e){var r,i,n,s;for(let a of e){for(;;){let o=((r=a.children)==null?void 0:r.length)==1,l=((n=(i=a.children)==null?void 0:i.first())==null?void 0:n.data)==null;if(!(a.children!=null&&o&&l))break;let c=a.children.first();a.title+="/"+c.title,a.data=c.data,a.path=c.path,a.vaultPath=c.vaultPath,a.children=c.children}a.children!=null&&this.simplify(a.children),(s=a.children)==null||s.sort((o,l)=>{let c=(l.data==null?1:0)-(o.data==null?1:0);return c!=0?c:o.title.localeCompare(l.title)})}return e.sort((a,o)=>{let l=(o.data==null?1:0)-(a.data==null?1:0);return l!=0?l:a.title.localeCompare(o.title)})}getTreeStructure(e){let r=this._getTreeStructure(e);return this.simplify(r)}async formatCommitMessage(e){let r;if(e.includes("{{numFiles}}")){r=await this.status();let i=r.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let i={},n="";if(r.staged.length<100){r.staged.forEach(a=>{a.index in i?i[a.index].push(a.path):i[a.index]=[a.path]});let s=[];for(let[a,o]of Object.entries(i))s.push(a+" "+o.join(" "));n=s.join(", ")}else n="Too many files to list";e=e.replace("{{files}}",n)}if(e=e.replace("{{date}}",(0,zP.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=r!=null?r:await this.status(),n="";i.staged.length<100?n=i.staged.map(s=>s.path).join(` +`):n="Too many files to list",e=e+` + +Affected files: +`+n}return e}};p();var js=require("obsidian"),yh=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 i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof js.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):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)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof js.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof js.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let i=this.vault.getAbstractFileByPath(e);return i instanceof js.TFile?this.vault.modifyBinary(i,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,js.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!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 i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof js.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){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 KP=Mt(ZP()),Di=class extends vl{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 yh(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,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new Pa.Notice("Authentication failed. Please try with different credentials");let r=await new Qe(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new Qe(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await oG(s));let o=await(0,Pa.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:aG(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await r;return await this.fs.saveAndClear(),i}catch(i){throw await this.fs.saveAndClear(),i}}async status(r){let i,n=window.setTimeout(()=>{i=new Pa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let s={...this.getRepo()};(r==null?void 0:r.path)!=null&&(s.filepaths=[`${r.path}/`]);let a=(await this.wrapFS(re.default.statusMatrix(s))).map(f=>this.getFileStatusResult(f)),o=[],l=[],c=[];for(let f of a)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&c.push(f);let u=[];return window.clearTimeout(n),i==null||i.hide(),{all:c,changed:o,staged:l,conflicted:u}}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async commitAll({message:r,status:i,unstagedFiles:n}){try{return await this.checkAuthorInfo(),await this.stageAll({status:i,unstagedFiles:n}),this.commit({message:r})}catch(s){throw this.plugin.displayError(s),s}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let i=await this.formatCommitMessage(r),n=this.plugin.localStorage.getConflict(),s;if(n){let a=await this.branchInfo();s=[a.current,a.tracking]}await this.wrapFS(re.default.commit({...this.getRepo(),message:i,parent:s})),this.plugin.localStorage.setConflict(!1);return}catch(i){throw this.plugin.displayError(i),i}}async stage(r,i){let n=this.getRelativeRepoPath(r,i),s;i?s=r:s=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(s)?await this.wrapFS(re.default.add({...this.getRepo(),filepath:n})):await this.wrapFS(re.default.remove({...this.getRepo(),filepath:n}))}catch(a){throw this.plugin.displayError(a),a}}async stageAll({dir:r,status:i,unstagedFiles:n}){try{if(i)await Promise.all(i.changed.map(s=>s.workingDir!=="D"?this.wrapFS(re.default.add({...this.getRepo(),filepath:s.path})):re.default.remove({...this.getRepo(),filepath:s.path})));else{let s=n!=null?n:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(s.map(({path:a,type:o})=>o=="D"?re.default.remove({...this.getRepo(),filepath:a}):this.wrapFS(re.default.add({...this.getRepo(),filepath:a}))))}}catch(s){throw this.plugin.displayError(s),s}}async unstage(r,i){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.wrapFS(re.default.resetIndex({...this.getRepo(),filepath:r}))}catch(n){throw this.plugin.displayError(n),n}}async unstageAll({dir:r,status:i}){try{let n;i?n=i.staged.map(s=>s.path):n=(await this.getStagedFiles(r!=null?r:".")).map(({path:a})=>a),await this.wrapFS(Promise.all(n.map(s=>re.default.resetIndex({...this.getRepo(),filepath:s}))))}catch(n){throw this.plugin.displayError(n),n}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(re.default.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async discardAll({dir:r,status:i}){let n=[];i?r!=null?n=i.changed.filter(s=>s.workingDir!="U"&&s.path.startsWith(r)).map(s=>s.path):n=i.changed.filter(s=>s.workingDir!="U").map(s=>s.path):n=(await this.getUnstagedFiles(r)).filter(s=>s.type!="A").map(({path:s})=>s);try{await this.wrapFS(re.default.checkout({...this.getRepo(),filepaths:n,force:!0}))}catch(s){throw this.plugin.displayError(s),s}}async getUntrackedPaths(r){let i=[];if(r.status)for(let n of r.status.changed)n.index=="U"&&n.workingDir==="U"&&n.path.startsWith(r.path!=null?`${r.path}/`:"")&&i.push(n.path);else{let n=await this.status({path:r==null?void 0:r.path});for(let s of n.changed)s.index==="U"&&s.workingDir==="U"&&i.push(s.path)}return i}getProgressText(r,i){let n=`${r} progress:`;return i.phase&&(n=`${n} ${i.phase}:`),i.loaded&&(n=`${n} ${i.loaded}`,i.total&&(n=`${n} of ${i.total}`)),n}resolveRef(r){return this.wrapFS(re.default.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let i=await this.resolveRef("HEAD");await this.fetch();let n=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(re.default.merge({...this.getRepo(),ours:n.current,theirs:n.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var b,k,x;let c=l[0],u=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(b=u.match(d))!=null?b:[],m=(k=c.match(d))!=null?k:[],g=(x=f.match(d))!=null?x:[],v=(0,KP.default)(h,m,g),w="";for(let E of v)E.ok&&(w+=E.ok.join("")),E.conflict&&(w+=this.plugin.settings.mergeStrategy==="ours"?E.conflict.a.join(""):E.conflict.b.join(""));return{cleanMerge:!0,mergedText:w}}:void 0}))).alreadyMerged||await this.wrapFS(re.default.checkout({...this.getRepo(),ref:n.current,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:n.remote})),r==null||r.hide();let a=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(i,a);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(i){throw r==null||r.hide(),i instanceof re.Errors.MergeConflictError&&await this.plugin.handleConflict(i.data.filepaths.map(n=>this.getRelativeVaultPath(n))),this.plugin.displayError(i),i}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let i=await this.branchInfo(),n=i.tracking,s=i.current,a=(await this.getFileChangesCount(s,n)).length;this.plugin.setPluginState({gitAction:5});let o=await this.getCurrentRemote();return await this.wrapFS(re.default.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Pushing",l))}})),r==null||r.hide(),a}catch(i){throw r==null||r.hide(),this.plugin.displayError(i),i}}async getUnpushedCommits(){let r=await this.branchInfo(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let s=await this.resolveRef(n),a=await this.resolveRef(i);return(await this.getFileChangesCount(s,a)).length}async canPush(){let r=await this.branchInfo(),i=r.tracking,n=r.current,s=await this.resolveRef(n),a=await this.resolveRef(i);return s!=a}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,i;try{let n=await re.default.currentBranch(this.getRepo())||"",s=await re.default.listBranches(this.getRepo()),a=(r=await this.getConfig(`branch.${n}.remote`))!=null?r:"origin",o=(i=await this.getConfig(`branch.${n}.merge`))==null?void 0:i.split("refs/heads")[1],l=o?a+o:void 0;return{current:n,tracking:l,branches:s,remote:a}}catch(n){throw this.plugin.displayError(n),n}}async getCurrentRemote(){var n;let r=await re.default.currentBranch(this.getRepo())||"";return(n=await this.getConfig(`branch.${r}.remote`))!=null?n:"origin"}async checkout(r,i){try{return this.wrapFS(re.default.checkout({...this.getRepo(),ref:r,force:!!i,remote:i}))}catch(n){throw this.plugin.displayError(n),n}}async createBranch(r){try{await this.wrapFS(re.default.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(i){throw this.plugin.displayError(i),i}}async deleteBranch(r){try{await this.wrapFS(re.default.deleteBranch({...this.getRepo(),ref:r}))}catch(i){throw this.plugin.displayError(i),i}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(re.default.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,i,n){let s=this.showNotice("Initializing clone");try{await this.wrapFS(re.default.clone({...this.getRepo(),dir:i,url:r,depth:n,onProgress:a=>{s!==void 0&&(s.noticeEl.innerText=this.getProgressText("Cloning",a))}})),s==null||s.hide()}catch(a){throw s==null||s.hide(),this.plugin.displayError(a),a}}async setConfig(r,i){try{return this.wrapFS(re.default.setConfig({...this.getRepo(),path:r,value:i}))}catch(n){throw this.plugin.displayError(n),n}}async getConfig(r){try{return this.wrapFS(re.default.getConfig({...this.getRepo(),path:r}))}catch(i){throw this.plugin.displayError(i),i}}async fetch(r){let i=this.showNotice("Initializing fetch");try{let n={...this.getRepo(),onProgress:s=>{i!==void 0&&(i.noticeEl.innerText=this.getProgressText("Fetching",s))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(re.default.fetch(n)),i==null||i.hide()}catch(n){throw this.plugin.displayError(n),i==null||i.hide(),n}}async setRemote(r,i){try{await this.wrapFS(re.default.addRemote({...this.getRepo(),remote:r,url:i,force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async getRemoteBranches(r){let i=[];return i.push(...await this.wrapFS(re.default.listBranches({...this.getRepo(),remote:r}))),i.remove("HEAD"),i=i.map(n=>`${r}/${n}`),i}async getRemotes(){return(await this.wrapFS(re.default.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(re.default.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var i;return(i=(await this.wrapFS(re.default.listRemotes({...this.getRepo()}))).filter(n=>n.remote==r)[0])==null?void 0:i.url}async log(r,i=!0,n,s){let a=await this.wrapFS(re.default.log({...this.getRepo(),depth:n,ref:s}));return Promise.all(a.map(async o=>{let l=o.commit.message.split(` + +`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(` + +`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Zn(r),s=await this.branchInfo();await this.wrapFS(re.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[re.default.TREE({ref:r}),re.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(re.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!Uw(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[re.default.TREE({ref:"HEAD"}),re.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new Pa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(re.default.walk({...s,trees:[re.default.WORKDIR(),re.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await re.default.isIgnored({...s,filepath:o})||!Uw(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,m;return u==="blob"&&f!=="blob"?m="42":u==="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(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await re.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h}),u=await re.default.readCommit({...this.getRepo(),oid:n}),f=await(0,re.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof re.default.Errors.NotFoundError))throw h});return cu(s,f!=null?f:"",c!=null?c:"")}let o=(await re.default.walk({...this.getRepo(),trees:[re.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,re.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof re.default.Errors.NotFoundError))throw f});return cu(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",cu(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await re.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new Pa.Notice(r,i?this.noticeLength:void 0)}};async function*aG(t){yield new Uint8Array(t)}async function oG(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}p();var UI=Mt(xh()),ei=Mt(require("fs/promises")),Qn=require("obsidian"),Ge=Mt(require("path")),Mu=require("path");p();var Oh=Mt(iR(),1),$h=Mt(xh(),1),C$=require("child_process"),fI=Mt(Ww(),1),xl=Mt(Ww(),1),LI=require("node:events"),h0=Object.defineProperty,AG=Object.getOwnPropertyDescriptor,p0=Object.getOwnPropertyNames,TG=Object.prototype.hasOwnProperty,Y=(t,e)=>function(){return t&&(e=(0,t[p0(t)[0]])(t=0)),e},CG=(t,e)=>function(){return e||(0,t[p0(t)[0]])((e={exports:{}}).exports,e),e.exports},vt=(t,e)=>{for(var r in e)h0(t,r,{get:e[r],enumerable:!0})},PG=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p0(e))!TG.call(t,n)&&n!==r&&h0(t,n,{get:()=>e[n],enumerable:!(i=AG(e,n))||i.enumerable});return t},ut=t=>PG(h0({},"__esModule",{value:!0}),t);function RG(...t){let e=new String(t);return Fh.set(e,t),e}function Ch(t){return t instanceof String&&Fh.has(t)}function nR(t){return Fh.get(t)||[]}var Fh,Pu=Y({"src/lib/args/pathspec.ts"(){"use strict";Fh=new WeakMap}}),Rr,zs=Y({"src/lib/errors/git-error.ts"(){"use strict";Rr=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Ru,El=Y({"src/lib/errors/git-response-error.ts"(){"use strict";zs(),Ru=class extends Rr{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),MR,DR=Y({"src/lib/errors/task-configuration-error.ts"(){"use strict";zs(),MR=class extends Rr{constructor(t){super(void 0,t)}}}});function LR(t){return typeof t!="function"?Ma:t}function BR(t){return typeof t=="function"&&t!==Ma}function NR(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function HR(t,e=0){return UR(t)&&t.length>e?t[e]:void 0}function Oa(t,e=0){if(UR(t)&&t.length>e)return t[t.length-1-e]}function UR(t){return!!(t&&typeof t.length=="number")}function $u(t="",e=!0,r=` +`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function m0(t,e){return $u(t,!0).map(r=>e(r))}function g0(t){return(0,Oh.exists)(t,Oh.FOLDER)}function Oe(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function GR(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Mh(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function mn(t){return Array.isArray(t)?t:[t]}function jR(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function qR(t){return mn(t).map(String)}function Ve(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function Tu(t,e){let r=[];for(let i=0,n=t.length;ir in t?{[r]:t[r]}:{}))}function e0(t=0){return new Promise(e=>setTimeout(e,t))}function t0(t){if(t!==!1)return t}var Sl,Ma,Iu,Dh=Y({"src/lib/utils/util.ts"(){"use strict";Sl="\0",Ma=()=>{},Iu=Object.prototype.toString.call.bind(Object.prototype.toString)}});function gn(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function r0(t,e){let r=Ch(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Lh(t){return!!t&&Iu(t)==="[object Object]"}function VR(t){return typeof t=="function"}var Fu,er,WR,Ph,v0,YR=Y({"src/lib/utils/argument-filters.ts"(){"use strict";Dh(),Pu(),Fu=t=>Array.isArray(t),er=t=>typeof t=="string",WR=t=>Array.isArray(t)&&t.every(er),Ph=t=>er(t)||Array.isArray(t)&&t.every(er),v0=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),i0,$G=Y({"src/lib/utils/exit-codes.ts"(){"use strict";i0=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(i0||{})}}),Rh,IG=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";Rh=class XR{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new XR(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),me,qs,FG=Y({"src/lib/utils/line-parser.ts"(){"use strict";me=class{constructor(t,e){this.matches=[],this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},qs=class extends me{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function ZR(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...KR},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var KR,OG=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";KR={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function w0(t,e=[]){return Lh(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(Ch(n))r.push(n);else if(r0(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)r0(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Cr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n{for(let s=$u(n,i),a=0,o=s.length;a{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var LG=Y({"src/lib/utils/task-parser.ts"(){"use strict";Dh()}}),QR={};vt(QR,{ExitCodes:()=>i0,GitOutputStreams:()=>Rh,LineParser:()=>me,NOOP:()=>Ma,NULL:()=>Sl,RemoteLineParser:()=>qs,append:()=>Oe,appendTaskOptions:()=>w0,asArray:()=>mn,asCamelCase:()=>jR,asFunction:()=>LR,asNumber:()=>Ve,asStringArray:()=>qR,bufferToString:()=>Cu,callTaskParser:()=>n0,createInstanceConfig:()=>ZR,delay:()=>e0,filterArray:()=>Fu,filterFunction:()=>VR,filterHasLength:()=>v0,filterPlainObject:()=>Lh,filterPrimitives:()=>r0,filterString:()=>er,filterStringArray:()=>WR,filterStringOrStringArray:()=>Ph,filterType:()=>gn,first:()=>HR,folderExists:()=>g0,forEachLineWithContent:()=>m0,getTrailingOptions:()=>Cr,including:()=>GR,isUserFunction:()=>BR,last:()=>Oa,objectToString:()=>Iu,orVoid:()=>t0,parseStringResponse:()=>$r,pick:()=>zR,prefixedArray:()=>Tu,remove:()=>Mh,splitOn:()=>NR,toLinesWithContent:()=>$u,trailingFunctionArgument:()=>ft,trailingOptionsArgument:()=>y0});var de=Y({"src/lib/utils/index.ts"(){"use strict";YR(),$G(),IG(),FG(),OG(),DG(),LG(),Dh()}}),JR={};vt(JR,{CheckRepoActions:()=>s0,checkIsBareRepoTask:()=>t$,checkIsRepoRootTask:()=>e$,checkIsRepoTask:()=>BG});function BG(t){switch(t){case"bare":return t$();case"root":return e$()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:Bh,parser:b0}}function e$(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:Bh,parser(e){return/^\.(git)?$/.test(e.trim())}}}function t$(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:Bh,parser:b0}}function NG(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var s0,Bh,b0,r$=Y({"src/lib/tasks/check-is-repo.ts"(){"use strict";de(),s0=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(s0||{}),Bh=({exitCode:t},e,r,i)=>{if(t===128&&NG(e))return r(Buffer.from("false"));i(e)},b0=t=>t.trim()==="true"}});function HG(t,e){let r=new i$(t),i=t?s$:n$;return $u(e).forEach(n=>{let s=n.replace(i,"");r.paths.push(s),(a$.test(s)?r.folders:r.files).push(s)}),r}var i$,n$,s$,a$,UG=Y({"src/lib/responses/CleanSummary.ts"(){"use strict";de(),i$=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},n$=/^[a-z]+\s*/i,s$=/^[a-z]+\s+[a-z]+\s*/i,a$=/\/$/}}),a0={};vt(a0,{EMPTY_COMMANDS:()=>Nh,adhocExecTask:()=>o$,configurationErrorTask:()=>Pr,isBufferTask:()=>c$,isEmptyTask:()=>u$,straightThroughBufferTask:()=>l$,straightThroughStringTask:()=>mr});function o$(t){return{commands:Nh,format:"empty",parser:t}}function Pr(t){return{commands:Nh,format:"empty",parser(){throw typeof t=="string"?new MR(t):t}}}function mr(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function l$(t){return{commands:t,format:"buffer",parser(e){return e}}}function c$(t){return t.format==="buffer"}function u$(t){return t.format==="empty"||!t.commands.length}var Nh,gt=Y({"src/lib/tasks/task.ts"(){"use strict";DR(),Nh=[]}}),f$={};vt(f$,{CONFIG_ERROR_INTERACTIVE_MODE:()=>_0,CONFIG_ERROR_MODE_REQUIRED:()=>x0,CONFIG_ERROR_UNKNOWN_OPTION:()=>S0,CleanOptions:()=>Fa,cleanTask:()=>d$,cleanWithOptionsTask:()=>GG,isCleanOptionsArray:()=>jG});function GG(t,e){let{cleanMode:r,options:i,valid:n}=qG(t);return r?n.options?(i.push(...e),i.some(WG)?Pr(_0):d$(r,i)):Pr(S0+JSON.stringify(t)):Pr(x0)}function d$(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(i){return HG(t==="n",i)}}}function jG(t){return Array.isArray(t)&&t.every(e=>E0.has(e))}function qG(t){let e,r=[],i={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(n=>{zG(n)?(e=n,i.cleanMode=!0):i.options=i.options&&VG(r[r.length]=`-${n}`)}),{cleanMode:e,options:r,valid:i}}function zG(t){return t==="f"||t==="n"}function VG(t){return/^-[a-z]$/i.test(t)&&E0.has(t.charAt(1))}function WG(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var _0,x0,S0,Fa,E0,h$=Y({"src/lib/tasks/clean.ts"(){"use strict";UG(),de(),gt(),_0="Git clean interactive mode is not supported",x0='Git clean mode parameter ("n" or "f") is required',S0="Git clean unknown option found in: ",Fa=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(Fa||{}),E0=new Set(["i",...qR(Object.values(Fa))])}});function YG(t){let e=new m$;for(let r of p$(t))e.addValue(r.file,String(r.key),r.value);return e}function XG(t,e){let r=null,i=[],n=new Map;for(let s of p$(t,e))s.key===e&&(i.push(r=s.value),n.has(s.file)||n.set(s.file,[]),n.get(s.file).push(r));return{key:e,paths:Array.from(n.keys()),scopes:n,value:r,values:i}}function ZG(t){return t.replace(/^(file):/,"")}function*p$(t,e=null){let r=t.split("\0");for(let i=0,n=r.length-1;iObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Oa(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);i.hasOwnProperty(e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function Yw(t,e){return typeof t=="string"&&o0.hasOwnProperty(t)?t:e}function QG(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function JG(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return XG(i,t)}}}function ej(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return YG(r)}}}function tj(){return{addConfig(t,e,...r){return this._runTask(QG(t,e,r[0]===!0,Yw(r[1],"local")),ft(arguments))},getConfig(t,e){return this._runTask(JG(t,Yw(e,void 0)),ft(arguments))},listConfig(...t){return this._runTask(ej(Yw(t[0],void 0)),ft(arguments))}}}var o0,g$=Y({"src/lib/tasks/config.ts"(){"use strict";KG(),de(),o0=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(o0||{})}});function rj(t){return v$.has(t)}var Xw,v$,w$=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";Xw=(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))(Xw||{}),v$=new Set(Object.values(Xw))}});function ij(...t){return new b$().param(...t)}function nj(t){let e=new Set,r={};return m0(t,i=>{let[n,s,a]=i.split(Sl);e.add(n),(r[n]=r[n]||[]).push({line:Ve(s),path:n,preview:a})}),{paths:e,results:r}}function sj(){return{grep(t){let e=ft(arguments),r=Cr(arguments);for(let n of y$)if(r.includes(n))return this._runTask(Pr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=ij().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return nj(n)}},e)}}}var y$,Au,sR,b$,_$=Y({"src/lib/tasks/grep.ts"(){"use strict";de(),gt(),y$=["-h"],Au=Symbol("grepQuery"),b$=class{constructor(){this[sR]=[]}*[(sR=Au,Symbol.iterator)](){for(let t of this[Au])yield t}and(...t){return t.length&&this[Au].push("--and","(",...Tu(t,"-e"),")"),this}param(...t){return this[Au].push(...Tu(t,"-e")),this}}}}),x$={};vt(x$,{ResetMode:()=>kh,getResetMode:()=>oj,resetTask:()=>aj});function aj(t,e){let r=["reset"];return S$(t)&&r.push(`--${t}`),r.push(...e),mr(r)}function oj(t){if(S$(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function S$(t){return E$.includes(t)}var kh,E$,k$=Y({"src/lib/tasks/reset.ts"(){"use strict";gt(),kh=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(kh||{}),E$=Array.from(Object.values(kh))}});function lj(){return(0,$h.default)("simple-git")}function aR(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function cj(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function k0(t,e,r,i=lj()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=cj(gn(e,er),a,i);return c(r);function l(u,f){return Oe(s,k0(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&aR(a,f)||Ma,h=aR(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var A$=Y({"src/lib/git-logger.ts"(){"use strict";de(),$h.default.formatters.L=t=>String(v0(t)?t.length:"-"),$h.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Iu(t)}}),T$,uj=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;zs(),A$(),T$=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=k0(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Rr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger("Starting task"),i}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function Ia(t,e){return{method:HR(t.commands)||"",commands:e}}function fj(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function oR(t,e,r,i){return n=>{r("%s received %L bytes",e,n),i("%B",n),t.push(n)}}var l0,dj=Y({"src/lib/runners/git-executor-chain.ts"(){"use strict";zs(),gt(),de(),uj(),l0=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new T$}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:i}=this._queue.attempt(t);return await(u$(t)?this.attemptEmptyTask(t,i):this.attemptRemoteTask(t,i))}catch(i){throw this.onFatalException(t,i)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof Rr?Object.assign(e,{task:t}):new Rr(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",Ia(t,t.commands)),i=this._plugins.exec("spawn.args",[...t.commands],Ia(t,t.commands)),n=await this.gitResponse(t,r,i,this.outputHandler,e.step("SPAWN")),s=await this.handleTaskData(t,i,n,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),c$(t)?n0(t.parser,s):n0(t.parser,s.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,i){let{exitCode:n,rejection:s,stdOut:a,stdErr:o}=r;return new Promise((l,c)=>{i("Preparing to handle process response exitCode=%d stdOut=",n);let{error:u}=this._plugins.exec("task.error",{error:s},{...Ia(t,e),...r});if(u&&t.onError)return i.info("exitCode=%s handling with custom error handler"),t.onError(r,u,f=>{i.info("custom error handler treated as success"),i("custom error returned a %s",Iu(f)),l(new Rh(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return i.info("handling as error: exitCode=%s stdErr=%s rejection=%o",n,o.length,s),c(u);i.info("retrieving task output complete"),l(new Rh(Buffer.concat(a),Buffer.concat(o)))})}async gitResponse(t,e,r,i,n){let s=n.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Ia(t,t.commands));return new Promise(o=>{let l=[],c=[];n.info("%s %o",e,r),n("%O",a);let u=this._beforeSpawn(t,r);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,{...Ia(t,r),kill(d){u=d||u}});let f=(0,C$.spawn)(e,r,a);f.stdout.on("data",oR(l,"stdOut",n,s.step("stdOut"))),f.stderr.on("data",oR(c,"stdErr",n,s.step("stdErr"))),f.on("error",fj(c,n)),i&&(n("Passing child process stdOut/stdErr to custom outputHandler"),i(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...Ia(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:c,exitCode:d,rejection:u||h})},kill(d){f.killed||(u=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...Ia(t,e),kill(i){r=i||r}}),r}}}}),P$={};vt(P$,{GitExecutor:()=>R$});var R$,hj=Y({"src/lib/runners/git-executor.ts"(){"use strict";dj(),R$=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new l0(this,this._scheduler,this._plugins)}chain(){return new l0(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function pj(t,e,r=Ma){let i=s=>{r(null,s)},n=s=>{(s==null?void 0:s.task)===t&&r(s instanceof Ru?mj(s):s,void 0)};e.then(i,n)}function mj(t){let e=i=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${i} should be GitResponseError.git.${i}, this will no longer be available in version 3`),e=Ma};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(i,n){return n in t||(i[n]={enumerable:!1,configurable:!1,get(){return e(n),t.git[n]}}),i}}var gj=Y({"src/lib/task-callback.ts"(){"use strict";El(),de()}});function lR(t,e){return o$(r=>{if(!g0(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var vj=Y({"src/lib/tasks/change-working-directory.ts"(){"use strict";de(),gt()}});function Zw(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Mh(e,"-B")),mr(e)}function wj(){return{checkout(){return this._runTask(Zw(Cr(arguments,1)),ft(arguments))},checkoutBranch(t,e){return this._runTask(Zw(["-b",t,e,...Cr(arguments)]),ft(arguments))},checkoutLocalBranch(t){return this._runTask(Zw(["-b",t,...Cr(arguments)]),ft(arguments))}}}var yj=Y({"src/lib/tasks/checkout.ts"(){"use strict";de(),gt()}});function bj(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function _j(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return $r(bj(),[$$],t)}})}}}var $$,xj=Y({"src/lib/tasks/count-objects.ts"(){"use strict";de(),$$=new me(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let i=jR(e);t.hasOwnProperty(i)&&(t[i]=Ve(r))})}});function Sj(t){return $r({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},I$,t)}var I$,Ej=Y({"src/lib/parsers/parse-commit.ts"(){"use strict";de(),I$=[new me(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,i])=>{t.branch=e,t.commit=i,t.root=!!r}),new me(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),i=r.pop();!i||!i.includes("@")||(t.author={email:i.substr(0,i.length-1),name:r.join("<").trim()})}),new me(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(i,10)||0}),new me(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0;let n=parseInt(r,10)||0;i==="-"?t.summary.deletions=n:i==="+"&&(t.summary.insertions=n)})]}});function kj(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Tu(t,"-m"),...e,...r],format:"utf-8",parser:Sj}}function Aj(){return{commit(e,...r){let i=ft(arguments),n=t(e)||kj(mn(e),mn(gn(r[0],Ph,[])),[...gn(r[1],Fu,[]),...Cr(arguments,0,!0)]);return this._runTask(n,i)}};function t(e){return!Ph(e)&&Pr("git.commit: requires the commit message to be supplied as a string/string[]")}}var Tj=Y({"src/lib/tasks/commit.ts"(){"use strict";Ej(),de(),gt()}});function Cj(){return{firstCommit(){return this._runTask(mr(["rev-list","--max-parents=0","HEAD"],!0),ft(arguments))}}}var Pj=Y({"src/lib/tasks/first-commit.ts"(){"use strict";de(),gt()}});function Rj(t,e){let r=["hash-object",t];return e&&r.push("-w"),mr(r,!0)}var $j=Y({"src/lib/tasks/hash-object.ts"(){"use strict";gt()}});function Ij(t,e,r){let i=String(r).trim(),n;if(n=F$.exec(i))return new Ah(t,e,!1,n[1]);if(n=O$.exec(i))return new Ah(t,e,!0,n[1]);let s="",a=i.split(" ");for(;a.length;)if(a.shift()==="in"){s=a.join(" ");break}return new Ah(t,e,/^re/i.test(i),s)}var Ah,F$,O$,Fj=Y({"src/lib/responses/InitSummary.ts"(){"use strict";Ah=class{constructor(t,e,r,i){this.bare=t,this.path=e,this.existing=r,this.gitDir=i}},F$=/^Init.+ repository in (.+)$/,O$=/^Rein.+ in (.+)$/}});function Oj(t){return t.includes(A0)}function Mj(t=!1,e,r){let i=["init",...r];return t&&!Oj(i)&&i.splice(1,0,A0),{commands:i,format:"utf-8",parser(n){return Ij(i.includes("--bare"),e,n)}}}var A0,Dj=Y({"src/lib/tasks/init.ts"(){"use strict";Fj(),A0="--bare"}});function T0(t){for(let e=0;e$r(new M$,e,r,!1)}var Kw,cR,uR,fR,L$,B$=Y({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Ou(),Bj(),w$(),de(),Kw=[new me(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,i=""])=>{t.files.push({file:e.trim(),changes:Ve(r),insertions:i.replace(/[^+]/g,"").length,deletions:i.replace(/[^-]/g,"").length,binary:!1})}),new me(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,i])=>{t.files.push({file:e.trim(),before:Ve(r),after:Ve(i),binary:!0})}),new me(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let i=/(\d+) i/.exec(r),n=/(\d+) d/.exec(r);t.changed=Ve(e),t.insertions=Ve(i==null?void 0:i[1]),t.deletions=Ve(n==null?void 0:n[1])})],cR=[new me(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,i])=>{let n=Ve(e),s=Ve(r);t.changed++,t.insertions+=n,t.deletions+=s,t.files.push({file:i,changes:n+s,insertions:n,deletions:s,binary:!1})}),new me(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],uR=[new me(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],fR=[new me(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,i,n,s])=>{t.changed++,t.files.push({file:s!=null?s:i,changes:0,insertions:0,deletions:0,binary:!1,status:t0(rj(e)&&e),from:t0(!!s&&i!==s&&i),similarity:Ve(r)})})],L$={"":Kw,"--stat":Kw,"--numstat":cR,"--name-status":fR,"--name-only":uR}}});function Nj(t,e){return e.reduce((r,i,n)=>(r[i]=t[n]||"",r),Object.create({diff:null}))}function N$(t=$0,e=H$,r=""){let i=D$(r);return function(n){let s=$u(n.trim(),!1,P0).map(function(a){let o=a.split(R0),l=Nj(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=i(o[1])),l});return{all:s,latest:s.length&&s[0]||null,total:s.length}}}var P0,R0,$0,H$,U$=Y({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";de(),B$(),Ou(),P0="\xF2\xF2\xF2\xF2\xF2\xF2 ",R0=" \xF2\xF2",$0=" \xF2 ",H$=["hash","date","message","refs","author_name","author_email"]}}),G$={};vt(G$,{diffSummaryTask:()=>Hj,validateLogFormatConfig:()=>Hh});function Hj(t){let e=T0(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),Hh(r)||{commands:r,format:"utf-8",parser:D$(e)}}function Hh(t){let e=t.filter(Lj);if(e.length>1)return Pr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Pr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var I0=Y({"src/lib/tasks/diff.ts"(){"use strict";Ou(),B$(),gt()}});function Uj(t,e){let r=[],i=[];return Object.keys(t).forEach(n=>{r.push(n),i.push(String(t[n]))}),[r,i.join(e)]}function Gj(t){return Object.keys(t).reduce((e,r)=>(r in c0||(e[r]=t[r]),e),{})}function j$(t={},e=[]){let r=gn(t.splitter,er,$0),i=Lh(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[n,s]=Uj(i,r),a=[],o=[`--pretty=format:${P0}${s}${R0}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let c=t.symmetric!==!1?"...":"..";a.push(`${t.from||""}${c}${t.to||""}`)}return er(t.file)&&o.push("--follow",RG(t.file)),w0(Gj(t),o),{fields:n,splitter:r,commands:[...o,...a]}}function jj(t,e,r){let i=N$(t,e,T0(r));return{commands:["log",...r],format:"utf-8",parser:i}}function qj(){return{log(...r){let i=ft(arguments),n=j$(y0(arguments),gn(arguments[0],Fu)),s=e(...r)||Hh(n.commands)||t(n);return this._runTask(s,i)}};function t(r){return jj(r.splitter,r.fields,r.commands)}function e(r,i){return er(r)&&er(i)&&Pr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var c0,q$=Y({"src/lib/tasks/log.ts"(){"use strict";Ou(),Pu(),U$(),de(),gt(),I0(),c0=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(c0||{})}}),Th,z$,zj=Y({"src/lib/responses/MergeSummary.ts"(){"use strict";Th=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},z$=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),u0,V$,Vj=Y({"src/lib/responses/PullSummary.ts"(){"use strict";u0=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},V$=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Qw(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function dR(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Ve(e&&e[1]||"0"),delta:Ve(r&&r[1]||"0")}}var W$,Wj=Y({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";de(),W$=[new qs(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=Qw(t.remoteMessages);Object.assign(n,{[i]:Ve(r)})}),new qs(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=Qw(t.remoteMessages);Object.assign(n,{[i]:Ve(r)})}),new qs(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,i])=>{let n=Qw(t.remoteMessages);n.total=dR(e),n.reused=dR(r),n.packReused=Ve(i)})]}});function Y$(t,e){return $r({remoteMessages:new Z$},X$,e)}var X$,Z$,K$=Y({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";de(),Wj(),X$=[new qs(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...W$,new qs([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new qs([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,i])=>{t.remoteMessages.vulnerabilities={count:Ve(e),summary:r,url:i}})],Z$=class{constructor(){this.all=[]}}}});function Yj(t,e){let r=$r(new V$,Q$,[t,e]);return r.message&&r}var hR,pR,mR,gR,Q$,vR,F0,J$=Y({"src/lib/parsers/parse-pull.ts"(){"use strict";Vj(),de(),K$(),hR=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,pR=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,mR=/^(create|delete) mode \d+ (.+)/,gR=[new me(hR,(t,[e,r,i])=>{t.files.push(e),r&&(t.insertions[e]=r.length),i&&(t.deletions[e]=i.length)}),new me(pR,(t,[e,,r,,i])=>r!==void 0||i!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+i||0,!0):!1),new me(mR,(t,[e,r])=>{Oe(t.files,r),Oe(e==="create"?t.created:t.deleted,r)})],Q$=[new me(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new me(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new me(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,i,n])=>{t.branch.local=i,t.hash.local=e,t.branch.remote=n,t.hash.remote=r})],vR=(t,e)=>$r(new u0,gR,[t,e]),F0=(t,e)=>Object.assign(new u0,vR(t,e),Y$(t,e))}}),wR,eI,yR,Xj=Y({"src/lib/parsers/parse-merge.ts"(){"use strict";zj(),de(),J$(),wR=[new me(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new me(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Th(e,r))}),new me(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,i])=>{t.conflicts.push(new Th(e,r,{deleteRef:i}))}),new me(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Th(e,null))}),new me(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],eI=(t,e)=>Object.assign(yR(t,e),F0(t,e)),yR=t=>$r(new z$,wR,t)}});function bR(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let i=eI(e,r);if(i.failed)throw new Ru(i);return i}}:Pr("Git.merge requires at least one option")}var Zj=Y({"src/lib/tasks/merge.ts"(){"use strict";El(),Xj(),gt()}});function Kj(t,e,r){let i=r.includes("deleted"),n=r.includes("tag")||/^refs\/tags/.test(t),s=!r.includes("new");return{deleted:i,tag:n,branch:!n,new:!s,alreadyUpdated:s,local:t,remote:e}}var _R,tI,xR,Qj=Y({"src/lib/parsers/parse-push.ts"(){"use strict";de(),K$(),_R=[new me(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new me(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new me(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,i])=>{t.pushed.push(Kj(e,r,i))}),new me(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,i])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:i}}),new me(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,i,n])=>{t.update={head:{local:e,remote:r},hash:{from:i,to:n}}})],tI=(t,e)=>{let r=xR(t,e),i=Y$(t,e);return{...r,...i}},xR=(t,e)=>$r({pushed:[]},_R,[t,e])}}),rI={};vt(rI,{pushTagsTask:()=>Jj,pushTask:()=>O0});function Jj(t={},e){return Oe(e,"--tags"),O0(t,e)}function O0(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Mh(r,"-v"),Oe(r,"--verbose"),Oe(r,"--porcelain"),{commands:r,format:"utf-8",parser:tI}}var iI=Y({"src/lib/tasks/push.ts"(){"use strict";Qj(),de()}});function eq(){return{showBuffer(){let t=["show",...Cr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(l$(t),ft(arguments))},show(){let t=["show",...Cr(arguments,1)];return this._runTask(mr(t),ft(arguments))}}}var tq=Y({"src/lib/tasks/show.ts"(){"use strict";de(),gt()}}),SR,nI,rq=Y({"src/lib/responses/FileStatusSummary.ts"(){"use strict";SR=/^(.+)\0(.+)$/,nI=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let i=SR.exec(t)||[null,t,t];this.from=i[2]||"",this.path=i[1]||""}}}}});function ER(t){let[e,r]=t.split(Sl);return{from:r||e,to:e}}function Jr(t,e,r){return[`${t}${e}`,r]}function Jw(t,...e){return e.map(r=>Jr(t,r,(i,n)=>Oe(i.conflicted,n)))}function iq(t,e){let r=e.trim();switch(" "){case r.charAt(2):return i(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return i(" ",r.charAt(0),r.substr(2));default:return}function i(n,s,a){let o=`${n}${s}`,l=sI.get(o);l&&l(t,a),o!=="##"&&o!=="!!"&&t.files.push(new nI(a,n,s))}}var kR,sI,aI,nq=Y({"src/lib/responses/StatusSummary.ts"(){"use strict";de(),rq(),kR=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},sI=new Map([Jr(" ","A",(t,e)=>Oe(t.created,e)),Jr(" ","D",(t,e)=>Oe(t.deleted,e)),Jr(" ","M",(t,e)=>Oe(t.modified,e)),Jr("A"," ",(t,e)=>Oe(t.created,e)&&Oe(t.staged,e)),Jr("A","M",(t,e)=>Oe(t.created,e)&&Oe(t.staged,e)&&Oe(t.modified,e)),Jr("D"," ",(t,e)=>Oe(t.deleted,e)&&Oe(t.staged,e)),Jr("M"," ",(t,e)=>Oe(t.modified,e)&&Oe(t.staged,e)),Jr("M","M",(t,e)=>Oe(t.modified,e)&&Oe(t.staged,e)),Jr("R"," ",(t,e)=>{Oe(t.renamed,ER(e))}),Jr("R","M",(t,e)=>{let r=ER(e);Oe(t.renamed,r),Oe(t.modified,r.to)}),Jr("!","!",(t,e)=>{Oe(t.ignored=t.ignored||[],e)}),Jr("?","?",(t,e)=>Oe(t.not_added,e)),...Jw("A","A","U"),...Jw("D","D","U"),...Jw("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,i=/behind (\d+)/,n=/^(.+?(?=(?:\.{3}|\s|$)))/,s=/\.{3}(\S*)/,a=/\son\s([\S]+)$/,o;o=r.exec(e),t.ahead=o&&+o[1]||0,o=i.exec(e),t.behind=o&&+o[1]||0,o=n.exec(e),t.current=o&&o[1],o=s.exec(e),t.tracking=o&&o[1],o=a.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),aI=function(t){let e=t.split(Sl),r=new kR;for(let i=0,n=e.length;i!oI.includes(r))],parser(r){return aI(r)}}}var oI,aq=Y({"src/lib/tasks/status.ts"(){"use strict";nq(),oI=["--null","-z"]}});function Ih(t=0,e=0,r=0,i="",n=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:i,installed:n},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function oq(){return Ih(0,0,0,"",!1)}function lq(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:cq,onError(t,e,r,i){if(t.exitCode===-2)return r(Buffer.from(M0));i(e)}})}}}function cq(t){return t===M0?oq():$r(Ih(0,0,0,t),lI,t)}var M0,lI,uq=Y({"src/lib/tasks/version.ts"(){"use strict";de(),M0="installed=false",lI=[new me(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,i,n=""])=>{Object.assign(t,Ih(Ve(e),Ve(r),Ve(i),n))}),new me(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,i,n=""])=>{Object.assign(t,Ih(Ve(e),Ve(r),i,n))})]}}),cI={};vt(cI,{SimpleGitApi:()=>f0});var f0,fq=Y({"src/lib/simple-git-api.ts"(){"use strict";gj(),vj(),yj(),xj(),Tj(),g$(),Pj(),_$(),$j(),Dj(),q$(),Zj(),iI(),tq(),aq(),gt(),uq(),de(),f0=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),i=r.push(t);return e&&pj(t,i,e),Object.create(this,{then:{value:i.then.bind(i)},catch:{value:i.catch.bind(i)},_executor:{value:r}})}add(t){return this._runTask(mr(["add",...mn(t)]),ft(arguments))}cwd(t){let e=ft(arguments);return typeof t=="string"?this._runTask(lR(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(lR(t.path,t.root&&this._executor||void 0),e):this._runTask(Pr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Rj(t,e===!0),ft(arguments))}init(t){return this._runTask(Mj(t===!0,this._executor.cwd,Cr(arguments)),ft(arguments))}merge(){return this._runTask(bR(Cr(arguments)),ft(arguments))}mergeFromTo(t,e){return er(t)&&er(e)?this._runTask(bR([t,e,...Cr(arguments)]),ft(arguments,!1)):this._runTask(Pr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=O0({remote:gn(arguments[0],er),branch:gn(arguments[1],er)},Cr(arguments));return this._runTask(t,ft(arguments))}stash(){return this._runTask(mr(["stash",...Cr(arguments)]),ft(arguments))}status(){return this._runTask(sq(Cr(arguments)),ft(arguments))}},Object.assign(f0.prototype,wj(),Aj(),tj(),_j(),Cj(),sj(),qj(),eq(),lq())}}),uI={};vt(uI,{Scheduler:()=>dI});var AR,dI,dq=Y({"src/lib/runners/scheduler.ts"(){"use strict";de(),A$(),AR=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,fI.createDeferred)();return{promise:e,done:r,id:t}}})(),dI=class{constructor(t=2){this.concurrency=t,this.logger=k0("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=Oe(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Mh(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Oe(this.pending,AR());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),hI={};vt(hI,{applyPatchTask:()=>hq});function hq(t,e){return mr(["apply",...e,...t])}var pq=Y({"src/lib/tasks/apply-patch.ts"(){"use strict";gt()}});function mq(t,e){return{branch:t,hash:e,success:!0}}function gq(t){return{branch:t,hash:null,success:!1}}var pI,vq=Y({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";pI=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function mI(t,e){return e===1&&d0.test(t)}var TR,d0,CR,Uh,wq=Y({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";vq(),de(),TR=/(\S+)\s+\(\S+\s([^)]+)\)/,d0=/^error[^']+'([^']+)'/m,CR=[new me(TR,(t,[e,r])=>{let i=mq(e,r);t.all.push(i),t.branches[e]=i}),new me(d0,(t,[e])=>{let r=gq(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],Uh=(t,e)=>$r(new pI,CR,[t,e])}}),gI,yq=Y({"src/lib/responses/BranchSummary.ts"(){"use strict";gI=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,i,n){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:i,label:n}}}}});function PR(t){return t?t.charAt(0):""}function vI(t){return $r(new gI,wI,t)}var wI,bq=Y({"src/lib/parsers/parse-branch.ts"(){"use strict";yq(),de(),wI=[new me(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,i,n])=>{t.push(PR(e),!0,r,i,n)}),new me(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,i,n])=>{t.push(PR(e),!1,r,i,n)})]}}),yI={};vt(yI,{branchLocalTask:()=>xq,branchTask:()=>_q,containsDeleteBranchCommand:()=>bI,deleteBranchTask:()=>Eq,deleteBranchesTask:()=>Sq});function bI(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function _q(t){let e=bI(t),r=["branch",...t];return r.length===1&&r.push("-a"),r.includes("-v")||r.splice(1,0,"-v"),{format:"utf-8",commands:r,parser(i,n){return e?Uh(i,n).all[0]:vI(i)}}}function xq(){return{format:"utf-8",commands:["branch","-v"],parser:vI}}function Sq(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,i){return Uh(r,i)},onError({exitCode:r,stdOut:i},n,s,a){if(!mI(String(n),r))return a(n);s(i)}}}function Eq(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(i,n){return Uh(i,n).branches[t]},onError({exitCode:i,stdErr:n,stdOut:s},a,o,l){if(!mI(String(a),i))return l(a);throw new Ru(r.parser(Cu(s),Cu(n)),String(a))}};return r}var kq=Y({"src/lib/tasks/branch.ts"(){"use strict";El(),wq(),bq(),de()}}),_I,Aq=Y({"src/lib/responses/CheckIgnore.ts"(){"use strict";_I=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),xI={};vt(xI,{checkIgnoreTask:()=>Tq});function Tq(t){return{commands:["check-ignore",...t],format:"utf-8",parser:_I}}var Cq=Y({"src/lib/tasks/check-ignore.ts"(){"use strict";Aq()}}),SI={};vt(SI,{cloneMirrorTask:()=>Rq,cloneTask:()=>EI});function Pq(t){return/^--upload-pack(=|$)/.test(t)}function EI(t,e,r){let i=["clone",...r];return er(t)&&i.push(t),er(e)&&i.push(e),i.find(Pq)?Pr("git.fetch: potential exploit argument blocked."):mr(i)}function Rq(t,e,r){return Oe(r,"--mirror"),EI(t,e,r)}var $q=Y({"src/lib/tasks/clone.ts"(){"use strict";gt(),de()}});function Iq(t,e){return $r({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},kI,[t,e])}var kI,Fq=Y({"src/lib/parsers/parse-fetch.ts"(){"use strict";de(),kI=[new me(/From (.+)$/,(t,[e])=>{t.remote=e}),new me(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new me(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new me(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new me(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,i,n])=>{t.updated.push({name:i,tracking:n,to:r,from:e})})]}}),AI={};vt(AI,{fetchTask:()=>Mq});function Oq(t){return/^--upload-pack(=|$)/.test(t)}function Mq(t,e,r){let i=["fetch",...r];return t&&e&&i.push(t,e),i.find(Oq)?Pr("git.fetch: potential exploit argument blocked."):{commands:i,format:"utf-8",parser:Iq}}var Dq=Y({"src/lib/tasks/fetch.ts"(){"use strict";Fq(),gt()}});function Lq(t){return $r({moves:[]},TI,t)}var TI,Bq=Y({"src/lib/parsers/parse-move.ts"(){"use strict";de(),TI=[new me(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),CI={};vt(CI,{moveTask:()=>Nq});function Nq(t,e){return{commands:["mv","-v",...mn(t),e],format:"utf-8",parser:Lq}}var Hq=Y({"src/lib/tasks/move.ts"(){"use strict";Bq(),de()}}),PI={};vt(PI,{pullTask:()=>Uq});function Uq(t,e,r){let i=["pull",...r];return t&&e&&i.splice(1,0,t,e),{commands:i,format:"utf-8",parser(n,s){return F0(n,s)},onError(n,s,a,o){let l=Yj(Cu(n.stdOut),Cu(n.stdErr));if(l)return o(new Ru(l));o(s)}}}var Gq=Y({"src/lib/tasks/pull.ts"(){"use strict";El(),J$(),de()}});function jq(t){let e={};return RI(t,([r])=>e[r]={name:r}),Object.values(e)}function qq(t){let e={};return RI(t,([r,i,n])=>{e.hasOwnProperty(r)||(e[r]={name:r,refs:{fetch:"",push:""}}),n&&i&&(e[r].refs[n.replace(/[^a-z]/g,"")]=i)}),Object.values(e)}function RI(t,e){m0(t,r=>e(r.split(/\s+/)))}var zq=Y({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";de()}}),$I={};vt($I,{addRemoteTask:()=>Vq,getRemotesTask:()=>Wq,listRemotesTask:()=>Yq,remoteTask:()=>Xq,removeRemoteTask:()=>Zq});function Vq(t,e,r){return mr(["remote","add",...r,t,e])}function Wq(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?qq:jq}}function Yq(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),mr(e)}function Xq(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),mr(e)}function Zq(t){return mr(["remote","remove",t])}var Kq=Y({"src/lib/tasks/remote.ts"(){"use strict";zq(),gt()}}),II={};vt(II,{stashListTask:()=>Qq});function Qq(t={},e){let r=j$(t),i=["stash","list",...r.commands,...e],n=N$(r.splitter,r.fields,T0(i));return Hh(i)||{commands:i,format:"utf-8",parser:n}}var Jq=Y({"src/lib/tasks/stash-list.ts"(){"use strict";Ou(),U$(),I0(),q$()}}),FI={};vt(FI,{addSubModuleTask:()=>ez,initSubModuleTask:()=>tz,subModuleTask:()=>Gh,updateSubModuleTask:()=>rz});function ez(t,e){return Gh(["add",t,e])}function tz(t){return Gh(["init",...t])}function Gh(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),mr(e)}function rz(t){return Gh(["update",...t])}var iz=Y({"src/lib/tasks/sub-module.ts"(){"use strict";gt()}});function nz(t,e){let r=isNaN(t),i=isNaN(e);return r!==i?r?1:-1:r?OI(t,e):0}function OI(t,e){return t===e?0:t>e?1:-1}function sz(t){return t.trim()}function Eh(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var RR,MI,az=Y({"src/lib/responses/TagList.ts"(){"use strict";RR=class{constructor(t,e){this.all=t,this.latest=e}},MI=function(t,e=!1){let r=t.split(` +`).map(sz).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return nz(Eh(a[0]),Eh(o[0]));for(let l=0,c=Math.max(a.length,o.length);ln.indexOf(".")>=0);return new RR(r,i)}}}),DI={};vt(DI,{addAnnotatedTagTask:()=>cz,addTagTask:()=>lz,tagListTask:()=>oz});function oz(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return MI(r,e)}}}function lz(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function cz(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var uz=Y({"src/lib/tasks/tag.ts"(){"use strict";az()}}),fz=CG({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(hj(),ut(P$)),{SimpleGitApi:i}=(fq(),ut(cI)),{Scheduler:n}=(dq(),ut(uI)),{configurationErrorTask:s}=(gt(),ut(a0)),{asArray:a,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:m}=(de(),ut(QR)),{applyPatchTask:g}=(pq(),ut(hI)),{branchTask:v,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:k}=(kq(),ut(yI)),{checkIgnoreTask:x}=(Cq(),ut(xI)),{checkIsRepoTask:E}=(r$(),ut(JR)),{cloneTask:A,cloneMirrorTask:y}=($q(),ut(SI)),{cleanWithOptionsTask:S,isCleanOptionsArray:_}=(h$(),ut(f$)),{diffSummaryTask:T}=(I0(),ut(G$)),{fetchTask:P}=(Dq(),ut(AI)),{moveTask:D}=(Hq(),ut(CI)),{pullTask:B}=(Gq(),ut(PI)),{pushTagsTask:N}=(iI(),ut(rI)),{addRemoteTask:ce,getRemotesTask:Pe,listRemotesTask:ve,remoteTask:se,removeRemoteTask:xe}=(Kq(),ut($I)),{getResetMode:we,resetTask:z}=(k$(),ut(x$)),{stashListTask:Q}=(Jq(),ut(II)),{addSubModuleTask:j,initSubModuleTask:Le,subModuleTask:lr,updateSubModuleTask:Ft}=(iz(),ut(FI)),{addAnnotatedTagTask:Ie,addTagTask:At,tagListTask:Tt}=(uz(),ut(DI)),{straightThroughBufferTask:jt,straightThroughStringTask:Ze}=(gt(),ut(a0));function q(L,V){this._plugins=V,this._executor=new r(L.baseDir,new n(L.maxConcurrentProcesses),V),this._trimmed=L.trimmed}(q.prototype=Object.create(i.prototype)).constructor=q,q.prototype.customBinary=function(L){return this._plugins.reconfigure("binary",L),this},q.prototype.env=function(L,V){return arguments.length===1&&typeof L=="object"?this._executor.env=L:(this._executor.env=this._executor.env||{})[L]=V,this},q.prototype.stashList=function(L){return this._runTask(Q(m(arguments)||{},o(L)&&L||[]),h(arguments))};function Z(L,V,Te,qe){return typeof Te!="string"?s(`git.${L}() requires a string 'repoPath'`):V(Te,f(qe,c),d(arguments))}q.prototype.clone=function(){return this._runTask(Z("clone",A,...arguments),h(arguments))},q.prototype.mirror=function(){return this._runTask(Z("mirror",y,...arguments),h(arguments))},q.prototype.mv=function(L,V){return this._runTask(D(L,V),h(arguments))},q.prototype.checkoutLatestTag=function(L){var V=this;return this.pull(function(){V.tags(function(Te,qe){V.checkout(qe.latest,L)})})},q.prototype.pull=function(L,V,Te,qe){return this._runTask(B(f(L,c),f(V,c),d(arguments)),h(arguments))},q.prototype.fetch=function(L,V){return this._runTask(P(f(L,c),f(V,c),d(arguments)),h(arguments))},q.prototype.silent=function(L){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},q.prototype.tags=function(L,V){return this._runTask(Tt(d(arguments)),h(arguments))},q.prototype.rebase=function(){return this._runTask(Ze(["rebase",...d(arguments)]),h(arguments))},q.prototype.reset=function(L){return this._runTask(z(we(L),d(arguments)),h(arguments))},q.prototype.revert=function(L){let V=h(arguments);return typeof L!="string"?this._runTask(s("Commit must be a string"),V):this._runTask(Ze(["revert",...d(arguments,0,!0),L]),V)},q.prototype.addTag=function(L){let V=typeof L=="string"?At(L):s("Git.addTag requires a tag name");return this._runTask(V,h(arguments))},q.prototype.addAnnotatedTag=function(L,V){return this._runTask(Ie(L,V),h(arguments))},q.prototype.deleteLocalBranch=function(L,V,Te){return this._runTask(k(L,typeof V=="boolean"?V:!1),h(arguments))},q.prototype.deleteLocalBranches=function(L,V,Te){return this._runTask(b(L,typeof V=="boolean"?V:!1),h(arguments))},q.prototype.branch=function(L,V){return this._runTask(v(d(arguments)),h(arguments))},q.prototype.branchLocal=function(L){return this._runTask(w(),h(arguments))},q.prototype.raw=function(L){let V=!Array.isArray(L),Te=[].slice.call(V?arguments:L,0);for(let Ot=0;Ott.removeEventListener("abort",s))}}]:void 0}function pz(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function mz(t,e){if(pz(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Kn(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function gz(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Kn(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new Kn(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new Kn(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function vz({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,i){return r.forEach((n,s)=>{let a=se0(n))).then(a.done)}return{type:"spawn.after",async action(n,{spawned:s,close:a}){var u,f;let o=r(),l=!0,c=()=>void(l=!1);(u=s.stdout)==null||u.on("data",c),(f=s.stderr)==null||f.on("data",c),s.on("error",c),s.on("close",d=>o.close(d)),s.on("exit",d=>o.exit(d));try{await o.result,l&&await e0(50),a(o.exitCode)}catch(d){a(o.exitCode,d)}}}}de();var bz="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",IR="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function _z(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function FR(t,e){if(t.length<1||t.length>2)throw new Kn(void 0,"binary",bz);if(t.some(_z))if(e)console.warn(IR);else throw new Kn(void 0,"binary",IR);let[i,n]=t;return{binary:i,prefix:n}}function xz(t,e=["git"],r=!1){let i=FR(mn(e),r);t.on("binary",n=>{i=FR(mn(n),r)}),t.append("spawn.binary",()=>i.binary),t.append("spawn.args",n=>i.prefix?[i.prefix,...n]:n)}zs();function Sz(t){return!!(t.exitCode&&t.stdErr.length)}function Ez(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function kz(t=!1,e=Sz,r=Ez){return(i,n)=>!t&&i||!e(n)?i:r(n)}function OR(t){return{type:"task.error",action(e,r){let i=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(i)?{error:new Rr(void 0,i.toString("utf-8"))}:{error:i}}}}de();var Az=class{constructor(){this.plugins=new Set,this.events=new LI.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Oe(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return mn(t).forEach(r=>r&&this.plugins.add(Oe(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let i=e,n=Object.freeze(Object.create(r));for(let s of this.plugins)s.type===t&&(i=s.action(i,n));return i}};de();function Tz(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(s,a){return r.includes(a.method)?GR(s,e):s}},{type:"spawn.after",action(s,a){var o;a.commands.includes(e)&&((o=a.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:a.method,stage:Cz(c[1]),progress:Ve(c[2]),processed:Ve(c[3]),total:Ve(c[4])})}))}}]}function Cz(t){return String(t.toLowerCase().split(" ",1))||"unknown"}de();function Pz(t){let e=zR(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function Rz({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(i,n){var c,u;let s;function a(){s&&clearTimeout(s),s=setTimeout(l,t)}function o(){var f,d;(f=n.spawned.stdout)==null||f.off("data",a),(d=n.spawned.stderr)==null||d.off("data",a),n.spawned.off("exit",o),n.spawned.off("close",o),s&&clearTimeout(s)}function l(){o(),n.kill(new Kn(void 0,"timeout","block timeout reached"))}r&&((c=n.spawned.stdout)==null||c.on("data",a)),e&&((u=n.spawned.stderr)==null||u.on("data",a)),n.spawned.on("exit",o),n.spawned.on("close",o),a()}}}Pu();function $z(){return{type:"spawn.args",action(t){let e=[],r;function i(n){(r=r||[]).push(...n)}for(let n=0;nCh(a)&&nR(a)||a));break}e.push(s)}return r?[...e,"--",...r.map(String)]:e}}}de();var Iz=fz();function Fz(t,e){var n;let r=new Az,i=ZR(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!g0(i.baseDir))throw new dz(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(wz(i.config)),r.add(vz(i.unsafe)),r.add($z()),r.add(yz(i.completion)),i.abort&&r.add(hz(i.abort)),i.progress&&r.add(Tz(i.progress)),i.timeout&&r.add(Rz(i.timeout)),i.spawnOptions&&r.add(Pz(i.spawnOptions)),r.add(OR(kz(!0))),i.errors&&r.add(OR(i.errors)),xz(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new Iz(i,r)}El();var BI=Fz;var Se=class extends vl{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var i;if(await this.isGitInstalled()){let n=this.app.vault.adapter,s=n.getBasePath(),a=s;this.plugin.settings.basePath&&(await n.exists((0,Qn.normalizePath)(this.plugin.settings.basePath))?a=Ge.join(s,this.plugin.settings.basePath):r||new Qn.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=a,this.git=BI({baseDir:a,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Nd:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir;if(o.length>0){let v=o.join(":")+":"+process.env.PATH;process.env.PATH=v}c&&(process.env.GIT_DIR=c);for(let v of l){let[w,b]=v.split("=");process.env[w]=b}let u="simple-git",f=",",h=((i=localStorage.debug)!=null?i:"").split(f);if(!h.includes(u)&&!h.includes(`-${u}`)&&(h.push(u),UI.default.enable(h.join(f))),await this.git.checkIsRepo()){let v=await this.git.revparse("--show-cdup"),w=(0,Mu.resolve)(a+Mu.sep+v);this.absoluteRepoPath=w,await this.git.cwd(w)}let m=Ge.join(s,this.app.vault.configDir,"plugins","obsidian-git"),g=Ge.join(m,Ta);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=g),process.env.SSH_ASKPASS_REQUIRE="force",process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=Ge.join(m,Hd),process.env.SSH_ASKPASS==g&&this.askpass().catch(v=>this.plugin.displayError(v))}}getRelativeVaultPath(r){let n=this.app.vault.adapter.getBasePath(),s=Ge.join(this.absoluteRepoPath,r),a=Ge.relative(n,s);return Qn.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(r,i=!0){if(i){let s=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,o=Ge.join(s,r),l=Ge.relative(a,o);return Qn.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let i=this.app.vault.adapter.getBasePath();return Ge.join(i,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return Ge.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,i=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await ei.writeFile(Ge.join(this.absPluginConfigPath,Ta),GA),await ei.chmod(Ge.join(this.absPluginConfigPath,Ta),493),this.watchAbortController=new AbortController;let{signal:n}=this.watchAbortController;try{let s=ei.watch(this.absPluginConfigPath,{signal:n});for await(let a of s){if(a.filename!=Hd)continue;let o=i+Hd;if(await new Promise(f=>setTimeout(f,200)),!await r.exists(o))continue;let l=await r.read(o),c;l.length>60&&(c=new Qn.Notice(l,999999));let u=await new Qe(this.plugin,{allowEmpty:!0,obscure:!0,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();c==null||c.hide(),await r.exists(o)&&await r.write(`${o}.response`,u!=null?u:"")}}catch(s){this.plugin.displayError(s),await ei.rm(Ge.join(this.absPluginConfigPath,Ta),{force:!0}),await ei.rm(Ge.join(this.absPluginConfigPath,`${Ta}.response`),{force:!0}),await new Promise(a=>setTimeout(a,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),i=Ge.join(this.app.vault.configDir,"plugins","obsidian-git",Ta),n=this.getRelativeRepoPath(i,!0);(await ei.readFile(r,"utf-8")).split(` +`).some(l=>l.contains(n))||await ei.appendFile(r,n+` +`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",Ge.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(` +`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Mu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Bd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Gs(i)}a.push("--",o);let c=await this.git.raw(a);return Oz(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),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,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),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 i=Ge.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Fa.RECURSIVE+Fa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"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}`,n]),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 s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let r=await this.git.status(),i=r.tracking,n=r.current;if(!i&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let s=null;return i&&(s=(await this.git.diffSummary([n,i,"--"])).changed),await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),s}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let[s,a]=Zn(i);return(await this.getRemoteBranches(s)).includes(i)?(await this.git.diffSummary([n,i,"--"])).changed:(this.plugin.log(`Tracking branch ${i} does not exist on remote ${s}.`),0)}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),i=r.tracking,n=r.current;return i?(await this.git.diffSummary([n,i,"--"])).changed!==0:!1}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),i=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:i.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(i){if(String(i).contains(r))return;throw i}}async log(r,i=!0,n,s){let a;r&&(a=this.getRelativeRepoPath(r,i));let o={file:a,maxCount:n,"--diff-merges":"first-parent","--name-status":null};return s&&(o[s]=null),(await this.git.log(o)).all.map(c=>{var u,f,d,h;return{...c,author:{name:c.author_name,email:c.author_email},refs:c.refs.split(", ").filter(m=>m.length>0),diff:{...c.diff,files:(f=(u=c.diff)==null?void 0:u.files.map(m=>({...m,status:m.status,path:m.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(m.file),fromPath:m.from,fromVaultPath:m.from!=null?this.getRelativeVaultPath(m.from):void 0,binary:m.binary})))!=null?f:[]},fileName:(h=(d=c.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(r,i,n=!0){let s=this.getRelativeRepoPath(i,n);return this.git.show([r+":"+s])}async checkout(r,i){if(i&&(r=`${i}/${r}`),await this.git.checkout(r),this.plugin.settings.submoduleRecurseCheckout){let n=await this.getSubmodulePaths();for(let s of n){let a=await this.git.cwd({path:s,root:!1}).branch();Object.keys(a.branches).includes(r)&&await this.git.cwd({path:s,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,i){await this.git.branch([i?"-D":"-d",r])}async branchIsMerged(r){return!(await this.git.branch(["--no-merged"])).all.contains(r)}async init(){await this.git.init(!1)}async clone(r,i,n){await this.git.clone(r,Ge.join(this.app.vault.adapter.getBasePath(),i),n?["--depth",`${n}`]:[]),await this.setGitInstance()}async setConfig(r,i){i==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,i)}async getConfig(r,i="local"){let n;i=="all"?n=await this.git.listConfig():n=await this.git.listConfig(i);let s=n.all[r.toLowerCase()];if(typeof s=="string"||s==null)return s;throw new Error("Config value is not a string")}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,i){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,i]):await this.git.remote(["add",r,i])}async getRemoteBranches(r){let i=await this.git.branch(["-r","--list",`${r}*`]),n=[];for(let s in i.branches)n.push(i.branches[s].name);return n}async getRemotes(){let r=await this.git.remote([]);return r?r.trim().split(` +`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Zn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Ge.dirname(r)))return;let i=await this.git.raw(["-C",Ge.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",Ge.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(Ge.normalize(r)),o=Ge.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Rr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await ku(r||"git",["--version"],{});if(i.error)if(Qn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Nd}) of Git for Windows.`);let n=await ku(Nd,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Rr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new cl(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},GI={hash:"000000",isZeroCommit:!0,summary:""};function Oz(t){let r=t.replace(`\r +`,` +`).split(` +`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s=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 i}function Dz(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=HI(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=HI(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function Lz(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);D0(t.author)&&(t.author=void 0),D0(t.committer)&&(t.committer=void 0),D0(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function D0(t){return!t||Object.keys(t).length===0}function NI(t){return t.length>0&&t[0].trim()===t[0]}function HI(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}p();var hF=require("@codemirror/state");p();var L0=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()}},Jn=new L0;p();var qh=require("@codemirror/state"),jI=Mt(B0());function qI(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var zI=qh.StateEffect.define();function VI(t,e,r){return r.update({effects:zI.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var kl=qh.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(zI))return r.value;return Bz(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function zh(t){var s;let e=jI.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var wi={get:void 0,save:void 0};function WI(t,e){wi.get=t,wi.save=e}function Vh(t){var e,r;return(r=(e=jh(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:jh(rt.lineAuthor.coloringMaxAge).asDays()}function Bz(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var m;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;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 YI(){Al=void 0,N0=[],Wh=0,Xh.clear(),Zh.clear(),Tl.clear()}var Al,Yh=()=>Al;function XI(t,e){var n;let r=e.length;if(r<((n=Al==null?void 0:Al.length)!=null?n:0))return;Al={gutter:t,length:r,text:e};let i=wi.get();r!==i.gutterSpacingFallbackLength&&(i.gutterSpacingFallbackLength=r,wi.save(i))}var N0=[],Nz=15,Wh=0;function ZI(t){N0[Wh]=t,Wh=(Wh+1)%Nz}function KI(){return NP(N0)}var Xh=new Map,Zh=new Map,Tl=new Set;p();var uF=require("@codemirror/state"),fF=require("@codemirror/view");p();var j0=require("@codemirror/view"),aF=Mt(B0()),Cl=require("obsidian");p();p();var Kh={x:-10,y:-10};function QI(){Kh.x===-10&&window.addEventListener("mousedown",t=>{Kh.x=t.clientX,Kh.y=t.clientY})}function JI(){for(let t of Tl)if(Hz(t,Kh))return t}function Hz(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var eF="data-commit";function tF(t,e,r){if(e.hasFocus())return;let i=JI();if(!i)return;let n=Gz(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&Uz(n,t),H0("showCommitHash",t),H0("authorDisplay",t),H0("dateTimeFormatOptions",t))}function Uz(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(i=>navigator.clipboard.writeText(t.hash)))}function H0(t,e){var l,c;let r,i,n=Fi.plugin.settings.lineAuthor,s=n[t],a=typeof s=="boolean"?s:s!=="hide",o=rt.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",i=s;else if(t==="authorDisplay"){let u=(l=n.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(a?s:u),i=a?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=n.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(a?s:u),r+=r.contains("date")?"":" date",i=a?"hide":u}else Gs(t);e.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(a).onClick(f=>{var d,h;return(h=(d=Fi.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,i)}))}function rF(t,e,r){r.setAttr(eF,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function Gz(t){let e=t.getAttr(eF);return e?JSON.parse(e):void 0}p();function Jh(t,e){return t==="oldest"?Qh(0,!1,e).color:Qh(void 0,!0,e).color}function Qh(t,e,r){let i=Vh(r),n=Date.now()/1e3,s=t!=null?t:0,o=(e?0:n-s)/60/60/24,l=Math.pow(Math.clamp(o/i,0,1),1/2.3),c=jz(),u=r.colorNew,f=r.colorOld,d=c?.4:1,h=U0(u.r,f.r,l)*d,m=U0(u.g,f.g,l)*d,g=U0(u.b,f.b,l)*d;return{color:`rgba(${h},${m},${g},${c?.75:.25})`,daysSinceCommit:o}}function U0(t,e,r){return t+(e-t)*r}function jz(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function iF(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}p();function nF(t,e,r){let i;for(let n=e;n<=r;n++){let s=t.hashPerLine[n],a=t.commits.get(s);(!i||a.isZeroCommit||qz(a,i))&&(i=a)}return i}function qz(t,e){var n,s,a,o;let r=(s=(n=t.author)==null?void 0:n.epochSeconds)!=null?s:0,i=(o=(a=e.author)==null?void 0:a.epochSeconds)!=null?o:0;return r>i}var sF="-",zz="+",Vz=3,Wz="*",Yz=/\S/g,Xz="%",Pl=class t extends j0.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof t&&this.text===r.text}toDOM(){return document.createTextNode(this.text)}destroy(r){}},G0=class extends j0.GutterMarker{constructor(r,i,n,s,a,o){super();this.lineAuthoring=r;this.startLine=i;this.endLine=n;this.key=s;this.settings=a;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(r){return this.key===(r==null?void 0:r.key)&&this.startLine===(r==null?void 0:r.startLine)&&this.endLine===(r==null?void 0:r.endLine)&&(this==null?void 0:this.options)===(r==null?void 0:r.options)}toDOM(){var r;return this.precomputedDomProvider=(r=this.precomputedDomProvider)!=null?r:this.computeDom(),this.precomputedDomProvider()}destroy(r){r&&(document.body.contains(r)||Tl.delete(r))}computeDom(){let r=nF(this.lineAuthoring,this.startLine,this.endLine),i=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?XI(this,i):i=this.adaptTextForFakeCommit(r,i,this.options),this.createHtmlNode(r,i,this.options==="waiting-for-result")}createHtmlNode(r,i,n){var c,u,f,d,h,m;let s=window.createDiv();s.setText(i);let{color:a,daysSinceCommit:o}=Qh((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);s.style.backgroundColor=a,s.setAttribute("data-author",(f=(u=r==null?void 0:r.author)==null?void 0:u.name)!=null?f:""),s.setAttribute("data-author-email",(h=(d=r==null?void 0:r.author)==null?void 0:d.email)!=null?h:""),(0,Cl.setTooltip)(s,(m=r==null?void 0:r.summary)!=null?m:""),rF(r,n,s);function l(){let g=s.cloneNode(!0);return Tl.add(g),n||ZI(o),g}return l}renderNonZeroCommit(r){let i=this.settings.showCommitHash?this.renderHash(r):"",n=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,s=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[i,n,s].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,i){var o,l,c,u;let n=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",s=n.split(" ").filter(f=>f.length>=1),a;switch(i){case"initials":a=s.map(f=>f[0].toUpperCase()).join("");break;case"first name":a=(c=s.first())!=null?c:sF;break;case"last name":a=(u=s.last())!=null?u:sF;break;case"full":a=n;break;default:return Gs(i)}return HP(r==null?void 0:r.author,r==null?void 0:r.committer)||(a=a+Wz),a}renderAuthoringDate(r,i,n,s){var c;let a="?";if(((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds)===void 0)return a;let o;switch(i){case"date":o=Ld;break;case"datetime":o=Sv;break;case"custom":o=n;break;case"natural language":o=u=>{let f=u.diff((0,Cl.moment)());return Cl.moment.duration(f).humanize(!0)};break;default:return Gs(i)}let l=Cl.moment.unix(r.author.epochSeconds);switch(s){case"viewer-local":break;case"author-local":l=l.utcOffset(r.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return Gs(s)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,i,n){var l,c,u,f;let s=(c=(l=Yh())==null?void 0:l.text)!=null?c:i,a=n!=="waiting-for-result"&&r.isZeroCommit?zz:Xz;i=s.replace(Yz,a);let o=(f=(u=wi.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:i.length;if(i=UP(i,o,a),n!=="waiting-for-result"&&r.isZeroCommit){let d=Math.min(o,Vz);i=GP(i,o-d)}return i}};function Da(t,e,r,i,n,s){let a=aF.sha256.create();a.update(JSON.stringify(n)),a.update(`s${e}-e${r}-k${i}-o${s}`);let o=a.hex(),l=Xh.get(o);if(l)return l;let c=new G0(t,e,r,i,n,s);return Xh.set(o,c),c}p();var oF=require("obsidian");function q0(){var e,r;let t=(r=(e=wi.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?r:rt.lineAuthor.gutterSpacingFallbackLength;return new Pl(Array(t).fill("-").join(""))}function z0(t){let{lineAuthoring:e,ageForInitialRender:r}=Zz(t);return Da(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function Zz(t){var s;let e=(s=KI())!=null?s:Vh(t)*.25,r=(0,oF.moment)().add(-e,"days"),i={name:"",epochSeconds:BP(r),tz:"+0000"},n={hash:"waiting-for-result",author:i,committer:i,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",n]])},ageForInitialRender:e}}p();function lF(t,e){return Da({hashPerLine:[void 0,"000000"],commits:new Map([["000000",GI]])},1,1,t,e)}var V0=new Pl(""),dF=(0,fF.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(kl,!1);return Kz(t,e)},lineMarkerChange(t){let e=zh(t.state.field(kl));return zh(t.startState.field(kl))!==e},renderEmptyElements:!0,initialSpacer:t=>(cF(t),q0()),updateSpacer:(t,e)=>{var r,i;return cF(e.view),(i=(r=Yh())==null?void 0:r.gutter)!=null?i:q0()}});function Kz(t,e){let r=zh(e),i=t.state.doc,n=new Map;for(let u=1;u<=i.lines;u++){let f=i.line(u).from,d=t.lineBlockAt(f).to;n.set(u,[f,d]),r.update([f,d,0])}let s=wi.get();r.update("s"+Object.values(wi).join(","));let a=r.hex(),o=Zh.get(a);if(o)return o;let{result:l,allowCache:c}=Qz(i,n,s,e);return c&&Zh.set(a,l),l}function Qz(t,e,r,i){let n=!0,s=t.lines,a=[];function o(f,d,h){return a.push(h.range(f,d))}let l=Jz(s,i),c=t.length===0,u=t.iterLines(s,s+1).next().value==="";for(let f=1;f<=s;f++){let[d,h]=e.get(f),m=t.lineAt(h).number;if(c){o(d,h,V0);continue}if(f===s&&u){o(d,h,V0);continue}if(i===void 0){o(d,h,z0(r)),n=!1;continue}let{key:g,la:v}=i;if(v==="untracked"){o(d,h,lF(v,r));continue}let w=v.hashPerLine.length-1,b=l[f],k=l[m];if(k&&k>w&&o(d,h,V0),b!==void 0&&jw(1,b,w)&&k!==void 0&&jw(1,k,w)){o(d,h,Da(v,b,k,g,r));continue}if(w<1){o(d,h,z0(r)),n=!1;continue}let x=Math.clamp(b!=null?b:f,1,w),E=Math.clamp(k!=null?k:m,1,w);o(d,h,Da(v,x,E,g+"computing",r,"waiting-for-result"))}return{result:uF.RangeSet.of(a,!0),allowCache:n}}function Jz(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),n=>n);let r=[void 0],i=0;for(let n=1;n<=t;n++){let s=e.lineOffsetsFromUnsavedChanges.get(n);i+=s!=null?s:0,r[n]=s===void 0?n-i:void 0}return r}function cF(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var ep=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),YI()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,i=await r.submoduleAwareHeadRevisonInContainingDirectory(e),n=await r.hashObject(e),s=qI(i,n,e);if(s!==void 0){if(!this.lineAuthorings.has(s)){let a=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(s,a)}this.notifyComputationResultToSubscribers(e,s)}}notifyComputationResultToSubscribers(e,r){Jn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},pF=hF.Prec.high([kl,dF]);var eV="https://momentjs.com/docs/#/parsing/string-format/",tV="https://publish.obsidian.md/git-doc/Line+Authoring",tp=class extends U.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i;this.lineAuthorColorSettings=new Map;this.icon="git-pull-request"}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,i=this.plugin,n;i.settings.differentIntervalCommitAndPush?n="commit":n="commit-and-sync";let s=i.gitReady;r.empty(),s||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let a;if(s){new U.Setting(r).setName("Automatic").setHeading(),new U.Setting(r).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(f=>f.setValue(i.settings.differentIntervalCommitAndPush).onChange(async d=>{i.settings.differentIntervalCommitAndPush=d,await i.saveSettings(),i.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new U.Setting(r).setName(`Auto ${n} interval (minutes)`).setDesc(`${i.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoSaveInterval"}),f.setPlaceholder(String(rt.autoSaveInterval)),f.onChange(async d=>{d!==""?i.settings.autoSaveInterval=Number(d):i.settings.autoSaveInterval=rt.autoSaveInterval,await i.saveSettings(),i.automaticsManager.reload("commit")})}),a=new U.Setting(r).setName(`Auto ${n} after stopping file edits`).setDesc(`Requires the ${n} interval not to be 0. + If turned on, do auto ${n} every ${jP(i.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(rt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=rt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(rt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=rt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(rt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=rt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading();let c=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). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${rt.commitMessage}"`).onClick(()=>{f.setValue(rt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),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(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=rt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.innerHTML=` + Specify custom date format. E.g. "${Ev}. See Moment.js for more formats.`,new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new U.Setting(r).setName("Preview commit message").addButton(f=>f.setButtonText("Preview").onClick(async()=>{let d=await i.gitManager.formatCommitMessage(i.settings.commitMessage);new U.Notice(`${d}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(f=>f.setValue(i.settings.listChangedFilesInMessageBody).onChange(async d=>{i.settings.listChangedFilesInMessageBody=d,await i.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),i.gitManager instanceof Se&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(f=>{let d={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};f.addOptions(d),f.setValue(i.settings.syncMethod),f.onChange(async h=>{i.settings.syncMethod=h,await i.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(f=>{let d={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};f.addOptions(d),f.setValue(i.settings.mergeStrategy),f.onChange(async h=>{i.settings.mergeStrategy=h,await i.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(f=>f.setValue(i.settings.autoPullOnBoot).onChange(async d=>{i.settings.autoPullOnBoot=d,await i.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(),a=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 ${i.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(f=>f.setValue(!i.settings.disablePush).onChange(async d=>{i.settings.disablePush=!d,this.refreshDisplayWithDelay(),await i.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 ${i.settings.disablePush?"":"and push "}only.`).addToggle(f=>f.setValue(i.settings.pullBeforePush).onChange(async d=>{i.settings.pullBeforePush=d,this.refreshDisplayWithDelay(),await i.saveSettings()})),i.gitManager instanceof Se&&(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(f=>f.setValue(i.settings.hunks.showSigns).onChange(async d=>{i.settings.hunks.showSigns=d,await i.saveSettings(),i.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(f=>f.setValue(i.settings.hunks.hunkCommands).onChange(async d=>{i.settings.hunks.hunkCommands=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Status bar with summary of line changes").addDropdown(f=>f.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(i.settings.hunks.statusBar).onChange(async d=>{i.settings.hunks.statusBar=d,await i.saveSettings(),i.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(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(i.settings.authorInHistoryView),c.onChange(async f=>{i.settings.authorInHistoryView=f,await i.saveSettings(),await i.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(c=>c.setValue(i.settings.dateInHistoryView).onChange(async u=>{i.settings.dateInHistoryView=u,await i.saveSettings(),await i.refresh()})),new U.Setting(r).setName("Source control view").setHeading(),new U.Setting(r).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(i.settings.refreshSourceControl).onChange(async u=>{i.settings.refreshSourceControl=u,await i.saveSettings()})),new U.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"refreshSourceControlTimer"}),c.setPlaceholder(String(rt.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?i.settings.refreshSourceControlTimer=Math.max(Number(f),500):i.settings.refreshSourceControlTimer=rt.refreshSourceControlTimer,await i.saveSettings(),i.setRefreshDebouncer()})}),new U.Setting(r).setName("Miscellaneous").setHeading(),i.gitManager instanceof Se&&new U.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(c=>{let u={split:"Split",git_unified:"Unified"};c.addOptions(u),c.setValue(i.settings.diffStyle),c.onChange(async f=>{i.settings.diffStyle=f,await i.saveSettings()})}),new U.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(i.settings.disablePopups).onChange(async u=>{i.settings.disablePopups=u,this.refreshDisplayWithDelay(),await i.saveSettings()})),new U.Setting(r).setName("Disable error notifications").setDesc("Disable error notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(!i.settings.showErrorNotices).onChange(async u=>{i.settings.showErrorNotices=!u,await i.saveSettings()})),i.settings.disablePopups||new U.Setting(r).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(i.settings.disablePopupsForNoChanges).onChange(async u=>{i.settings.disablePopupsForNoChanges=u,await i.saveSettings()})),new U.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showStatusBar).onChange(async u=>{i.settings.showStatusBar=u,await i.saveSettings()})),new U.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(c=>c.setValue(i.settings.showFileMenu).onChange(async u=>{i.settings.showFileMenu=u,await i.saveSettings()})),new U.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showBranchStatusBar).onChange(async u=>{i.settings.showBranchStatusBar=u,await i.saveSettings()})),new U.Setting(r).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(i.settings.changedFilesInStatusBar).onChange(async u=>{i.settings.changedFilesInStatusBar=u,await i.saveSettings()})),i.gitManager instanceof Di?new U.Setting(r).setName("Authentication/commit author").setHeading():new U.Setting(r).setName("Commit author").setHeading(),i.gitManager instanceof Di&&new U.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=i.localStorage.getUsername())!=null?u:""),c.onChange(f=>{i.localStorage.setUsername(f)})}),i.gitManager instanceof Di&&new U.Setting(r).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(c=>{c.inputEl.autocapitalize="off",c.inputEl.autocomplete="off",c.inputEl.spellcheck=!1,c.onChange(u=>{i.localStorage.setPassword(u)})}),i.gitReady&&new U.Setting(r).setName("Author name for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.name"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.name",f==""?void 0:f)})}),i.gitReady&&new U.Setting(r).setName("Author email for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.email"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.email",f==""?void 0:f)})}),new U.Setting(r).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be required for special setups.").setHeading(),i.gitManager instanceof Se&&(new U.Setting(r).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(c=>c.setValue(i.settings.updateSubmodules).onChange(async u=>{i.settings.updateSubmodules=u,await i.saveSettings()})),i.settings.updateSubmodules&&new U.Setting(r).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(c=>c.setValue(i.settings.submoduleRecurseCheckout).onChange(async u=>{i.settings.submoduleRecurseCheckout=u,await i.saveSettings()}))),i.gitManager instanceof Se&&new U.Setting(r).setName("Custom Git binary path").setDesc("Specify the path to the Git binary/executable. Git should already be in your PATH. Should only be necessary for a custom Git installation.").addText(c=>{var u;c.setValue((u=i.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{i.localStorage.setGitPath(f),i.gitManager.updateGitPath(f||"git").catch(d=>i.displayError(d))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(c=>{c.setPlaceholder("GIT_DIR=/path/to/git/dir"),c.setValue(i.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(` +`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(` +`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(` +`))})}),i.gitManager instanceof Se&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(` + Sets the relative path to the vault from which the Git binary should be executed. + Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. + `).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new 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(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new 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(c=>{c.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});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 c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging: +You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new 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=` + Feature guide and quick examples
+ The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`,r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(s=>{s.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),s.setValue(this.settings.lineAuthor.followMovement),s.onChange(a=>this.lineAuthorSettingHandler("followMovement",a))});if(i.descEl.innerHTML=` + By default (deactivated), each line only shows the newest commit where it was changed. +
+ With same commit, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown. +
+ With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected. +
+ It uses git-blame and + for matches (at least ${Bd} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new U.Setting(this.containerEl).setName("Show commit hash").addToggle(s=>{s.setValue(this.settings.lineAuthor.showCommitHash),s.onChange(a=>this.lineAuthorSettingHandler("showCommitHash",a))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(s=>{let a={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};s.addOptions(a),s.setValue(this.settings.lineAuthor.authorDisplay),s.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(s=>{let a={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};s.addOptions(a),s.setValue(this.settings.lineAuthor.dateTimeFormatOptions),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let s=new U.Setting(this.containerEl);s.setName("Custom authoring date format").addText(a=>{a.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),a.setPlaceholder("YYYY-MM-DD HH:mm"),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),s.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),s.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(s=>{let a={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};s.addOptions(a),s.setValue(this.settings.lineAuthor.dateTimeTimezone),s.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 + UTC\xB100:00. + `;let n=new U.Setting(this.containerEl).setName("Oldest age in coloring");n.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],n.addText(s=>{s.setPlaceholder("1y"),s.setValue(this.settings.lineAuthor.coloringMaxAge),s.onChange(async a=>{let[o,l]=this.previewOldestAgeDescriptionHtml(a);n.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",a),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new U.Setting(this.containerEl).setName("Text color").addText(s=>{s.setValue(this.settings.lineAuthor.textColorCss),s.onChange(async a=>{await this.lineAuthorSettingHandler("textColorCss",a)})}).descEl.innerHTML=` + The CSS color of the gutter text.
+ + It is highly recommended to use + + CSS variables + defined by themes + (e.g.
var(--text-muted)
or +
var(--text-on-accent)
, + because they automatically adapt to theme changes.
+ + See: + List of available CSS variables in Obsidian + + `,new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(s=>{s.setValue(this.settings.lineAuthor.ignoreWhitespace),s.onChange(a=>this.lineAuthorSettingHandler("ignoreWhitespace",a))}).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. +
+ If you don't care about purely-whitespace changes + (e.g. list nesting / quote indentation changes), + then activating this will provide more meaningful change detection. + `}}createColorSetting(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=W0(r,this.settings.lineAuthor),a=W0(r,rt.lineAuthor);n.setPlaceholder(Gw(a)),n.setValue(Gw(s)),n.onChange(async o=>{let l=LP(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,W0(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.innerText=`Color for ${n} commits`}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&(n.descEl.innerHTML=this.colorSettingPreviewDescHtml(r,this.settings.lineAuthor,i!==void 0))}colorSettingPreviewDescHtml(r,i,n){let s=n?Jh(r,i):"rgba(127,127,127,0.3)",a=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),o=n?`abcdef Author Name ${a}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and + named colors (e.g. 'black', 'purple'). Color preview: ${`
${o}
`}`}previewCustomDateTimeDescriptionHtml(r){let i=(0,U.moment)().format(r);return`
Format string to display the authoring date.
Currently: ${i}`}previewOldestAgeDescriptionHtml(r){let i=jh(r);return[`The oldest age in the line author coloring. Everything older will have the same color. +
Smallest valid age is "1d". Currently: ${i!==void 0?`${i.asDays()} days`:"invalid!"}`,i]}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];rt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function W0(t,e){return t==="oldest"?e.colorOld:e.colorNew}function jh(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}p();var ti=require("obsidian");var rp=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,ti.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,ti.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,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,(i=this.unPushedCommits)!=null&&i&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.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 np=require("obsidian"),ip=class extends np.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 i=(0,np.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};p();var mF=require("obsidian"),Du=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,mF.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){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.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}diff(e,r){let n=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,n)}};p();var Ni=require("obsidian");p();var Lu=require("obsidian");async function gF(t,e,r){let i=await wF(e,r);if(i.result==="failure"){new Lu.Notice(i.reason);return}let{isGitHub:n,branch:s,repo:a,user:o,filePath:l}=i;if(n){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}-L${u}`)}else new Lu.Notice("It seems like you are not using GitHub")}async function vF(t,e){let r=await wF(t,e);if(r.result==="failure"){new Lu.Notice(r.reason);return}let{isGitHub:i,branch:n,repo:s,user:a,filePath:o}=r;i?window.open(`https://github.com/${a}/${s}/commits/${n}/${o}`):new Lu.Notice("It seems like you are not using GitHub")}async function wF(t,e){let r=await e.branchInfo(),i=r.tracking,n=r.current,s,a=e.getRelativeRepoPath(t.path);if(e instanceof Se){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){a=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(i=c.tracking||void 0,n=c.current||void 0,i){let u=i.substring(0,i.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)s=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(i==null)return{result:"failure",reason:"Remote branch is not configured"};if(n==null)return{result:"failure",reason:"Failed to get current branch name"};if(s==null){let l=i.substring(0,i.indexOf("/"));if(s=await e.getConfig(`remote.${l}.url`),s==null)return{result:"failure",reason:"Failed to get remote url"}}let o=s.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[l,c,u,f,d]=o;return{result:"success",isGitHub:!!l,repo:u||d,user:c||f,branch:n,filePath:a}}}p();var yF=require("obsidian"),sp=class extends yF.FuzzySuggestModal{constructor(e,r){super(e.app),this.plugin=e,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.workingDir=="U")return`Untracked | ${e.vaultPath}`;let r="",i="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(i=`Index: ${e.index}`),`${r}${i} | ${e.vaultPath}`}onChooseItem(e,r){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};p();var bF=require("obsidian"),ap=class extends bF.Modal{constructor(r,i){super(r);this.content=i;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:i}=this;i.setText("Edit .gitignore");let n=r.createDiv(),s=n.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});n.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(s.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};p();var Wu=require("@codemirror/state"),_p=require("@codemirror/view");p();var Il=require("@codemirror/state");p();var Nt=class t{static createHunk(e,r,i,n){return{removed:{start:e,count:r,lines:[]},added:{start:i,count:n,lines:[]},head:`@@ -${e}${r>0?`,${r}`:""} +${i}${n>0?`,${n}`:""} @@`,vend:i+Math.max(n-1,0),type:n===0?"delete":r===0?"add":"change"}}static createPartialHunk(e,r,i){let n=r,s=i-r+1,a=0;for(let o of e){let l=o.added.count-o.removed.count,c=0;if(o.added.start>=r&&o.vend<=i)c=l;else{let u=Math.max(0,i+1-(o.added.start+o.removed.count)),f=Math.max(0,r-(o.added.start+o.removed.count));o.added.start>=r&&o.added.start<=i?c=u:o.vend>=r&&o.vend<=i?(c=l-f,n=n-f):o.added.start<=r&&o.vend>=i?(c=u-f,n=n-f):a++,r>o.vend&&(n=n-l)}s=s-c}if(a!==e.length)return s===0&&(n=n-1),this.createHunk(n,s,r,i-r+1)}patchLines(e,r=!1){let i=[];for(let n of e.removed.lines)i.push("-"+n);for(let n of e.added.lines)i.push("+"+n);return r?i.map(n=>n.replace(/\r$/,"")):i}static parseDiffLine(e){let n=e.split("@@")[1].trim().split(" "),s=n[0].substring(1).split(","),a=n[1].substring(1).split(","),o=this.createHunk(parseInt(s[0]),parseInt(s[1]||"1"),parseInt(a[0]),parseInt(a[1]||"1"));return o.head=e,o}static changeEnd(e){return e.added.count===0?e.added.start:e.removed.count===0?e.added.start+e.added.count-1:e.added.start+Math.min(e.added.count,e.removed.count)-1}static calcSigns(e,r,i,n=1,s=1/0,a){if(a&&r.type!=="add")return console.error(`Invalid hunk with untracked=${a} hunk="${r.head}"`),[];n=Math.max(1,n);let{start:o,added:l,removed:c}={start:r.added.start,added:r.added.count,removed:r.removed.count},u=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!i||i.added.start!==o+1);f&&n===1&&(n=0);let d=[];for(let h=Math.max(o,n);h<=Math.min(u,s);h++){let m=r.type==="change"&&(c>l&&h===u||e&&e.added.start===0);d.push({type:f?"topdelete":m?"changedelete":a?"untracked":r.type,count:h===o?r.type==="add"?l:c:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>c&&r.vend>=n&&u<=s)for(let h=Math.max(u,n);h<=Math.min(r.vend,s);h++)d.push({type:"add",count:h===r.vend?l-c:void 0,lnum:h});return d}static createPatch(e,r,i,n=!1){let s=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${i}`,`--- a/${e}`,`+++ b/${e}`],a=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,c=o.removed.count,u=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;n&&([c,u]=[u,c],[f,d]=[d,f]),s.push(`@@ -${l},${c} +${l+a},${u} @@`);for(let h of f)s.push("-"+h);(n?o.added:o.removed).no_nl_at_eof&&s.push("\\ No newline at end of file");for(let h of d)s.push("+"+h);(n?o.removed:o.added).no_nl_at_eof&&s.push("\\ No newline at end of file"),o.removed.start=l+a,a=a+(u-c)}return s}getSummary(e){let r={added:0,changed:0,removed:0};for(let i of e)if(i.type==="add")r.added+=i.added.count;else if(i.type==="delete")r.removed+=i.removed.count;else if(i.type==="change"){let n=i.added.count,s=i.removed.count,a=Math.min(n,s);r.changed+=a,r.added+=n-a,r.removed+=s-a}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let i=0;i=e)return[n,i]}return[void 0,void 0]}static findNearestHunk(e,r,i,n){if(r.length!==0){if(i==="first")return 0;if(i==="last")return r.length-1;if(i==="next"){if(r[0].added.start>e)return 0;for(let s=r.length-1;s>=0;s--)if(r[s].added.start<=e){if(s+1e)return s+1;if(n)return 0}}else if(i==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[s-1].vend,1)l.added.start?n++:o.added.starta.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),m,l);else if(m&&typeof m=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(n(h),m,u,d)}else m!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in e)s(n(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=xF[_F]||1;return xF[_F]=e+1,Y0+e.toString(36)}static mount(e,r,i){let n=e[X0],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Z0(e,s),n.mount(Array.isArray(r)?r:[r],e)}},SF=new Map,Z0=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=SF.get(i);if(s)return e[X0]=s;this.sheet=new n.CSSStyleSheet,SF.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[X0]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;cc){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new _t(e,e+f,n,n),new _t(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new _t(e,e,n,n+f),new _t(r,r,n+f+l,s)]}if(l==1||c==1)return[new _t(e,r,n,s)];let u=jF(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ba(t,e,f,i,n,d).concat(Ba(t,f+h,r,i,d+h,s))}return iV(t,e,r,i,n,s)}var Bu=1e9,Nu=0,iy=!1;function iV(t,e,r,i,n,s){let a=r-e,o=s-n;if(Bu<1e9&&Math.min(a,o)>Bu*16||Nu>0&&Date.now()>Nu)return Math.min(a,o)>Bu*64?[new _t(e,r,n,s)]:EF(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);K0.reset(l),Q0.reset(l);let c=(h,m)=>t.charCodeAt(e+h)==i.charCodeAt(n+m),u=(h,m)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-m-1),f=(a-o)%2!=0?Q0:null,d=f?null:K0;for(let h=0;hBu||Nu>0&&!(h&63)&&Date.now()>Nu)return EF(t,e,r,i,n,s);let m=K0.advance(h,a,o,l,f,!1,c)||Q0.advance(h,a,o,l,d,!0,u);if(m)return nV(t,e,r,e+m[0],i,n,s,n+m[1])}return[new _t(e,r,n,s)]}var dp=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},K0=new dp,Q0=new dp;function nV(t,e,r,i,n,s,a,o){let l=!1;return!$l(t,i)&&++i==r&&(l=!0),!$l(n,o)&&++o==a&&(l=!0),l?[new _t(e,r,s,a)]:Ba(t,e,i,n,s,o).concat(Ba(t,i,r,n,o,a))}function GF(t,e){let r=1,i=Math.min(t,e);for(;rr||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-($l(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function sy(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=GF(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function J0(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let m=ny(t,f,r,i,n+h+d.length,s),g=sy(t,e,u,i,n,n+h),v=d.length+m+g;(!c||c[2]>1}}function jF(t,e,r,i,n,s){let a=r-e,o=s-n;if(an.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new _t(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function sV(t,e,r){for(;;){qF(r,1);let i=!1;for(let n=0;n3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=AF(e,s.fromA,c),d=kF(e,s.toA,u),h=s.fromA-f,m=d-s.toA;if((!a||!o)&&h&&m){let g=Math.max(a,o),[v,w,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(b-h,b)?(s=t[n]=new _t(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=kF(e,s.toA,l-s.toA)):g>m&&e.slice(s.toA,d)==v.slice(w,w+m)&&(s=t[n]=new _t(d-a,d,s.fromB+m,s.toB+m),d=s.toA,f=AF(e,s.fromA,s.fromA-i)),h=s.fromA-f,m=d-s.toA}if(h||m)s=t[n]=new _t(s.fromA-h,s.toA+m,s.fromB-h,s.toB+m);else if(a){if(!o){let g=CF(e,s.fromA,s.toA),v,w=g<0?-1:TF(e,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=u&&e.slice(s.fromA,g)==e.slice(s.toA,s.toA+v)?s=t[n]=s.offset(v):w>-1&&(v=s.toA-w)<=c&&e.slice(s.fromA-v,s.fromA)==e.slice(w,s.toA)&&(s=t[n]=s.offset(-v))}}else{let g=CF(r,s.fromB,s.toB),v,w=g<0?-1:TF(r,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=u&&r.slice(s.fromB,g)==r.slice(s.toB,s.toB+v)?s=t[n]=s.offset(v):w>-1&&(v=s.toB-w)<=c&&r.slice(s.fromB-v,s.fromB)==r.slice(w,s.toB)&&(s=t[n]=s.offset(-v))}}i=s.toA}return qF(t,3),t}var La;try{La=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function zF(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function VF(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?zF(r)?1:0:La?!XF(r)||e==t.length-1?La.test(String.fromCharCode(r))?1:0:La.test(t.slice(e,e+2))?2:0:0}function WF(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?zF(r)?1:0:La?!ZF(r)||e==1?La.test(String.fromCharCode(r))?1:0:La.test(t.slice(e-2,e))?2:0:0}var YF=8;function kF(t,e,r){if(e==t.length||!WF(t,e))return e;for(let i=e,n=e+r,s=0;sn)return i;i+=a}return e}function AF(t,e,r){if(!e||!VF(t,e))return e;for(let i=e,n=e-r,s=0;st>=55296&&t<=56319,ZF=t=>t>=56320&&t<=57343;function $l(t,e){return!e||e==t.length||!XF(t.charCodeAt(e-1))||!ZF(t.charCodeAt(e))}function oV(t,e,r){var i;let n=r==null?void 0:r.override;return n?n(t,e):(Bu=((i=r==null?void 0:r.scanLimit)!==null&&i!==void 0?i:1e9)>>1,Nu=r!=null&&r.timeout?Date.now()+r.timeout:0,iy=!1,sV(t,e,Ba(t,0,t.length,e,0,e.length)))}function KF(){return!iy}function QF(t,e,r){return aV(oV(t,e,r),t,e)}var Li=$e.Facet.define({combine:t=>t[0]}),ey=$e.StateEffect.define(),lV=$e.Facet.define(),Na=$e.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is(ey)&&(t=r.value);for(let r of e.state.facet(lV))t=r(t,e);return t}});function ay(t){let e=t.field(Na,!1);if(!e)return null;let r=t.facet(Li);return{chunks:e,side:r?r.side:null}}var es=class t{constructor(e,r,i,n,s,a=!0){this.changes=e,this.fromA=r,this.toA=i,this.fromB=n,this.toB=s,this.precise=a}offset(e,r){return e||r?new t(this.changes,this.fromA+e,this.toA+e,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,r,i){let n=QF(e.toString(),r.toString(),i);return JF(n,e,r,0,0,KF())}static updateA(e,r,i,n,s){return FF(IF(e,n,!0,i.length),e,r,i,s)}static updateB(e,r,i,n,s){return FF(IF(e,n,!1,r.length),e,r,i,s)}};function PF(t,e,r,i){let n=r.lineAt(t),s=i.lineAt(e);return n.to==t&&s.to==e&&tf+1&&v>d+1)break;h.push(m.offset(-c+i,-u+n)),[f,d]=RF(m.toA+i,m.toB+n,e,r),o++}a.push(new es(h,c,Math.max(c,f),u,Math.max(u,d),s))}return a}var lp=1e3;function $F(t,e,r,i){let n=0,s=t.length;for(;;){if(n==s){let u=0,f=0;n&&({toA:u,toB:f}=t[n-1]);let d=e-(r?u:f);return[u+d,f+d]}let a=n+s>>1,o=t[a],[l,c]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)s=a;else if(c<=e)n=a+1;else return i?[o.fromA,o.fromB]:[o.toA,o.toB]}}function IF(t,e,r,i){let n=[];return e.iterChangedRanges((s,a,o,l)=>{let c=0,u=r?e.length:i,f=0,d=r?i:e.length;s>lp&&([c,f]=$F(t,s-lp,r,!0)),a=c?n[n.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:d,diffA:m.diffA+g,diffB:m.diffB+v}:n.push({fromA:c,toA:u,fromB:f,toB:d,diffA:g,diffB:v})}),n}function FF(t,e,r,i,n){if(!t.length)return e;let s=[];for(let a=0,o=0,l=0,c=0;;a++){let u=a==t.length?null:t[a],f=u?u.fromA+o:r.length,d=u?u.fromB+l:i.length;for(;cf||v.endB+l>d)break;s.push(v.offset(o,l)),c++}if(!u)break;let h=u.toA+o+u.diffA,m=u.toB+l+u.diffB,g=QF(r.sliceString(f,h),i.sliceString(d,m),n);for(let v of JF(g,r,i,f,d,KF()))s.push(v);for(o+=u.diffA,l+=u.diffB;ch&&v.fromB+l>m)break;c++}}return s}var cV={scanLimit:500},eO=Me.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=DF(t))}update(t){(t.docChanged||t.viewportChanged||uV(t.startState,t.state)||fV(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=DF(t.view))}},{decorations:t=>t.deco}),cp=$e.Prec.low((0,Me.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(eO))===null||e===void 0?void 0:e.gutter)||$e.RangeSet.empty}}));function uV(t,e){return t.field(Na,!1)!=e.field(Na,!1)}function fV(t,e){return t.facet(Li)!=e.facet(Li)}var OF=Me.Decoration.line({class:"cm-changedLine"}),dV=Me.Decoration.mark({class:"cm-changedText"}),hV=Me.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),pV=Me.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),MF=new class extends Me.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function mV(t,e,r,i,n,s){let a=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(a!=o){n.add(a,a,OF),n.add(a,o,r?pV:hV),s&&s.add(a,a,MF);for(let c=e.iterRange(a,o-1),u=a;!c.next().done;){if(c.lineBreak){u++,n.add(u,u,OF),s&&s.add(u,u,MF);continue}let f=u+c.value.length;if(i)for(;l=u)break;(a?f.toA:f.toB)>c&&(!s||!s(t.state,f,o,l))&&mV(f,t.state.doc,a,i,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var Rl=class extends Me.WidgetType{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},hp=$e.StateEffect.define({map:(t,e)=>t.map(e)}),Hu=$e.StateField.define({create:()=>Me.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(hp))return r.value;return t.map(e.changes)},provide:t=>Me.EditorView.decorations.from(t)}),up=.01;function LF(t,e){if(t.size!=e.size)return!1;let r=t.iter(),i=e.iter();for(;r.value;){if(r.from!=i.from||Math.abs(r.value.spec.widget.height-i.value.spec.widget.height)>1)return!1;r.next(),i.next()}return!0}function gV(t,e,r){let i=new $e.RangeSetBuilder,n=new $e.RangeSetBuilder,s=t.state.field(Hu).iter(),a=e.state.field(Hu).iter(),o=0,l=0,c=0,u=0,f=t.viewport,d=e.viewport;for(let v=0;;v++){let w=vup&&(u+=A,n.add(l,l,Me.Decoration.widget({widget:new Rl(A),block:!0,side:-1})))}if(b>o+1e3&&of.from&&ld.from){let x=Math.min(f.from-o,d.from-l);o+=x,l+=x,v--}else if(w)o=w.toA,l=w.toB;else break;for(;s.value&&s.fromup&&n.add(e.state.doc.length,e.state.doc.length,Me.Decoration.widget({widget:new Rl(h),block:!0,side:1}));let m=i.finish(),g=n.finish();LF(m,t.state.field(Hu))||t.dispatch({effects:hp.of(m)}),LF(g,e.state.field(Hu))||e.dispatch({effects:hp.of(g)})}var ty=$e.StateEffect.define({map:(t,e)=>e.mapPos(t)});var ry=class extends Me.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=e.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",i=>{let n=e.posAtDOM(i.target);e.dispatch({effects:ty.of(n)});let{side:s,sibling:a}=e.state.facet(Li);a&&a().dispatch({effects:ty.of(vV(n,e.state.field(Na),s=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function vV(t,e,r){let i=0,n=0;for(let s=0;;s++){let a=s=t)return n+(t-i);[i,n]=r?[a.toA,a.toB]:[a.toB,a.toA]}}var wV=$e.StateField.define({create(t){return Me.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(ty)&&(t=t.update({filter:i=>i!=r.value}));return t},provide:t=>Me.EditorView.decorations.from(t)});function BF({margin:t=3,minSize:e=4}){return wV.init(r=>yV(r,t,e))}function yV(t,e,r){let i=new $e.RangeSetBuilder,n=t.facet(Li).side=="a",s=t.field(Na),a=1;for(let o=0;;o++){let l=o=r&&i.add(t.doc.line(c).from,t.doc.line(u).to,Me.Decoration.replace({widget:new ry(f),block:!0})),!l)break;a=t.doc.lineAt(Math.min(t.doc.length,n?l.toA:l.toB)).number}return i.finish()}var bV=Me.EditorView.styleModule.of(new op({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),_V=Me.EditorView.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),NF=new $e.Compartment,fp=new $e.Compartment,pp=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||cV;let r=[$e.Prec.low(eO),_V,bV,Hu,Me.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(hp)))&&this.measure()})],i=[Li.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(cp);let n=$e.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Me.EditorView.editorAttributes.of({class:"cm-merge-a"}),fp.of(i),r]}),s=[Li.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(cp);let a=$e.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Me.EditorView.editorAttributes.of({class:"cm-merge-b"}),fp.of(s),r]});this.chunks=es.build(n.doc,a.doc,this.diffConf);let o=[Na.init(()=>this.chunks),NF.of(e.collapseUnchanged?BF(e.collapseUnchanged):[])];n=n.update({effects:$e.StateEffect.appendConfig.of(o)}).state,a=a.update({effects:$e.StateEffect.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:u),this.editorDOM.appendChild(l=="a-b"?u:c),this.a=new Me.EditorView({state:n,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Me.EditorView({state:a,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,r){if(e.some(i=>i.docChanged)){let i=e[e.length-1],n=e.reduce((a,o)=>a.compose(o.changes),$e.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?es.updateA(this.chunks,i.newDoc,this.b.state.doc,n,this.diffConf):es.updateB(this.chunks,this.a.state.doc,i.newDoc,n,this.diffConf),r.update([...e,i.state.update({effects:ey.of(this.chunks)})]);let s=r==this.a?this.b:this.a;s.update([s.state.update({effects:ey.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,o=this.b.dom.parentNode;a.remove(),o.remove(),this.editorDOM.insertBefore(s?a:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,o=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(s,a,o)}let r="highlightChanges"in e,i="gutter"in e,n="collapseUnchanged"in e;if(r||i||n){let s=[],a=[];if(r||i){let o=this.a.state.facet(Li),l=i?e.gutter!==!1:o.markGutter,c=r?e.highlightChanges!==!1:o.highlightChanges;s.push(fp.reconfigure([Li.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?cp:[]])),a.push(fp.reconfigure([Li.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?cp:[]]))}if(n){let o=NF.reconfigure(e.collapseUnchanged?BF(e.collapseUnchanged):[]);s.push(o),a.push(o)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,r,i){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=i,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",n=>this.revertClicked(n)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){gV(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,i=this.a.viewport,n=this.b.viewport;for(let s=0;si.to||a.fromB>n.to)break;if(a.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function HF(t){let e=t.nextSibling;return t.remove(),e}var oy=require("@codemirror/state");function ly(t,e,r){let i=[],n=t.split(` +`),s=e.split(` +`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Nt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;dn.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;ds.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function cy(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:mp(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:mp(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var tO={scanLimit:1e3,timeout:200};function xV(t,e,r,i){let n=oy.Text.of(t.split(` +`)),s=oy.Text.of(e.split(` +`)),a=r&&i?es.updateB(r,n,s,i,tO):es.build(n,s,tO),o=[];for(let l=0;lh.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(` +`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(` +`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(` +`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(` +`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(` +`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(` +`).length&&!u.compareText.endsWith(` +`)&&(c.removed.no_nl_at_eof=!0);return c}},Ir=Il.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is(Ol)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Uu)&&iO(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=SV(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&iO(r,n,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 iO(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(Fl.editorInfoField).file;(s=(n=Fi.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var uy=Il.StateField.define({create:()=>({debouncer:(0,Fl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=nO(e,r,i,n);e.field(Fl.editorEditorField).dispatch({effects:Uu.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Uu))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 nO(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=rO(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function SV(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(uy);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,nO(n,e,r,t.changes)}var Ol=Il.StateEffect.define(),Uu=Il.StateEffect.define();function sO(t,e){return e.update({effects:Ol.of(t)})}p();p();p();var it;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(it||(it={}));var aO={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},oO={LINES:"lines",WORDS:"words",NONE:"none"},lO={WORD:"word",CHAR:"char"},Ha;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ha||(Ha={}));p();var EV=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],kV=RegExp("["+EV.join("\\")+"]","g");function cO(t){return t.replace(kV,"\\$&")}function fy(t){return t&&t.replace(/\\/g,"/")}function uO(t){let e,r,i,n=0;for(e=0,i=t.length;e1?r[r.length-1]:e}function dO(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var hO=["a/","b/","i/","w/","c/","o/"];function Vs(t,e,r){let i=r!==void 0?[...hO,r]:hO,n=e?new RegExp(`^${cO(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function AV(t,e){return Vs(t,"---",e)}function TV(t,e){return Vs(t,"+++",e)}function pO(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,m=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,k=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,E=/^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})/,D=/^new file mode (\d{6})/,B=/^deleted file mode (\d{6}),(\d{6})/,N=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function ce(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Pe(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function ve(){ce(),Pe(),i={blocks:[],deletedLines:0,addedLines:0}}function se(z){ce();let Q;i!==null&&((Q=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(Q[1],10),o=parseInt(Q[2],10)):(Q=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(Q[1],10),a=parseInt(Q[2],10),o=parseInt(Q[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function xe(z){if(i===null||n===null||s===null||o===null)return;let Q={content:z},j=i.isCombined?["+ "," +","++"]:["+"],Le=i.isCombined?["- "," -","--"]:["-"];dO(z,j)?(i.addedLines++,Q.type=it.INSERT,Q.oldNumber=void 0,Q.newNumber=o++):dO(z,Le)?(i.deletedLines++,Q.type=it.DELETE,Q.oldNumber=s++,Q.newNumber=void 0):(Q.type=it.CONTEXT,Q.oldNumber=s++,Q.newNumber=o++),n.lines.push(Q)}function we(z,Q){let j=Q;for(;j{if(!z||z.startsWith("*"))return;let j,Le=N[Q-1],lr=N[Q+1],Ft=N[Q+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(ve(),(j=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Vs(j[1],void 0,e.dstPrefix),c=Vs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(ve(),(j=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Vs(j[1],void 0,e.dstPrefix),c=Vs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&lr.startsWith(f)&&Ft.startsWith(d))&&ve(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let At=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";se(At);return}if(z.startsWith(u)&&lr.startsWith(f)||z.startsWith(f)&&Le.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(j=AV(z,e.srcPrefix))){i.oldName=j,i.language=fO(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(j=TV(z,e.dstPrefix))){i.newName=j,i.language=fO(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){se(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){xe(z);return}let Ie=!we(z,Q);if(i===null)throw new Error("Where is my file !!!");(j=h.exec(z))?i.oldMode=j[1]:(j=m.exec(z))?i.newMode=j[1]:(j=g.exec(z))?(i.deletedFileMode=j[1],i.isDeleted=!0):(j=v.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=w.exec(z))?(Ie&&(i.oldName=j[1]),i.isCopy=!0):(j=b.exec(z))?(Ie&&(i.newName=j[1]),i.isCopy=!0):(j=k.exec(z))?(Ie&&(i.oldName=j[1]),i.isRename=!0):(j=x.exec(z))?(Ie&&(i.newName=j[1]),i.isRename=!0):(j=S.exec(z))?(i.isBinary=!0,i.oldName=Vs(j[1],void 0,e.srcPrefix),i.newName=Vs(j[2],void 0,e.dstPrefix),se("Binary file")):_.test(z)?(i.isBinary=!0,se(z)):(j=E.exec(z))?i.unchangedPercentage=parseInt(j[1],10):(j=A.exec(z))?i.changedPercentage=parseInt(j[1],10):(j=y.exec(z))?(i.checksumBefore=j[1],i.checksumAfter=j[2],j[3]&&(i.mode=j[3])):(j=T.exec(z))?(i.checksumBefore=[j[2],j[3]],i.checksumAfter=j[1]):(j=P.exec(z))?(i.oldMode=[j[2],j[3]],i.newMode=j[1]):(j=D.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=B.exec(z))&&(i.deletedFileMode=j[1],i.isDeleted=!0)}),ce(),Pe(),r}p();p();p();function PV(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return PV(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l0||o.indexB>0)&&(k=v.concat(k)),(i.length>d||n.length>h)&&(k=k.concat(b)),k}return r}var Vt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},Ua={matching:oO.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:lO.WORD,colorScheme:Ha.LIGHT},vn="/",mO=Ml(t=>t.value),RV=Dl(mO);function hy(t){return t.indexOf("dev/null")!==-1}function $V(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function IV(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function Ll(t){switch(t){case it.CONTEXT:return Vt.CONTEXT;case it.INSERT:return Vt.INSERTS;case it.DELETE:return Vt.DELETES}}function Bl(t){switch(t){case Ha.DARK:return"d2h-dark-color-scheme";case Ha.AUTO:return"d2h-auto-color-scheme";case Ha.LIGHT:default:return"d2h-light-color-scheme"}}function FV(t){return t?2:1}function Ws(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function yi(t,e,r=!0){let i=FV(e);return{prefix:t.substring(0,i),content:r?Ws(t.substring(i)):t.substring(i)}}function Ga(t){let e=fy(t.oldName),r=fy(t.newName);if(e!==r&&!hy(e)&&!hy(r)){let i=[],n=[],s=e.split(vn),a=r.split(vn),o=s.length,l=a.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&s[u]===a[f];)n.unshift(a[f]),u-=1,f-=1;let d=i.join(vn),h=n.join(vn),m=s.slice(c,u+1).join(vn),g=a.slice(c,f+1).join(vn);return d.length&&h.length?d+vn+"{"+m+" \u2192 "+g+"}"+vn+h:d.length?d+vn+"{"+m+" \u2192 "+g+"}":h.length?"{"+m+" \u2192 "+g+"}"+vn+h:e+" \u2192 "+r}else return hy(r)?e:r}function Nl(t){return`d2h-${uO(Ga(t)).toString().slice(-6)}`}function Hl(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 vp(t,e,r,i={}){let{matching:n,maxLineLengthHighlight:s,matchWordsThreshold:a,diffStyle:o}=Object.assign(Object.assign({},Ua),i),l=yi(t,r,!1),c=yi(e,r,!1);if(l.content.length>s||c.content.length>s)return{oldLine:{prefix:l.prefix,content:Ws(l.content)},newLine:{prefix:c.prefix,content:Ws(c.content)}};let u=o==="char"?Av(l.content,c.content):Iv(l.content,c.content),f=[];if(o==="word"&&n==="words"){let h=u.filter(v=>v.removed),m=u.filter(v=>v.added);RV(m,h).forEach(v=>{v[0].length===1&&v[1].length===1&&mO(v[0][0],v[1][0]){let g=m.added?"ins":m.removed?"del":null,v=f.indexOf(m)>-1?' class="d2h-change"':"",w=Ws(m.value);return g!==null?`${h}<${g}${v}>${w}`:`${h}${w}`},"");return{oldLine:{prefix:l.prefix,content:$V(d)},newLine:{prefix:c.prefix,content:IV(d)}}}var gO="file-summary",OV="icon",MV={colorScheme:Ua.colorScheme},wp=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},MV),r)}render(e){let r=e.map(i=>this.hoganUtils.render(gO,"line",{fileHtmlId:Nl(i),oldName:i.oldName,newName:i.newName,fileName:Ga(i),deletedLines:"-"+i.deletedLines,addedLines:"+"+i.addedLines},{fileIcon:this.hoganUtils.template(OV,Hl(i))})).join(` +`);return this.hoganUtils.render(gO,"wrapper",{colorScheme:Bl(this.config.colorScheme),filesNumber:e.length,files:r})}};p();var my=Object.assign(Object.assign({},Ua),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Gu="generic",vO="line-by-line",DV="icon",LV="tag",ju=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},my),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` +`);return this.hoganUtils.render(Gu,"wrapper",{colorScheme:Bl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(vO,"file-diff"),n=this.hoganUtils.template(Gu,"file-path"),s=this.hoganUtils.template(DV,"file"),a=this.hoganUtils.template(LV,Hl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Ga(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Gu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Vt})}generateFileHtml(e){let r=Dl(Ml(i=>yi(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Gu,"block-header",{CSSLineClass:Vt,blockHeader:e.isTooBig?i.header:Ws(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=yi(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Vt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(` +`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===it.CONTEXT?r.push([[a],[],[]]):a.type===it.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===it.INSERT&&i.length>0?n.push(a):a.type===it.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=gp(e.concat(r).map(o=>o.content.length));return n{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` +`);return this.hoganUtils.render(qu,"wrapper",{colorScheme:Bl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(BV,"file-diff"),n=this.hoganUtils.template(qu,"file-path"),s=this.hoganUtils.template(NV,"file"),a=this.hoganUtils.template(HV,Hl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Ga(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(qu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Vt})}}generateFileHtml(e){let r=Dl(Ml(i=>yi(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=yi(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Vt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Vt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===it.CONTEXT?r.push([[a],[],[]]):a.type===it.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===it.INSERT&&i.length>0?n.push(a):a.type===it.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=gp(e.concat(r).map(o=>o.content.length));return n'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileName",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("addedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("deletedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{"'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")"),i.b(` +`+r),i.b(' hide'),i.b(` +`+r),i.b(' show'),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
    '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});wt["generic-block-header"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});wt["generic-empty-diff"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" File without changes"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});wt["generic-file-path"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(''),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b(""),i.b(` +`+r),i.b(i.rp(""),i.b(` +`+r),i.b('"),i.fl()},partials:{""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("prefix",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b('  '),i.b(` +`+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("content",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b('
'),i.b(` +`+r)),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});wt["generic-wrapper"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});wt["icon-file-added"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});wt["icon-file-changed"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});wt["icon-file-deleted"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});wt["icon-file-renamed"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});wt["icon-file"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});wt["line-by-line-file-diff"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});wt["line-by-line-numbers"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("
"),i.b(` +`+r),i.b('
'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("
"),i.fl()},partials:{},subs:{}});wt["side-by-side-file-diff"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});wt["tag-file-added"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('ADDED'),i.fl()},partials:{},subs:{}});wt["tag-file-changed"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('CHANGED'),i.fl()},partials:{},subs:{}});wt["tag-file-deleted"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('DELETED'),i.fl()},partials:{},subs:{}});wt["tag-file-renamed"]=new xt.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('RENAMED'),i.fl()},partials:{},subs:{}});var Vu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=by.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},wt),e),i)}static compile(e){return by.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var GV=Object.assign(Object.assign(Object.assign({},my),gy),{outputFormat:aO.LINE_BY_LINE,drawFileList:!0});function bp(t,e={}){let r=Object.assign(Object.assign({},GV),e),i=typeof t=="string"?pO(t,r):t,n=new Vu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new wp(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new zu(n,r).render(i):new ju(n,r).render(i);return o+l}var kO=Mt(SO());var ja=require("obsidian"),_y=Wu.StateEffect.define();function Ys(t,e){let r=t.state,i=r.field(xp),n=r.field(Ir),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Nt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(ja.editorEditorField).dispatch({effects:_y.of({pos:o,add:!l})})}var xp=Wu.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(_y)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),AO=Wu.StateField.define({create:t=>EO(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Ol)||r.is(_y))?EO(e.state):t},provide:t=>_p.showTooltip.computeN([t],e=>e.field(t))}),TO=_p.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 EO(t){let e=t.field(Ir);return e?[...t.field(xp)].map(i=>{let n=t.doc.lineAt(i),s=Nt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>jV(s,t,i)}}).filter(i=>i!==void 0):[]}function jV(t,e,r){var g,v;let i=Nt.createPatch("file",[t],"10064",!1).join(` +`)+` +`,n=bp(i,{colorScheme:kO.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=document.createElement("div"),o=document.createElement("div");o.addClass("tooltip-toolbar");let l=(w,b)=>{let k=document.createElement("div");return(0,ja.setIcon)(k,w),k.setAttr("aria-label",b),k.addClass("clickable-icon"),k},c=l("x","Close hunk"),u=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(c),o.appendChild(u),o.appendChild(f),a.appendChild(o),a.appendChild(s),a.addClass("git-diff-tooltip","git-diff");let d=e.field(ja.editorEditorField);c.onclick=()=>{Ys(d,r)},u.onclick=()=>{let w=Fi.plugin;w&&(w.promiseQueue.addTask(()=>w.hunkActions.stageHunk(r)),Ys(d,r))},f.onclick=()=>{let w=Fi.plugin;w&&(w.hunkActions.resetHunk(r),Ys(d,r))};let h=(v=(g=Fi.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(ja.MarkdownView))==null?void 0:v.scope,m=h==null?void 0:h.register(null,"Escape",(w,b)=>{Ys(d,r)});return{dom:a,destroy:()=>{m&&(h==null||h.unregister(m))},update:w=>{r=w.changes.mapPos(r)}}}function CO(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new ap(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(zt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:zt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(gi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:gi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return gF(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return vF(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof Ni.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),Ni.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.stageFile(i))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.unstageFile(i))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(r=>t.displayError(r))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(r=>t.displayError(r))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(r=>t.displayError(r))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new Qe(t,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&(await e.vault.adapter.rmdir(`${t.settings.basePath}/.git`,!0),new Ni.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new Ni.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let r=await t.updateCachedStatus();if(r.changed.length+r.staged.length>500){t.displayError("Too many changes to display");return}new sp(t,r.all).open()}catch(r){t.displayError(r)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{let r=await t.discardAll();switch(r){case"discard":new Ni.Notice("Discarded all changes in tracked files.");break;case"delete":new Ni.Notice("Discarded all files.");break;case!1:break;default:wh(r)}}}),t.addCommand({id:"pause-automatic-routines",name:"Pause/Resume automatic routines",callback:()=>{let r=!t.localStorage.getPausedAutomatics();t.localStorage.setPausedAutomatics(r),r?(t.automaticsManager.unload(),new Ni.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new Ni.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let i=t.gitManager;if(r)return i instanceof Se;t.tools.runRawCommand().catch(n=>t.displayError(n))}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=t.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}}),t.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(r,i,n){if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.resetHunk()}}),t.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.promiseQueue.addTask(()=>t.hunkActions.stageHunk())}}),t.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let s=t.hunkActions.editor.editor;Ys(s)}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("next")}}),t.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("prev")}})}p();var Sp=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let r of e){let i=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&i!=null&&i!=null&&(this.app.saveLocalStorage(this.prefix+r,i),localStorage.removeItem(this.prefix+r))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(e){return this.app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(e){return this.app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return this.app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return this.app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return this.app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,r;return(r=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?r:[]}setPATHPaths(e){return this.app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}getPausedAutomatics(){return this.app.loadLocalStorage(this.prefix+"pausedAutomatics")=="true"}setPausedAutomatics(e){return this.app.saveLocalStorage(this.prefix+"pausedAutomatics",`${e}`)}};p();var Ul=require("obsidian");var Yu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),i=r.tracking?Zn(r.tracking)[0]:null;if(!i)return!1;let n=await this.plugin.gitManager.getRemoteUrl(i);if(n!=null&&n.includes("github.com")){let s=[],a=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),c=!1;if(l instanceof Ul.TFile)l.stat.size>=1e8&&(c=!0);else{let u=await this.plugin.app.vault.adapter.stat(o.vaultPath);u&&u.size>=1e8&&(c=!0)}if(c){let u=!1;a instanceof Se&&(u=await a.isFileTrackedByLFS(o.path)),u||s.push(o)}}if(s.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: +- ${s.map(o=>o.vaultPath).join(` +- `)} +Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(al,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&al.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(al,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Ul.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=Mi(this.plugin.app,s))==null||l.setViewState({type:Ls.type,active:!0,state:o}):a=="git_unified"&&((c=Mi(this.plugin.app,s))==null||c.setViewState({type:Bs.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Se))return;let i=await new Qe(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Ul.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};p();var Ep=require("obsidian");var qa=class extends Ep.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Bs.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Bs.name}getIcon(){return Bs.icon}async setState(r,i){this.state=r,Ep.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Se&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` +`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null ++++ ${this.state.bFile} +@@ -0,0 +1,${s.split(` +`).length} @@`.split(` +`),...s.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(i){let s=this.parser.parseFromString(bp(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};p();var ts=require("obsidian");var jl=require("@codemirror/commands");var kp=require("@codemirror/search"),Gl=require("@codemirror/state"),_i=require("@codemirror/view");var za=class extends ts.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ts.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ls.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ls.name}getIcon(){return Ls.icon}async setState(r,i){this.state=r,ts.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Rr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Gl.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(){let r=document.createElement("div"),i=r.createDiv();if(i.addClass("clickable-icon"),i.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,ts.setIcon)(i,this.state.bRef==null?"plus":"minus"),i.onmousedown=async n=>{var h;let s=this.mergeView.b,a=this.mergeView.a,o=ay(s.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),c=o.chunks[l],u=cy(c,a.state.doc,s.state.doc),f=ly(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[u])[0],d=Nt.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 n=r.createDiv();n.addClass("clickable-icon"),n.setAttr("aria-label","Reset hunk"),(0,ts.setIcon)(n,"undo"),n.onmousedown=s=>{var f;let a=this.mergeView.a,o=this.mergeView.b,l=ay(o.state),c=(f=r.parentElement)==null?void 0:f.indexOf(r),u=l.chunks[c];if(u){let d=u.fromA,h=u.toA,m=u.fromB,g=u.toB,v=a.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=a.state.lineBreak),o.dispatch({changes:{from:m,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},r}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,_i.lineNumbers)(),(0,kp.highlightSelectionMatches)(),(0,_i.drawSelection)(),_i.keymap.of([...jl.standardKeymap,jl.indentWithTab]),(0,jl.history)(),(0,kp.search)(),_i.EditorView.lineWrapping],c=this,u=_i.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(w=>w.annotation(Gl.Transaction.remote))){let w=g.state.doc.toString();c.fileSaveDebouncer(w)}}})),f={doc:a,extensions:[...l,_i.EditorView.editable.of(!1),Gl.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(_i.EditorView.editable.of(!1),Gl.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let m=this.plugin.gitManager instanceof Se&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new pp({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:s}),this.refreshing=!1}}};p();var sD=require("obsidian");p();p();p();var PO="5";var RO,$O,IO;typeof window!="undefined"&&((IO=($O=(RO=window.__svelte)!=null?RO:window.__svelte={}).v)!=null?IO:$O.v=new Set).add(PO);p();p();p();var Xu="[",wn="[!",Va="]",rs={};var Je=Symbol(),xi=Symbol("filename"),FO=Symbol("hmr"),OO="http://www.w3.org/1999/xhtml";p();p();p();p();var Ap=!0;p();var M=!1;p();var is=Array.isArray,MO=Array.prototype.indexOf,Hi=Array.prototype.includes,ql=Array.from,xy=Object.keys,tr=Object.defineProperty,Fr=Object.getOwnPropertyDescriptor,Sy=Object.getOwnPropertyDescriptors,Ey=Object.prototype,DO=Array.prototype,zl=Object.getPrototypeOf,ky=Object.isExtensible;function Ay(t){return typeof t=="function"}var Or=()=>{};function Tp(t){for(var e=0;e{t=i,e=n});return{promise:r,resolve:t,reject:e}}p();p();var Wt=Symbol("$state"),Zu=Symbol("legacy props"),LO=Symbol(""),Pp=Symbol("proxy path"),yn=new class extends Error{constructor(){super(...arguments);ze(this,"name","StaleReactionError");ze(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Vl=3,Mr=8;p();p();function Rp(t){if(M){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 BO(){if(M){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 Ty(){if(M){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 NO(){if(M){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 Cy(t,e,r){if(M){let i=new Error(`each_key_duplicate +${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`} +https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function HO(t){if(M){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 UO(){if(M){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 GO(t){if(M){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 jO(){if(M){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 qO(){if(M){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 zO(t){if(M){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 VO(t){if(M){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 WO(){if(M){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 YO(){if(M){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 XO(){if(M){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ZO(){if(M){let t=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}p();p();p();var Xs="font-weight: bold",Zs="font-weight: normal";function KO(t,e){M?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,Zs):console.warn("https://svelte.dev/e/await_waterfall")}function QO(t,e,r){M?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,Zs):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Wa(t){M?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,Zs):console.warn("https://svelte.dev/e/hydration_mismatch")}function JO(){M?console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`,Xs,Zs):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function $p(t){M?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,Zs):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function eM(){M?console.warn(`%c[svelte] state_proxy_unmount +%cTried to unmount a state proxy, rather than a component +https://svelte.dev/e/state_proxy_unmount`,Xs,Zs):console.warn("https://svelte.dev/e/state_proxy_unmount")}function tM(){M?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Xs,Zs):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function rM(t){M?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,Zs):console.warn("https://svelte.dev/e/transition_slide_display")}var ie=!1;function Ht(t){ie=t}var ge;function je(t){if(t===null)throw Wa(),rs;return ge=t}function rr(){return je(Zt(ge))}function H(t){if(ie){if(Zt(ge)!==null)throw Wa(),rs;ge=t}}function Ya(t=1){if(ie){for(var e=t,r=ge;e--;)r=Zt(r);ge=r}}function ns(t=!0){for(var e=0,r=ge;;){if(r.nodeType===Mr){var i=r.data;if(i===Va){if(e===0)return r;e-=1}else(i===Xu||i===wn)&&(e+=1)}var n=Zt(r);t&&r.remove(),r=n}}function Ip(t){if(!t||t.nodeType!==Mr)throw Wa(),rs;return t.data}p();p();p();p();function Fp(t){return t===this.v}function Py(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Op(t){return!Py(t,this.v)}p();var ir=!1,ss=!1,Ui=!1;p();p();p();var Ku=null;function Dr(t,e){return t.label=e,Mp(t.v,e),t}function Mp(t,e){var r;return(r=t==null?void 0:t[Pp])==null||r.call(t,e),t}p();function bn(t){let e=new Error,r=zV();return r.length===0?null:(r.unshift(` +`),tr(e,"stack",{value:r.join(` +`)}),tr(e,"name",{value:t}),e)}function zV(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(` +`),i=[];for(let n=0;n{e===Xa&&nM()})}Xa.push(t)}function sM(){for(;Xa.length>0;)nM()}p();var Iy=new WeakMap;function Lp(t){var e=ne;if(e===null)return le.f|=8388608,t;if(M&&t instanceof Error&&!Iy.has(t)&&Iy.set(t,VV(t,e)),e.f&32768)En(t,e);else{if(!(e.f&128))throw M&&!e.parent&&t instanceof Error&&aM(t),t;e.b.error(t)}}function En(t,e){for(;e!==null;){if(e.f&128)try{e.b.error(t);return}catch(r){t=r}e=e.parent}throw M&&t instanceof Error&&aM(t),t}function VV(t,e){var a,o,l;let r=Fr(t,"message");if(!(r&&!r.configurable)){for(var i=Qu?" ":" ",n=` +${i}in ${((a=e.fn)==null?void 0:a.name)||""}`,s=e.ctx;s!==null;)n+=` +${i}in ${(o=s.function)==null?void 0:o[xi].split("/").pop()}`,s=s.p;return{message:t.message+` +${n} +`,stack:(l=t.stack)==null?void 0:l.split(` +`).filter(c=>!c.includes("svelte/src/internal")).join(` +`)}}}function aM(t){let e=Iy.get(t);e&&(tr(t,"message",{value:e.message}),tr(t,"stack",{value:e.stack}))}p();p();var WV=-7169;function Be(t,e){t.f=t.f&WV|e}function Xl(t){t.f&512||t.deps===null?Be(t,1024):Be(t,4096)}function oM(t){if(t!==null)for(let e of t)!(e.f&2)||!(e.f&32768)||(e.f^=32768,oM(e.deps))}function Bp(t,e,r){t.f&2048?e.add(t):t.f&4096&&r.add(t),oM(t.deps),Be(t,1024)}var Zl=new Set,ye=null,tf=null,Rt=null,Br=[],Hp=null,Fy=!1,Za=!1,Kl,Ql,Ka,Jl,rf,nf,Qa,os,ec,kn,Oy,My,cM,Ly=class Ly{constructor(){pe(this,kn);ze(this,"committed",!1);ze(this,"current",new Map);ze(this,"previous",new Map);pe(this,Kl,new Set);pe(this,Ql,new Set);pe(this,Ka,0);pe(this,Jl,0);pe(this,rf,null);pe(this,nf,new Set);pe(this,Qa,new Set);pe(this,os,new Map);ze(this,"is_fork",!1);pe(this,ec,!1)}is_deferred(){return this.is_fork||$(this,Jl)>0}skip_effect(e){$(this,os).has(e)||$(this,os).set(e,{d:[],m:[]})}unskip_effect(e){var r=$(this,os).get(e);if(r){$(this,os).delete(e);for(var i of r.d)Be(i,2048),vr(i);for(i of r.m)Be(i,4096),vr(i)}}process(e){var n;Br=[],this.apply();var r=[],i=[];for(let s of e)bt(this,kn,Oy).call(this,s,r,i);if(this.is_deferred()){bt(this,kn,My).call(this,i),bt(this,kn,My).call(this,r);for(let[s,a]of $(this,os))dM(s,a)}else{for(let s of $(this,Kl))s();$(this,Kl).clear(),$(this,Ka)===0&&bt(this,kn,cM).call(this),tf=this,ye=null,lM(i),lM(r),tf=null,(n=$(this,rf))==null||n.resolve()}Rt=null}capture(e,r){r!==Je&&!this.previous.has(e)&&this.previous.set(e,r),e.f&8388608||(this.current.set(e,e.v),Rt==null||Rt.set(e,e.v))}activate(){ye=this,this.apply()}deactivate(){ye===this&&(ye=null,Rt=null)}flush(){if(this.activate(),Br.length>0){if(Dy(),ye!==null&&ye!==this)return}else $(this,Ka)===0&&this.process([]);this.deactivate()}discard(){for(let e of $(this,Ql))e(this);$(this,Ql).clear()}increment(e){fe(this,Ka,$(this,Ka)+1),e&&fe(this,Jl,$(this,Jl)+1)}decrement(e){fe(this,Ka,$(this,Ka)-1),e&&fe(this,Jl,$(this,Jl)-1),!$(this,ec)&&(fe(this,ec,!0),yt(()=>{fe(this,ec,!1),this.is_deferred()?Br.length>0&&this.flush():this.revive()}))}revive(){for(let e of $(this,nf))$(this,Qa).delete(e),Be(e,2048),vr(e);for(let e of $(this,Qa))Be(e,4096),vr(e);this.flush()}oncommit(e){$(this,Kl).add(e)}ondiscard(e){$(this,Ql).add(e)}settled(){var e;return((e=$(this,rf))!=null?e:fe(this,rf,Cp())).promise}static ensure(){if(ye===null){let e=ye=new Ly;Zl.add(ye),Za||yt(()=>{ye===e&&e.flush()})}return ye}apply(){if(!(!ir||!this.is_fork&&Zl.size===1)){Rt=new Map(this.current);for(let e of Zl)if(e!==this)for(let[r,i]of e.previous)Rt.has(r)||Rt.set(r,i)}}};Kl=new WeakMap,Ql=new WeakMap,Ka=new WeakMap,Jl=new WeakMap,rf=new WeakMap,nf=new WeakMap,Qa=new WeakMap,os=new WeakMap,ec=new WeakMap,kn=new WeakSet,Oy=function(e,r,i){var d;e.f^=1024;for(var n=e.first,s=null;n!==null;){var a=n.f,o=(a&96)!==0,l=o&&(a&1024)!==0,c=l||(a&8192)!==0||$(this,os).has(n);if(ir&&s===null&&a&128&&((d=n.b)!=null&&d.is_pending)&&(s=n),!c&&n.fn!==null){o?n.f^=1024:s!==null&&a&16777228?s.b.defer_effect(n):a&4?r.push(n):ir&&a&16777224?i.push(n):ea(n)&&(a&16&&$(this,Qa).add(n),Js(n));var u=n.first;if(u!==null){n=u;continue}}var f=n.parent;for(n=n.next;n===null&&f!==null;)f===s&&(s=null),n=f.next,f=f.parent}},My=function(e){for(var r=0;r1){this.previous.clear();var e=Rt,r=!0;for(let s of Zl){if(s===this){r=!1;continue}let a=[];for(let[l,c]of this.current){if(s.current.has(l))if(r&&c!==s.current.get(l))s.current.set(l,c);else continue;a.push(l)}if(a.length===0)continue;let o=[...s.current.keys()].filter(l=>!this.current.has(l));if(o.length>0){var i=Br;Br=[];let l=new Set,c=new Map;for(let u of a)uM(u,o,l,c);if(Br.length>0){ye=s,s.apply();for(let u of Br)bt(n=s,kn,Oy).call(n,u,[],[]);s.deactivate()}Br=i}}ye=null,Rt=e}this.committed=!0,Zl.delete(this)};var Hr=Ly;function Ja(t){var e=Za;Za=!0;try{var r;for(t&&(ye!==null&&Dy(),r=t());;){if(sM(),Br.length===0&&(ye==null||ye.flush(),Br.length===0))return Hp=null,r;Dy()}}finally{Za=e}}function Dy(){var s;Fy=!0;var t=M?new Set:null;try{for(var e=0;Br.length>0;){var r=Hr.ensure();if(e++>1e3){if(M){var i=new Map;for(let a of r.current.keys())for(let[o,l]of(s=a.updated)!=null?s:[]){var n=i.get(o);n||(n={error:l.error,count:0},i.set(o,n)),n.count+=l.count}for(let a of i.values())a.error&&console.error(a.error)}XV()}if(r.process(Br),An.clear(),M)for(let a of r.current.keys())t.add(a)}}finally{if(Br=[],Fy=!1,Hp=null,M)for(let a of t)a.updated=null}}function XV(){try{jO()}catch(t){M&&tr(t,"stack",{value:""}),En(t,Hp)}}var Lr=null;function lM(t){var e=t.length;if(e!==0){for(var r=0;r0)){An.clear();for(let n of Lr){if(n.f&24576)continue;let s=[n],a=n.parent;for(;a!==null;)Lr.has(a)&&(Lr.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){let l=s[o];l.f&24576||Js(l)}}Lr.clear()}}Lr=null}}function uM(t,e,r,i){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(let n of t.reactions){let s=n.f;s&2?uM(n,e,r,i):s&4194320&&!(s&2048)&&fM(n,e,i)&&(Be(n,2048),vr(n))}}function fM(t,e,r){let i=r.get(t);if(i!==void 0)return i;if(t.deps!==null)for(let n of t.deps){if(Hi.call(e,n))return!0;if(n.f&2&&fM(n,e,r))return r.set(n,!0),!0}return r.set(t,!1),!1}function vr(t){for(var e=Hp=t;e.parent!==null;){e=e.parent;var r=e.f;if(Fy&&e===ne&&r&16&&!(r&262144))return;if(r&96){if(!(r&1024))return;e.f^=1024}}Br.push(e)}function dM(t,e){if(!(t.f&32&&t.f&1024)){t.f&2048?e.d.push(t):t.f&4096&&e.m.push(t),Be(t,1024);for(var r=t.first;r!==null;)dM(r,e),r=r.next}}p();p();p();function pM(t){let e=0,r=sr(0),i;return M&&Dr(r,"createSubscriber version"),()=>{Qs()&&(R(r),Kt(()=>(e===0&&(i=We(()=>t(()=>eo(r)))),e+=1,()=>{yt(()=>{e-=1,e===0&&(i==null||i(),i=void 0,eo(r))})})))}}var KV=589952;function Gy(t,e,r){new Ny(t,e,r)}var ri,sf,Tn,to,Cn,Si,Gr,Pn,ls,ta,ro,cs,nc,io,sc,ac,Rn,zp,St,mM,gM,Hy,jp,qp,Uy,Ny=class{constructor(e,r,i){pe(this,St);ze(this,"parent");ze(this,"is_pending",!1);pe(this,ri);pe(this,sf,ie?ge:null);pe(this,Tn);pe(this,to);pe(this,Cn);pe(this,Si,null);pe(this,Gr,null);pe(this,Pn,null);pe(this,ls,null);pe(this,ta,null);pe(this,ro,0);pe(this,cs,0);pe(this,nc,!1);pe(this,io,!1);pe(this,sc,new Set);pe(this,ac,new Set);pe(this,Rn,null);pe(this,zp,pM(()=>(fe(this,Rn,sr($(this,ro))),M&&Dr($(this,Rn),"$effect.pending()"),()=>{fe(this,Rn,null)})));fe(this,ri,e),fe(this,Tn,r),fe(this,to,i),this.parent=ne.b,this.is_pending=!!$(this,Tn).pending,fe(this,Cn,ii(()=>{if(ne.b=this,ie){let s=$(this,sf);rr(),s.nodeType===Mr&&s.data===wn?bt(this,St,gM).call(this):(bt(this,St,mM).call(this),$(this,cs)===0&&(this.is_pending=!1))}else{var n=bt(this,St,Hy).call(this);try{fe(this,Si,Ut(()=>i(n)))}catch(s){this.error(s)}$(this,cs)>0?bt(this,St,qp).call(this):this.is_pending=!1}return()=>{var s;(s=$(this,ta))==null||s.remove()}},KV)),ie&&fe(this,ri,ge)}defer_effect(e){Bp(e,$(this,sc),$(this,ac))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!$(this,Tn).pending}update_pending_count(e){bt(this,St,Uy).call(this,e),fe(this,ro,$(this,ro)+e),!(!$(this,Rn)||$(this,nc))&&(fe(this,nc,!0),yt(()=>{fe(this,nc,!1),$(this,Rn)&&Vi($(this,Rn),$(this,ro))}))}get_effect_pending(){return $(this,zp).call(this),R($(this,Rn))}error(e){var r=$(this,Tn).onerror;let i=$(this,Tn).failed;if($(this,io)||!r&&!i)throw e;$(this,Si)&&(dt($(this,Si)),fe(this,Si,null)),$(this,Gr)&&(dt($(this,Gr)),fe(this,Gr,null)),$(this,Pn)&&(dt($(this,Pn)),fe(this,Pn,null)),ie&&(je($(this,sf)),Ya(),je(ns()));var n=!1,s=!1;let a=()=>{if(n){tM();return}n=!0,s&&ZO(),Hr.ensure(),fe(this,ro,0),$(this,Pn)!==null&&$n($(this,Pn),()=>{fe(this,Pn,null)}),this.is_pending=this.has_pending_snippet(),fe(this,Si,bt(this,St,jp).call(this,()=>(fe(this,io,!1),Ut(()=>$(this,to).call(this,$(this,ri)))))),$(this,cs)>0?bt(this,St,qp).call(this):this.is_pending=!1};yt(()=>{try{s=!0,r==null||r(e,a),s=!1}catch(o){En(o,$(this,Cn)&&$(this,Cn).parent)}i&&fe(this,Pn,bt(this,St,jp).call(this,()=>{Hr.ensure(),fe(this,io,!0);try{return Ut(()=>{i($(this,ri),()=>e,()=>a)})}catch(o){return En(o,$(this,Cn).parent),null}finally{fe(this,io,!1)}}))})}};ri=new WeakMap,sf=new WeakMap,Tn=new WeakMap,to=new WeakMap,Cn=new WeakMap,Si=new WeakMap,Gr=new WeakMap,Pn=new WeakMap,ls=new WeakMap,ta=new WeakMap,ro=new WeakMap,cs=new WeakMap,nc=new WeakMap,io=new WeakMap,sc=new WeakMap,ac=new WeakMap,Rn=new WeakMap,zp=new WeakMap,St=new WeakSet,mM=function(){try{fe(this,Si,Ut(()=>$(this,to).call(this,$(this,ri))))}catch(e){this.error(e)}},gM=function(){let e=$(this,Tn).pending;e&&(fe(this,Gr,Ut(()=>e($(this,ri)))),yt(()=>{var r=bt(this,St,Hy).call(this);fe(this,Si,bt(this,St,jp).call(this,()=>(Hr.ensure(),Ut(()=>$(this,to).call(this,r))))),$(this,cs)>0?bt(this,St,qp).call(this):($n($(this,Gr),()=>{fe(this,Gr,null)}),this.is_pending=!1)}))},Hy=function(){var e=$(this,ri);return this.is_pending&&(fe(this,ta,It()),$(this,ri).before($(this,ta)),e=$(this,ta)),e},jp=function(e){var r=ne,i=le,n=ke;Gt($(this,Cn)),$t($(this,Cn)),as($(this,Cn).ctx);try{return e()}catch(s){return Lp(s),null}finally{Gt(r),$t(i),as(n)}},qp=function(){let e=$(this,Tn).pending;$(this,Si)!==null&&(fe(this,ls,document.createDocumentFragment()),$(this,ls).append($(this,ta)),Vp($(this,Si),$(this,ls))),$(this,Gr)===null&&fe(this,Gr,Ut(()=>e($(this,ri))))},Uy=function(e){var r;if(!this.has_pending_snippet()){this.parent&&bt(r=this.parent,St,Uy).call(r,e);return}if(fe(this,cs,$(this,cs)+e),$(this,cs)===0){this.is_pending=!1;for(let i of $(this,sc))Be(i,2048),vr(i);for(let i of $(this,ac))Be(i,4096),vr(i);$(this,sc).clear(),$(this,ac).clear(),$(this,Gr)&&$n($(this,Gr),()=>{fe(this,Gr,null)}),$(this,ls)&&($(this,ri).before($(this,ls)),fe(this,ls,null))}};p();function Wp(t,e,r,i){let n=xn()?no:so;var s=t.filter(d=>!d.settled);if(r.length===0&&s.length===0){i(e.map(n));return}var a=ye,o=ne,l=vM(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(d=>d.promise)):null;function u(d){l();try{i(d)}catch(h){o.f&16384||En(h,o)}a==null||a.deactivate(),af()}if(r.length===0){c.then(()=>u(e.map(n)));return}function f(){l(),Promise.all(r.map(d=>qy(d))).then(d=>u([...e.map(n),...d])).catch(d=>En(d,o))}c?c.then(f):f()}function vM(){var t=ne,e=le,r=ke,i=ye;if(M)var n=_n;return function(a=!0){Gt(t),$t(e),as(r),a&&(i==null||i.activate()),M&&(jy(null),Wl(n))}}function af(){Gt(null),$t(null),as(null),M&&(jy(null),Wl(null))}var of=null;function jy(t){of=t}var lf=new Set;function no(t){var e=2050,r=le!==null&&le.f&2?le:null;ne!==null&&(ne.f|=524288);let i={ctx:ke,deps:null,effects:null,equals:Fp,f:e,fn:t,reactions:null,rv:0,v:Je,wv:0,parent:r!=null?r:ne,ac:null};return M&&Ui&&(i.created=bn("created at")),i}function qy(t,e,r){let i=ne;i===null&&BO();var n=i.b,s=void 0,a=sr(Je);M&&(a.label=e);var o=!le,l=new Map;return wM(()=>{var h;M&&(of=ne);var c=Cp();s=c.promise;try{Promise.resolve(t()).then(c.resolve,c.reject).then(()=>{u===ye&&u.committed&&u.deactivate(),af()})}catch(m){c.reject(m),af()}M&&(of=null);var u=ye;if(o){var f=n.is_rendered();n.update_pending_count(1),u.increment(f),(h=l.get(u))==null||h.reject(yn),l.delete(u),l.set(u,c)}let d=(m,g=void 0)=>{if(of=null,u.activate(),g)g!==yn&&(a.f|=8388608,Vi(a,g));else{a.f&8388608&&(a.f^=8388608),Vi(a,m);for(let[v,w]of l){if(l.delete(v),v===u)break;w.reject(yn)}M&&r!==void 0&&(lf.add(a),setTimeout(()=>{lf.has(a)&&(KO(a.label,r),lf.delete(a))}))}o&&(n.update_pending_count(-1),u.decrement(f))};c.promise.then(d,m=>d(null,m||"unknown"))}),ar(()=>{for(let c of l.values())c.reject(yn)}),M&&(a.f|=4194304),new Promise(c=>{function u(f){function d(){f===s?c(a):u(s)}f.then(d,d)}u(s)})}function Et(t){let e=no(t);return ir||Zp(e),e}function so(t){let e=no(t);return e.equals=Op,e}function Yp(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r5){let l=bn("updated at");if(l!==null){let c=t.updated.get(l.stack);c||(c={error:l,count:0},t.updated.set(l.stack,c)),c.count++}}}ne!==null&&(t.set_during_effect=!0)}if(t.f&2){let o=t;t.f&2048&&cf(o),Xl(o)}t.wv=ic(),bM(t,2048),xn()&&ne!==null&&ne.f&1024&&!(ne.f&96)&&(si===null?_M([t]):si.push(t)),!i.is_fork&&ao.size>0&&!Wy&&Gp()}return e}function Gp(){Wy=!1;for(let t of ao)t.f&1024&&Be(t,4096),ea(t)&&Js(t);ao.clear()}function eo(t){ae(t,t.v+1)}function bM(t,e){var u;var r=t.reactions;if(r!==null)for(var i=xn(),n=r.length,s=0;s{if(ra===a)return f();var d=le,h=ra;$t(null),Yy(a);var m=f();return $t(d),Yy(h),m};i&&(r.set("length",De(t.length,s)),M&&(t=iW(t)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,Dr(n,`${l} version`);for(let[d,h]of r)Dr(h,lo(l,d));c=!1}}return new Proxy(t,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&WO();var m=r.get(d);return m===void 0?m=o(()=>{var g=De(h.value,s);return r.set(d,g),M&&typeof d=="string"&&Dr(g,lo(l,d)),g}):ae(m,h.value,!0),!0},deleteProperty(f,d){var h=r.get(d);if(h===void 0){if(d in f){let m=o(()=>De(Je,s));r.set(d,m),eo(n),M&&Dr(m,lo(l,d))}}else ae(h,Je),eo(n);return!0},get(f,d,h){var w;if(d===Wt)return t;if(M&&d===Pp)return u;var m=r.get(d),g=d in f;if(m===void 0&&(!g||(w=Fr(f,d))!=null&&w.writable)&&(m=o(()=>{var b=Xe(g?f[d]:Je),k=De(b,s);return M&&Dr(k,lo(l,d)),k}),r.set(d,m)),m!==void 0){var v=R(m);return v===Je?void 0:v}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var m=r.get(d);m&&(h.value=R(m))}else if(h===void 0){var g=r.get(d),v=g==null?void 0:g.v;if(g!==void 0&&v!==Je)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return h},has(f,d){var v;if(d===Wt)return!0;var h=r.get(d),m=h!==void 0&&h.v!==Je||Reflect.has(f,d);if(h!==void 0||ne!==null&&(!m||(v=Fr(f,d))!=null&&v.writable)){h===void 0&&(h=o(()=>{var w=m?Xe(f[d]):Je,b=De(w,s);return M&&Dr(b,lo(l,d)),b}),r.set(d,h));var g=R(h);if(g===Je)return!1}return m},set(f,d,h,m){var y;var g=r.get(d),v=d in f;if(i&&d==="length")for(var w=h;wDe(Je,s)),r.set(w+"",b),M&&Dr(b,lo(l,w)))}if(g===void 0)(!v||(y=Fr(f,d))!=null&&y.writable)&&(g=o(()=>De(void 0,s)),M&&Dr(g,lo(l,d)),ae(g,Xe(h)),r.set(d,g));else{v=g.v!==Je;var k=o(()=>Xe(h));ae(g,k)}var x=Reflect.getOwnPropertyDescriptor(f,d);if(x!=null&&x.set&&x.set.call(m,h),!v){if(i&&typeof d=="string"){var E=r.get("length"),A=Number(d);Number.isInteger(A)&&A>=E.v&&ae(E,A+1)}eo(n)}return!0},ownKeys(f){R(n);var d=Reflect.ownKeys(f).filter(g=>{var v=r.get(g);return v===void 0||v.v!==Je});for(var[h,m]of r)m.v!==Je&&!(h in f)&&d.push(h);return d},setPrototypeOf(){YO()}})}function lo(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:tW.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Kp(t){try{if(t!==null&&typeof t=="object"&&Wt in t)return t[Wt]}catch(e){}return t}var rW=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function iW(t){return new Proxy(t,{get(e,r,i){var n=Reflect.get(e,r,i);return rW.has(r)?function(...s){yM();var a=n.apply(this,s);return Gp(),a}:n}})}function xM(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:i,includes:n}=t;t.indexOf=function(s,a){let o=r.call(this,s,a);if(o===-1){for(let l=a!=null?a:0;l{t.indexOf=r,t.lastIndexOf=i,t.includes=n}}var Xy,SM,Qu,EM,kM;function Qp(){if(Xy===void 0){Xy=window,SM=document,Qu=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;EM=Fr(e,"firstChild").get,kM=Fr(e,"nextSibling").get,ky(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),ky(r)&&(r.__t=void 0),M&&(t.__svelte_meta=null,xM())}}function It(t=""){return document.createTextNode(t)}function Qt(t){return EM.call(t)}function Zt(t){return kM.call(t)}function G(t,e){if(!ie)return Qt(t);var r=Qt(ge);if(r===null)r=ge.appendChild(It());else if(e&&r.nodeType!==Vl){var i=It();return r==null||r.before(i),je(i),i}return e&&em(r),je(r),r}function zr(t,e=!1){var n,s;if(!ie){var r=Qt(t);return r instanceof Comment&&r.data===""?Zt(r):r}if(e){if(((n=ge)==null?void 0:n.nodeType)!==Vl){var i=It();return(s=ge)==null||s.before(i),je(i),i}em(ge)}return ge}function te(t,e=1,r=!1){let i=ie?ge:t;for(var n;e--;)n=i,i=Zt(i);if(!ie)return i;if(r){if((i==null?void 0:i.nodeType)!==Vl){var s=It();return i===null?n==null||n.after(s):i.before(s),je(s),s}em(i)}return je(i),i}function oc(t){t.textContent=""}function Jp(){if(!ir||Lr!==null)return!1;var t=ne.f;return(t&32768)!==0}function em(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===Vl;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}p();p();function Zy(t){ie&&Qt(t)!==null&&oc(t)}var AM=!1;function Ky(){AM||(AM=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r.__on_r)==null||e.call(r)})},{capture:!0}))}function Wi(t){var e=le,r=ne;$t(null),Gt(null);try{return t()}finally{$t(e),Gt(r)}}function Qy(t,e,r,i=r){t.addEventListener(e,()=>Wi(r));let n=t.__on_r;n?t.__on_r=()=>{n(),i(!0)}:t.__on_r=()=>i(!0),Ky()}function TM(t){ne===null&&(le===null&&GO(t),UO()),Ei&&HO(t)}function sW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function In(t,e,r){var o;var i=ne;if(M)for(;i!==null&&i.f&131072;)i=i.parent;i!==null&&i.f&8192&&(t|=8192);var n={ctx:ke,deps:null,nodes:null,f:t|2048|512,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null};if(M&&(n.component_function=Gi),r)try{Js(n),n.f|=32768}catch(l){throw dt(n),l}else e!==null&&vr(n);var s=n;if(r&&s.deps===null&&s.teardown===null&&s.nodes===null&&s.first===s.last&&!(s.f&524288)&&(s=s.first,t&16&&t&65536&&s!==null&&(s.f|=65536)),s!==null&&(s.parent=i,i!==null&&sW(s,i),le!==null&&le.f&2&&!(t&64))){var a=le;((o=a.effects)!=null?o:a.effects=[]).push(s)}return n}function Qs(){return le!==null&&!qr}function ar(t){let e=In(8,null,!1);return Be(e,1024),e.teardown=t,e}function or(t){var n;TM("$effect"),M&&tr(t,"name",{value:"$effect"});var e=ne.f,r=!le&&(e&32)!==0&&(e&32768)===0;if(r){var i=ke;((n=i.e)!=null?n:i.e=[]).push(t)}else return $y(t)}function $y(t){return In(1048580,t,!1)}function eb(t){Hr.ensure();let e=In(524352,t,!0);return()=>{dt(e)}}function CM(t){Hr.ensure();let e=In(524352,t,!0);return(r={})=>new Promise(i=>{r.outro?$n(e,()=>{dt(e),i(void 0)}):(dt(e),i(void 0))})}function Vr(t){return In(4,t,!1)}function wM(t){return In(4718592,t,!0)}function Kt(t,e=0){return In(8|e,t,!0)}function Ne(t,e=[],r=[],i=[]){Wp(i,e,r,n=>{In(8,()=>t(...n.map(R)),!0)})}function ii(t,e=0){var r=In(16|e,t,!0);return M&&(r.dev_stack=_n),r}function Ut(t){return In(524320,t,!0)}function tb(t){var e=t.teardown;if(e!==null){let r=Ei,i=le;Jy(!0),$t(null);try{e.call(null)}finally{Jy(r),$t(i)}}}function rb(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){let n=r.ac;n!==null&&Wi(()=>{n.abort(yn)});var i=r.next;r.f&64?r.parent=null:dt(r,e),r=i}}function PM(t){for(var e=t.first;e!==null;){var r=e.next;e.f&32||dt(e),e=r}}function dt(t,e=!0){var r=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(RM(t.nodes.start,t.nodes.end),r=!0),rb(t,e&&!r),ff(t,0),Be(t,16384);var i=t.nodes&&t.nodes.t;if(i!==null)for(let s of i)s.stop();tb(t);var n=t.parent;n!==null&&n.first!==null&&By(t),M&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function RM(t,e){for(;t!==null;){var r=t===e?null:Zt(t);t.remove(),t=r}}function By(t){var e=t.parent,r=t.prev,i=t.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),e!==null&&(e.first===t&&(e.first=i),e.last===t&&(e.last=r))}function $n(t,e,r=!0){var i=[];$M(t,i,!0);var n=()=>{r&&dt(t),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var o of i)o.out(a)}else n()}function $M(t,e,r){if(!(t.f&8192)){t.f^=8192;var i=t.nodes&&t.nodes.t;if(i!==null)for(let o of i)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var s=n.next,a=(n.f&65536)!==0||(n.f&32)!==0&&(t.f&16)!==0;$M(n,e,a?r:!1),n=s}}}function uf(t){IM(t,!0)}function IM(t,e){if(t.f&8192){t.f^=8192,t.f&1024||(Be(t,2048),vr(t));for(var r=t.first;r!==null;){var i=r.next,n=(r.f&65536)!==0||(r.f&32)!==0;IM(r,n?e:!1),r=i}var s=t.nodes&&t.nodes.t;if(s!==null)for(let a of s)(a.is_global||e)&&a.in()}}function Vp(t,e){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end;r!==null;){var n=r===i?null:Zt(r);e.append(r),r=n}}p();var FM=null;var tm=!1,Ei=!1;function Jy(t){Ei=t}var le=null,qr=!1;function $t(t){le=t}var ne=null;function Gt(t){ne=t}var ni=null;function Zp(t){le!==null&&(!ir||le.f&2)&&(ni===null?ni=[t]:ni.push(t))}var Wr=null,ai=0,si=null;function _M(t){si=t}var OM=1,co=0,ra=co;function Yy(t){ra=t}function ic(){return++OM}function ea(t){var e=t.f;if(e&2048)return!0;if(e&2&&(t.f&=-32769),e&4096){for(var r=t.deps,i=r.length,n=0;nt.wv)return!0}e&512&&Rt===null&&Be(t,1024)}return!1}function MM(t,e,r=!0){var i=t.reactions;if(i!==null&&!(!ir&&ni!==null&&Hi.call(ni,t)))for(var n=0;n{t.ac.abort(yn)}),t.ac=null);try{t.f|=2097152;var u=t.fn,f=u(),d=t.deps,h=(g=ye)==null?void 0:g.is_fork;if(Wr!==null){var m;if(h||ff(t,ai),d!==null&&ai>0)for(d.length=ai+Wr.length,m=0;m{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),Ja()}function R(t){var h,m,g;var e=t.f,r=(e&2)!==0;if((h=FM)==null||h.add(t),le!==null&&!qr){var i=ne!==null&&(ne.f&16384)!==0;if(!i&&(ni===null||!Hi.call(ni,t))){var n=le.deps;if(le.f&2097152)t.rvr==null?void 0:r.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?yt(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function oi(t,e,r,i,n){var s={capture:i,passive:n},a=NM(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ar(()=>{e.removeEventListener(t,a,s)})}function kt(t){for(var e=0;e{throw w});throw d}}finally{t.__root=e,delete t.currentTarget,$t(u),Gt(f)}}}p();p();function nm(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function Fn(t,e){var r=ne;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function ue(t,e){var r=(e&1)!==0,i=(e&2)!==0,n,s=!t.startsWith("");return()=>{if(ie)return Fn(ge,null),ge;n===void 0&&(n=nm(s?t:""+t),r||(n=Qt(n)));var a=i||Qu?document.importNode(n,!0):n.cloneNode(!0);if(r){var o=Qt(a),l=a.lastChild;Fn(o,l)}else Fn(a,a);return a}}function fs(){if(ie)return Fn(ge,null),ge;var t=document.createDocumentFragment(),e=document.createComment(""),r=It();return t.append(e,r),Fn(e,r),t}function oe(t,e){if(ie){var r=ne;(!(r.f&32768)||r.nodes.end===null)&&(r.nodes.end=ge),rr();return}t!==null&&t.before(e)}p();var fW=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Cle=[...fW,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var dW=["touchstart","touchmove"];function UM(t){return dW.includes(t)}var hW=["$state","$state.raw","$derived","$derived.by"],Ple=[...hW,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var sm=!0;function Ue(t,e){var i;var r=e==null?"":typeof e=="object"?e+"":e;r!==((i=t.__t)!=null?i:t.__t=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function ia(t,e){return GM(t,e)}function ab(t,e){var a;Qp(),e.intro=(a=e.intro)!=null?a:!1;let r=e.target,i=ie,n=ge;try{for(var s=Qt(r);s&&(s.nodeType!==Mr||s.data!==Xu);)s=Zt(s);if(!s)throw rs;Ht(!0),je(s);let o=GM(t,{...e,anchor:s});return Ht(!1),o}catch(o){if(o instanceof Error&&o.message.split(` +`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==rs&&console.warn("Failed to hydrate: ",o),e.recover===!1&&qO(),Qp(),oc(r),Ht(!1),ia(t,e)}finally{Ht(i),je(n)}}var cc=new Map;function GM(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0}){Qp();var o=new Set,l=f=>{for(var d=0;d{var f=r!=null?r:e.appendChild(It());return Gy(f,{pending:()=>{}},d=>{ot({});var h=ke;if(s&&(h.c=s),n&&(i.$$events=n),ie&&Fn(d,null),sm=a,c=t(d,i)||{},sm=!0,ie&&(ne.nodes.end=ge,ge===null||ge.nodeType!==Mr||ge.data!==Va))throw Wa(),rs;lt()}),()=>{var m;for(var d of o){e.removeEventListener(d,lc);var h=cc.get(d);--h===0?(document.removeEventListener(d,lc),cc.delete(d)):cc.set(d,h)}im.delete(l),f!==r&&((m=f.parentNode)==null||m.removeChild(f))}});return sb.set(c,u),c}var sb=new WeakMap;function ds(t,e){let r=sb.get(t);return r?(sb.delete(t),r(e)):(M&&(Wt in t?eM():JO()),Promise.resolve())}p();p();p();var Yi,On,li,uo,df,hf,am,hs=class{constructor(e,r=!0){ze(this,"anchor");pe(this,Yi,new Map);pe(this,On,new Map);pe(this,li,new Map);pe(this,uo,new Set);pe(this,df,!0);pe(this,hf,()=>{var e=ye;if($(this,Yi).has(e)){var r=$(this,Yi).get(e),i=$(this,On).get(r);if(i)uf(i),$(this,uo).delete(r);else{var n=$(this,li).get(r);n&&($(this,On).set(r,n.effect),$(this,li).delete(r),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of $(this,Yi)){if($(this,Yi).delete(s),s===e)break;let o=$(this,li).get(a);o&&(dt(o.effect),$(this,li).delete(a))}for(let[s,a]of $(this,On)){if(s===r||$(this,uo).has(s))continue;let o=()=>{if(Array.from($(this,Yi).values()).includes(s)){var c=document.createDocumentFragment();Vp(a,c),c.append(It()),$(this,li).set(s,{effect:a,fragment:c})}else dt(a);$(this,uo).delete(s),$(this,On).delete(s)};$(this,df)||!i?($(this,uo).add(s),$n(a,o,!1)):o()}}});pe(this,am,e=>{$(this,Yi).delete(e);let r=Array.from($(this,Yi).values());for(let[i,n]of $(this,li))r.includes(i)||(dt(n.effect),$(this,li).delete(i))});this.anchor=e,fe(this,df,r)}ensure(e,r){var i=ye,n=Jp();if(r&&!$(this,On).has(e)&&!$(this,li).has(e))if(n){var s=document.createDocumentFragment(),a=It();s.append(a),$(this,li).set(e,{effect:Ut(()=>r(a)),fragment:s})}else $(this,On).set(e,Ut(()=>r(this.anchor)));if($(this,Yi).set(i,e),n){for(let[o,l]of $(this,On))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of $(this,li))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit($(this,hf)),i.ondiscard($(this,am))}else ie&&(this.anchor=ge),$(this,hf).call(this)}};Yi=new WeakMap,On=new WeakMap,li=new WeakMap,uo=new WeakMap,df=new WeakMap,hf=new WeakMap,am=new WeakMap;if(M){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;VO(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function fo(t){ke===null&&Rp("onMount"),ss&&ke.l!==null?gW(ke).m.push(t):or(()=>{let e=We(t);if(typeof e=="function")return e})}function gW(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}p();p();var zM=new Map;function VM(t,e){var r=zM.get(t);r||(r=new Set,zM.set(t,r)),r.add(e)}p();p();p();p();p();p();p();p();p();function Ae(t,e,r=!1){ie&&rr();var i=new hs(t),n=r?65536:0;function s(a,o){if(ie){let c=Ip(t)===wn;if(a===c){var l=ns();je(l),i.anchor=l,Ht(!1),i.ensure(a,o),Ht(!0);return}}i.ensure(a,o)}ii(()=>{var a=!1;e((o,l=!0)=>{a=!0,s(l,o)}),a||s(!1,null)},n)}p();var Tfe=Symbol("NaN");p();p();function ci(t,e){return e}function SW(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;ob(ql(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;oc(u),u.append(c),t.items.clear()}ob(e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function ob(t,e=!0){for(var r=0;r{var w=r();return is(w)?w:w==null?[]:ql(w)}),d,h=!0;function m(){v.fallback=u,EW(v,d,a,e,i),u!==null&&(d.length===0?u.f&33554432?(u.f^=33554432,mf(u,null,a)):uf(u):$n(u,()=>{u=null}))}var g=ii(()=>{d=R(f);var w=d.length;let b=!1;if(ie){var k=Ip(a)===wn;k!==(w===0)&&(a=ns(),je(a),Ht(!1),b=!0)}for(var x=new Set,E=ye,A=Jp(),y=0;ys(a)):(u=Ut(()=>s(uc!=null?uc:uc=It())),u.f|=33554432)),w>x.size&&(M?AW(d,i):Cy("","","")),ie&&w>0&&je(ns()),!h)if(A){for(let[P,D]of o)x.has(P)||E.skip_effect(D.e);E.oncommit(m),E.ondiscard(()=>{})}else m();b&&Ht(!0),R(f)}),v={effect:g,flags:e,items:o,outrogroups:null,fallback:u};h=!1,ie&&(a=ge)}function pf(t){for(;t!==null&&!(t.f&32);)t=t.next;return t}function EW(t,e,r,i,n){var T,P,D,B,N,ce,Pe,ve,se;var s=(i&8)!==0,a=e.length,o=t.items,l=pf(t.effect.first),c,u=null,f,d=[],h=[],m,g,v,w;if(s)for(w=0;w0){var _=i&4&&a===0?r:null;if(s){for(w=0;w{var xe,we;if(f!==void 0)for(v of f)(we=(xe=v.nodes)==null?void 0:xe.a)==null||we.apply()})}function kW(t,e,r,i,n,s,a,o){var l=a&1?a&16?sr(r):oo(r,!1,!1):null,c=a&2?sr(n):null;return M&&l&&(l.trace=()=>{var u;o()[(u=c==null?void 0:c.v)!=null?u:n]}),{v:l,i:c,e:Ut(()=>(s(e,l!=null?l:r,c!=null?c:n,o),()=>{t.delete(i)}))}}function mf(t,e,r){if(t.nodes)for(var i=t.nodes.start,n=t.nodes.end,s=e&&!(e.f&33554432)?e.nodes.start:r;i!==null;){var a=Zt(i);if(s.before(i),i===n)return;i=a}}function na(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function AW(t,e){let r=new Map,i=t.length;for(let n=0;nperformance.now():()=>Date.now(),Xi={tick:t=>(Ap?requestAnimationFrame:Or)(t),now:()=>TW(),tasks:new Set};function YM(){let t=Xi.now();Xi.tasks.forEach(e=>{e.c(t)||(Xi.tasks.delete(e),e.f())}),Xi.tasks.size!==0&&Xi.tick(YM)}function XM(t){let e;return Xi.tasks.size===0&&Xi.tick(YM),{promise:new Promise(r=>{Xi.tasks.add(e={c:t,f:r})}),abort(){Xi.tasks.delete(e)}}}function om(t,e){Wi(()=>{t.dispatchEvent(new CustomEvent(e))})}function $W(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 ZM(t){let e={},r=t.split(";");for(let i of r){let[n,s]=i.split(":");if(!n||s===void 0)break;let a=$W(n.trim());e[a]=s.trim()}return e}var IW=t=>t;function Zi(t,e,r,i){var k,x;var n=(t&1)!==0,s=(t&2)!==0,a=n&&s,o=(t&4)!==0,l=a?"both":n?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function m(){return Wi(()=>{var E;return c!=null?c:c=r()(e,(E=i==null?void 0:i())!=null?E:{},{direction:l})})}var g={is_global:o,in(){var E;if(e.inert=u,!n){h==null||h.abort(),(E=h==null?void 0:h.reset)==null||E.call(h);return}s||d==null||d.abort(),d=lb(e,m(),h,1,()=>{om(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(E){if(!s){E==null||E(),c=void 0;return}e.inert=!0,h=lb(e,m(),d,0,()=>{om(e,"outroend"),E==null||E()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=ne;if(((x=(k=v.nodes).t)!=null?x:k.t=[]).push(g),n&&sm){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&&Vr(()=>{We(()=>g.in())})}}function lb(t,e,r,i,n){var s=i===1;if(Ay(e)){var a,o=!1;return yt(()=>{if(!o){var v=e({direction:s?"in":"out"});a=lb(t,v,r,i,n)}}),{abort:()=>{o=!0,a==null||a.abort()},deactivate:()=>a.deactivate(),reset:()=>a.reset(),t:()=>a.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration)&&!(e!=null&&e.delay))return om(t,s?"introstart":"outrostart"),n(),{abort:Or,deactivate:Or,reset:Or,t:()=>i};let{delay:l=0,css:c,tick:u,easing:f=IW}=e;var d=[];if(s&&r===void 0&&(u&&u(0,1),c)){var h=ZM(c(0,1));d.push(h,h)}var m=()=>1-i,g=t.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{var _;g.cancel(),om(t,s?"introstart":"outrostart");var v=(_=r==null?void 0:r.t())!=null?_:1-i;r==null||r.abort();var w=i-v,b=e.duration*Math.abs(w),k=[];if(b>0){var x=!1;if(c)for(var E=Math.ceil(b/16.666666666666668),A=0;A<=E;A+=1){var y=v+w*f(A/E),S=ZM(c(y,1-y));k.push(S),x||(x=S.overflow==="hidden")}x&&(t.style.overflow="hidden"),m=()=>{var T=g.currentTime;return v+w*f(T/b)},u&&XM(()=>{if(g.playState!=="running")return!1;var T=m();return u(T,1-T),!0})}g=t.animate(k,{duration:b,fill:"forwards"}),g.onfinish=()=>{m=()=>i,u==null||u(i,1-i),n()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=Or)},deactivate:()=>{n=Or},reset:()=>{i===0&&(u==null||u(1,0))},t:()=>m()}}p();p();function Ki(t,e){Vr(()=>{var n;var r=t.getRootNode(),i=r.host?r:(n=r.head)!=null?n:r.ownerDocument.head;if(!i.querySelector("#"+e.hash)){let s=document.createElement("style");s.id=e.hash,s.textContent=e.code,i.appendChild(s),M&&VM(e.hash,s)}})}p();p();p();p();p();p();var QM=[...` +\r\f\xA0\v\uFEFF`];function JM(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n in r)if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||QM.includes(i[a-1]))&&(o===i.length||QM.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}p();function ht(t,e,r,i,n,s){var a=t.__className;if(ie||a!==r||a===void 0){var o=JM(r,i,s);(!ie||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}p();p();var HW=Symbol("class"),UW=Symbol("style"),GW=Symbol("is custom element"),jW=Symbol("is html");function be(t,e,r,i){var n=qW(t);if(ie&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){i||VW(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[LO]=r),r==null?t.removeAttribute(e):typeof r!="string"&&zW(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function qW(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[GW]:t.nodeName.includes("-"),[jW]:t.namespaceURI===OO}}var eD=new Map;function zW(t){var e=t.getAttribute("is")||t.nodeName,r=eD.get(e);if(r)return r;eD.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Sy(n);for(var a in i)i[a].set&&r.push(a);n=zl(n)}return r}function VW(t,e,r){var i;M&&(e==="srcset"&&WW(t,r)||cb((i=t.getAttribute(e))!=null?i:"",r)||QO(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function cb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function tD(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function WW(t,e){var r=tD(t.srcset),i=tD(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(cb(r[a][0],n)||cb(n,r[a][0])))}p();p();p();function db(t,e,r=e){var i=new WeakSet;Qy(t,"input",async n=>{M&&t.type==="checkbox"&&Ty();var s=n?t.defaultValue:t.value;if(s=ub(t)?fb(s):s,r(s),ye!==null&&i.add(ye),await rm(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ie&&t.defaultValue!==t.value||We(e)==null&&t.value)&&(r(ub(t)?fb(t.value):t.value),ye!==null&&i.add(ye)),Kt(()=>{var a;M&&t.type==="checkbox"&&Ty();var n=e();if(t===document.activeElement){var s=(a=tf)!=null?a:ye;if(i.has(s))return}ub(t)&&n===fb(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function ub(t){var e=t.type;return e==="number"||e==="range"}function fb(t){return t===""?null:+t}p();p();p();p();p();function iD(t,e){return t===e||(t==null?void 0:t[Wt])===e}function st(t={},e,r,i){return Vr(()=>{var n,s;return Kt(()=>{n=s,s=(i==null?void 0:i())||[],We(()=>{t!==r(...s)&&(e(t,...s),n&&iD(r(...n),t)&&e(null,...n))})}),()=>{yt(()=>{s&&iD(r(...s),t)&&e(null,...s)})}}),t}p();p();p();p();p();p();p();p();p();var cm=!1,Wme=Symbol();function pb(t){var e=cm;try{return cm=!1,[t(),cm]}finally{cm=e}}function ki(t,e,r,i){var k,x;var n=!ss||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=()=>(l&&(l=!1,o=a?We(i):i),o),u;if(s){var f=Wt in t||Zu in t;u=(x=(k=Fr(t,e))==null?void 0:k.set)!=null?x:f&&e in t?E=>t[e]=E:void 0}var d,h=!1;s?[d,h]=pb(()=>t[e]):d=t[e],d===void 0&&i!==void 0&&(d=c(),u&&(n&&zO(e),u(d)));var m;if(n?m=()=>{var E=t[e];return E===void 0?c():(l=!0,E)}:m=()=>{var E=t[e];return E!==void 0&&(o=void 0),E===void 0?o:E},n&&!(r&4))return m;if(u){var g=t.$$legacy;return function(E,A){return arguments.length>0?((!n||!A||g||h)&&u(A?m():E),E):m()}}var v=!1,w=(r&1?no:so)(()=>(v=!1,m()));M&&(w.label=e),s&&R(w);var b=ne;return function(E,A){if(arguments.length>0){let y=A?R(w):n&&s?Xe(E):E;return ae(w,y),v=!0,o!==void 0&&(o=y),E}return Ei&&v||b.f&16384?w.v:R(w)}}p();p();p();function nD(t){return new mb(t)}var ms,Ai,mb=class{constructor(e){pe(this,ms);pe(this,Ai);var s,a;var r=new Map,i=(o,l)=>{var c=oo(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return R((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Zu?!0:(R((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return ae((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});fe(this,Ai,(e.hydrate?ab:ia)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover})),!ir&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&Ja(),fe(this,ms,n.$$events);for(let o of Object.keys($(this,Ai)))o==="$set"||o==="$destroy"||o==="$on"||tr(this,o,{get(){return $(this,Ai)[o]},set(l){$(this,Ai)[o]=l},enumerable:!0});$(this,Ai).$set=o=>{Object.assign(n,o)},$(this,Ai).$destroy=()=>{ds($(this,Ai))}}$set(e){$(this,Ai).$set(e)}$on(e,r){$(this,ms)[e]=$(this,ms)[e]||[];let i=(...n)=>r.call(this,...n);return $(this,ms)[e].push(i),()=>{$(this,ms)[e]=$(this,ms)[e].filter(n=>n!==i)}}$destroy(){$(this,Ai).$destroy()}};ms=new WeakMap,Ai=new WeakMap;var o9;typeof HTMLElement=="function"&&(o9=class extends HTMLElement{constructor(e,r,i){super();ze(this,"$$ctor");ze(this,"$$s");ze(this,"$$c");ze(this,"$$cn",!1);ze(this,"$$d",{});ze(this,"$$r",!1);ze(this,"$$p_d",{});ze(this,"$$l",{});ze(this,"$$l_u",new Map);ze(this,"$$me");ze(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=r,i&&(this.$$shadowRoot=this.attachShadow(i))}addEventListener(e,r,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let n=this.$$c.$on(e,r);this.$$l_u.set(r,n)}super.addEventListener(e,r,i)}removeEventListener(e,r,i){if(super.removeEventListener(e,r,i),this.$$c){let n=this.$$l_u.get(r);n&&(n(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return s=>{let a=document.createElement("slot");n!=="default"&&(a.name=n),oe(s,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},i=l9(this);for(let n of this.$$s)n in i&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),r.default=!0):r[n]=e(n));for(let n of this.attributes){let s=this.$$g_p(n.name);s in this.$$d||(this.$$d[s]=gb(s,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=nD({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=eb(()=>{Kt(()=>{var n;this.$$r=!0;for(let s of xy(this.$$c)){if(!((n=this.$$p_d[s])!=null&&n.reflect))continue;this.$$d[s]=this.$$c[s];let a=gb(s,this.$$d[s],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,a)}this.$$r=!1})});for(let n in this.$$l)for(let s of this.$$l[n]){let a=this.$$c.$on(n,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,r,i){var n;this.$$r||(e=this.$$g_p(e),this.$$d[e]=gb(e,i,this.$$p_d,"toProp"),(n=this.$$c)==null||n.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return xy(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function gb(t,e,r,i){var s;let n=(s=r[t])==null?void 0:s.type;if(e=n==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!r[t])return e;if(i==="toAttribute")switch(n){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(n){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function l9(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}p();p();function ho(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(u){try{c(i.next(u))}catch(f){a(f)}}function l(u){try{c(i.throw(u))}catch(f){a(f)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((i=i.apply(t,e||[])).next())})}var bb=require("obsidian");p();var wb=require("obsidian");p();function c9(t){let e=t-1;return e*e*e+1}var vb=!1;function Dn(t,{delay:e=0,duration:r=400,easing:i=c9,axis:n="y"}={}){let s=getComputedStyle(t);M&&!vb&&/(contents|inline|table)/.test(s.display)&&(vb=!0,Promise.resolve().then(()=>vb=!1),rM(s.display));let a=+s.opacity,o=n==="y"?"height":"width",l=parseFloat(s[o]),c=n==="y"?["top","bottom"]:["left","right"],u=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),h=parseFloat(s[`margin${u[0]}`]),m=parseFloat(s[`margin${u[1]}`]),g=parseFloat(s[`border${u[0]}Width`]),v=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:r,easing:i,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*a};${o}: ${w*l}px;padding-${c[0]}: ${w*f}px;padding-${c[1]}: ${w*d}px;margin-${c[0]}: ${w*h}px;margin-${c[1]}: ${w*m}px;border-${c[0]}-width: ${w*g}px;border-${c[1]}-width: ${w*v}px;min-${o}: 0`}}p();var um=require("obsidian");var u9=ue('
'),f9=ue('
'),d9={hash:"svelte-1c0jiav",code:"main.svelte-1c0jiav .nav-file-title:where(.svelte-1c0jiav) {align-items:center;}"};function gf(t,e){ot(e,!0),Ki(t,d9);let r=Xe([]),i=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");or(()=>{for(let w of r)w&&(0,um.setIcon)(w,w.getAttr("data-icon"))});function n(w){w.stopPropagation(),pl(e.diff.path)?s(w):a(w)}function s(w){var b;w.stopPropagation();let k=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);k instanceof um.TFile&&((b=Mi(e.view.app,w))===null||b===void 0||b.openFile(k).catch(x=>e.view.plugin.displayError(x)))}function a(w){var b;e.view.plugin.tools.openDiff({event:w,aFile:(b=e.diff.fromPath)!==null&&b!==void 0?b:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}var o=f9();o.__click=n;var l=G(o),c=G(l),u=G(c,!0);H(c);var f=te(c,2),d=G(f),h=G(d);{var m=w=>{var b=u9();b.__click=s,st(b,k=>r[0]=k,()=>r==null?void 0:r[0]),oi("auxclick",b,s),oe(w,b)};Ae(h,w=>{ml(e.diff.vaultPath,e.view.app)&&w(m)})}H(d);var g=te(d,2),v=G(g,!0);H(g),H(f),H(l),H(o),Ne(w=>{be(l,"data-path",e.diff.vaultPath),be(l,"data-tooltip-position",R(i)),be(l,"aria-label",e.diff.vaultPath),Ue(u,w),be(g,"data-type",e.diff.status),Ue(v,e.diff.status)},[()=>pn(e.diff.vaultPath)]),oi("auxclick",o,w=>{w.stopPropagation(),w.button==2?hn(e.view.app,w,e.diff.vaultPath,e.view.leaf,"git-history"):n(w)}),oe(t,o),lt()}kt(["click"]);p();var h9=ue("
"),p9=ue(''),m9=ue('
'),g9=ue("
"),v9={hash:"svelte-d9h7mp",code:"main.svelte-d9h7mp .nav-folder-title-content:where(.svelte-d9h7mp) {display:flex;align-items:center;}"};function vf(t,e){ot(e,!0),Ki(t,v9);let r=ki(e,"topLevel",3,!1),i=ki(e,"closed",15),n=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(l,c){l.stopPropagation(),i(i()[c.path]=!i()[c.path],!0)}var a=g9();let o;ui(a,21,()=>e.hierarchy.children,ci,(l,c)=>{var u=fs(),f=zr(u);{var d=m=>{var g=h9(),v=G(g);gf(v,{get diff(){return R(c).data},get view(){return e.view}}),H(g),oe(m,g)},h=m=>{var g=m9();let v;var w=G(g);w.__click=S=>s(S,R(c));var b=te(G(w),2);let k;var x=te(b,2),E=G(x,!0);H(x),H(w);var A=te(w,2);{var y=S=>{var _=p9(),T=G(_);vf(T,{get hierarchy(){return R(c)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return i()},set closed(P){i(P)}}),H(_),Zi(3,_,()=>Dn,()=>({duration:150})),oe(S,_)};Ae(A,S=>{i()[R(c).path]||S(y)})}H(g),Ne(()=>{v=ht(g,1,"tree-item nav-folder",null,v,{"is-collapsed":i()[R(c).path]}),be(w,"data-tooltip-position",R(n)),be(w,"aria-label",R(c).vaultPath),k=ht(b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,k,{"is-collapsed":i()[R(c).path]}),Ue(E,R(c).title)}),oe(m,g)};Ae(f,m=>{R(c).data?m(d):m(h,!1)})}oe(l,u)}),H(a),Ne(()=>o=ht(a,1,"svelte-d9h7mp",null,o,{topLevel:r()})),oe(t,a),lt()}kt(["click"]);var w9=ue('
'),y9=ue('
'),b9=ue('
'),_9=ue(''),x9=ue('
'),S9={hash:"svelte-1edsiy5",code:""};function yb(t,e){ot(e,!0),Ki(t,S9);let r=Et(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),i=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left"),n=De(!0),s=De(Xe({}));function a(S){let _=S.author.name;if(e.plugin.settings.authorInHistoryView=="full")return _;if(e.plugin.settings.authorInHistoryView=="initials")return _.split(" ").filter(P=>P.length>0).map(P=>P[0].toUpperCase()).join("")}var o=x9(),l=G(o);let c;var u=G(l);u.__click=()=>ae(n,!R(n));var f=G(u);let d;var h=te(f,2),m=G(h);{var g=S=>{var _=w9(),T=G(_,!0);H(_),Ne(P=>Ue(T,P),[()=>e.log.refs.join(", ")]),oe(S,_)};Ae(m,S=>{e.log.refs.length>0&&S(g)})}var v=te(m,2);{var w=S=>{var _=y9(),T=G(_,!0);H(_),Ne(P=>Ue(T,P),[()=>a(e.log)]),oe(S,_)};Ae(v,S=>{var _;e.plugin.settings.authorInHistoryView!="hide"&&((_=e.log.author)!=null&&_.name)&&S(w)})}var b=te(v,2);{var k=S=>{var _=b9(),T=G(_,!0);H(_),Ne(P=>Ue(T,P),[()=>(0,wb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),oe(S,_)};Ae(b,S=>{e.plugin.settings.dateInHistoryView&&S(k)})}var x=te(b,2),E=G(x,!0);H(x),H(h),H(u);var A=te(u,2);{var y=S=>{var _=_9(),T=G(_);{var P=B=>{vf(B,{get hierarchy(){return R(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return R(s)},set closed(N){ae(s,N,!0)}})},D=B=>{var N=fs(),ce=zr(N);ui(ce,17,()=>e.log.diff.files,ci,(Pe,ve)=>{gf(Pe,{get view(){return e.view},get diff(){return R(ve)}})}),oe(B,N)};Ae(T,B=>{e.showTree?B(P):B(D,!1)})}H(_),Zi(3,_,()=>Dn,()=>({duration:150})),oe(S,_)};Ae(A,S=>{R(n)||S(y)})}H(l),H(o),Ne(S=>{c=ht(l,1,"tree-item nav-folder",null,c,{"is-collapsed":R(n)}),be(u,"aria-label",S),be(u,"data-tooltip-position",R(i)),d=ht(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,{"is-collapsed":R(n)}),Ue(E,e.log.message)},[()=>{var S;return`${e.log.refs.length>0?e.log.refs.join(", ")+` +`:""}${(S=e.log.author)==null?void 0:S.name} +${(0,wb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} +${e.log.message}`}]),oe(t,o),lt()}kt(["click"]);var E9=ue(''),k9=ue('
'),A9={hash:"svelte-12n6twc",code:""};function _b(t,e){ot(e,!0),Ki(t,A9);let r=ki(e,"plugin",15),i=De(!1),n=Xe([]),s=De(void 0),a=De(Xe(r().settings.treeStructure)),o;or(()=>{o&&o.empty()}),fo(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)))}),or(()=>{n.forEach(x=>(0,bb.setIcon)(x,x.getAttr("data-icon")))}),fo(()=>{let x=new IntersectionObserver(A=>{A[0].isIntersecting&&!R(i)&&u().catch(console.error)}),E=document.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return ho(this,void 0,void 0,function*(){var x;if(!r().gitReady){ae(s,void 0);return}ae(i,!0);let E=r().gitManager instanceof Se,A;((x=R(s)===null||R(s)===void 0?void 0:R(s).length)!==null&&x!==void 0?x:0)==0?A=E?50:10:A=R(s).length,ae(s,yield r().gitManager.log(void 0,!1,A),!0),ae(i,!1)})}function u(){return ho(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(s)===void 0)return;ae(i,!0);let A=r().gitManager instanceof Se?50:10,y=yield r().gitManager.log(void 0,!1,A,(x=R(s).last())===null||x===void 0?void 0:x.hash);R(s).push(...y.slice(1)),ae(i,!1)})}var f=k9(),d=G(f),h=G(d),m=G(h);m.__click=()=>{ae(a,!R(a)),(0,bb.setIcon)(n[0],R(a)?"list":"folder"),r(r().settings.treeStructure=R(a),!0),r().saveSettings()},st(m,x=>n[0]=x,()=>n==null?void 0:n[0]);var g=te(m,2);let v;g.__click=l,st(g,x=>n[1]=x,()=>n==null?void 0:n[1]),H(h),H(d);var w=te(d,2),b=G(w);{var k=x=>{var E=E9();ui(E,21,()=>R(s),ci,(A,y)=>{yb(A,{get view(){return e.view},get showTree(){return R(a)},get log(){return R(y)},get plugin(){return r()}})}),H(E),oe(x,E)};Ae(b,x=>{R(s)&&x(k)})}Ya(4),H(w),H(f),Ne(()=>{be(m,"data-icon",R(a)?"list":"folder"),v=ht(g,1,"clickable-icon nav-action-button",null,v,{loading:R(i)})}),oe(t,f),lt()}kt(["click"]);var wf=class extends sD.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return gi.type}getDisplayText(){return gi.name}getIcon(){return gi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=ia(_b,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var aD=require("obsidian"),fm=class extends aD.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};p();var cD=require("obsidian");p();var go=require("obsidian");p();var yf=require("obsidian");p();var oD=require("obsidian");var fc=class extends oD.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${Su(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${Su(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${Su(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${Su(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};var T9=ue('
'),C9=ue('
');function bf(t,e){ot(e,!0);let r=Xe([]),i=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");or(()=>{for(let A of r)A&&(0,yf.setIcon)(A,A.getAttr("data-icon"))});function n(A){A.stopPropagation(),pl(e.change.path)?a(A):l(A)}function s(A){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&gl(e.view.app,A,e.view,e.change.vaultPath)}function a(A){var y;A.stopPropagation();let S=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);S instanceof yf.TFile&&((y=Mi(e.view.app,A))===null||y===void 0||y.openFile(S).catch(_=>e.view.plugin.displayError(_)))}function o(A){A.stopPropagation(),e.manager.stage(e.change.path,!1).catch(y=>e.view.plugin.displayError(y)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(A){A.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:A})}function c(A){A.stopPropagation();let y=e.change.workingDir=="U";new fc({app:e.view.app,filesToDeleteCount:y?1:0,filesToDiscardCount:y?0:1,path:e.change.vaultPath}).openAndGetResult().then(S=>ho(this,void 0,void 0,function*(){if(S=="delete"){let _=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);_ instanceof yf.TFile?yield e.view.app.fileManager.trashFile(_):yield e.view.app.vault.adapter.remove(e.change.vaultPath)}else S=="discard"&&(yield e.manager.discard(e.change.path).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")}));e.view.app.workspace.trigger("obsidian-git:refresh")}),S=>e.view.plugin.displayError(S))}var u=C9();u.__mouseover=s,u.__click=n;var f=G(u),d=G(f),h=G(d,!0);H(d);var m=te(d,2),g=G(m),v=G(g);{var w=A=>{var y=T9();y.__click=a,st(y,S=>r[0]=S,()=>r==null?void 0:r[0]),oi("auxclick",y,a),oe(A,y)};Ae(v,A=>{ml(e.change.vaultPath,e.view.app)&&A(w)})}var b=te(v,2);b.__click=c,st(b,A=>r[1]=A,()=>r==null?void 0:r[1]);var k=te(b,2);k.__click=o,st(k,A=>r[2]=A,()=>r==null?void 0:r[2]),H(g);var x=te(g,2),E=G(x,!0);H(x),H(m),H(f),H(u),Ne(A=>{be(f,"data-path",e.change.vaultPath),be(f,"data-tooltip-position",R(i)),be(f,"aria-label",e.change.vaultPath),Ue(h,A),be(x,"data-type",e.change.workingDir),Ue(E,e.change.workingDir)},[()=>pn(e.change.vaultPath)]),oi("auxclick",u,A=>{A.stopPropagation(),A.button==2?hn(e.view.app,A,e.change.vaultPath,e.view.leaf,"git-source-control"):n(A)}),oe(t,u),lt()}kt(["mouseover","click"]);p();var lD=require("obsidian");var P9=ue('
');function _f(t,e){ot(e,!0);let r=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function i(d){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&gl(e.view.app,d,e.view,e.change.vaultPath)}function n(d){var h;d.stopPropagation();let m=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);m instanceof lD.TFile&&((h=Mi(e.view.app,d))===null||h===void 0||h.openFile(m).catch(g=>e.view.plugin.displayError(g)))}var s=P9();s.__mouseover=i,s.__click=n;var a=G(s),o=G(a),l=G(o,!0);H(o);var c=te(o,2),u=G(c),f=G(u,!0);H(u),H(c),H(a),H(s),Ne(d=>{be(a,"data-path",e.change.vaultPath),be(a,"data-tooltip-position",R(r)),be(a,"aria-label",e.change.vaultPath),Ue(l,d),be(u,"data-type",e.change.workingDir),Ue(f,e.change.workingDir)},[()=>pn(e.change.vaultPath)]),oi("auxclick",s,d=>{d.stopPropagation(),d.button==2?hn(e.view.app,d,e.change.vaultPath,e.view.leaf,"git-source-control"):n(d)}),oe(t,s),lt()}kt(["mouseover","click"]);p();var dm=require("obsidian");var R9=ue('
'),$9=ue('
');function xf(t,e){ot(e,!0);let r=Xe([]),i=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");or(()=>{for(let x of r)x&&(0,dm.setIcon)(x,x.getAttr("data-icon"))});function n(x){x.stopPropagation(),pl(e.change.path)?a(x):o(x)}function s(x){e.view.app.vault.getFileByPath(e.change.vaultPath)&&gl(e.view.app,x,e.view,e.change.vaultPath)}function a(x){var E;x.stopPropagation();let A=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);A instanceof dm.TFile&&((E=Mi(e.view.app,x))===null||E===void 0||E.openFile(A).catch(y=>e.view.plugin.displayError(y)))}function o(x){var E;x.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(E=e.change.from)!==null&&E!==void 0?E:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:x})}function l(x){x.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(E=>e.view.plugin.displayError(E)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var c=$9();c.__mouseover=s,c.__click=n;var u=G(c),f=G(u),d=G(f,!0);H(f);var h=te(f,2),m=G(h),g=G(m);{var v=x=>{var E=R9();E.__click=a,st(E,A=>r[0]=A,()=>r==null?void 0:r[0]),oe(x,E)};Ae(g,x=>{ml(e.change.vaultPath,e.view.app)&&x(v)})}var w=te(g,2);w.__click=l,st(w,x=>r[1]=x,()=>r==null?void 0:r[1]),H(m);var b=te(m,2),k=G(b,!0);H(b),H(h),H(u),H(c),Ne(x=>{be(u,"data-path",e.change.vaultPath),be(u,"data-tooltip-position",R(i)),be(u,"aria-label",e.change.vaultPath),Ue(d,x),be(b,"data-type",e.change.index),Ue(k,e.change.index)},[()=>pn(e.change.vaultPath)]),oi("auxclick",c,x=>{x.stopPropagation(),x.button==2?hn(e.view.app,x,e.change.vaultPath,e.view.leaf,"git-source-control"):n(x)}),oe(t,c),lt()}kt(["mouseover","click"]);p();p();var I9=ue(''),F9=ue("
");function po(t,e){ot(e,!0);var r=F9(),i=G(r);{var n=s=>{var a=I9(),o=G(a),l=G(o),c=G(l,!0);H(l),H(o),H(a),Ne(()=>{be(o,"aria-label","And "+(e.files.length-500)+" more files"),Ue(c,"And "+(e.files.length-500)+" more files")}),oe(s,a)};Ae(i,s=>{e.files.length>500&&s(n)})}H(r),oe(t,r),lt()}var M9=ue("
"),D9=ue('
'),L9=ue('
',1),B9=ue(''),N9=ue('
'),H9=ue("
");function mo(t,e){ot(e,!0);let r=ki(e,"topLevel",3,!1),i=ki(e,"closed",15);fo(()=>{var h,m;for(let g of e.hierarchy.children)((m=(h=g.children)===null||h===void 0?void 0:h.length)!==null&&m!==void 0?m:0)>100&&i(i()[g.title]=!0,!0)});let n=Et(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(h,m){h.stopPropagation(),e.plugin.gitManager.stageAll({dir:m}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function a(h,m){h.stopPropagation(),e.plugin.gitManager.unstageAll({dir:m}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function o(h,m){h.stopPropagation(),e.plugin.discardAll(m.vaultPath)}function l(h,m){h.stopPropagation(),i(i()[m.path]=!i()[m.path],!0)}var c=H9();let u;var f=G(c);ui(f,17,()=>Eu(e.hierarchy.children,500),ci,(h,m)=>{var g=fs(),v=zr(g);{var w=k=>{var x=M9(),E=G(x);{var A=S=>{xf(S,{get change(){return R(m).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},y=S=>{var _=fs(),T=zr(_);{var P=B=>{bf(B,{get change(){return R(m).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},D=B=>{var N=fs(),ce=zr(N);{var Pe=ve=>{_f(ve,{get change(){return R(m).data},get view(){return e.view}})};Ae(ce,ve=>{e.fileType==2&&ve(Pe)},!0)}oe(B,N)};Ae(T,B=>{e.fileType==1?B(P):B(D,!1)},!0)}oe(S,_)};Ae(E,S=>{e.fileType==0?S(A):S(y,!1)})}H(x),oe(k,x)},b=k=>{var x=N9();x.__click=se=>l(se,R(m));let E;var A=G(x),y=te(G(A),2);let S;var _=te(y,2),T=G(_,!0);H(_);var P=te(_,2),D=G(P),B=G(D);{var N=se=>{var xe=D9();xe.__click=we=>a(we,R(m).path),oe(se,xe)},ce=se=>{var xe=L9(),we=zr(xe);we.__click=Q=>o(Q,R(m));var z=te(we,2);z.__click=Q=>s(Q,R(m).path),oe(se,xe)};Ae(B,se=>{e.fileType==0?se(N):se(ce,!1)})}Ya(2),H(D),H(P),H(A);var Pe=te(A,2);{var ve=se=>{var xe=B9(),we=G(xe);mo(we,{get hierarchy(){return R(m)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return i()},set closed(z){i(z)}}),H(xe),Zi(3,xe,()=>Dn,()=>({duration:150})),oe(se,xe)};Ae(Pe,se=>{i()[R(m).path]||se(ve)})}H(x),Ne(()=>{E=ht(x,1,"tree-item nav-folder",null,E,{"is-collapsed":i()[R(m).path]}),be(A,"data-tooltip-position",R(n)),be(A,"aria-label",R(m).vaultPath),S=ht(y,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,S,{"is-collapsed":i()[R(m).path]}),Ue(T,R(m).title)}),oi("auxclick",x,se=>hn(e.view.app,se,R(m).vaultPath,e.view.leaf,"git-source-control")),oe(k,x)};Ae(v,k=>{R(m).data?k(w):k(b,!1)})}oe(h,g)});var d=te(f,2);po(d,{get files(){return e.hierarchy.children}}),H(c),Ne(()=>u=ht(c,1,"",null,u,{topLevel:r()})),oe(t,c),lt()}kt(["click"]);var U9=ue('
'),G9=ue(" ",1),j9=ue(''),q9=ue(" ",1),z9=ue(''),V9=ue(" ",1),W9=ue(''),Y9=ue('
'),X9=ue(''),Z9=ue('
'),K9={hash:"svelte-5wq9p",code:`.commit-msg-input.svelte-5wq9p {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-5wq9p {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-5wq9p .git-tools:where(.svelte-5wq9p) .files-count:where(.svelte-5wq9p) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-5wq9p {align-items:center;}.git-commit-msg-clear-button.svelte-5wq9p {position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out;}.git-commit-msg-clear-button.svelte-5wq9p:after {content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat;}`};function xb(t,e){ot(e,!0),Ki(t,K9);let r=ki(e,"plugin",7),i=ki(e,"view",7),n=De(!1),s=De(void 0),a=De(Xe([])),o=Et(()=>r().settings.commitMessage),l=Xe([]),c=De(void 0),u=De(void 0),f=De(void 0),d=De(!0),h=De(!0),m=De(!0),g=De(0),v=De(Xe({})),w=De(Xe({})),b=De(Xe({})),k=Et(()=>r().settings.treeStructure);fo(()=>{console.log("Git view mounted"),i().registerEvent(i().app.workspace.on("obsidian-git:loading-status",()=>ae(n,!0))),i().registerEvent(i().app.workspace.on("obsidian-git:status-changed",()=>void A().catch(console.error))),i().plugin.cachedStatus==null?i().plugin.refresh().catch(console.error):A().catch(console.error),i().scope=new go.Scope(r().app.scope),i().scope.register(["Ctrl"],"Enter",Z=>E())}),or(()=>{l.forEach(Z=>(0,go.setIcon)(Z,Z.getAttr("data-icon")))}),or(()=>{l.forEach(Z=>{var L,V;!Z||Z.id!="push"||(go.Platform.isMobile?(Z.removeClass("button-border"),R(g)>0&&Z.addClass("button-border")):((L=Z.firstElementChild)===null||L===void 0||L.removeAttribute("color"),R(g)>0&&((V=Z.firstElementChild)===null||V===void 0||V.setAttr("color","var(--text-accent)"))))})});function x(){if(ae(n,!0),R(s)){let Z=R(s).staged.length>0;r().promiseQueue.addTask(()=>r().commit({fromAuto:!1,commitMessage:R(o),onlyStaged:Z}).then(()=>ae(o,r().settings.commitMessage)).finally(y))}}function E(){if(ae(n,!0),R(s)){let Z=R(s).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:R(o),onlyStaged:Z}).then(()=>{ae(o,r().settings.commitMessage)}).finally(y))}}function A(){return ho(this,void 0,void 0,function*(){if(!r().gitReady){ae(s,void 0);return}if(ae(g,yield r().gitManager.getUnpushedCommits(),!0),ae(s,r().cachedStatus,!0),ae(n,!1),r().lastPulledFiles&&r().lastPulledFiles!=R(a)&&(ae(a,r().lastPulledFiles,!0),ae(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a))},!0)),R(s)){let Z=(L,V)=>L.vaultPath.split("/").last().localeCompare(pn(V.vaultPath));R(s).changed.sort(Z),R(s).staged.sort(Z),ae(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(s).changed)},!0),ae(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(s).staged)},!0)}else ae(c,void 0),ae(u,void 0)})}function y(){i().app.workspace.trigger("obsidian-git:refresh")}function S(Z){Z.stopPropagation(),ae(n,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:R(s)}).finally(y))}function _(Z){Z.stopPropagation(),ae(n,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:R(s)}).finally(y))}function T(){ae(n,!0),r().promiseQueue.addTask(()=>r().push().finally(y))}function P(){ae(n,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(y))}function D(Z){Z.stopPropagation(),r().discardAll()}let B=Et(()=>(R(o).match(/\n/g)||[]).length+1||1);var N=Z9(),ce=G(N),Pe=G(ce),ve=G(Pe);ve.__click=E,st(ve,Z=>l[0]=Z,()=>l==null?void 0:l[0]);var se=te(ve,2);se.__click=x,st(se,Z=>l[1]=Z,()=>l==null?void 0:l[1]);var xe=te(se,2);xe.__click=S,st(xe,Z=>l[2]=Z,()=>l==null?void 0:l[2]);var we=te(xe,2);we.__click=_,st(we,Z=>l[3]=Z,()=>l==null?void 0:l[3]);var z=te(we,2);z.__click=T,st(z,Z=>l[4]=Z,()=>l==null?void 0:l[4]);var Q=te(z,2);Q.__click=P,st(Q,Z=>l[5]=Z,()=>l==null?void 0:l[5]);var j=te(Q,2);j.__click=()=>{ae(k,!R(k)),(0,go.setIcon)(l[6],R(k)?"list":"folder"),r().settings.treeStructure=R(k),r().saveSettings()},st(j,Z=>l[6]=Z,()=>l==null?void 0:l[6]);var Le=te(j,2);let lr;Le.__click=y,st(Le,Z=>l[7]=Z,()=>l==null?void 0:l[7]),H(Pe),H(ce);var Ft=te(ce,2),Ie=G(Ft);Zy(Ie);var At=te(Ie,2);{var Tt=Z=>{var L=U9();L.__click=()=>ae(o,""),be(L,"aria-label","Clear"),oe(Z,L)};Ae(At,Z=>{R(o)&&Z(Tt)})}H(Ft);var jt=te(Ft,2),Ze=G(jt);{var q=Z=>{var L=X9(),V=G(L);let Te;var qe=G(V);qe.__click=()=>ae(h,!R(h));var Ot=G(qe);let yo;var Tb=te(Ot,4),Em=G(Tb),Cb=G(Em);Cb.__click=_,st(Cb,cr=>l[8]=cr,()=>l==null?void 0:l[8]),H(Em);var Pb=te(Em,2),wD=G(Pb,!0);H(Pb),H(Tb),H(qe);var yD=te(qe,2);{var bD=cr=>{var yr=j9(),bo=G(yr);{var gs=ur=>{mo(ur,{get hierarchy(){return R(u)},get plugin(){return r()},get view(){return i()},get fileType(){return 0},topLevel:!0,get closed(){return R(v)},set closed(Ti){ae(v,Ti,!0)}})},_o=ur=>{var Ti=G9(),sa=zr(Ti);ui(sa,17,()=>Eu(R(s).staged,500),ci,(vs,hc)=>{xf(vs,{get change(){return R(hc)},get view(){return i()},get manager(){return r().gitManager}})});var aa=te(sa,2);po(aa,{get files(){return R(s).staged}}),oe(ur,Ti)};Ae(bo,ur=>{R(k)?ur(gs):ur(_o,!1)})}H(yr),Zi(3,yr,()=>Dn,()=>({duration:150})),oe(cr,yr)};Ae(yD,cr=>{R(h)&&cr(bD)})}H(V);var Ef=te(V,2);let Rb;var kf=G(Ef);kf.__click=()=>ae(d,!R(d));var $b=G(kf);let Ib;var Fb=te($b,4),km=G(Fb),Ob=G(km);Ob.__click=D;var Mb=te(Ob,2);Mb.__click=S,st(Mb,cr=>l[9]=cr,()=>l==null?void 0:l[9]),H(km);var Db=te(km,2),_D=G(Db,!0);H(Db),H(Fb),H(kf);var xD=te(kf,2);{var SD=cr=>{var yr=z9(),bo=G(yr);{var gs=ur=>{mo(ur,{get hierarchy(){return R(c)},get plugin(){return r()},get view(){return i()},get fileType(){return 1},topLevel:!0,get closed(){return R(w)},set closed(Ti){ae(w,Ti,!0)}})},_o=ur=>{var Ti=q9(),sa=zr(Ti);ui(sa,17,()=>Eu(R(s).changed,500),ci,(vs,hc)=>{bf(vs,{get change(){return R(hc)},get view(){return i()},get manager(){return r().gitManager}})});var aa=te(sa,2);po(aa,{get files(){return R(s).changed}}),oe(ur,Ti)};Ae(bo,ur=>{R(k)?ur(gs):ur(_o,!1)})}H(yr),Zi(3,yr,()=>Dn,()=>({duration:150})),oe(cr,yr)};Ae(xD,cr=>{R(d)&&cr(SD)})}H(Ef);var ED=te(Ef,2);{var kD=cr=>{var yr=Y9();let bo;var gs=G(yr);gs.__click=()=>ae(m,!R(m));var _o=te(G(gs),4),ur=G(_o,!0);H(_o),H(gs);var Ti=te(gs,2);{var sa=aa=>{var vs=W9(),hc=G(vs);{var AD=xo=>{mo(xo,{get hierarchy(){return R(f)},get plugin(){return r()},get view(){return i()},get fileType(){return 2},topLevel:!0,get closed(){return R(b)},set closed(Af){ae(b,Af,!0)}})},TD=xo=>{var Af=V9(),Lb=zr(Af);ui(Lb,17,()=>R(a),ci,(PD,RD)=>{_f(PD,{get change(){return R(RD)},get view(){return i()}})});var CD=te(Lb,2);po(CD,{get files(){return R(a)}}),oe(xo,Af)};Ae(hc,xo=>{R(k)?xo(AD):xo(TD,!1)})}H(vs),Zi(3,vs,()=>Dn,()=>({duration:150})),oe(aa,vs)};Ae(Ti,aa=>{R(m)&&aa(sa)})}H(yr),Ne(()=>{bo=ht(yr,1,"pulled nav-folder",null,bo,{"is-collapsed":!R(m)}),Ue(ur,R(a).length)}),oe(cr,yr)};Ae(ED,cr=>{R(a).length>0&&R(f)&&cr(kD)})}H(L),Ne(()=>{Te=ht(V,1,"staged tree-item nav-folder",null,Te,{"is-collapsed":!R(h)}),yo=ht(Ot,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,yo,{"is-collapsed":!R(h)}),Ue(wD,R(s).staged.length),Rb=ht(Ef,1,"changes tree-item nav-folder",null,Rb,{"is-collapsed":!R(d)}),Ib=ht($b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Ib,{"is-collapsed":!R(d)}),Ue(_D,R(s).changed.length)}),oe(Z,L)};Ae(Ze,Z=>{R(s)&&R(u)&&R(c)&&Z(q)})}H(jt),H(N),Ne(()=>{be(N,"data-type",zt.type),be(j,"data-icon",R(k)?"list":"folder"),lr=ht(Le,1,"clickable-icon nav-action-button",null,lr,{loading:R(n)}),be(Ie,"rows",R(B))}),db(Ie,()=>R(o),Z=>ae(o,Z)),oe(t,N),lt()}kt(["click"]);var Sf=class extends cD.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return zt.type}getDisplayText(){return zt.name}getIcon(){return zt.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=ia(xb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var hm=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(i=>{this.plugin.switchBranch().catch(n=>r.displayError(n))})}async display(){if(this.plugin.gitReady){let e=await this.plugin.gitManager.branchInfo();e.current!=null?this.statusBarEl.setText(e.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}remove(){this.statusBarEl.remove()}};p();var uD=require("obsidian");var pm=class{constructor(e){this.plugin=e}get editor(){var i;let e=(i=this.plugin.app.workspace.activeEditor)==null?void 0:i.editor,r=e==null?void 0:e.cm;if(!(!e||!Bi.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Bi.getHunk(r.state,!1,e);if(n){let s,a;n.type==="delete"?(s=n.added.start+1,a=n.added.start+1):(s=n.added.start-0,a=n.added.start-1+n.added.count);let o=r.state.doc.line(s).from,l=n.type==="delete"?r.state.doc.line(a).from:r.state.doc.line(a).to+1,c=n.removed.lines.join(` +`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=` +`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Bi.getHunk(r.state,!1,e),n=!1;if(i||(i=Bi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(uD.editorInfoField).file.path,a=Nt.createPatch(s,[i],"100644",n).join(` +`)+` +`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Bi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Nt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};p();p();var vo=require("obsidian");var mm=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 vo.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),WI(()=>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;iF(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new ep(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&&vo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(pF),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(),QI(),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 i;return e instanceof vo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof vo.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",tF)}};p();var dc=require("obsidian");p();p();var wo=require("@codemirror/state"),vm=require("@codemirror/view");var gm=class extends vm.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=document.createElement("div");return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},Sb=wo.StateField.define({create:()=>wo.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Ir,!1);if(!r)return wo.RangeSet.empty;let i=e.effects.some(s=>s.is(Uu)),n=e.effects.some(s=>s.is(Ol));if(i||n||(e.docChanged||t.size==0)&&r.isDirty==!1){let s=new Set,a=fD(e,r.hunks,!1,s),o=fD(e,r.stagedHunks,!0,s);return t=wo.RangeSet.of([...a,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function fD(t,e,r,i){let n=[];for(let a=0;a0?e[a-1]:void 0,l=a{var e;return(e=t.state.field(Sb,!1))!=null?e:wo.RangeSet.empty},initialSpacer:t=>new gm("delete",!1),domEventHandlers:{click:(t,e,r)=>{var n;return((n=Bi.getHunkAtPos(t.state,e.from,!1))!=null?n:Bi.getHunkAtPos(t.state,e.from,!0))&&(Ys(t,e.from),r.preventDefault()),!1}}});var wm=class{constructor(e){this.plugin=e}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeSigns(e.path)}}destroy(){}async computeSigns(e){let i=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:i,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Jn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyGitCompare(r)))}},hD=[AO,TO,dD,Sb,xp],pD=[Ir,uy];p();var Eb=require("obsidian"),ym=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;e.addClass("git-changes-status-bar"),r.settings.hunks.statusBar==="colored"&&e.addClass("git-changes-status-bar-colored"),e.setAttr("aria-label","Git diff of the current editor"),this.statusBarEl.setAttribute("data-tooltip-position","top"),r.app.workspace.on("active-leaf-change",i=>{(!i||i.getRoot()==r.app.workspace.rootSplit&&!(i.view instanceof Eb.MarkdownView))&&this.statusBarEl.empty()})}display(e,r){var o;let i=this.plugin.app.workspace.getActiveViewOfType(Eb.MarkdownView);if(!i||((o=i.file)==null?void 0:o.path)!==(r==null?void 0:r.path))return;let n=0,s=0,a=0;for(let l of e)n+=Math.max(0,l.added.count-l.removed.count),s+=Math.min(l.added.count,l.removed.count),a+=Math.max(0,l.removed.count-l.added.count);this.statusBarEl.empty(),n>0&&this.statusBarEl.createSpan({text:`+${n} `,cls:"git-add"}),s>0&&this.statusBarEl.createSpan({text:`~${s} `,cls:"git-change"}),a>0&&this.statusBarEl.createSpan({text:`-${a}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var bm=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.signsProvider){console.warn("Git: undefined signsProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof dc.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.signsProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions)}conditionallyActivateBySettings(){(this.plg.settings.hunks.showSigns||this.plg.settings.hunks.statusBar!="disabled"||this.plg.settings.hunks.hunkCommands)&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;if(this.signsProvider=new wm(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new ym(e,this.plg)}}catch(e){console.warn("Git: Error while loading signs feature.",e),this.deactivateFeature()}}deactivateFeature(){var e,r;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.signsProvider)==null||e.destroy(),this.signsProvider=void 0,(r=this.changeStatusBar)==null||r.remove(),this.changeStatusBar=void 0}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&dc.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Se?this.plg.gitManager:void 0}}refresh(){this.plg.settings.hunks.showSigns&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(pD),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...hD),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.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileRenameEvent=this.createFileRenameEvent(),this.pluginRefreshedEvent=this.createPluginRefreshedEvent(),this.intervalRefreshEvent=this.createIntervalRefreshEvent(),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileRenameEvent),this.plg.registerEvent(this.pluginRefreshedEvent),this.plg.registerInterval(this.intervalRefreshEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.pluginRefreshedEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent),window.clearInterval(this.intervalRefreshEvent)}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return Jn.ifFilepathDefinedTransformSubscribers(r,n=>n.forEach(s=>{s.changeToNewFilepath(e.path)})),e instanceof dc.TFile&&((i=this.signsProvider)==null?void 0:i.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refresh",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,r;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((r=this.signsProvider)==null||r.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};p();var mD=require("@codemirror/state"),_m=require("obsidian");var kb=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let i=this.view.state,n=VI(e,r,i);this.view.dispatch(n)}notifyGitCompare(e){if(this.view===void 0){console.warn("Git: View is not defined for editor cache key. Unforeseen situation. id: ");return}if(this.removeIfStale())return;let r=this.view.state,i=r.field(Ir);if(!i||i.compareText!=e.compareText||i.compareTextHead!=e.compareTextHead){let n=sO(e,r);this.view.dispatch(n)}}updateToNewState(e){return this.state=e,!this.lastSeenPath&&this.filepath&&this.subscribeMe(),this}removeIfStale(){var e;return((e=this.view)==null?void 0:e.state.field(Ab,!1))!=this||this.view.destroyed?(this.unsubscribeMe(this.lastSeenPath),!0):!1}changeToNewFilepath(e){this.unsubscribeMe(this.lastSeenPath),this.subscribeMe(e)}subscribeMe(e){e!=null||(e=this.filepath),e!==void 0&&(Jn.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Jn.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(_m.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(_m.editorEditorField)}},Ab=mD.StateField.define({create:t=>new kb(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var xm=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new mm(this.plg);this.signsFeature=new bm(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature()}onLoadPlugin(){this.plg.registerEditorExtension(Ab),this.lineAuthoringFeature.onLoadPlugin(),this.signsFeature.onLoadPlugin()}onReady(){this.lineAuthoringFeature.conditionallyActivateBySettings(),this.signsFeature.conditionallyActivateBySettings()}activateLineAuthoring(){this.lineAuthoringFeature.activateFeature()}deactiveLineAuthoring(){this.lineAuthoringFeature.deactivateFeature()}refreshSignsSettings(){let e=this.plg.settings.hunks;e.showSigns||e.statusBar!="disabled"||e.hunkCommands?(this.signsFeature.deactivateFeature(),this.signsFeature.activateFeature()):this.signsFeature.deactivateFeature()}};var Sm=class extends _e.Plugin{constructor(){super(...arguments);this.automaticsManager=new Du(this);this.tools=new Yu(this);this.localStorage=new Sp(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Dd(this);this.intervalsToClear=[];this.editorIntegration=new xm(this);this.hunkActions=new pm(this)}setPluginState(r){var i;this.state=Object.assign(this.state,r),(i=this.statusBar)==null||i.display()}async updateCachedStatus(){var r,i;return this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((r=this.branchBar)==null?void 0:r.display())):(this.localStorage.setConflict(!1),await((i=this.branchBar)==null?void 0:i.display())),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}async refresh(){if(!this.gitReady)return;let r=this.app.workspace.getLeavesOfType(zt.type),i=this.app.workspace.getLeavesOfType(gi.type);(this.settings.changedFilesInStatusBar||r.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)})||i.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)}))&&await this.updateCachedStatus().catch(n=>this.displayError(n)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Fi.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new tp(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(r=>this.displayError(r))))}onExternalSettingsChange(){this.reloadSettings().catch(r=>this.displayError(r))}async reloadSettings(){let r=JSON.stringify(this.settings);await this.loadSettings();let i=JSON.stringify(this.settings);r!==i&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(zt.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}),this.app.workspace.getLeavesOfType(gi.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(r=>this.displayError(r))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{this.onActiveLeafChange(r)})),this.registerEvent(this.app.vault.on("modify",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerView(zt.type,r=>new Sf(r,this)),this.registerView(gi.type,r=>new wf(r,this)),this.registerView(Bs.type,r=>new qa(r,this)),this.registerView(Ls.type,r=>new za(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var n;let r=this.app.workspace.getLeavesOfType(zt.type),i;r.length===0?(i=(n=this.app.workspace.getRightLeaf(!1))!=null?n:this.app.workspace.getLeaf(),await i.setViewState({type:zt.type})):i=r.first(),await this.app.workspace.revealLeaf(i)}),this.registerHoverLinkSource(zt.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),CO(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,_e.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,i){let n=this.gitManager.getRelativeRepoPath(r,!0),s=qP({isFolder:i,gitRelativePath:n});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof _e.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof _e.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof _e.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof _e.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof _e.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(vD.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=XA(rt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return _e.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new rp(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Se(this),await this.gitManager.setGitInstance()):this.gitManager=new Di(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new _e.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}),_e.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new hm(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new _e.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new _e.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new Qe(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new Qe(this,{options:this.gitManager instanceof Di?[n]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof Di}).openAndGetResult();if(s==null)return;if(s===n&&(s="."),s=(0,_e.normalizePath)(s),s==="/"&&(s="."),s==="."){let f=await new Qe(this,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(f===void 0){new _e.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new Qe(this,{options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new _e.Notice("Aborted clone");return}}}let a=await new Qe(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(a===void 0){new _e.Notice("Aborted clone");return}if(a!==""&&(o=parseInt(a),isNaN(o))){new _e.Notice("Invalid depth. Aborting clone.");return}new _e.Notice(`Cloning new repo into "${s}"`);let l=this.settings.basePath,c=s&&s!==".";c&&(this.settings.basePath=s);try{await this.gitManager.clone(qw(i),s,o),new _e.Notice("Cloned new repo."),new _e.Notice("Please restart Obsidian"),c&&await this.saveSettings()}catch(u){this.displayError(u),this.settings.basePath=l,await this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init({fromReload:!0}),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let r=await this.pull();if(r!==!1){if(r||this.displayMessage("Pull: Everything is up-to-date"),this.gitManager instanceof Se){let i=await this.updateCachedStatus();i.conflicted.length>0&&(this.displayError(`You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:i=!1,commitMessage:n,onlyStaged:s=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:i,commitMessage:n,onlyStaged:s}))||(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?await this.push():this.displayMessage("No commits to push")),this.setPluginState({gitAction:0}))}async commit({fromAuto:r,requestCustomMessage:i=!1,onlyStaged:n=!1,commitMessage:s,amend:a=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c=[],u=[];if(this.gitManager instanceof Se){if(await this.mayDeleteConflictFile(),l=await this.updateCachedStatus(),l.conflicted.length==0&&(o=!1),r&&l.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${l.conflicted.length} ${l.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(l.conflicted),!1;c=l.staged,u=l.changed}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;{o&&await this.mayDeleteConflictFile();let f=this.gitManager;n?c=await f.getStagedFiles():u=(await f.getUnstagedFiles()).map(({path:h,type:m})=>({vaultPath:this.gitManager.getRelativeVaultPath(h),path:h,type:m}))}}if(await this.tools.hasTooBigFiles(n?c:[...c,...u]))return this.setPluginState({gitAction:0}),!1;if(u.length+c.length!==0||o){let f=s!=null?s:s=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||i){!this.settings.disablePopups&&r&&new _e.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let m=await new ip(this).openAndGetResult();if(m!=null&&m!=""&&m!="...")f=m;else return this.setPluginState({gitAction:0}),!1}else if(this.gitManager instanceof Se&&this.settings.commitMessageScript){let m=this.settings.commitMessageScript,g=this.localStorage.getHostname()||"",v=m.replace("{{hostname}}",g);v=v.replace("{{date}}",(0,_e.moment)().format(this.settings.commitDateFormat));let w=await ku("sh",["-c",v],{cwd:this.gitManager.absoluteRepoPath});w.code!=0?this.displayError(w.stderr):w.stdout.trim().length==0?this.displayMessage("Stdout from commit message script is empty. Using default message."):f=w.stdout}if(!f||f.trim()==="")return new _e.Notice("Commit aborted: No commit message provided"),this.setPluginState({gitAction:0}),!1;let d;n?d=await this.gitManager.commit({message:f,amend:a}):d=await this.gitManager.commitAll({message:f,status:l,unstagedFiles:u,amend:a}),this.gitManager instanceof Se&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=u.length+c.length||0),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(o){return this.displayError(o),!1}}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let r=this.localStorage.getConflict();try{this.gitManager instanceof Se&&await this.mayDeleteConflictFile();let i;if(this.gitManager instanceof Se&&(i=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted),!1;if(this.gitManager instanceof Di&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let n=await this.gitManager.push();return n!==void 0&&(n===null?this.displayMessage("Pushed to remote"):n>0?this.displayMessage(`Pushed ${n} ${n==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(i){return i instanceof cl?this.handleNoNetworkError(i):this.displayError(i),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let r=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),r.length>0&&(this.displayMessage(`Pulled ${r.length} ${r.length==1?"file":"files"} from remote`),this.lastPulledFiles=r),r.length}catch(r){return this.displayError(r),!1}}async fetch(){if(await this.remotesAreSet())try{await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh")}catch(r){this.displayError(r)}}async mayDeleteConflictFile(){let r=this.app.vault.getAbstractFileByPath(al);r&&(this.app.workspace.iterateAllLeaves(i=>{var n;i.view instanceof _e.MarkdownView&&((n=i.view.file)==null?void 0:n.path)==r.path&&i.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(r){return await this.isAllInitialized()?(await this.gitManager.unstage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),i=await new fm(this,r.branches).openAndGetReslt();if(i!=null)return await this.gitManager.checkout(i),this.displayMessage(`Switched to ${i}`),this.app.workspace.trigger("obsidian-git:refresh"),await((n=this.branchBar)==null?void 0:n.display()),i}async switchRemoteBranch(){var s;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[i,n]=Zn(r);if(n!=null&&i!=null)return await this.gitManager.checkout(n,i),this.displayMessage(`Switched to ${r}`),await((s=this.branchBar)==null?void 0:s.display()),r}async createBranch(){var i;if(!await this.isAllInitialized())return;let r=await new Qe(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async deleteBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let i=await new Qe(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(i!=null){let s=!1;if(!await this.gitManager.branchIsMerged(i)){let o=await new Qe(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;s=o==="YES"}return await this.gitManager.deleteBranch(i,s),this.displayMessage(`Deleted branch ${i}`),await((n=this.branchBar)==null?void 0:n.display()),i}}async remotesAreSet(){return this.settings.updateSubmodules||this.gitManager instanceof Se&&await this.gitManager.getConfig("push.autoSetupRemote","all")=="true"||(await this.gitManager.branchInfo()).tracking?!0:(new _e.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let r=await this.selectRemoteBranch();return r==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(r),this.displayMessage(`Set upstream branch to ${r}`),this.setPluginState({gitAction:0}),!0)}async discardAll(r){if(!await this.isAllInitialized())return!1;let i=await this.gitManager.status({path:r}),n=0,s=0;for(let o of i.changed)o.workingDir=="U"?n++:s++;if(n+s==0)return!1;let a=await new fc({app:this.app,filesToDeleteCount:n,filesToDiscardCount:s,path:r!=null?r:""}).openAndGetResult();switch(a){case!1:return a;case"discard":await this.gitManager.discardAll({dir:r,status:this.cachedStatus});break;case"delete":{await this.gitManager.discardAll({dir:r,status:this.cachedStatus});let o=await this.gitManager.getUntrackedPaths({path:r,status:this.cachedStatus});for(let l of o){let c=this.gitManager.getRelativeVaultPath(l),u=this.app.vault.getAbstractFileByPath(c);u?await this.app.fileManager.trashFile(u):l.endsWith("/")?await this.app.vault.adapter.rmdir(c,!0):await this.app.vault.adapter.remove(c)}break}default:wh(a)}return this.app.workspace.trigger("obsidian-git:refresh"),a}async handleConflict(r){this.localStorage.setConflict(!0);let i;r!==void 0&&(i=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...r.map(n=>{let s=this.app.vault.getAbstractFileByPath(n);return s instanceof _e.TFile?`- [[${this.app.metadataCache.fileToLinktext(s,"/")}]]`:`- Not a file: ${n}`}),` +# 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(i==null?void 0:i.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new Qe(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new Qe(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,qw(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new Qe(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new Qe(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new Qe(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof qa||i instanceof za))return;let n=this.app.workspace.getLeavesOfType(zt.type).first(),s=this.app.workspace.getLeavesOfType(gi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof qa||(r==null?void 0:r.view)instanceof za){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new _e.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof gD.Errors.UserCanceledError){new _e.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new _e.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) + +crc-32/crc32.js: + (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) + +isomorphic-git/index.cjs: + (*! + * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements. + * SPDX-License-Identifier: LGPL-3.0-or-later + * Copyright (c) James Prevett and other ZenFS contributors. + *) + +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 */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json new file mode 100644 index 0000000..fe238e5 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -0,0 +1,10 @@ +{ + "author": "Vinzent", + "authorUrl": "https://github.com/Vinzent03", + "id": "obsidian-git", + "name": "Git", + "description": "Integrate Git version control with automatic backup and other advanced features.", + "isDesktopOnly": false, + "fundingUrl": "https://ko-fi.com/vinzent", + "version": "2.37.1" +} diff --git a/.obsidian/plugins/obsidian-git/obsidian_askpass.sh b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh new file mode 100644 index 0000000..2e5eb5d --- /dev/null +++ b/.obsidian/plugins/obsidian-git/obsidian_askpass.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +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" diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css new file mode 100644 index 0000000..92c8af8 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -0,0 +1,705 @@ +@keyframes loading { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.git-signs-gutter { + .cm-gutterElement { + /* Needed to align the sign properly for different line heigts. Such as + * when having a heading or list item. + */ + padding-top: 0 !important; + } +} + +.workspace-leaf-content[data-type="git-view"] .button-border { + border: 2px solid var(--interactive-accent); + border-radius: var(--radius-s); +} + +.workspace-leaf-content[data-type="git-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.loading { + overflow: hidden; +} + +.loading > svg { + animation: 2s linear infinite loading; + transform-origin: 50% 50%; + display: inline-block; +} + +.obsidian-git-center { + margin: auto; + text-align: center; + width: 50%; +} + +.obsidian-git-textarea { + display: block; + margin-left: auto; + margin-right: auto; +} + +.obsidian-git-disabled { + opacity: 0.5; +} + +.obsidian-git-center-button { + display: block; + margin: 20px auto; +} + +.tooltip.mod-left { + overflow-wrap: break-word; +} + +.tooltip.mod-right { + overflow-wrap: break-word; +} + +/* Limits the scrollbar to the view body */ +.git-view { + display: flex; + flex-direction: column; + position: relative; + height: 100%; +} + +.git-tools { + display: flex; + margin-left: auto; +} +.git-tools .type { + padding-left: var(--size-2-1); + display: flex; + align-items: center; + justify-content: center; + width: 11px; +} + +.git-tools .type[data-type="M"] { + color: orange; +} +.git-tools .type[data-type="D"] { + color: red; +} +.git-tools .buttons { + display: flex; +} +.git-tools .buttons > * { + padding: 0 0; + height: auto; +} + +.workspace-leaf-content[data-type="git-view"] .tree-item-self, +.workspace-leaf-content[data-type="git-history-view"] .tree-item-self { + align-items: center; +} + +.workspace-leaf-content[data-type="git-view"] + .tree-item-self:hover + .clickable-icon, +.workspace-leaf-content[data-type="git-history-view"] + .tree-item-self:hover + .clickable-icon { + color: var(--icon-color-hover); +} + +/* Highlight an item as active if it's diff is currently opened */ +.is-active .git-tools .buttons > * { + color: var(--nav-item-color-active); +} + +.git-author { + color: var(--text-accent); +} + +.git-date { + color: var(--text-accent); +} + +.git-ref { + color: var(--text-accent); +} + +/* ====== diff2html ====== +The following styles are adapted from the obsidian-version-history plugin by +@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss +which itself is adapted from the diff2html library with the following original license: + + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +.theme-dark, +.theme-light { + --git-delete-bg: #ff475040; + --git-delete-hl: #96050a75; + --git-insert-bg: #68d36840; + --git-insert-hl: #23c02350; + --git-change-bg: #ffd55840; + --git-selected: #3572b0; + + --git-delete: #c33; + --git-insert: #399839; + --git-change: #d0b44c; + --git-move: #3572b0; +} + +.git-diff { + .d2h-d-none { + display: none; + } + .d2h-wrapper { + text-align: left; + border-radius: 0.25em; + overflow: auto; + } + .d2h-file-header.d2h-file-header { + background-color: var(--background-secondary); + border-bottom: 1px solid var(--background-modifier-border); + font-family: + Source Sans Pro, + Helvetica Neue, + Helvetica, + Arial, + sans-serif; + height: 35px; + padding: 5px 10px; + } + .d2h-file-header, + .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + } + .d2h-file-header { + display: none; + } + .d2h-file-stats { + font-size: 14px; + margin-left: auto; + } + .d2h-lines-added { + border: 1px solid var(--color-green); + border-radius: 5px 0 0 5px; + color: var(--color-green); + padding: 2px; + text-align: right; + vertical-align: middle; + } + .d2h-lines-deleted { + border: 1px solid var(--color-red); + border-radius: 0 5px 5px 0; + color: var(--color-red); + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; + } + .d2h-file-name-wrapper { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 15px; + width: 100%; + } + .d2h-file-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--text-normal); + font-size: var(--h5-size); + } + .d2h-file-wrapper { + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + margin-bottom: 1em; + max-height: 100%; + } + .d2h-file-collapse { + -webkit-box-pack: end; + -ms-flex-pack: end; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; + } + .d2h-file-collapse.d2h-selected { + background-color: var(--git-selected); + } + .d2h-file-collapse-input { + margin: 0 4px 0 0; + } + .d2h-diff-table { + border-collapse: collapse; + font-family: var(--font-monospace); + font-size: var(--code-size); + width: 100%; + } + .d2h-files-diff { + width: 100%; + } + .d2h-file-diff { + /* + overflow-y: scroll; + */ + border-radius: 5px; + font-size: var(--font-text-size); + line-height: var(--line-height-normal); + } + .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; + } + .d2h-code-line { + padding-left: 6em; + padding-right: 1.5em; + } + .d2h-code-line, + .d2h-code-side-line { + display: inline-block; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + width: 100%; + } + .d2h-code-side-line { + /* needed to be changed */ + padding-left: 0.5em; + padding-right: 0.5em; + } + .d2h-code-line-ctn { + word-wrap: normal; + background: none; + display: inline-block; + padding: 0; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + vertical-align: middle; + width: 100%; + /* only works for line-by-line */ + white-space: pre-wrap; + } + .d2h-code-line del, + .d2h-code-side-line del { + background-color: var(--git-delete-hl); + color: var(--text-normal); + } + .d2h-code-line del, + .d2h-code-line ins, + .d2h-code-side-line del, + .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; + } + .d2h-code-line ins, + .d2h-code-side-line ins { + background-color: var(--git-insert-hl); + text-align: left; + } + .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; + } + .line-num1 { + float: left; + } + .line-num1, + .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* + padding: 0 0.5em; + */ + text-overflow: ellipsis; + width: 2.5em; + padding-left: 0; + } + .line-num2 { + float: right; + } + .d2h-code-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 5.5em; + } + .d2h-code-linenumber:after { + content: "\200b"; + } + .d2h-code-side-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + overflow: hidden; + padding: 0 0.5em; + text-align: right; + text-overflow: ellipsis; + width: 4em; + /* needed to be changed */ + display: table-cell; + position: relative; + } + .d2h-code-side-linenumber:after { + content: "\200b"; + } + .d2h-code-side-emptyplaceholder, + .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + } + .d2h-code-line-prefix, + .d2h-code-linenumber, + .d2h-code-side-linenumber, + .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + .d2h-code-linenumber, + .d2h-code-side-linenumber { + direction: rtl; + } + .d2h-del { + background-color: var(--git-delete-bg); + border-color: var(--git-delete-hl); + } + .d2h-ins { + background-color: var(--git-insert-bg); + border-color: var(--git-insert-hl); + } + .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-faint); + } + .d2h-del, + .d2h-ins, + .d2h-file-diff .d2h-change { + color: var(--text-normal); + } + .d2h-file-diff .d2h-del.d2h-change { + background-color: var(--git-change-bg); + } + .d2h-file-diff .d2h-ins.d2h-change { + background-color: var(--git-insert-bg); + } + .d2h-file-list-wrapper { + a { + text-decoration: none; + cursor: default; + -webkit-user-drag: none; + } + + svg { + display: none; + } + } + .d2h-file-list-header { + text-align: left; + } + .d2h-file-list-title { + display: none; + } + .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; + } + .d2h-file-list { + } + .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; + } + .d2h-file-list > li:last-child { + border-bottom: none; + } + .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; + } + .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; + } + .d2h-deleted { + color: var(--git-delete); + } + .d2h-added { + color: var(--git-insert); + } + .d2h-changed { + color: var(--git-change); + } + .d2h-moved { + color: var(--git-move); + } + .d2h-tag { + background-color: var(--background-secondary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; + } + .d2h-deleted-tag { + border: 1px solid var(--git-delete); + } + .d2h-added-tag { + border: 1px solid var(--git-insert); + } + .d2h-changed-tag { + border: 1px solid var(--git-change); + } + .d2h-moved-tag { + border: 1px solid var(--git-move); + } + + /* needed for line-by-line*/ + + .d2h-diff-tbody { + position: relative; + } +} + +/* ====================== Line Authoring Information ====================== */ + +.cm-gutterElement.obs-git-blame-gutter { + /* Add background color to spacing inbetween and around the gutter for better aesthetics */ + border-width: 0px 2px 0.2px 2px; + border-style: solid; + border-color: var(--background-secondary); + background-color: var(--background-secondary); +} + +.cm-gutterElement.obs-git-blame-gutter > div, +.line-author-settings-preview { + /* delegate text color to settings */ + color: var(--obs-git-gutter-text); + font-family: monospace; + height: 100%; /* ensure, that age-based background color occupies entire parent */ + text-align: right; + padding: 0px 6px 0px 6px; + white-space: pre; /* Keep spaces and do not collapse them. */ +} + +@media (max-width: 800px) { + /* hide git blame gutter not to superpose text */ + .cm-gutterElement.obs-git-blame-gutter { + display: none; + } +} + +.git-unified-diff-view, +.git-split-diff-view .cm-deletedLine .cm-changedText { + background-color: #ee443330; +} + +.git-unified-diff-view, +.git-split-diff-view .cm-insertedLine .cm-changedText { + background-color: #22bb2230; +} + +.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +/* Override styling of Codemirror merge view "collapsed lines" indicator */ +.git-split-diff-view .ͼ2 .cm-collapsedLines { + background: var(--interactive-normal); + border-radius: var(--radius-m); + color: var(--text-accent); + font-size: var(--font-small); + padding: var(--size-4-1) var(--size-4-1); +} +.git-split-diff-view .ͼ2 .cm-collapsedLines:hover { + background: var(--interactive-hover); + color: var(--text-accent-hover); +} + +.git-signs-gutter { + .cm-gutterElement { + display: grid; + } +} + +.git-gutter-marker:hover { + border-radius: 2px; +} + +.git-gutter-marker.git-add { + background-color: var(--color-green); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-change { + background-color: var(--color-yellow); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-changedelete { + color: var(--color-yellow); + font-weight: var(--font-bold); + font-size: 1rem; + justify-self: center; + height: inherit; +} + +.git-gutter-marker.git-delete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: end; +} + +.git-gutter-marker.git-topdelete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: start; +} + +div:hover > .git-gutter-marker.git-change { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-add { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-delete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-topdelete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-changedelete { + font-weight: var(--font-bold); +} + +.git-gutter-marker.staged { + opacity: 0.5; +} + +.git-diff { + .cm-merge-revert { + width: 4em; + } + /* Ensure that merge revert markers are positioned correctly */ + .cm-merge-revert > * { + position: absolute; + background-color: var(--background-secondary); + display: flex; + } +} + +/* Prevent shifting of the editor when git signs gutter is the only gutter present */ +.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) { + margin-inline-end: 0; + .git-signs-gutter { + margin-inline-start: -1rem; + } +} + +.git-changes-status-bar-colored { + .git-add { + color: var(--color-green); + } + .git-change { + color: var(--color-yellow); + } + .git-delete { + color: var(--color-red); + } +} + +.git-changes-status-bar .git-add { + margin-right: 0.3em; +} + +.git-changes-status-bar .git-change { + margin-right: 0.3em; +} diff --git a/Home Assistant/Automations.md b/Home Assistant/Automations.md new file mode 100644 index 0000000..f13490c --- /dev/null +++ b/Home Assistant/Automations.md @@ -0,0 +1,140 @@ +--- +title: Home Assistant Automations +category: Home Assistant +status: active +total_automations: 41 +active_count: 24 +disabled_count: 10 +unavailable_count: 7 +date_generated: 2026-02-23 +tags: + - home-assistant + - HA + - reference +--- + +# Home Assistant Automations + +**Generated:** 2026-02-23 18:05 +**Total:** 41 automations +**Active:** 24 | **Disabled:** 10 | **Unavailable:** 7 + +--- + +## Active Automations (On) + +- **Pantry On/Off** + - La4st Changed: 2026-02-20T16:03:33.636268+00:00 +- **Sink Light On/Off** + - Last Changed: 2026-02-20T16:03:33.636439+00:00 +- **Dining Off Auto** + - Last Changed: 2026-02-20T16:03:33.636664+00:00 +- **Master Bath Heater** + - Last Changed: 2026-02-20T16:03:33.636771+00:00 +- **Office closet light** + - Last Changed: 2026-02-20T16:03:33.637065+00:00 +- **Master Closet Lights** + - Last Changed: 2026-02-20T16:03:33.637169+00:00 +- **Master Hallway Lights** + - Last Changed: 2026-02-20T16:03:33.637272+00:00 +- **Master Hallway Lights Dim** + - Last Changed: 2026-02-20T16:03:33.637375+00:00 +- **Master Lamp On/Off** + - Last Changed: 2026-02-20T16:03:33.637727+00:00 +- **TV Backlight Off** + - Last Changed: 2026-02-20T16:03:33.637825+00:00 +- **Master Bath Vent On Humidity Heater Help** + - Last Changed: 2026-02-20T16:03:33.638119+00:00 +- **Garage Entrance Light** + - Last Changed: 2026-02-20T16:03:33.638221+00:00 +- **Master Pooper Light** + - Last Changed: 2026-02-20T16:03:33.638317+00:00 +- **Bay Windows** + - Last Changed: 2026-02-20T16:03:33.638424+00:00 +- **Counter Top LED** + - Last Changed: 2026-02-20T16:03:33.638525+00:00 +- **Master Bath Strip** + - Last Changed: 2026-02-20T16:03:33.638623+00:00 +- **Master Bath Heater Button** + - Last Changed: 2026-02-20T16:03:33.638727+00:00 +- **Master Shower Vent Switch** + - Last Changed: 2026-02-20T16:03:33.638830+00:00 +- **Living Room Bedtime** + - Last Changed: 2026-02-20T16:03:33.638932+00:00 +- **Living Room Lamps Presence Activation** + - Last Changed: 2026-02-20T16:03:33.639029+00:00 +- **Cameras to LR Roku** + - Last Changed: 2026-02-20T16:03:33.639954+00:00 +- **Kathy Low Sugar** + - Last Changed: 2026-02-20T16:03:33.640163+00:00 +- **Living Room Frigate Notify** + - Last Changed: 2026-02-20T16:03:33.640256+00:00 +- **Air purifier always on** + - Last Changed: 2026-02-20T16:03:33.640350+00:00 + +--- + +## Disabled Automations (Off) + +- **TV Off** +- **Alexa Living Room Check** +- **Master Shower Vent On Humidity** +- **Reminder** +- **AI Camera Event Summary** +- **AI Camera Events Kitchen** +- **AI Camera Events Living Room** +- **AI Camera Event Front Yard** +- **AI Camera Events Back Yard** +- **Notification of camera events** + +--- + +## Unavailable Automations (Broken) + +These automations may have missing entities or configuration issues. + +- **Drying Complete Notification** +- **Pantry Reminder** +- **Frigate person count Main Ceiling on/off** +- **Driveway Occupancy** +- **SMARTi Update Power Measurement Device List** +- **SMARTi Restore Power Settings** +- **SMARTi Save Power Settings Before Shutdown** + +--- + +## Automation Categories + +### Lighting +- Sink Light On/Off +- Office closet light +- Master Closet Lights +- Master Hallway Lights +- Master Hallway Lights Dim +- Master Lamp On/Off +- TV Backlight Off +- Garage Entrance Light +- Master Pooper Light +- Bay Windows +- Counter Top LED +- Master Bath Strip +- Living Room Lamps Presence Activation + +### Climate / Ventilation +- Master Bath Heater +- Master Bath Vent On Humidity Heater Help +- Master Bath Heater Button +- Master Shower Vent Switch +- Air purifier always on + +### Security / Cameras +- Cameras to LR Roku +- Living Room Frigate Notify + +### Notifications / Reminders +- Kathy Low Sugar +- Living Room Frigate Notify + +--- + +*Last Updated: 2026-02-23 18:05* diff --git a/OpenClaw/Dataview Query Examples.md b/OpenClaw/Dataview Query Examples.md new file mode 100644 index 0000000..5a2461e --- /dev/null +++ b/OpenClaw/Dataview Query Examples.md @@ -0,0 +1,209 @@ +--- +title: Dataview Query Examples +category: Reference +date: 2026-02-23 +tags: [dataview, queries, obsidian, examples] +--- + +# Dataview Query Examples + +**Plugin:** [Obsidian Dataview](https://github.com/blacksmithgu/obsidian-dataview) +**Your Vault Location:** `C:\Users\admin\Documents\Corey` + +--- + +## 📊 Summary Statistics + +### All Files in Vault +```dataview +TABLE file.mtime AS "Modified", file.size AS "Size" +FROM "" +SORT file.mtime DESC +LIMIT 20 +``` + +### Files by Category +```dataview +TABLE rows.file.name +FROM "" +WHERE category +GROUP BY category +``` + +--- + +## 🏠 Home Assistant Queries + +### Show Home Assistant Notes +```dataview +TABLE status, total_automations AS "Total", active_count AS "Active", unavailable_count AS "Broken" +FROM "Home Assistant" +SORT file.name +``` + +### Recent HA Updates +```dataview +LIST +FROM "Home Assistant" +WHERE date_generated +SORT date_generated DESC +``` + +--- + +## 📁 Projects Dashboard + +### Active Projects Only +```dataview +LIST +FROM "Projects" +WHERE contains(file.content, "Status: Active") +SORT file.name +``` + +### All Projects with Status +```dataview +TABLE status, type, last_updated +FROM "Projects" +WHERE status +SORT status DESC, file.name +``` + +--- + +## 📝 Research Summaries + +### Recent Summaries +```dataview +TABLE date, source_url +FROM "Summaries" +WHERE date +SORT date DESC +LIMIT 10 +``` + +### Summaries by Tag +```dataview +TABLE date, source_url +FROM #security OR #ai OR #infrastructure +WHERE date +SORT date DESC +``` + +### By Source Type +```dataview +TABLE date, type, tags +FROM "Summaries" +WHERE type +SORT type, date DESC +``` + +--- + +## 🤖 OpenClaw Configuration + +### OpenClaw Notes +```dataview +TABLE category, status, date +FROM "OpenClaw" +SORT date DESC +``` + +--- + +## 📅 Daily Notes (if you create them) + +### Daily Notes Calendar +```dataview +CALENDAR date +FROM "memory" +WHERE date +``` + +--- + +## 🔍 Search Examples + +### Find Notes Without Tags +```dataview +LIST file.name +FROM "" +WHERE !file.tags +SORT file.name +``` + +### Recently Modified Files +```dataview +TABLE file.mtime AS "Modified" +FROM "" +WHERE file.mtime > date(today) - dur(7 days) +SORT file.mtime DESC +``` + +### Notes by Category +```dataview +TABLE category, status, date +FROM "" +WHERE category +SORT category, file.name +``` + +--- + +## 🛠️ Custom Queries + +### Broken HA Automations (needs attention) +```dataview +LIST +FROM "Home Assistant" +WHERE unavailable_count > 0 +``` + +### Active Configurations +```dataview +TABLE category, date, config_file +FROM "" +WHERE status = "active" +SORT category +``` + +### Research by Date Range +```dataview +TABLE date, type, source +FROM "Summaries" +WHERE date > date(2026-02-01) AND date < date(2026-03-01) +SORT date DESC +``` + +--- + +## 🎯 Quick Reference + +| Query Type | Syntax | +|------------|--------| +| **List** | `LIST FROM "folder" WHERE condition` | +| **Table** | `TABLE col1, col2 FROM "folder"` | +| **Sort** | `SORT column ASC/DESC` | +| **Limit** | `LIMIT number` | +| **Where** | `WHERE field = "value"` | +| **Group** | `GROUP BY field` | +| **Tags** | `FROM #tag1 OR #tag2` | + +--- + +## 📝 Adding Frontmatter to New Notes + +Use this template: +```yaml +--- +title: Your Note Title +category: Category Name +status: active/inactive/completed +date: YYYY-MM-DD +tags: [tag1, tag2, tag3] +--- +``` + +--- + +*Create your own queries by copying these and modifying!* diff --git a/OpenClaw/Discord Config.md b/OpenClaw/Discord Config.md new file mode 100644 index 0000000..42fac78 --- /dev/null +++ b/OpenClaw/Discord Config.md @@ -0,0 +1,93 @@ +--- +title: Discord / OpenClaw Configuration +category: OpenClaw +status: active +date: 2026-02-23 +config_file: ~/.openclaw/config/config.json +tags: [openclaw, discord, config, slash-commands] +--- + +# Discord / OpenClaw Configuration + +## Date: 2026-02-23 + +## Working Config (Slash Commands + Agent Responses) + +**File Location:** `~/.openclaw/config/config.json` + +### Critical Setup + +Both layers required for full functionality: + +```json +"channels": { + "discord": { + "enabled": true, + "token": "YOUR_TOKEN", + "groupPolicy": "open", + "guilds": { + "1465924568119251006": { + "users": [ + "458667380332036117", + "1465926559134257294" + ], + "channels": { + "1466074219829006599": { + "allow": true + } + }, + "requireMention": false + } + } + } +} +``` + +### Why Both Layers? + +| Layer | Location | Purpose | Without It | +|-------|----------|---------|------------| +| `users` | Guild level | Slash commands working | `/compact`, `/status` don't register | +| `channels.allow` | Channel level | Agent can respond | Agent stops responding to messages | + +### Bug/Design Issue + +The `users` whitelist prevents agent responses — it's a bug where: +1. `users` enables slash commands ✅ +2. But also breaks message processing ❌ +3. `channels.allow` is the workaround to re-enable responses + +**Both required** until OpenClaw fixes the bug. + +### Channel IDs + +| Name | ID | Purpose | +|------|-----|---------| +| #home-assistant | 1466074219829006599 | HA, room-assistant | +| #coding | 1468627455656067074 | Code, git, projects | +| #projects | 1468257895152881796 | Non-coding experiments | +| #alerts | 1473701182076752135 | System alerts | + +### User IDs + +| User | ID | +|------|-----| +| Corey | 458667380332036117 | +| OpenClaw Bot | 1465926559134257294 | + +## Slash Commands + +| Command | Purpose | +|---------|---------| +| `/compact` | Compact session context | +| `/status` | Show session status | + +## Related OpenClaw Files + +- [[Memory System]] — Complete memory architecture documentation +- [[Projects/Memory System/Memory System Architecture]] — Detailed data flow diagrams +- [[Dataview Query Examples]] — Query memory system with Dataview + +--- + +*Updated: 2026-02-23* diff --git a/OpenClaw/MEMORY Index.md b/OpenClaw/MEMORY Index.md new file mode 100644 index 0000000..84a040e --- /dev/null +++ b/OpenClaw/MEMORY Index.md @@ -0,0 +1,91 @@ +# MEMORY.md — Corey's Agent Index + +*Lightweight reference table (~1.5k tokens). Drill down to detail files as needed.* + +--- + +## About Corey +- **Person:** See `memory/people/corey.md` +- **Trigger:** "corey", "user", "timezone", "preferences" +- **Quick Ref:** America/Chicago, 70582 LA, °F/MPH, chill vibe + +--- + +## Active Projects (Always Context) + +| Project | Status | Detail File | Trigger Words | +|---------|--------|-------------|---------------| +| **Home Assistant** | 🔄 In Progress | `memory/projects/home-assistant.md` | "home assistant", "HA", "mqtt", "sensor" | +| **Mission Control Python** | ✅ Live | `memory/projects/mission-control-python.md` | "dashboard", "mission control", "python", "flask" | +| **Proton Mail Bridge** | ✅ Functional | `memory/projects/proton-mail-bridge.md` | "proton", "email", "imap", "smtp", "mail" | +| **Coding Workflow** | ✅ Active | `memory/projects/coding-workflow.md` | "coding", "git", "repo", "workflow" | +| **Memory System** | 🔄 Restructure | `memory/projects/memory-system.md` | "memory", "database", "backup", "sqlite" | +| **Discord Voice Bot** | ✅ Complete | `memory/projects/discord-voice-bot.md` | "voice bot", "glados", "TTS", "STT" | + +## Platform Decisions (Sticky) + +| Decision | Status | Date | Notes | +|----------|--------|------|-------| +| **Primary Chat** | ✅ Discord | 2026-02-23 | Staying with Discord (rolled back ID reqs). Zulip/Rocket.Chat experiments cancelled. | +| **Voice Bot** | ✅ GLaDOS | — | Operational in #coding voice channel | + +## Active Workflows (Auto-Execute) + +| Trigger | Action | Output | Notes | +|---------|--------|--------|-------| +| `/summarize [URL]` | Fetch → Summarize → Save | `Summaries/[Title].md` | Works in ANY channel. Auto-saves to Obsidian. Confirm with file path. | + +--- + +## Quick Reference + +### Discord Channels +- **#home-assistant:** 1466074219829006599 (HA, room-assistant) +- **#coding:** 1468627455656067074 (code, git, projects) +- **#projects:** 1468257895152881796 (experiments, non-coding) +- **#alerts:** 1473701182076752135 (system alerts) + +### Critical Info +- **HA URL:** http://192.168.0.39:8123 +- **MQTT:** 192.168.0.39:1883 (corey/41945549) +- **Phone MAC:** b0:c2:c7:07:28:b5 +- **News Brief:** Strict NO F1 spoilers policy + +--- + +## Decisions Log +- **Current Month:** `memory/decisions/2026-02.md` +- **Trigger:** "decided", "decision", "why did we" + +--- + +## Drill-Down Rules + +**MUST drill when mentioned:** +- Any active project above → Read full detail file +- "Decisions" or "why" → Read monthly decision log +- Person questions → Read `memory/people/corey.md` + +**MAY drill when relevant:** +- Past projects → Check `memory/projects/` +- Daily context → Check `memory/YYYY-MM-DD.md` +- Learnings → Check `.learnings/` + +**Hard cap:** Max 5 drill-downs per session start + +--- + +## Integration Points + +| System | Location | Use When | +|--------|----------|----------| +| **Daily Notes** | `memory/2026-*.md` | "What happened on [date]?" | +| **SQLite DB** | `~/.openclaw/memory.db` | "What tasks are pending?" (structured query) | +| **Workspace Context** | `workspace-context.md` | Current conversation, in-progress | +| **Supermemory** | Cloud backup | Disaster recovery | + +--- + +*Last Updated: 2026-02-20* +*Version: Hierarchical Index v1.1* +*Next Review: When projects change status* diff --git a/OpenClaw/Memory System.md b/OpenClaw/Memory System.md new file mode 100644 index 0000000..3c97e58 --- /dev/null +++ b/OpenClaw/Memory System.md @@ -0,0 +1,188 @@ +--- +title: OpenClaw Memory System +category: OpenClaw +type: Architecture/Documentation +status: active +date: 2026-02-16 +last_updated: 2026-02-23 +source_file: memory_system_architecture.md +tags: [openclaw, memory, architecture, system-design, data-flow, sqlite] +--- + +# OpenClaw Memory System + +*Source of truth for how information flows and persists* + +**Original File:** `memory_system_architecture.md` +**Created:** Evening of major OpenClaw upgrade (2026-02-16) + +--- + +## Overview + +``` +┌─────────────────────────────────────────────────────────────────────────────┐ +│ INFORMATION FLOW │ +└─────────────────────────────────────────────────────────────────────────────┘ + + User Conversation + │ + ▼ +┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ +│ ME (Main Agent) │────▶│ Memory Worker │────▶│ SQLite Database │ +│ (Real-time) │ │ (Daily 3 AM) │ │ (Structured) │ +└─────────────────────┘ └─────────────────────┘ └─────────────────────┘ + │ │ │ + │ │ │ + ▼ ▼ ▼ +┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ +│ Daily Notes │ │ Query Interface │ │ Stats/Search │ +│ (memory/*.md) │◄────│ (On Demand) │◄────│ (SQL/FTS) │ +└─────────────────────┘ └─────────────────────┘ └─────────────────────┘ + │ + ▼ +┌─────────────────────┐ +│ MEMORY.md │ +│ (Curated) │ +└─────────────────────┘ + │ + ▼ +┌─────────────────────┐ +│ Supermemory.ai │ +│ (Cloud Backup) │ +└─────────────────────┘ +``` + +--- + +## Storage Layers (6 Total) + +| Layer | Speed | Persistence | Purpose | +|-------|-------|-------------|---------| +| 1. Session RAM | ⚡ Fastest | Minutes-hours | Working conversation context | +| 2. Workspace Context | 📝 Fast | ~24 hours | Session bridge between channels | +| 3. Daily Notes | 📄 Medium | 30-90 days | Raw daily activity | +| 4. MEMORY.md | 🧠 Slow | Permanent | Curated important info | +| 5. SQLite DB | 📊 Query | Permanent | Structured data with FTS | +| 6. Supermemory.ai | 🌐 Cloud | Permanent | Full cloud backup | + +--- + +## Key Components + +### 1. Session RAM +- **What:** Current conversation context +- **Writes:** Real-time +- **Survives:** ❌ Crash ❌ Restart +- **Size:** ~100K-250K tokens +- **Risk:** Lost on compaction + +### 2. Daily Notes (memory/*.md) +- **What:** Raw daily activity, decisions, errors +- **Writes:** Pre-compaction flush +- **Survives:** ✅ Everything +- **Retention:** 30-90 days + +### 3. MEMORY.md +- **What:** Curated long-term memory +- **Writes:** Manual review +- **Survives:** ✅ Everything +- **Retention:** Permanent + +### 4. SQLite Database (~/.openclaw/memory.db) +- **What:** Structured tasks, decisions, facts +- **Writes:** Daily 3 AM (Memory Worker cron) +- **Schema:** + ```sql + memory_cells: id, scene, cell_type, salience, content, source_file, created_at + scenes: scene, summary, item_count, updated_at + memory_fts: full-text search index + ``` +- **Survives:** ✅ File-based +- **Retention:** Permanent + +### 5. Supermemory.ai +- **What:** Full cloud backup +- **Writes:** Daily 2 AM (Python script) +- **Survives:** ✅ Disk failure +- **Retention:** Cloud dependent + +### 6. Workspace Context (workspace-context.md) +- **What:** Current conversation bridge +- **Writes:** Continuous +- **Survives:** ✅ Channel switch +- **Cleared:** Nightly (~11 PM) + +--- + +## Cron Jobs (Memory System) + +| Job | Time | Purpose | +|-----|------|---------| +| Supermemory Backup | 2:00 AM | Cloud backup of all memory files | +| Cron Cleanup | 3:00 AM | Remove finished one-shot jobs | +| Memory Worker | 3:04 AM | Extract to SQLite database | + +--- + +## Key Principles + +1. **Text > Brain** — Files persist, sessions don't +2. **Daily notes = raw, MEMORY.md = curated** — Filter noise from signal +3. **Worker = automated structuring** — Don't manually organize everything +4. **Hybrid = best of both** — Human-readable + machine-queryable +5. **Multiple backups** — Local + cloud + structured + +--- + +## Access Patterns + +### Main Agent Reads: +- `MEMORY.md` — Every session (core identity, prefs) +- `USER.md` — Every session (who Corey is) +- `SOUL.md` — Every session (how to behave) +- `workspace-context.md` — Every session (current state) +- `memory/*.md` — During heartbeats (recent context) +- `SQLite DB` — On demand (structured queries) + +### Memory Worker Reads: +- `IDENTITY.md` — Daily 3 AM +- `SOUL.md` — Daily 3 AM +- `HEARTBEAT.md` — Daily 3 AM (instructions) +- `memory/YYYY-MM-DD.md` — Daily 3 AM (content to extract) +- Writes to SQLite DB + +--- + +## Failure Recovery + +| Scenario | Survives | Lost | Recovery | +|----------|----------|------|----------| +| Session Crash | Files | Session RAM | Read files, reconstruct | +| Gateway Restart | All files | Session/cron state | Restart, verify jobs | +| Disk Failure | Supermemory | Local files + DB | Restore from cloud | + +--- + +## File Locations + +| File | Location | +|------|----------| +| MEMORY.md | `~/.openclaw/workspace/MEMORY.md` | +| Daily Notes | `~/.openclaw/workspace/memory/YYYY-MM-DD.md` | +| SQLite DB | `~/.openclaw/memory.db` | +| Workspace Context | `~/.openclaw/workspace/workspace-context.md` | +| Architecture Doc | `Projects/Memory System/Memory System Architecture.md` (Obsidian) | + +--- + +## Related + +- [[Discord Config]] — Discord/OpenClaw configuration +- [[Projects/Daily Notes/YYYY-MM-DD]] — Daily notes structure +- [[Dataview Query Examples]] — Query the SQLite database + +--- + +*This is the source of truth for Corey's OpenClaw memory system.* +*Created: 2026-02-16 | Last Updated: 2026-02-23* diff --git a/OpenClaw/Sync History 2026-02-24.md b/OpenClaw/Sync History 2026-02-24.md new file mode 100644 index 0000000..2298aa0 --- /dev/null +++ b/OpenClaw/Sync History 2026-02-24.md @@ -0,0 +1,10 @@ +# OpenClaw Sync - 2026-02-24 + +## Files Synced +- Tools Reference.md (from TOOLS.md) +- MEMORY Index.md (from MEMORY.md) + +## Notes +Last updated: 06:01 + +--- diff --git a/OpenClaw/System Overview.md b/OpenClaw/System Overview.md new file mode 100644 index 0000000..5ee7e74 --- /dev/null +++ b/OpenClaw/System Overview.md @@ -0,0 +1,98 @@ +# System Overview + +## Core Services + +| Service | URL | Status | Purpose | +|---------|-----|--------|---------| +| Mission Control (Python) | http://localhost:5050 | ✅ Live | Flask dashboard | +| Mission Control (Next.js) | http://localhost:3000 | ✅ Complete | React dashboard (archived) | +| Home Assistant | http://192.168.0.39:8123 | 🔄 Active | Entity cleanup | +| OpenClaw Gateway | localhost:8787 | ✅ Active | Multi-channel bot | +| Discord Bot | Discord | ✅ Active | Chat + voice | + +--- + +## Pi Infrastructure + +| Device | IP | Purpose | Status | +|--------|-----|---------|--------| +| livingroom-pi | 192.168.0.95 | Room-assistant presence | ✅ Working | +| HA Server | 192.168.0.39 | Home Assistant core | ✅ Running | +| VPN Box | — | Downloads (qbit/sonarr/radarr) | ✅ Active | + +--- + +## Automation (Cron Jobs) + +| Job | Schedule | Last Status | Purpose | +|-----|----------|-------------|---------| +| Supermemory Backup | 2:00 AM | ✅ | Cloud backup | +| Daily Cron Cleanup | 3:00 AM | ✅ | Job maintenance | +| Memory Worker | 3:00 AM | ✅ | Extract to SQLite | +| News Brief | 8:00 AM | ✅ | Morning news | +| Job Verifier | 9:00 AM | ✅ | Check overnight jobs | +| Shipping Tracker | 6 AM/12 PM/6 PM | ✅ | Package alerts | + +--- + +## Discord Channels + +| Channel | ID | Purpose | Model | +|---------|-----|---------|-------| +| #home-assistant | 1466074219829006599 | HA, room-assistant | kimi | +| #coding | 1468627455656067074 | Code, projects | qwen3-coder | +| #projects | 1468257895152881796 | Experiments | kimi | +| #alerts | 1473701182076752135 | System alerts | kimi | +| #news-brief | 1471156195233628394 | Morning news | kimi | +| #calendar | 1474636036905631867 | Scheduling | kimi | + +--- + +## Key Directories + +### OpenClaw Workspace +``` +~/.openclaw/workspace/ +├── memory/ # Memory files + SQLite +│ ├── projects/ # Project detail files +│ ├── people/ # User profiles +│ └── decisions/ # Decision log +├── skills/ # Installed skills +├── tools/ # Custom scripts +└── scripts/ # Automation scripts +``` + +### Mission Control +``` +C:\web\htdocs\ +├── mission-control-py/ # Flask dashboard (live) +├── mission-control/ # Next.js dashboard (complete) +└── dashboard/ # Legacy PHP dashboard +``` + +### Other Important Paths +- **MySQL:** C:\web\mysql\ (MariaDB 10.4.32) +- **Frigate:** P:\frigate\ (NVR with 4 cameras) +- **Nextcloud:** http://aiagents:8081 (removed from startup - thermal issues) +- **HA:** 192.168.0.39:8123 + +--- + +## Projects Status Overview + +### Active +- Home Assistant — Entity cleanup +- Mission Control Python — Dashboard live on :5050 +- Coding Workflow — Git/controls-web +- Memory System — Daily extractions working + +### Completed +- Discord Voice Bot — Always available in #coding +- Proton Mail Bridge — Tested and functional +- Mission Control Next.js — Archived +- Supermemory backup — Daily automation +- Room-Assistant — Presence tracking working + +--- + +*Last Updated: 2026-02-22* \ No newline at end of file diff --git a/OpenClaw/Tools Reference.md b/OpenClaw/Tools Reference.md new file mode 100644 index 0000000..a05c318 --- /dev/null +++ b/OpenClaw/Tools Reference.md @@ -0,0 +1,196 @@ +# TOOLS.md - Local Notes + +--- + +## Credentials Location + +All credentials stored in `.credentials/` (gitignored): +- `example-api.txt` — Example API key + +--- + +## [Tool Name] + +**Status:** ✅ Working | ⚠️ Issues | ❌ Not configured + +**Configuration:** +``` +Key details about how this tool is configured +``` + +**Gotchas:** +- Things that don't work as expected +- Workarounds discovered + +**Common Operations:** +```bash +# Example command +tool-name --common-flag +``` + +--- +Skills define *how* tools work. This file is for *your* specifics — the stuff that's unique to your setup. + +## What Goes Here + +Things like: +- Camera names and locations +- SSH hosts and aliases +- Preferred voices for TTS +- Speaker/room names +- Device nicknames +- Anything environment-specific +- Tool configurations and settings +- Credential locations (not the credentials themselves!) +- Gotchas and workarounds discovered +- Common commands and patterns +- Integration notes + +## Examples + +```markdown +### Cameras +- living-room → Main area, 180° wide angle +- front-door → Entrance, motion-triggered + +### SSH +- home-server → 192.168.1.100, user: admin + +### TTS +- Preferred voice: "Nova" (warm, slightly British) +- Default speaker: Kitchen HomePod +``` + +## Home Assistant + +```markdown +### Home Assistant +- URL: http://192.168.0.39:8123 +- Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJmYzg2NzQwNGNlMzY0NmM5YjA0MTQ4YWFjYjY3OGM4OSIsImlhdCI6MTc3MTE3MzcwNSwiZXhwIjoyMDg2NTMzNzA1fQ.IdlfMvFeiEwv2GSH7hRnG_Au48KRYbfVF0Fa7g5eMpc +``` + +## Why Separate? + +Skills are shared. Your setup is yours. Keeping them apart means you can update skills without losing your notes, and share skills without leaking your infrastructure. + +## Workspace Organization + +- **Root** (`~/.openclaw/workspace/`) → Core config files and documentation +- **`scripts/`** → One-off helper scripts (PowerShell/Shell) +- **`temp/`** → Temporary files, downloads, transcripts + +--- + +## Obsidian / NotesMD + +**Status:** ✅ Configured + +**CLI Location:** `C:\tools\notesmd-cli.exe` (or in PATH as `notesmd-cli.exe`) + +**Default Vault:** `C:\Users\admin\Documents\Corey` (already set via `notesmd-cli set-default`) + +**Common Commands:** +```powershell +# Check default vault +notesmd-cli print-default --path-only + +# Search notes +notesmd-cli search "query" + +# Search content inside notes +notesmd-cli search-content "query" + +# Create new note +notesmd-cli create "Folder/New note" --content "..." --open + +# Move/rename (updates wikilinks) +notesmd-cli move "old/path" "new/path" +``` + +**Gotchas:** +- Vault path uses regular Windows paths, NOT WSL paths +- Default vault must be set before commands work without `--vault` flag +- Notes survive session chops (written to disk immediately) + +--- + +## Discord / OpenClaw Config + +**Status:** ✅ Working + +**File:** `~/.openclaw/config/config.json` + +**Working Channel Permissions Setup (for Slash Commands + Agent Responses):** + +```json +"channels": { + "discord": { + "enabled": true, + "token": "YOUR_TOKEN", + "groupPolicy": "open", + "guilds": { + "1465924568119251006": { + "users": [ + "458667380332036117", + "1465926559134257294" + ], + "channels": { + "1466074219829006599": { "allow": true }, + "1468627455656067074": { "allow": true }, + "1468257895152881796": { "allow": true }, + "1471202415385509981": { "allow": true } + }, + "requireMention": false + } + } + } +} +``` + +**Critical:** Both layers needed: +- `users` at guild level → enables slash commands +- `channels.allow: true` at channel level → lets agent respond + +**Without `users`:** Slash commands don't work +**Without `channels.allow`:** Agent doesn't respond (even with `users` set) + +**Bug/Design Issue:** Dual-whitelist is redundant but required. The `users` filter blocks agent responses when enabled. + +### Discord Channels Reference + +| Channel | ID | Purpose | Agent Active | +|---------|-----|---------|--------------| +| #home-assistant | 1466074219829006599 | HA, room-assistant | ✅ | +| #coding | 1468627455656067074 | Code, git, projects | ✅ | +| #projects | 1468257895152881796 | Experiments, non-coding | ✅ | +| #summaries | 1471202415385509981 | URL summaries, YouTube | ✅ | +| #alerts | 1473701182076752135 | System alerts | ✅ | + +**Note:** Channel names change sometimes... IDs are forever 😂 + +--- + +## Docker Services + +**Location:** `~/.openclaw/workspace/docker/` + +**Services:** +| Service | Size | Purpose | Config | +|---------|------|---------|--------| +| **frigate** | 219 MB | NVR/AI camera detection | `docker-compose.yml`, `config.yml` | +| **nextcloud** | 1.1 GB | Self-hosted file sync | `docker-compose.yml` | +| **discord-voice-bot** | <1 MB | GLaDOS voice bot | `docker-compose.yml` | + +**Note:** Frigate media files moved outside workspace. Only config and AI model remain. + +**To start/stop:** +```bash +cd ~/.openclaw/workspace/docker/[service] +docker-compose up -d # Start +docker-compose down # Stop +docker-compose logs -f # View logs +``` + +--- + +Add whatever helps you do your job. This is your cheat sheet. diff --git a/Projects/Coding Workflow.md b/Projects/Coding Workflow.md new file mode 100644 index 0000000..9cb5522 --- /dev/null +++ b/Projects/Coding Workflow.md @@ -0,0 +1,86 @@ +# Coding Workflow + +## Environment +- **Primary Channel:** Discord #coding (1468627455656067074) +- **Repository:** whoisfrost/controls-web (Lassite controls internal website) +- **Model:** kimi-k2.5:cloud (home-assistant), qwen3-coder-next:cloud (coding) + +--- + +## Git Workflow + +### Branch Strategy +| Branch | Purpose | +|--------|---------| +| `main` | Stable/production branch | +| `dev` | Testing/playground branch | +| `feature/*` | Specific changes (deleted after merge) | + +### Deployment Process +``` +Work PC → GitHub (dev) → Dev Server (pulls dev) → Live Server (pulls main) +``` + +### Workflow Steps +1. Create feature branch from dev +2. Work and commit +3. Push feature branch to GitHub +4. Merge feature → dev +5. Test on dev server +6. Merge dev → main +7. Deploy to live server + +### Commands +```bash +git checkout -b dev # Create dev branch +git push origin dev # Push dev branch +git checkout -b feature-name # Create feature branch +git push origin feature-name # Push feature +git checkout dev +git merge feature-name # Merge into dev +git push origin dev +git checkout main +git merge dev # After testing +git push origin main +``` + +--- + +## LAMP Stack + +### Local Development +- **Dashboard:** `C:\web\htdocs\dashboard` (active project) +- **Web Root:** `C:\web\htdocs\` +- **Old Dashboard:** `/var/www/html/dashboardv2/` (ignore - archived) + +### Production +- Dev server pulls from `dev` branch +- Live server pulls from `main` branch + +--- + +## Tools & Environment +- **Shell:** Bash +- **SSH, curl, jq** +- **Node.js:** For Next.js/React projects +- **Python:** For Flask backends + +--- + +## Model Assignments (Confirmed 2026-02-10) + +| Channel | Model | Reason | +|---------|-------|--------| +| #home-assistant | kimi-k2.5:cloud | General purpose | +| #coding | qwen3-coder-next:cloud | Optimized for code | +| #projects | kimi-k2.5:cloud | General purpose | + +--- + +## Related Projects +- [[Mission Control Dashboard (Python)]] — Flask dashboard :5050 +- [[Mission Control Dashboard (Next.js)]] — React dashboard :3000 (completed) + +--- + +*Status: Active | Updated: 2026-02-22* \ No newline at end of file diff --git a/Projects/Discord Voice Bot.md b/Projects/Discord Voice Bot.md new file mode 100644 index 0000000..f5c2e33 --- /dev/null +++ b/Projects/Discord Voice Bot.md @@ -0,0 +1,90 @@ +# Discord Voice Bot (GLaDOS) + +## Overview +Voice-controlled Discord bot with conversational AI — always available in #coding voice channel + +--- + +## Location +`/home/admin/.openclaw/workspace/discord-voice-bot/` + +--- + +## Architecture (Completed 2026-02-08) + +### Components +| Component | Endpoint | Purpose | +|-----------|----------|---------| +| **TTS** | 192.168.0.17:5050 | GLaDOS voice synthesis | +| **STT** | 192.168.0.17:10300 | Whisper via Wyoming protocol | +| **LLM** | 192.168.0.17:11434 | Ollama (qwen3-coder-next:cloud) | +| **Auto-join** | On startup | Joins #coding voice channel | + +### Voice Pipeline +``` +Wake Word → STT (Whisper) → LLM (Ollama) → TTS (GLaDOS) → Voice Output +``` + +--- + +## Commands +- `!join` — Join voice channel +- `!leave` — Leave voice channel +- `!test [text]` — Test TTS synthesis +- `!listen` — 5-second voice recording (7-10 sec latency) + +--- + +## MCP Integration (OpenClaw Bridge) + +### MCP Tools Available via Voice +- `list_projects()` — "What am I working on?" +- `create_project(name)` — Start new project +- `add_task(project, task)` — Add tasks via voice +- `update_task_status(taskId, status)` — Mark complete +- `get_project_status()` — Check overall progress + +### MCP Server Config +```yaml +mcp_servers: + - name: "openclaw" + transport: "stdio" + command: "python" + args: + - "C:\Users\admin\.openclaw\workspace\discord-voice-bot\openclaw_mcp_server.py" +``` + +--- + +## Files Created +- `openclaw_mcp_server.py` — FastMCP server exposing OpenClaw tools +- `main.py` — Bot implementation using discord.py, wyoming +- `config.yaml` — Configuration +- `requirements.txt` — Dependencies (discord.py, requests, numpy, wyoming) + +--- + +## What Changed (v2) +- Removed GLaDOS direct dependencies (simpler integration) +- Uses existing services (Whisper, Ollama, HTTP TTS) +- Auto-joins voice channel on startup +- Clean async architecture +- MCP bridge for OpenClaw integration + +--- + +## Known Limitations +- Voice latency: 7-10 seconds for `!listen` (5s recording + processing) +- Not conversational due to latency +- Best for command-based interactions, not real-time chat + +--- + +## Status +✅ **COMPLETED** — Operational in #coding voice channel + +Bot auto-joins on startup and accepts voice commands via MCP bridge. + +--- + +*Status: Complete | Version: 2.0 | Updated: 2026-02-22* \ No newline at end of file diff --git a/Projects/Home Assistant.md b/Projects/Home Assistant.md new file mode 100644 index 0000000..394e3fa --- /dev/null +++ b/Projects/Home Assistant.md @@ -0,0 +1,100 @@ +# Home Assistant + +## Environment +- **URL:** http://192.168.0.39:8123 +- **Auth Token:** eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMTRhMDMwYjNhNjg0N2JiYWY2YmUxNmY4YTBhYjVkZiIsImlhdCI6MTc3MDE3NTU0NSwiZXhwIjoyMDg1NTM1NTQ1fQ.8xxRzURj0NoFoo_UdtH34IXcuBX6fSpofdA8GjCK-B4 +- **MQTT Broker:** 192.168.0.39:1883 (corey/41945549) +- **Status:** 🔄 In Progress (entity cleanup ongoing) +- **Discord Channel:** #home-assistant (1466074219829006599) + +--- + +## Room-Assistant (Bluetooth Presence) - WORKING! ✅ + +**What it does:** +- Pi Zero W BLE scans for known phones +- Reports to HA via MQTT +- Creates device_tracker entities per room +- Multi-Pi setup gives room-level presence + +### Hardware +- **Pi 1:** livingroom-pi (192.168.0.95) +- **Bluetooth MAC:** B8:27:EB:50:C9:40 +- **SSH:** admin / 41945549 +- **SSH Key:** ~/.ssh/id_ed25519 (Windows SSH quirk - needs manual workarounds) + +### Phone Tracking +- **Corey's Phone:** B0:C2:C7:07:28:B4 (motorola razr 2024) +- **Phone MAC Discovery:** + - iPhone: Settings → About → Bluetooth + - Android: Settings → About Phone → Status → Bluetooth address + +### Room-Assistant Config (`/home/admin/config/local.yml`) +```yaml +mqtt: + host: "192.168.0.39" + port: 1883 + username: "corey" + password: "41945549" +bluetooth: + adminToken: "AF07072FBAC1FD6281FBE765DF6D841E" + timeout: 60 + addresses: + - "b0:c2:c7:07:28:b5" # Corey's phone MAC +settings: + room: "LivingRoom" +``` + +### Home Assistant Entities Created +- `sensor.livingroom_cluster_size` +- `sensor.livingroom_cluster_leader` +- `device_tracker.livingroom_phone` (when phone in range) + +### Key Config Notes +- Config location: `/home/admin/config/local.yml` (NOT in room-assistant subdir) +- Config format: keys at root level (v2.x), no "global." prefix +- mdns module needed: `sudo npm install -g mdns` (for cluster discovery) +- RSSI threshold: `-70` (adjustable for range) + +--- + +## Current Tasks + +### High Priority +- [ ] Entity cleanup (972 devices in spreadsheet) +- [x] Fix hallway sensor battery (1%) +- [ ] Add Kathy's phone to room-assistant config + +### In Progress +- [x] Room-assistant setup and working +- [x] Phone MAC paired and tracking +- [ ] Multi-Pi expansion (clone SD after first Pi stable) + +--- + +## Setup Workflow (for future Pis) +1. Flash Pi OS Lite to SD card +2. Enable SSH + WiFi via Pi Imager +3. Copy config files to Pi +4. Run `sudo ./setup-room-assistant.sh` +5. Script prompts for: room name, MQTT creds, phone MACs + +--- + +## Files Created +- `room-assistant-config.yml` — BLE presence config template +- `setup-room-assistant.sh` — Automated Pi setup script +- `ROOM_ASSISTANT_SETUP.md` — Complete setup documentation +- `temp/write_ha_names.py` — Push entity changes back to HA + +--- + +## Integration Points +- HA REST API (native) +- MQTT (for room-assistant) +- Mission Control dashboard (for display) +- Discord notifications (alerts) + +--- + +*Status: Room presence working, entity cleanup ongoing | Updated: 2026-02-22* \ No newline at end of file diff --git a/Projects/Memory System.md b/Projects/Memory System.md new file mode 100644 index 0000000..e4063f3 --- /dev/null +++ b/Projects/Memory System.md @@ -0,0 +1,144 @@ +# Memory System + +## Architecture Evolution +Started as flat file system, evolved to hierarchical hybrid (file + SQL) architecture. + +--- + +## Current Stack (February 2026) + +### 1. Hierarchical File Structure +Based on ucsandman's design — index + drill-down: + +` +memory/ +├── MEMORY.md # ~2.4k token index (was 5-10k) +├── people/ +│ └── corey.md # User details +├── projects/ +│ ├── mission-control-python.md +│ ├── home-assistant.md +│ ├── memory-system.md +│ └── [others] +├── decisions/ +│ └── 2026-02.md # Monthly decisions +└── 2026-02-21.md # Daily notes +` + +**Benefits:** +- Session start: ~2.4k tokens (was 5-10k) +- On-demand drill-down: ~1k tokens per file +- **~70% token savings** + +### 2. SQLite Database +- **Location:** ~/.openclaw/memory.db +- **Tables:** + - memory_cells — Structured data + - scenes — Context/grouping + - memory_fts — Full-text search +- **Extraction:** Memory Worker agent (3 AM daily) + +### 3. Supermemory.ai Backup +- **Schedule:** Daily 2 AM +- **Script:** scripts/backup-memory.py +- **History:** Document IDs tracked per backup + +### 4. MySQL Mirror (Legacy) +- **Host:** localhost:3306 +- **Database:** clawdbot_projects +- **Tables:** daily_notes, long_term_memories, action_items, backup_logs, sessions +- **User:** AlexAI/alexisabignerd +- **Status:** Functional but not actively used + +--- + +## Key Decisions + +| Date | Decision | Status | +|------|----------|--------| +| 2026-02-09 | Supermemory backup with cron | Active | +| 2026-02-12 | workspace-context.md for temp state | Active | +| 2026-02-16 | Hybrid File + SQLite (not MySQL) | Active | +| 2026-02-18 | Hierarchical index + drill-down | Live | +| 2026-02-20 | Memory Worker writes to SQLite | Working | + +--- + +## Ollama Memory Embeddings (2026-02-10) + +**Setup:** +- Installed skill from https://clawhub.ai/vidarbrekke/ollama-memory-embeddings +- Uses Ollama /v1/embeddings endpoint +- Replaces node-llama-cpp for local embeddings + +**Trade-off:** +- ✅ Faster, OpenAI-compatible API +- ⚠️ Two embedding universes: old (node-llama-cpp) vs new (Ollama) +- Historical memories may search differently + +--- + +## Workers + +### Memory Worker Daily +- **Schedule:** 3 AM +- **Task:** Extract structured data → SQLite +- **Extraction source:** memory/YYYY-MM-DD.md files +- **Output:** memory.db + Discord report + +### Job Verifier Daily +- **Schedule:** 9 AM +- **Task:** Check overnight job statuses +- **Reports to:** #alerts channel + +--- + +## Integration Points + +| System | Direction | Method | +|--------|-----------|--------| +| OpenClaw Memory Search | Read | semantic search | +| SQLite Database | Read/Write | memory tool | +| Supermemory | Write (backup) | API | +| Obsidian Vault | Write (export) | notesmd-cli | +| MySQL | Legacy | Direct SQL | + +--- + +## Skills Related + +| Skill | Purpose | +|-------|---------| +| ollama-memory-embeddings | Ollama-based embeddings | +| memory-to-obsidian | Export notes to Obsidian | +| ez-cronjob | Fix cron scheduling issues | +| self-improving-agent | Log errors/corrections | + +--- + +## Troubleshooting Notes + +**Cron deadlock bug:** +- Issue: cron tool hangs +- Fix: Use openclaw cron CLI via exec instead + +**Context bloat:** +- Issue: 256k limit hit frequently +- Fix: Spawn sub-agents for complex tasks + +**Session recovery:** +- workspace-context.md survives crashes +- Cleaned daily at ~11 PM + +--- + +## Future Ideas + +1. SQL → HA Dashboard integration +2. Automated presence tracking export +3. Memory stats/analytics in Mission Control +4. Re-embed historical memories for consistency + +--- + +Status: Live | Last Major Update: 2026-02-18 (Hierarchical restructure) \ No newline at end of file diff --git a/Projects/Memory System/Memory System Architecture.md b/Projects/Memory System/Memory System Architecture.md new file mode 100644 index 0000000..b7e3ebd --- /dev/null +++ b/Projects/Memory System/Memory System Architecture.md @@ -0,0 +1,261 @@ +--- +title: Memory System Architecture +category: Projects +project: Memory System +type: Architecture/Documentation +status: complete +date: 2026-02-16 +last_updated: 2026-02-23 +tags: [memory, architecture, openclaw, system-design, data-flow] +source_file: memory_system_architecture.md +--- + +# Memory System Architecture + +*Diagram of how information flows and persists in the OpenClaw system* + +--- + +## Overview + +``` +┌─────────────────────────────────────────────────────────────────────────────┐ +│ INFORMATION FLOW │ +└─────────────────────────────────────────────────────────────────────────────┘ + + User Conversation + │ + ▼ +┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ +│ ME (Main Agent) │────▶│ Memory Worker │────▶│ SQLite Database │ +│ (Real-time) │ │ (Daily 3 AM) │ │ (Structured) │ +└─────────────────────┘ └─────────────────────┘ └─────────────────────┘ + │ │ │ + │ │ │ + ▼ ▼ ▼ +┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ +│ Daily Notes │ │ Query Interface │ │ Stats/Search │ +│ (memory/*.md) │◄────│ (On Demand) │◄────│ (SQL/FTS) │ +└─────────────────────┘ └─────────────────────┘ └─────────────────────┘ + │ + ▼ +┌─────────────────────┐ +│ MEMORY.md │ +│ (Curated) │ +└─────────────────────┘ + │ + ▼ +┌─────────────────────┐ +│ Supermemory.ai │ +│ (Cloud Backup) │ +└─────────────────────┘ +``` + +--- + +## Storage Layers (By Speed & Persistence) + +### 1. ⚡ Session RAM (Transient) +| Aspect | Details | +|--------|---------| +| **What** | Current conversation context, tool outputs, working memory | +| **Writes** | Every message I process | +| **When** | Real-time during conversation | +| **Stored** | Until session ends or compaction (30 min - 4 hours) | +| **Survives** | ❌ Session crash ❌ Gateway restart | +| **Size** | ~100K-250K tokens | + +**Risk:** Compaction clears this. The "danger zone" is between last tool use and compaction. + +--- + +### 2. 📝 Daily Notes (Short-term) +| Aspect | Details | +|--------|---------| +| **What** | Raw daily activity, decisions, tasks, errors | +| **Writes** | Pre-compaction flush (automatic) + manual captures | +| **When** | End of productive sessions, before `/compact` | +| **Stored** | `memory/YYYY-MM-DD.md` | +| **Survives** | ✅ Session crash ✅ Gateway restart | +| **Retention** | ~30-90 days (manually reviewed) | +| **Format** | Free-form markdown | + +**Written by:** Me (main agent) during heartbeat or EOD ritual + +--- + +### 3. 🧠 MEMORY.md (Long-term) +| Aspect | Details | +|--------|---------| +| **What** | Curated important info, distilled from daily notes | +| **Writes** | Manual review of daily notes, during heartbeats | +| **When** | Every few days, or when something critical happens | +| **Stored** | `MEMORY.md` in workspace root | +| **Survives** | ✅ Everything (file-based) | +| **Retention** | Permanent (manual curation) | +| **Format** | Human-readable markdown | + +**Written by:** Me, after reviewing daily notes + +--- + +### 4. 📊 SQLite Database (Structured) +| Aspect | Details | +|--------|---------| +| **What** | Structured: tasks, decisions, facts, projects with salience | +| **Writes** | Memory Worker (automated daily extraction) | +| **When** | Daily 3:00 AM (cron job) | +| **Stored** | `~/.openclaw/memory.db` | +| **Survives** | ✅ File-based | +| **Retention** | Permanent (until manual deletion) | +| **Format** | Relational: cells, scenes, FTS index | + +**Written by:** Memory Worker agent (spawned via cron) + +**Schema:** +```sql +memory_cells: id, scene, cell_type, salience, content, source_file, created_at +scenes: scene, summary, item_count, updated_at +memory_fts: full-text search index +``` + +--- + +### 5. 🌐 Supermemory.ai (Cloud) +| Aspect | Details | +|--------|---------| +| **What** | Full backup of all memory files | +| **Writes** | Supermemory Backup job (automated) | +| **When** | Daily 2:00 AM | +| **Stored** | Supermemory.ai cloud service | +| **Survives** | ✅ Disk failure ✅ Workspace loss | +| **Retention** | Cloud provider dependent | +| **Format** | API-uploaded documents | + +**Written by:** Python script via cron job + +--- + +### 6. 📋 Workspace Context (Session Bridge) +| Aspect | Details | +|--------|---------| +| **What** | Current conversation, in-progress, finished today | +| **Writes** | Real-time during session | +| **When** | Continuously updated | +| **Stored** | `workspace-context.md` | +| **Survives** | ✅ Session crash ✅ Channel switch | +| **Retention** | Cleared nightly (~11 PM) | +| **Format** | Structured markdown | + +**Special:** Survives between channels and session crashes. Cleared daily. + +--- + +## Retention Summary + +| Layer | Retention | Cleared When | Backup | +|-------|-----------|--------------|--------| +| Session RAM | Minutes-hours | Compaction | ❌ | +| Workspace Context | ~24 hours | 11 PM nightly | ❌ | +| Daily Notes | 30-90 days | Manual archive | Supermemory | +| MEMORY.md | Permanent | Manual edit | Supermemory | +| SQLite DB | Permanent | Manual delete | ❌ (local only) | +| Supermemory | Permanent | Cloud provider | N/A (is backup) | + +--- + +## Write Triggers + +``` +Every Message + │ + ├─► Session RAM (immediate) + │ + └─► If important ┐ + ▼ + workspace-context.md + │ + Pre-compaction ┤ + ▼ + memory/YYYY-MM-DD.md + │ + Periodic review ┤ + ▼ + MEMORY.md + │ + Daily 2 AM ┤ + ▼ + Supermemory.ai + │ + Daily 3 AM ┤ + ▼ + SQLite Database +``` + +--- + +## Access Patterns + +### I (Main Agent) Access: +| Source | When | Purpose | +|--------|------|---------| +| MEMORY.md | Every session startup | Core identity, user prefs, important facts | +| USER.md | Every session startup | Who Corey is | +| SOUL.md | Every session startup | How I should behave | +| workspace-context.md | Every session startup | Current conversation state | +| memory/*.md | During heartbeats | Recent context | +| SQLite DB | On demand | Structured queries ("what tasks pending?") | + +### Memory Worker Access: +| Source | When | Purpose | +|--------|------|---------| +| IDENTITY.md | Daily 3 AM | Who it is | +| SOUL.md | Daily 3 AM | Its mission | +| HEARTBEAT.md | Daily 3 AM | What to do (the script) | +| memory/YYYY-MM-DD.md | Daily 3 AM | What to extract | +| SQLite DB | Daily 3 AM | Where to write | + +--- + +## Failure Recovery + +### Scenario: Session Crash +- ✅ **Survives:** Files (MEMORY.md, daily notes, workspace-context) +- ❌ **Lost:** Session RAM (compaction would have cleared anyway) +- 🔄 **Recovery:** Read files on restart, reconstruct context + +### Scenario: Gateway Restart +- ✅ **Survives:** All files, SQLite DB +- ❌ **Lost:** Session state, cron job state (must recreate jobs) +- 🔄 **Recovery:** Gateway restart, verify cron jobs running + +### Scenario: Disk Failure +- ✅ **Survives:** Supermemory.ai (cloud backup) +- ❌ **Lost:** Local files, SQLite DB +- 🔄 **Recovery:** Restore from Supermemory, recreate DB (re-extract from notes) + +--- + +## Key Insights + +1. **Text > Brain** — Files persist, my session doesn't +2. **Daily notes = raw, MEMORY.md = curated** — Filter noise from signal +3. **Worker = automated structuring** — Don't have to manually organize everything +4. **Hybrid = best of both** — Human-readable + machine-queryable +5. **Multiple backups** — Local files + cloud (Supermemory) + structured DB + +--- + +## Related Files + +- [[Memory System]] — OpenClaw summary (in OpenClaw/ folder) +- MEMORY.md — Curated long-term memory +- memory/YYYY-MM-DD.md — Daily notes +- workspace-context.md — Session bridge +- ~/.openclaw/memory.db — Structured SQLite database + +--- + +*Generated: 2026-02-16* +*Copied to Obsidian: 2026-02-23* +*System Version: Multi-agent with SQLite extraction* diff --git a/Projects/Mission Control Dashboard (Python).md b/Projects/Mission Control Dashboard (Python).md new file mode 100644 index 0000000..6cc10e0 --- /dev/null +++ b/Projects/Mission Control Dashboard (Python).md @@ -0,0 +1,40 @@ +# Mission Control Dashboard (Python) + +**Location:** C:\web\htdocs\mission-control-py +**URL:** http://localhost:5050 +**Tech:** Python/Flask + MySQL + Home Assistant API + +## Quick Reference + +| Command | Action | +|---------|--------| +| Run | cd C:\web\htdocs\mission-control-py && python app.py | +| Port | 5050 (Frigate-safe) | +| Restart | Auto-reloads on file changes | + +## Pages + +| Route | Purpose | +|-------|---------| +| / | Gateway status, Cron jobs, Weather | +| /admin | Projects/Tasks CRUD | +| /news | News briefs archive | +| /alerts | System alerts | +| /calendar | HA calendar + F1 races | +| /memory | Memory file stats | + +## Features + +- **Caching:** 5-minute TTL for Gateway/Cron/Weather +- **Weather:** From HA weather.home entity +- **News:** Cron-fed JSON at 8 AM daily +- **Calendar:** HA integration (date range bug known) + +## Known Issues + +| Issue | Status | +|-------|--------| +| Calendar >10 days not showing | Known | +| Calendar agent creates cron not events | Known | + +_Last updated: 2026-02-20_ \ No newline at end of file diff --git a/Projects/Multi-User Agent Architecture.md b/Projects/Multi-User Agent Architecture.md new file mode 100644 index 0000000..c3e9b6b --- /dev/null +++ b/Projects/Multi-User Agent Architecture.md @@ -0,0 +1,203 @@ +--- +title: Multi-User Agent Architecture +category: Projects +project: System Architecture +type: Research/Design +status: planning +date: 2026-02-24 +tags: [openclaw, multi-user, architecture, collaboration, discord, design] +--- + +# Multi-User Agent Architecture + +**Question:** What's the best way to handle multiple users using one agent for tasks and project management? + +**Date:** 2026-02-24 +**Status:** Planning/Research + +--- + +## Executive Summary + +Four approaches ranging from simple (separate channels) to complex (multi-agent). Recommendation: **Start with Option 1 (Separate Channels)** and add frontmatter tagging (Option 3) as needed. + +--- + +## Option 1: Separate Channels Per User ⭐ RECOMMENDED + +**Best for:** Small teams (2-5 people), clear separation + +### Setup +``` +Discord Server: +├── #home-assistant (shared - only you/active) +├── #corey-projects (your own) +├── #alice-projects (Alice's channel) +├── #bob-projects (Bob's channel) +└── #shared-projects (collaborative) +``` + +### How It Works +- Each user gets their own channel +- Agent has separate sessions for each +- Context isolation = no cross-contamination +- Shared projects in #shared-projects + +### Pros +- ✅ Total privacy per user +- ✅ Simple to manage +- ✅ One agent, multiple sessions +- ✅ User-specific memory stays isolated + +### Cons +- More channels to manage +- Shared projects need explicit cross-posting + +--- + +## Option 2: User Tagging System (Hybrid) + +**Best for:** Shared workspace with user-aware tasks + +### Setup +- One shared channel (#projects) +- Users tag messages: `@alice` or `#for-alice` +- Or: "Task for Alice: ..." + +### How It Works +- Agent identifies user from message content +- Store tasks with user attribution +- Query by user when needed + +### Example Workflow +``` +Corey: #task for @alice - Review the architecture doc +Alice: (in same channel) I reviewed it, looks good +Corey: #task for @bob - Deploy the update +``` + +### Pros +- ✅ Single channel +- ✅ Collaborative feel +- ✅ Clear ownership + +### Cons +- Requires discipline with tagging +- Context can get messy +- Privacy is opt-in (explicit tags) + +--- + +## Option 3: User Profiles in Frontmatter + +**Best for:** Shared Obsidian vault, Dataview queries + +### Setup +- Tasks/projects have frontmatter with `assignee: alice` +- Query using Dataview: `WHERE assignee = "alice"` + +### Example Task +```markdown +--- +title: Review architecture +project: Memory System +assignee: alice +status: todo +due: 2026-02-25 +--- + +Alice needs to review the memory system architecture. +``` + +### Query +```dataview +TABLE status, due +FROM "Tasks" +WHERE assignee = "alice" AND status = "todo" +SORT due ASC +``` + +### Pros +- ✅ Perfect for Obsidian +- ✅ Dataview-powered dashboards +- ✅ Automatic organization + +### Cons +- Requires frontmatter discipline +- Real-time chat = harder to manage + +--- + +## Option 4: Multi-Agent (Advanced) + +**Best for:** Teams where each person wants their own agent + +### Setup +- Each user has their own OpenClaw instance +- Shared resources via Obsidian/SQLite +- Sync via git or shared database + +### How It Syncs +- Obsidian vault is shared (Syncthing/Nextcloud) +- Both agents read/write same files +- Different identities, same data + +### Pros +- ✅ Full separation +- ✅ Personalized agents +- ✅ Shared long-term memory + +### Cons +- Complex setup +- More resources (multiple agents) +- Merge conflicts possible + +--- + +## Recommendation + +**Start with:** Option 1 (Separate Channels) + +**Why:** +- Simplest to implement +- No context pollution +- Easy permissions (Discord native) +- Can add Option 3 (Frontmatter) later + +**Hybrid Approach:** +- Private channels per user (`#alice-projects`, `#bob-projects`) +- Shared channel for collaboration (`#team-projects`) +- Obsidian vault is shared with user-tagged frontmatter + +--- + +## Decision Matrix + +| Factor | Option 1 | Option 2 | Option 3 | Option 4 | +|--------|----------|----------|----------|----------| +| **Privacy** | High | Medium | High | High | +| **Setup Complexity** | Low | Low | Medium | High | +| **Collaboration** | Medium | High | Medium | Medium | +| **Scalability** | Medium | High | High | High | +| **Discord Channels** | Many | One | N/A | Many | + +--- + +## Next Steps + +1. **Define users:** How many people? Technical level? +2. **Privacy check:** Do users need isolation from each other? +3. **Collaboration needs:** Shared projects vs individual work? +4. **Pilot:** Start with Option 1, iterate based on feedback + +--- + +## Related + +- [[Memory System]] — How agent memory works +- [[Dataview Query Examples]] — Query by user/assignee + +--- + +*Created: 2026-02-24* +*Based on discussion in #home-assistant* diff --git a/Projects/Projects-Index.md b/Projects/Projects-Index.md new file mode 100644 index 0000000..9af01dc --- /dev/null +++ b/Projects/Projects-Index.md @@ -0,0 +1,70 @@ +--- +title: Projects Index +category: Projects +status: active +last_updated: 2026-02-24 +tags: [projects, index, active, completed] +--- + +# Projects Index + +## Active Projects + +### Mission Control Python +- Status: Live on :5050 +- Type: Dashboard +- Tech: Flask + MySQL + HA API +- Notes: 6 pages, cron integration, weather, calendar +- Issues: Calendar date range bug, calendar agent bug + +### Home Assistant +- Status: Entity cleanup ongoing +- Type: Home Automation +- Notes: 972 devices cleanup, Room-Assistant working + +### Memory System +- Status: Hierarchical restructure complete +- Type: Infrastructure +- Notes: File + SQLite hybrid, Supermemory backups + +### Coding Workflow +- Status: Active +- Type: DevOps +- Notes: Git/controls-web, Kimi/mini model split + +### Auto-Summarize Workflow {#sync} +- Status: Active +- Type: Agent Capability +- Notes: "/summarize [URL]" → fetch → summarize → save to Summaries/ +- Works with: Any web URL + +### Multi-User Agent Architecture +- Status: Planning +- Type: System Design +- Notes: Researching multi-user approaches for task/project management +- Options: Separate channels, tagging system, frontmatter, multi-agent +- Decision: Start with Option 1 (separate Discord channels) + +## Completed Projects + +### Discord Voice Bot (GLaDOS) +- Status: Completed 2026-02-08 +- Type: Voice Bot +- Notes: Always in #coding voice + +### Proton Mail Bridge +- Status: Completed 2026-02-18 +- Type: Email Integration +- Notes: IMAP/SMTP tested + +## How to Sync +1. Edit any project note in Obsidian +2. Tell me to sync +3. I read the updated note and update my memory + +### How to Summarize +1. Type: `/summarize [URL]` +2. I fetch, summarize, and save to `Summaries/` +3. Confirm and link back to you + +Last Updated: 2026-02-23 diff --git a/Projects/Proton Mail Bridge.md b/Projects/Proton Mail Bridge.md new file mode 100644 index 0000000..3445a60 --- /dev/null +++ b/Projects/Proton Mail Bridge.md @@ -0,0 +1,84 @@ +# Proton Mail Bridge + +## Overview +Email integration via Proton Mail Bridge for IMAP/SMTP access. Gives local IMAP/SMTP endpoints that can be used with standard email clients. + +--- + +## Connection Details +- **IMAP Server:** 127.0.0.1:1143 +- **SMTP Server:** 127.0.0.1:1025 +- **Username:** alexthenerdyai@proton.me +- **Security:** AUTH=PLAIN (local connection only) +- **Bridge Version:** Proton Mail Bridge 03.22.00 - gluon + +--- + +## Test Results (2026-02-18) +✅ Connected successfully to Bridge IMAP +✅ Authenticated with Bridge password +✅ Retrieved folder list (10 folders found) +✅ INBOX has 3 messages, all unread + +--- + +## Folders +- INBOX +- Sent +- Drafts +- Starred +- Archive +- Spam +- Trash +- All Mail +- Folders +- Labels + +--- + +## Capabilities +- Read emails from INBOX +- Search, mark read/unread, move messages +- Send emails via SMTP +- Full folder management + +--- + +## Files Created +- `tools/proton_imap_test.py` — Initial test script +- `tools/proton_imap_simple.py` — Working IMAP test script + +--- + +## Potential Uses +- Daily email digest +- Notifications +- Automated responses +- Email-based triggers (IFTTT style) + +--- + +## Next Steps +- [ ] Integrate with cron jobs for email-based actions +- [ ] Create email notification system +- [ ] Set up email-to-Discord forwarding +- [ ] Build email digest bot + +--- + +## Technical Notes +- Bridge runs locally (127.0.0.1) +- AUTH=PLAIN is safe because connection is local only +- Standard Python imaplib/smtplib libraries work +- No Proton-specific libraries needed + +--- + +## Status +✅ **FUNCTIONAL** — Bridge connected and tested + +Ready for automation integration. + +--- + +*Status: Complete & Tested | Updated: 2026-02-22* \ No newline at end of file diff --git a/Summaries/7 Best Apify Alternatives 2026.md b/Summaries/7 Best Apify Alternatives 2026.md new file mode 100644 index 0000000..12c9931 --- /dev/null +++ b/Summaries/7 Best Apify Alternatives 2026.md @@ -0,0 +1,148 @@ +# 7 Best Apify Alternatives (2026) + +**Source:** https://www.gumloop.com/blog/apify-alternatives +**Summarized:** 2026-02-23 + +--- + +## TL;DR + +Apify is powerful but built for developers. These 7 alternatives offer web scraping with varying levels of no-code friendliness, AI integration, and pricing. + +--- + +## What to Look For in an Apify Alternative + +- **Built-in web scraping** — Native scraping vs HTTP parsing from scratch +- **Tech stack integration** — Google Sheets, Slack, Notion, CRM; MCP servers = bonus +- **LLM integration** — Pass scraped data through GPT/Claude/Gemini for enrichment +- **Security & scale** — RBAC, audit logs, SOC 2 if enterprise +- **Custom code support** — Python/JS for advanced scenarios +- **Templates/AI assistants** — Pre-built templates or AI that builds workflows for you + +--- + +## The 7 Alternatives + +### 1. Gumloop ⭐ (Author's Pick) + +| | | +|---|---| +| **Best for** | AI agents + workflows that scrape, analyze, and act | +| **Pricing** | Free (2K credits) → $37/mo (Solo) → $244/mo (Team) | + +**Why it wins:** +- "Gummie" AI assistant builds workflows via natural language +- Built-in web scraping + any LLM integration (no extra API keys needed) +- MCP server support for connecting to any tool +- Create autonomous AI agents that handle scraping tasks independently + +**Gotcha:** Not scraping-specific; template library limited (but Gummie makes templates obsolete) + +--- + +### 2. Octoparse + +| | | +|---|---| +| **Best for** | No-code scraping with 500+ preset templates | +| **Pricing** | Free (10 tasks, local only) → $83/mo (Standard) → $299/mo (Pro) | + +**Why it wins:** +- Visual crawler builder for non-technical users +- 500+ templates: Google Maps, LinkedIn, Amazon scrapers +- IP rotation + CAPTCHA solving built-in +- Run locally or cloud + +**Gotcha:** Workflows are rigid; struggles with complex multi-step flows; no AI agent features + +--- + +### 3. n8n + +| | | +|---|---| +| **Best for** | Technical teams wanting self-hosted, open-source automation | +| **Pricing** | Free (self-hosted) → $24/mo (cloud) | + +**Why it wins:** +- Open source, self-hostable = full data control +- Visual workflow builder with web scraping nodes +- Connect to any API/service + +**Gotcha:** Requires technical setup; not scraping-specific + +--- + +### 4. Relay.app + +| | | +|---|---| +| **Best for** | Workflow automation with human-in-the-loop steps | +| **Pricing** | Free tier available | + +**Why it wins:** +- Combines automation with human approval steps +- Good for workflows that need review before action + +--- + +### 5. Thunderbit + +| | | +|---|---| +| **Best for** | AI-powered web data extraction | +| **Pricing** | Varies | + +**Why it wins:** +- AI-first approach to scraping +- Handles dynamic content well + +--- + +### 6. Browse AI + +| | | +|---|---| +| **Best for** | No-code web monitoring and data extraction | +| **Pricing** | Free tier available | + +**Why it wins:** +- Record actions → replay automatically +- Monitor sites for changes +- Pre-built robots for common tasks + +--- + +### 7. Claude (Direct) + +| | | +|---|---| +| **Best for** | One-off scraping/analysis with AI | +| **Pricing** | Subscription-based | + +**Why it wins:** +- Can scrape and analyze web content directly +- No setup required for simple tasks +- Great for ad-hoc research + +--- + +## Quick Comparison + +| Tool | No-Code | AI Built-In | Self-Host | Price | +|------|---------|-------------|-----------|-------| +| Gumloop | ✅ | ✅ | ❌ | $0-244/mo | +| Octoparse | ✅ | ❌ | ❌ | $0-299/mo | +| n8n | Partial | ❌ | ✅ | $0-24/mo | +| Browse AI | ✅ | ❌ | ❌ | Freemium | +| Claude | N/A | ✅ | ❌ | Subscription | + +--- + +## Bottom Line + +- **Gumloop** = Best for AI-powered scraping + automation in one platform +- **Octoparse** = Best no-code scraping with templates +- **n8n** = Best for devs who want open-source + self-host +- **Claude** = Best for one-off AI scraping without setup \ No newline at end of file diff --git a/Summaries/Anthropic - Distillation Attacks.md b/Summaries/Anthropic - Distillation Attacks.md new file mode 100644 index 0000000..32fb7fe --- /dev/null +++ b/Summaries/Anthropic - Distillation Attacks.md @@ -0,0 +1,90 @@ +--- +title: Detecting and Preventing Distillation Attacks +category: Summary +type: Security/AI +source_url: https://www.anthropic.com/news/detecting-and-preventing-distillation-attacks +source: Anthropic News +date: 2026-02-23 +tags: [anthropic, ai, security, distillation, deepseek, moonshot, minimax] +--- + +# Detecting and Preventing Distillation Attacks + +**URL:** https://www.anthropic.com/news/detecting-and-preventing-distillation-attacks +**Source:** Anthropic News +**Date Summarized:** 2026-02-23 + +--- + +## tl;dr + +Anthropic identified three AI labs (DeepSeek, Moonshot, MiniMax) running industrial-scale campaigns to extract Claude's capabilities through "distillation" — generating over 16 million exchanges via 24,000+ fraudulent accounts to train their own models on Claude's outputs. + +--- + +## What is Distillation? + +**Definition:** Training a smaller/less capable model on outputs from a stronger one. + +**Legitimate Use:** Frontier labs distill their own models to create smaller, cheaper versions for customers. + +**Illicit Use:** Competitors extract powerful capabilities from other labs at fraction of the cost/time. + +--- + +## Why It Matters + +### National Security Risks +- Illicitly distilled models **lack safeguards** +- Protections against bioweapons, cyber attacks, etc. are stripped out +- Dangerous capabilities proliferate without protections + +### Authoritarian Use +- Foreign labs can feed distilled models into military/intelligence/surveillance +- Enables offensive cyber operations, disinformation, mass surveillance +- Open-sourced distilled models spread beyond any government's control + +--- + +## Export Control Implications + +- Distillation attacks **undermine export controls** +- Allows foreign labs (including CCP-controlled) to close competitive gaps +- Rapid "advancements" by these labs are actually **extracted capabilities**, not innovation +- Restricted chip access limits both: + - Direct model training + - Scale of illicit distillation campaigns + +--- + +## What Anthropic Found + +| Detail | Data | +|--------|------| +| **Labs involved** | DeepSeek, Moonshot, MiniMax | +| **Exchange volume** | 16+ million interactions | +| **Fraudulent accounts** | ~24,000 accounts | +| **Violation** | Terms of service + regional access restrictions | + +--- + +## The Threat + +- Campaigns growing in **intensity and sophistication** +- Window to act is **narrow** +- Threat extends **beyond any single company or region** +- Requires **coordinated action** by industry, policymakers, global AI community + +--- + +## Key Takeaways + +1. Distillation is a **dual-use technique** — legitimate for efficiency, dangerous when weaponized +2. **Scale matters** — 16M+ exchanges shows industrial-level extraction, not casual use +3. **Safeguards evaporate** — distilled models lose critical safety protections +4. **Export controls undermined** — distillation bypasses chip restrictions through data theft +5. **National security threat** — authoritarian actors gain frontier AI capabilities + +--- + +*Source: https://www.anthropic.com/news/detecting-and-preventing-distillation-attacks* diff --git a/Summaries/Home Assistant - 4 Automation Mistakes.md b/Summaries/Home Assistant - 4 Automation Mistakes.md new file mode 100644 index 0000000..1e347f1 --- /dev/null +++ b/Summaries/Home Assistant - 4 Automation Mistakes.md @@ -0,0 +1,66 @@ +# 4 Common Home Assistant Mistakes That Silently Break Your Automations + +**Source:** https://www.xda-developers.com/home-assistant-mistakes-that-can-break-your-automations/ +**Summarized:** 2026-02-23 + +--- + +## TL;DR + +Four common mistakes that break Home Assistant automations: conflicting conditions, unavailable entities, ignoring DST changes, and wrong automation modes. Most are fixable with documentation, better tooling, and understanding HASS automation modes. + +--- + +## 1. Conflicting Automation Conditions + +**Problem:** Multiple workflows trying to control the same device simultaneously, causing: +- Failed triggers when another automation is using the device +- Endless flip-flopping where two automations fight over device state + +**Solutions:** +- Document your automations thoroughly +- Avoid overly complex multi-device setups +- Switch to **Node-RED** for visual troubleshooting (canvas view vs YAML hunting) + +--- + +## 2. Entities Becoming Unavailable + +**Problem:** Cheap wireless devices drop connection; battery-powered sensors die → automations fail because the device isn't reachable. + +**Solutions:** +- Invest in reliable devices (not cheap knockoffs prone to disconnects) +- Keep battery-powered sensors charged +- Use a central bridge for devices with different protocols (reduces lag-induced missed triggers) + +--- + +## 3. Forgetting DST Changes in Time-Based Automations + +**Problem:** Daylight Saving Time shifts your triggers by an hour → automations fire at wrong times. + +**Solutions:** +- Set reminders to update automations before DST changes +- Use **HACS blueprints** that alert you when clocks shift +- Better: Use **sun position triggers** instead of hard-coded times (adaptive lighting approach) + +--- + +## 4. Choosing the Wrong Automation Mode + +**Problem:** Default mode is `single`, which warns/ignores new triggers while automation is running. Breaks motion sensors, timers, and anything that fires rapidly. + +**Modes Explained:** + +| Mode | Behavior | Best For | +|------|----------|----------| +| `single` (default) | Ignores new triggers while running | Simple toggles | +| `restart` | Aborts current action, starts fresh | Motion sensors, rapid re-triggers | +| `queued` | Logs triggers, executes sequentially | Tasks where order matters | +| `parallel` | Runs multiple actions simultaneously | Complex workflows with independent actions | + +--- + +## Key Takeaway + +Home Assistant automations are powerful but fragile. Documentation, reliable hardware, and understanding automation modes prevent most silent failures. \ No newline at end of file diff --git a/Summaries/Homelab MCP Server.md b/Summaries/Homelab MCP Server.md new file mode 100644 index 0000000..a579345 --- /dev/null +++ b/Summaries/Homelab MCP Server.md @@ -0,0 +1,88 @@ +--- +title: Homelab MCP Server +category: Summary +type: Infrastructure/MCP +source_url: https://lobehub.com/mcp/theonlytruebigmac-homelab-mcp +github: https://github.com/theonlytruebigmac/homelab-mcp +date: 2026-02-23 +tags: [mcp, homelab, infrastructure, ai, self-hosted] +--- + +# Homelab MCP Server + +**URL:** https://lobehub.com/mcp/theonlytruebigmac-homelab-mcp +**GitHub:** https://github.com/theonlytruebigmac/homelab-mcp +**Date Summarized:** 2026-02-23 + +## tl;dr + +A unified MCP (Model Context Protocol) server that connects AI agents to your self-hosted homelab infrastructure through 30+ consolidated tools. + +--- + +## What it is + +- **MCP Server** for homelab infrastructure +- Connects AI assistants (Claude, Gemini, ChatGPT, Cursor) to your self-hosted services +- Also exposes a full REST API for automation tools like n8n + +--- + +## Key Features + +- **30 consolidated MCP tools** — action-based compound tools for efficient context windows +- **MCP Resources** — real-time data feeds (clients, devices, queues, health) +- **MCP Prompts** — pre-built templates for troubleshooting, security audits, health checks +- **REST API** — every tool exposed as REST endpoint with Swagger docs +- **Conditional registration** — only enabled services register their tools +- **Docker-first deployment** — single `docker compose up` +- **Audit logging** — every tool call traced and logged + +--- + +## Supported Services (9 total) + +| Service | Category | Tools | Capabilities | +|---------|----------|-------|--------------| +| **Unifi** | Networking | 9 | Clients, devices, firewall, VLANs, security, guest access | +| **Proxmox** | Virtualization | 3 | VMs, containers, snapshots, storage, power mgmt | +| **Plex** | Media Server | 2 | Playback, library search, scans, stream control | +| **Radarr/Sonarr** | Media Mgmt | 4 | Movie/TV search, add content, calendar, queue | +| **SABnzbd** | Downloads | 2 | Queue management, speed limits, history | +| **Portainer** | Docker | 4 | Containers, stacks, volumes, logs | +| **OPNsense** | Firewall | 2 | Interfaces, DHCP, gateway, firmware | +| **Home Assistant** | IoT/Smart Home | 3 | Entities, automations, scenes, service calls | +| **Traefik** | Reverse Proxy | 1 | Router inspection, backends, health | + +--- + +## Tech Stack + +- **Python 3.11+** +- **Docker/Docker Compose** +- **MCP 2.0+** +- **MIT License** + +--- + +## Quick Install + +```bash +git clone https://github.com/theonlytruebigmac/homelab-mcp.git +cd homelab-mcp +cp .env.example .env +# Edit .env with your service credentials +docker compose up +``` + +--- + +## Notes + +- Each service has an `*_ENABLED` flag — set to `false` to disable +- Supports both MCP protocol and REST API +- Designed for AI agents to directly manage homelab infrastructure + +--- + +*Summarized from lobehub.com/mcp/theonlytruebigmac-homelab-mcp* diff --git a/Summaries/Khoj AI - Self-Hostable Research Tool.md b/Summaries/Khoj AI - Self-Hostable Research Tool.md new file mode 100644 index 0000000..5f59c15 --- /dev/null +++ b/Summaries/Khoj AI - Self-Hostable Research Tool.md @@ -0,0 +1,106 @@ +# Khoj AI - Self-Hostable AI Research App + +**Source:** https://www.makeuseof.com/started-using-self-hostable-app-for-research-should-have-sooner/ +**Summarized:** 2026-02-23 + +--- + +## TL;DR + +Khoj AI is a middle ground between ChatGPT (too minimal) and NotebookLM (too heavy). Self-hostable, supports custom agents, automations, and your own models via Ollama. Think of it as "NotebookLM + Claude had a baby." + +--- + +## What is Khoj AI? + +A research assistant that combines web search, document analysis, and LLM chat. Two ways to use: +- **Cloud:** Free tier with Gemini Flash 3 and basic models +- **Self-hosted:** Docker + bring your own model (Ollama supported) + +--- + +## Key Features + +### 1. Built-in Agents +Pre-configured personas: +- Khoj (default) +- Technical Lead +- Teacher +- Legal Expert + +Switch agents per conversation for role-specific responses. + +### 2. Slash Commands +| Command | Function | +|---------|----------| +| `/notes` | Pull info only from your uploaded documents | +| `/code` | Launch built-in Python interpreter (can generate graphs via Matplotlib) | +| `/web` | Web search integration | + +### 3. Custom Agents +Create your own: +1. Add files to knowledge base +2. Choose model +3. Set input/output modes +4. Done + +### 4. Automations +Schedule recurring tasks: +- Daily stock market summaries at 9 AM +- RSS feed fetching at set times +- Results delivered to email automatically + +No code required. + +--- + +## Self-Hosting Setup + +**Requirements:** Docker + decent hardware (local LLMs need beefy machines) + +```bash +mkdir ~/.khoj && cd ~/.khoj +wget https://raw.githubusercontent.com/khoj-ai/khoj/main/docker-compose.yml +nano docker-compose.yml # Set admin email/password, add API keys +docker-compose up +``` + +**Access:** http://localhost:3600 + +**Model options:** +- Use third-party providers (OpenAI, Anthropic, Gemini) with API keys +- Use local models via Ollama + +--- + +## Why Choose Khoj Over NotebookLM? + +| Khoj | NotebookLM | +|------|------------| +| Self-hostable | Cloud only | +| Custom agents | Fixed structure | +| Automations | Manual queries | +| Bring your own model | Google models only | +| Middle ground complexity | Heavy, structured | + +--- + +## Use Cases + +- **Students:** Research, understanding topics (not copy-pasting assignments) +- **Work:** Document analysis, research workflows +- **Personal projects:** Custom agents for specific domains + +--- + +## Caveats + +- LLMs can hallucinate — always verify important info (legal, medical) +- Local models need strong hardware +- Accuracy depends on model choice + +--- + +## Bottom Line + +Khoj fills the gap between minimal chat interfaces and heavy research tools. Self-hosting gives you full stack ownership—own, don't rent. \ No newline at end of file diff --git a/Summaries/Obsidian + Syncthing - Note-Taking Without Account.md b/Summaries/Obsidian + Syncthing - Note-Taking Without Account.md new file mode 100644 index 0000000..d25c82b --- /dev/null +++ b/Summaries/Obsidian + Syncthing - Note-Taking Without Account.md @@ -0,0 +1,58 @@ +# I Replaced My Entire Note-Taking System with a Tool That Syncs Without an Account + +**Source:** https://www.makeuseof.com/replaced-entire-note-taking-system-with-tool-that-syncs-without-account/ +**Summarized:** 2026-02-23 + +--- + +## TL;DR + +The author ditched subscription-based note apps for a free, open-source combo: **Obsidian** for writing + **Syncthing** for syncing. Result: full data ownership, no monthly fees, seamless cross-device sync without any cloud middleman. + +--- + +## The Problem + +Most note apps (Notion, Evernote, Apple Notes) lock data in proprietary formats on their servers. Two devices? Pay a subscription. Your data, their rules. + +--- + +## The Solution: Obsidian + Syncthing + +| Tool | Role | Why It Works | +|------|------|--------------| +| **Obsidian** | Note-taking | Local-first, Markdown files (.md), plain text = future-proof | +| **Syncthing** | Sync | P2P file sync, encrypted, no account needed | + +**Key Benefits:** +- Own your data — Notes are just files in a folder +- No subscriptions — Both tools free and open-source +- Cross-platform — Windows, macOS, Linux, Android, iOS +- Encrypted sync — Direct device-to-device, no server sees content +- Conflict handling — Creates `.sync-conflict` files instead of silent overwrites + +--- + +## Setup Highlights + +1. **Obsidian vault** = folder of Markdown files +2. **Syncthing** folder type: Send & Receive +3. **File versioning** enabled (keeps 5-10 backups) +4. **Ignore patterns** for `.obsidian/cache` and `workspace*` (prevents UI conflicts) +5. **Device pairing** via ID exchange — works identically desktop & Android + +**Android:** Use Syncthing-Fork (Play Store/F-Droid) with better battery optimization. + +--- + +## Pro Tips + +- Syncthing runs continuously → vault always up-to-date +- Bidirectional links + graph view in Obsidian = powerful knowledge mapping +- Plugins/themes sync too (`.obsidian` folder minus cache) + +--- + +## Bottom Line + +If you're tired of paying to access your own notes, this combo offers "unfairly good" value once the initial setup clicks into place. diff --git a/Summaries/Obsidian Dataview.md b/Summaries/Obsidian Dataview.md new file mode 100644 index 0000000..cfcbf95 --- /dev/null +++ b/Summaries/Obsidian Dataview.md @@ -0,0 +1,146 @@ +--- +title: Obsidian Dataview +category: Summary +type: Tool/Plugin +source: https://github.com/blacksmithgu/obsidian-dataview +date: 2026-02-23 +tags: [obsidian, dataview, plugin, query, database] +--- + +# Obsidian Dataview + +**URL:** https://github.com/blacksmithgu/obsidian-dataview +**Description:** A data index and query language over Markdown files for Obsidian +**Date Summarized:** 2026-02-24 + +--- + +## tl;dr + +Treat your Obsidian Vault as a **database** that you can query. Query, filter, sort, and extract data from Markdown pages using YAML frontmatter and inline fields. + +--- + +## What It Does + +Dataview generates data from your vault by pulling information from: + +1. **Markdown Frontmatter** — YAML at the top of documents: +```yaml +--- +alias: "document" +last-reviewed: 2021-08-17 +rating: 8 +status: active +--- +``` + +2. **Inline Fields** — Key:: Value syntax in documents: +```markdown +Basic Field:: Value +**Bold Field**:: Nice! +You can also write [field:: inline fields] +(field2:: hidden field) +``` + +--- + +## Query Modes + +### 1. Dataview Query Language (DQL) +Pipeline-based, SQL-like expressions: +```dataview +TABLE file.name AS "File", rating AS "Rating" +FROM #book +SORT rating DESC +``` + +### 2. Inline Expressions +Embed directly in markdown: +`= this.file.name` → shows filename + +### 3. DataviewJS +JavaScript for complex logic: +```dataviewjs +for (let group of dv.pages("#book") + .where(p => p["time-read"].year == 2021) + .groupBy(p => p.genre)) { + dv.header(3, group.key); + dv.table(["Name", "Rating"], group.rows + .sort(k => k.rating, 'desc') + .map(k => [k.file.link, k.rating])) +} +``` + +--- + +## Example Use Cases + +**Table of games with metadata:** +```dataview +TABLE time-played, length, rating +FROM "games" +SORT rating DESC +``` + +**List by tags:** +```dataview +LIST FROM #game/moba or #game/crpg +``` + +**Tasks from active projects:** +```dataview +TASK FROM #projects/active +``` + +**Books read in 2021, grouped by genre:** +```dataviewjs +for (let group of dv.pages("#book") + .where(p => p["time-read"].year == 2021) + .groupBy(p => p.genre)) { + dv.header(3, group.key); + dv.table(["Name", "Time Read", "Rating"], + group.rows.sort(k => k.rating, 'desc') + .map(k => [k.file.link, k["time-read"], k.rating])) +} +``` + +--- + +## Key Features + +- ✅ Query any Markdown files in your vault +- ✅ Filter by tags, folders, metadata +- ✅ Sort by any field +- ✅ Group results +- ✅ Render as tables, lists, or tasks +- ✅ JavaScript API for complex logic +- ✅ Inline fields for hidden metadata +- ✅ Automatic data index updates + +--- + +## Potential Uses for Corey's Vault + +1. **Home Assistant Automations Table** — Query all automations by status +2. **Projects Dashboard** — Active vs completed projects +3. **Daily Notes Query** — Recent entries, completed tasks +4. **Research Summaries** — All `/summarize` outputs by date +5. **Cron Jobs Status** — Active vs disabled jobs + +--- + +## Installation + +Available in Obsidian Community Plugins: +1. Settings → Community Plugins → Browse +2. Search "Dataview" +3. Install & Enable + +--- + +**Full Docs:** https://blacksmithgu.github.io/obsidian-dataview/ + +--- + +*Source: https://github.com/blacksmithgu/obsidian-dataview* diff --git a/Summaries/OpenClaw Multi-Agent Workflows - 4 Levels Explained.md b/Summaries/OpenClaw Multi-Agent Workflows - 4 Levels Explained.md new file mode 100644 index 0000000..786d42b --- /dev/null +++ b/Summaries/OpenClaw Multi-Agent Workflows - 4 Levels Explained.md @@ -0,0 +1,105 @@ +# OpenClaw Multi-Agent Workflows - 4 Levels Explained + +**Source:** https://www.reddit.com/r/openclaw/comments/1r2euvp/this_is_how_ive_learned_to_create_multiagent/ +**Summarized:** 2026-02-23 + +--- + +## TL;DR + +OpenClaw has **4 levels of multi-agent support** built-in, from simple persistent agents to full A2A Protocol orchestration. No Docker required for levels 1-3—they all run in a single gateway process. + +--- + +## Level 1: Multiple Persistent Agents (Built-in) + +Define isolated agents in config, each with their own workspace, system prompt, model, and tools: + +```yaml +agents: + list: + - id: researcher + default: true + workspace: ~/.openclaw/workspace-research + - id: coder + workspace: ~/.openclaw/workspace-code + +bindings: + - agentId: researcher + match: { channel: telegram, accountId: research-bot } + - agentId: coder + match: { channel: discord, guildId: "123456" } +``` + +Each agent has **full isolation**: separate session history, model config, tool permissions. + +--- + +## Level 2: Agent-to-Agent Communication (Built-in) + +Enable `tools.agentToAgent` for agents to talk via `sessions_send`: + +```yaml +tools: + agentToAgent: + enabled: true + allow: ["researcher", "coder", "writer"] +``` + +- Ping-pong conversations (up to 5 turns by default) +- `sessions_spawn` for background sub-agents that report back +- Closest to "orchestrator delegates to specialist" pattern + +--- + +## Level 3: Cross-Agent Delegation (3-Level Hierarchy) + +Work around single-level limits: + +``` +Orchestrator (main agent) +├─ sessions_send → Specialist A (sibling main agent) +│ ├─ sessions_spawn → subagent A1 +│ └─ sessions_spawn → subagent A2 +└─ sessions_send → Specialist B (sibling main agent) + ├─ sessions_spawn → subagent B1 + └─ sessions_spawn → subagent B2 +``` + +Config uses `subagents.allowAgents` for cross-agent spawning. + +--- + +## Level 4: True Multi-Agent Orchestration (A2A Protocol) + +For advanced use cases with intelligent routing, review, retries, synthesis: + +- **a2a-adapter**: Wraps OpenClaw agents as A2A Protocol servers +- Mix-and-match: OpenClaw + CrewAI + LangChain + n8n +- Can run as local Python processes or remote agents + +Example: +```python +from a2a_adapter import load_a2a_agent, serve_agent + +adapter = await load_a2a_agent({ + "adapter": "openclaw", + "agent_id": "researcher", + "thinking": "low", + "async_mode": True, +}) +serve_agent(agent_card=agent_card, adapter=adapter, port=9001) +``` + +--- + +## Key Takeaways + +| Level | Complexity | Setup | +|-------|-----------|-------| +| 1 | Low | Config only | +| 2 | Low-Medium | Config + enable tool | +| 3 | Medium | Config + cross-agent permissions | +| 4 | High | A2A Protocol + external orchestrator | + +**Bottom line:** OpenClaw's built-in multi-agent (levels 1-3) requires only `~/.openclaw/config.yaml` changes—no additional infrastructure needed. diff --git a/Tasks/All Tasks.md b/Tasks/All Tasks.md new file mode 100644 index 0000000..23f32e8 --- /dev/null +++ b/Tasks/All Tasks.md @@ -0,0 +1,27 @@ +# All Tasks + +## Home Assistant +- [ ] Entity cleanup (972 devices in spreadsheet) +- [ ] Fix hallway sensor battery (1%) + +## Memory System +- [ ] Complete hierarchical restructure +- [ ] Optimize SQLite queries + +## Proton Mail Bridge +- [ ] Cron integration for email actions +- [ ] Email notification system +- [ ] Email-to-Discord forwarding + +## Mission Control Dashboard +- [ ] Fix calendar date range bug +- [ ] Fix calendar agent (uses cron not ha_calendar) + +## Completed Tasks +- [x] Voice bot operational +- [x] Proton Mail Bridge connected +- [x] Mission Control dashboard live +- [x] Obsidian vault setup + +--- +Last Updated: 2026-02-22 \ No newline at end of file diff --git a/Templates/Weekly Review.md b/Templates/Weekly Review.md new file mode 100644 index 0000000..d2d7a68 --- /dev/null +++ b/Templates/Weekly Review.md @@ -0,0 +1,18 @@ +# Weekly Review - Week of {{date:YYYY-MM-DD}} + +## What Got Done + +### Projects +- [ ] + +### Improvements +- [ ] + +## What Didn't Happen + +## Notes & Learnings + +## Next Week Focus + +--- +_Template created: 2026-02-22_ \ No newline at end of file diff --git a/WORK/Tasks/2026-02-24 - Make Amazon order today.md b/WORK/Tasks/2026-02-24 - Make Amazon order today.md new file mode 100644 index 0000000..413ed65 --- /dev/null +++ b/WORK/Tasks/2026-02-24 - Make Amazon order today.md @@ -0,0 +1,22 @@ +# Task: Make Amazon order today! + +**Created:** 2026-02-24 +**Source:** #work-assistant +**Status:** TODO + +--- + +## Priority Items +- [ ] eGPU dock for Zac + +## Other Items + +*(Add other items here)* + +## Notes + +*(Links, prices, etc.)* + +--- + +*Created from Discord message: 1475864688150581410* diff --git a/WORK/Tasks/2026-02-24 - Setup Asset Keeper for Sean.md b/WORK/Tasks/2026-02-24 - Setup Asset Keeper for Sean.md new file mode 100644 index 0000000..cc31b5f --- /dev/null +++ b/WORK/Tasks/2026-02-24 - Setup Asset Keeper for Sean.md @@ -0,0 +1,22 @@ +# Task: Setup Asset Keeper for Sean + +**Created:** 2026-02-24 +**Source:** #work-assistant +**Status:** TODO + +--- + +## Description +Setup Asset Keeper for Sean + +## Notes + +*(Add details here: requirements, links, blockers, etc.)* + +## Related + +- + +--- + +*Created from Discord message: 1475862240669208739* diff --git a/WORK/Tasks/2026-02-24 - Sugar truck card for Early pina truck 62.md b/WORK/Tasks/2026-02-24 - Sugar truck card for Early pina truck 62.md new file mode 100644 index 0000000..5c8b056 --- /dev/null +++ b/WORK/Tasks/2026-02-24 - Sugar truck card for Early pina truck 62.md @@ -0,0 +1,22 @@ +# Task: Sugar truck card for Early pina truck #62 + +**Created:** 2026-02-24 +**Source:** #work-assistant +**Status:** TODO + +--- + +## Description +Sugar truck card for Early pina truck #62 + +## Notes + +*(Add details here: requirements, links, blockers, etc.)* + +## Related + +- + +--- + +*Created from Discord message: 1475863503821869179* diff --git a/WORK/Tasks/Task Tracker.md b/WORK/Tasks/Task Tracker.md new file mode 100644 index 0000000..7c19aad --- /dev/null +++ b/WORK/Tasks/Task Tracker.md @@ -0,0 +1,22 @@ +# Task Tracker + +*Work tasks extracted from #work-assistant channel* + +--- + +## Active Tasks + +| Task | Source | Date Added | Status | +|------|--------|------------|--------| +| Setup Asset Keeper for Sean | #work-assistant | 2026-02-24 | TODO | + +## Completed Recently + +- [x] Sugar truck card for Early pina truck #62 — *completed 2026-02-24* +- [x] Make Amazon order today! — *completed 2026-02-24* + +--- + +**Add tasks by:** +- Mentioning "task: [description]" in #work-assistant +- Or tell me directly and I'll log it here diff --git a/WORK/Work Canvas.canvas b/WORK/Work Canvas.canvas new file mode 100644 index 0000000..c0a215f --- /dev/null +++ b/WORK/Work Canvas.canvas @@ -0,0 +1,6 @@ +{ + "nodes":[ + {"id":"d46af6a894f8625f","x":-460,"y":-740,"width":500,"height":680,"type":"file","file":"WORK/Tasks/Task Tracker.md"} + ], + "edges":[] +} \ No newline at end of file