From a45deea7abfa40b3e732d62fd4f8cc2d3d8e26d3 Mon Sep 17 00:00:00 2001 From: Jason Ma Date: Mon, 19 Jan 2026 23:14:20 +0800 Subject: [PATCH 1/4] Refactoring --- .cursor/rules/lwgui-base-rules.mdc | 14 ++++++++++++++ Editor/ScriptableObject/LwguiRampAtlas.cs | 22 +++++++++++----------- Editor/ShaderDrawer.cs | 5 ++--- 3 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 .cursor/rules/lwgui-base-rules.mdc diff --git a/.cursor/rules/lwgui-base-rules.mdc b/.cursor/rules/lwgui-base-rules.mdc new file mode 100644 index 0000000..6b5f981 --- /dev/null +++ b/.cursor/rules/lwgui-base-rules.mdc @@ -0,0 +1,14 @@ +--- +name: lwgui-base-rule +description: LWGUI Base Rules +alwaysApply: true +--- + +该项目是个开源Unity Shader GUI插件, 具体介绍在README.md中. + +你在修改代码时需要遵循以下要求: + +- 沿用现有代码风格 +- 保持代码简洁, 不做不必要的修改 +- 使用清晰的命名替代简单代码的注释 +- 仅对于大段复杂代码和一些不常见的情况做注释 diff --git a/Editor/ScriptableObject/LwguiRampAtlas.cs b/Editor/ScriptableObject/LwguiRampAtlas.cs index 867182c..40700fb 100644 --- a/Editor/ScriptableObject/LwguiRampAtlas.cs +++ b/Editor/ScriptableObject/LwguiRampAtlas.cs @@ -13,19 +13,19 @@ namespace LWGUI { + [Serializable] + public class Ramp + { + public string name = "New Ramp"; + public LwguiGradient gradient = LwguiGradient.white; + public ColorSpace colorSpace = ColorSpace.Gamma; + public LwguiGradient.ChannelMask channelMask = LwguiGradient.ChannelMask.All; + public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; + } + [CreateAssetMenu(fileName = "LWGUI_RampAtlas.asset", menuName = "LWGUI/Ramp Atlas", order = 84)] public class LwguiRampAtlas : ScriptableObject { - [Serializable] - public class Ramp - { - public string name = "New Ramp"; - public LwguiGradient gradient = LwguiGradient.white; - public ColorSpace colorSpace = ColorSpace.Gamma; - public LwguiGradient.ChannelMask channelMask = LwguiGradient.ChannelMask.All; - public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; - } - public const string RampAtlasSOExtensionName = "asset"; public const string RampAtlasTextureExtensionName = "tga"; @@ -342,7 +342,7 @@ public static LwguiRampAtlas CreateRampAtlasSO(MaterialProperty rampAtlasProp, L var maxIndex = defaultRampAtlasIndexerDrawers.Max((tuple => tuple.defaultIndex)); for (int i = 0; i < maxIndex + 1; i++) { - newRampAtlasSO.ramps.Add(new LwguiRampAtlas.Ramp()); + newRampAtlasSO.ramps.Add(new Ramp()); if (newRampAtlasSO.ramps.Count >= newRampAtlasSO.rampAtlasHeight) newRampAtlasSO.rampAtlasHeight *= 2; } diff --git a/Editor/ShaderDrawer.cs b/Editor/ShaderDrawer.cs index aa50808..e13ae2e 100644 --- a/Editor/ShaderDrawer.cs +++ b/Editor/ShaderDrawer.cs @@ -985,7 +985,7 @@ public LwguiRampAtlas rampAtlasSO set => _rampAtlasSO = value; } - private LwguiRampAtlas.Ramp _currentRamp; + private Ramp _currentRamp; private bool _rampAtlasSOHasMixedValue; public RampAtlasIndexerDrawer(string group, string rampAtlasPropName) : this(group, rampAtlasPropName, "Ramp") {} @@ -1071,10 +1071,9 @@ protected override void CreateNewRampMap(MaterialProperty prop, MaterialEditor e { var newIndex = rampAtlasSO.ramps.Count; - rampAtlasSO.ramps.Add(new LwguiRampAtlas.Ramp() + rampAtlasSO.ramps.Add(new Ramp() { name = defaultRampName, - gradient = LwguiGradient.white, colorSpace = colorSpace, channelMask = viewChannelMask, timeRange = timeRange From 6cac23391e3f6712ff027af148f3c89b749f6f9d Mon Sep 17 00:00:00 2001 From: Jason Ma Date: Tue, 20 Jan 2026 20:24:49 +0800 Subject: [PATCH 2/4] [Shader Perf Monitor] Fix Keyword Override Add Context Menu: Reimport Shader --- Editor/Helper/ToolbarHelper.cs | 16 +++++++-- Editor/LWGUI.cs | 14 ++++++++ .../PerformanceMonitor/ShaderPerfMonitor.cs | 33 +++++++++++++------ 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/Editor/Helper/ToolbarHelper.cs b/Editor/Helper/ToolbarHelper.cs index b657065..60c1d26 100644 --- a/Editor/Helper/ToolbarHelper.cs +++ b/Editor/Helper/ToolbarHelper.cs @@ -371,8 +371,6 @@ public static bool DrawSearchField(Rect rect, LWGUIMetaDatas metaDatas) public static bool IsUserKeywordEnabled(string shaderUID, string keyword) => EditorPrefs.GetBool(GetKeywordEnabledPreferenceKey(shaderUID, keyword), false); - public static bool IsUserKeywordOverrideAndEnabled(string shaderUID, string keyword) => IsUserKeywordOverride(shaderUID, keyword) && IsUserKeywordEnabled(shaderUID, keyword); - private static void SetShowKeywordOverridesEnabled(string shaderUID, bool enabled) { if (enabled) @@ -422,7 +420,19 @@ private static void DrawKeywordOverridesList(LWGUIMetaDatas metaDatas) var allKeywords = shader.keywordSpace.keywords.Select(k => k.name).ToList(); foreach (var keyword in allKeywords) { - EditorGUILayout.BeginHorizontal(); + var rect = EditorGUILayout.BeginHorizontal(); + + // Context Menu + if (Event.current.type == EventType.ContextClick && rect.Contains(Event.current.mousePosition)) + { + Event.current.Use(); + var menu = new GenericMenu(); + menu.AddItem(new GUIContent("Copy Keyword"), false, () => + { + EditorGUIUtility.systemCopyBuffer = keyword; + }); + menu.ShowAsContext(); + } bool currentOverride = IsUserKeywordOverride(shaderUID, keyword); bool currentEnabled = currentOverride ? IsUserKeywordEnabled(shaderUID, keyword) : activeKeywords.Contains(keyword); diff --git a/Editor/LWGUI.cs b/Editor/LWGUI.cs index a7ad7ee..b03baa6 100644 --- a/Editor/LWGUI.cs +++ b/Editor/LWGUI.cs @@ -232,5 +232,19 @@ public override void ValidateMaterial(Material material) if (!hasChange) hasChange = true; } } + + [MenuItem("CONTEXT/Material/Reimport Shader", false, 100)] + static void MenuItem_ReimportShader(MenuCommand command) + { + var mat = command.context as Material; + if (mat != null) + { + var path = AssetDatabase.GetAssetPath(mat.shader); + if (!string.IsNullOrEmpty(path)) + { + AssetDatabase.ImportAsset(path); + } + } + } } } \ No newline at end of file diff --git a/Editor/PerformanceMonitor/ShaderPerfMonitor.cs b/Editor/PerformanceMonitor/ShaderPerfMonitor.cs index 730ad9c..c5aced0 100644 --- a/Editor/PerformanceMonitor/ShaderPerfMonitor.cs +++ b/Editor/PerformanceMonitor/ShaderPerfMonitor.cs @@ -32,20 +32,33 @@ public static List GetMaterialAndGlobalAndUserOverrideActiveKeywords(Mat foreach (var localKeyword in material.enabledKeywords) { - output.Add(localKeyword.name); + if (ToolbarHelper.IsUserKeywordOverride(shaderUID, localKeyword.name)) + { + if (ToolbarHelper.IsUserKeywordEnabled(shaderUID, localKeyword.name)) + output.Add(localKeyword.name); + } + else + { + output.Add(localKeyword.name); + } } foreach (var keyword in material.shader.keywordSpace.keywords) { - if (!keyword.isValid) - continue; - - // Is a global keyword? - if (keyword.isOverridable && Shader.IsKeywordEnabled(keyword.name)) - output.Add(keyword.name); - - if (ToolbarHelper.IsUserKeywordOverrideAndEnabled(shaderUID, keyword.name)) - output.Add(keyword.name); + if (ToolbarHelper.IsUserKeywordOverride(shaderUID, keyword.name)) + { + if (ToolbarHelper.IsUserKeywordEnabled(shaderUID, keyword.name)) + output.Add(keyword.name); + } + else + { + if (!keyword.isValid) + continue; + + // Is a global keyword? + if (keyword.isOverridable && Shader.IsKeywordEnabled(keyword.name)) + output.Add(keyword.name); + } } return output.Distinct().ToList(); From bd698994814a73cfaf23e96d7545afcfb27e35c8 Mon Sep 17 00:00:00 2001 From: Jason Ma Date: Thu, 22 Jan 2026 23:45:59 +0800 Subject: [PATCH 3/4] - Add Custom RampAtlas Type Support - Remove BOM --- .obsidian/plugins/obsidian-git/main.js | 462 ++++---- .obsidian/plugins/obsidian-git/manifest.json | 2 +- .obsidian/plugins/obsidian-git/styles.css | 974 ++++++++------- Editor/AssetProcessor/ExcludeFromBuild.cs | 2 +- Editor/CustomGUISample/CustomFooter.cs | 2 +- Editor/Helper/ContextMenuHelper.cs | 2 +- Editor/Helper/GUIStyles.cs | 19 +- Editor/Helper/IOHelper.cs | 2 +- Editor/Helper/MetaDataHelper.cs | 2 +- Editor/Helper/RampHelper.cs | 129 +- Editor/Helper/ToolbarHelper.cs | 2 +- Editor/LWGUI.cs | 2 +- Editor/MetaData/PerShaderData.cs | 2 +- .../Fxc/ShaderCompilerDefaultFxc.cs | 2 +- .../PerformanceMonitor/ShaderPerfMonitor.cs | 2 +- Editor/ScriptableObject/GradientObject.cs | 2 +- Editor/ScriptableObject/LwguiRampAtlas.cs | 1050 ++++++++++------- Editor/ShaderDrawer.cs | 219 +++- README.md | 17 +- README_CN.md | 15 +- Runtime/LwguiGradient/LwguiGradient.cs | 2 +- .../LwguiGradientDrawer.cs | 2 +- .../LwguiGradientEditorHelper.cs | 54 +- UnityEditorExtension/ReflectionHelper.cs | 54 +- package.json | 2 +- 25 files changed, 1824 insertions(+), 1199 deletions(-) diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js index b780486..b49e4e3 100644 --- a/.obsidian/plugins/obsidian-git/main.js +++ b/.obsidian/plugins/obsidian-git/main.js @@ -3,105 +3,104 @@ 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 WP=Object.create;var $o=Object.defineProperty;var qP=Object.getOwnPropertyDescriptor;var YP=Object.getOwnPropertyNames;var XP=Object.getPrototypeOf,ZP=Object.prototype.hasOwnProperty;var Uv=e=>{throw TypeError(e)};var KP=(e,t,r)=>t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var JP=(e,t)=>()=>(e&&(t=e(e=0)),t);var F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),QP=(e,t)=>{for(var r in t)$o(e,r,{get:t[r],enumerable:!0})},Gv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of YP(t))!ZP.call(e,i)&&i!==r&&$o(e,i,{get:()=>t[i],enumerable:!(n=qP(t,i))||n.enumerable});return e};var ze=(e,t,r)=>(r=e!=null?WP(XP(e)):{},Gv(t||!e||!e.__esModule?$o(r,"default",{value:e,enumerable:!0}):r,e)),eR=e=>Gv($o({},"__esModule",{value:!0}),e);var Pr=(e,t,r)=>KP(e,typeof t!="symbol"?t+"":t,r),zv=(e,t,r)=>t.has(e)||Uv("Cannot "+r);var Ht=(e,t,r)=>(zv(e,t,"read from private field"),r?r.call(e):t.get(e)),Tc=(e,t,r)=>t.has(e)?Uv("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Cc=(e,t,r,n)=>(zv(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var qv=F(Pc=>{"use strict";g();Pc.byteLength=rR;Pc.toByteArray=iR;Pc.fromByteArray=oR;var hn=[],Rr=[],tR=typeof Uint8Array!="undefined"?Uint8Array:Array,eh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ki=0,Vv=eh.length;Ki0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function rR(e){var t=Wv(e),r=t[0],n=t[1];return(r+n)*3/4-n}function nR(e,t,r){return(t+r)*3/4-r}function iR(e){var t,r=Wv(e),n=r[0],i=r[1],a=new tR(nR(e,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Rr[e.charCodeAt(l)]<<2|Rr[e.charCodeAt(l+1)]>>4,a[s++]=t&255),i===1&&(t=Rr[e.charCodeAt(l)]<<10|Rr[e.charCodeAt(l+1)]<<4|Rr[e.charCodeAt(l+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function aR(e){return hn[e>>18&63]+hn[e>>12&63]+hn[e>>6&63]+hn[e&63]}function sR(e,t,r){for(var n,i=[],a=t;ao?o:s+a));return n===1?(t=e[r-1],i.push(hn[t>>2]+hn[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(hn[t>>10]+hn[t>>4&63]+hn[t<<2&63]+"=")),i.join("")}});var Yv=F(th=>{g();th.read=function(e,t,r,n,i){var a,s,o=i*8-n-1,l=(1<>1,u=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=a*256+e[t+f],f+=d,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=n;u>0;s=s*256+e[t+f],f+=d,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-c}return(h?-1:1)*s*Math.pow(2,a-n)};th.write=function(e,t,r,n,i,a){var s,o,l,c=a*8-i-1,u=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,p=n?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?t+=d/l:t+=d*Math.pow(2,1-f),t*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(t*l-1)*Math.pow(2,i),s=s+f):(o=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=o&255,h+=p,o/=256,i-=8);for(s=s<0;e[r+h]=s&255,h+=p,s/=256,c-=8);e[r+h-p]|=m*128}});var uh=F(Qa=>{"use strict";g();var rh=qv(),Ka=Yv(),Xv=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qa.Buffer=M;Qa.SlowBuffer=hR;Qa.INSPECT_MAX_BYTES=50;var Rc=2147483647;Qa.kMaxLength=Rc;M.TYPED_ARRAY_SUPPORT=lR();!M.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function lR(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return!1}}Object.defineProperty(M.prototype,"parent",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.buffer}});Object.defineProperty(M.prototype,"offset",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.byteOffset}});function Nn(e){if(e>Rc)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,M.prototype),t}function M(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return sh(e)}return Qv(e,t,r)}M.poolSize=8192;function Qv(e,t,r){if(typeof e=="string")return uR(e,t);if(ArrayBuffer.isView(e))return fR(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(pn(e,ArrayBuffer)||e&&pn(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(pn(e,SharedArrayBuffer)||e&&pn(e.buffer,SharedArrayBuffer)))return ih(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return M.from(n,t,r);let i=dR(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return M.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}M.from=function(e,t,r){return Qv(e,t,r)};Object.setPrototypeOf(M.prototype,Uint8Array.prototype);Object.setPrototypeOf(M,Uint8Array);function e1(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function cR(e,t,r){return e1(e),e<=0?Nn(e):t!==void 0?typeof r=="string"?Nn(e).fill(t,r):Nn(e).fill(t):Nn(e)}M.alloc=function(e,t,r){return cR(e,t,r)};function sh(e){return e1(e),Nn(e<0?0:oh(e)|0)}M.allocUnsafe=function(e){return sh(e)};M.allocUnsafeSlow=function(e){return sh(e)};function uR(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!M.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=t1(e,t)|0,n=Nn(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function nh(e){let t=e.length<0?0:oh(e.length)|0,r=Nn(t);for(let n=0;n=Rc)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Rc.toString(16)+" bytes");return e|0}function hR(e){return+e!=e&&(e=0),M.alloc(+e)}M.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==M.prototype};M.compare=function(t,r){if(pn(t,Uint8Array)&&(t=M.from(t,t.offset,t.byteLength)),pn(r,Uint8Array)&&(r=M.from(r,r.offset,r.byteLength)),!M.isBuffer(t)||!M.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,s=Math.min(n,i);ai.length?(M.isBuffer(s)||(s=M.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(M.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function t1(e,t){if(M.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||pn(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ah(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return u1(e).length;default:if(i)return n?-1:ah(e).length;t=(""+t).toLowerCase(),i=!0}}M.byteLength=t1;function pR(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return ER(this,t,r);case"utf8":case"utf-8":return n1(this,t,r);case"ascii":return xR(this,t,r);case"latin1":case"binary":return SR(this,t,r);case"base64":return bR(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return AR(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}M.prototype._isBuffer=!0;function Ji(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}M.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(t+=" ... "),""};Xv&&(M.prototype[Xv]=M.prototype.inspect);M.prototype.compare=function(t,r,n,i,a){if(pn(t,Uint8Array)&&(t=M.from(t,t.offset,t.byteLength)),!M.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let s=a-i,o=n-r,l=Math.min(s,o),c=this.slice(i,a),u=t.slice(r,n);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ch(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=M.from(t,n)),M.isBuffer(t))return t.length===0?-1:Zv(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Zv(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Zv(e,t,r,n,i){let a=1,s=e.length,o=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,s/=2,o/=2,r/=2}function l(u,f){return a===1?u[f]:u.readUInt16BE(f*a)}let c;if(i){let u=-1;for(c=r;cs&&(r=s-o),c=r;c>=0;c--){let u=!0;for(let f=0;fi&&(n=i)):n=i;let a=t.length;n>a/2&&(n=a/2);let s;for(s=0;s>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-r;if((n===void 0||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return mR(this,t,r,n);case"utf8":case"utf-8":return gR(this,t,r,n);case"ascii":case"latin1":case"binary":return vR(this,t,r,n);case"base64":return yR(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wR(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function bR(e,t,r){return t===0&&r===e.length?rh.fromByteArray(e):rh.fromByteArray(e.slice(t,r))}function n1(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=r){let l,c,u,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=e[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(f=(a&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=e[i+1],c=e[i+2],u=e[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(a&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=o}return _R(n)}var Kv=4096;function _R(e){let t=e.length;if(t<=Kv)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=t;an&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}M.prototype.readUintLE=M.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||_t(t,r,this.length);let i=this[t],a=1,s=0;for(;++s>>0,r=r>>>0,n||_t(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i};M.prototype.readUint8=M.prototype.readUInt8=function(t,r){return t=t>>>0,r||_t(t,1,this.length),this[t]};M.prototype.readUint16LE=M.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||_t(t,2,this.length),this[t]|this[t+1]<<8};M.prototype.readUint16BE=M.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||_t(t,2,this.length),this[t]<<8|this[t+1]};M.prototype.readUint32LE=M.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||_t(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};M.prototype.readUint32BE=M.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||_t(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};M.prototype.readBigUInt64LE=fi(function(t){t=t>>>0,Ja(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lo(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,Ja(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lo(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||_t(t,r,this.length);let i=this[t],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};M.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||_t(t,r,this.length);let i=r,a=1,s=this[t+--i];for(;i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*r)),s};M.prototype.readInt8=function(t,r){return t=t>>>0,r||_t(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};M.prototype.readInt16LE=function(t,r){t=t>>>0,r||_t(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};M.prototype.readInt16BE=function(t,r){t=t>>>0,r||_t(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};M.prototype.readInt32LE=function(t,r){return t=t>>>0,r||_t(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};M.prototype.readInt32BE=function(t,r){return t=t>>>0,r||_t(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};M.prototype.readBigInt64LE=fi(function(t){t=t>>>0,Ja(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lo(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<>>0,Ja(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lo(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,r||_t(t,4,this.length),Ka.read(this,t,!0,23,4)};M.prototype.readFloatBE=function(t,r){return t=t>>>0,r||_t(t,4,this.length),Ka.read(this,t,!1,23,4)};M.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||_t(t,8,this.length),Ka.read(this,t,!0,52,8)};M.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||_t(t,8,this.length),Ka.read(this,t,!1,52,8)};function Jt(e,t,r,n,i,a){if(!M.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}M.prototype.writeUintLE=M.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;Jt(this,t,r,n,o,0)}let a=1,s=0;for(this[r]=t&255;++s>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;Jt(this,t,r,n,o,0)}let a=n-1,s=1;for(this[r+a]=t&255;--a>=0&&(s*=256);)this[r+a]=t/s&255;return r+n};M.prototype.writeUint8=M.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,1,255,0),this[r]=t&255,r+1};M.prototype.writeUint16LE=M.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};M.prototype.writeUint16BE=M.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};M.prototype.writeUint32LE=M.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};M.prototype.writeUint32BE=M.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function i1(e,t,r,n,i){c1(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function a1(e,t,r,n,i){c1(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}M.prototype.writeBigUInt64LE=fi(function(t,r=0){return i1(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});M.prototype.writeBigUInt64BE=fi(function(t,r=0){return a1(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});M.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Jt(this,t,r,n,l-1,-l)}let a=0,s=1,o=0;for(this[r]=t&255;++a>0)-o&255;return r+n};M.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Jt(this,t,r,n,l-1,-l)}let a=n-1,s=1,o=0;for(this[r+a]=t&255;--a>=0&&(s*=256);)t<0&&o===0&&this[r+a+1]!==0&&(o=1),this[r+a]=(t/s>>0)-o&255;return r+n};M.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};M.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};M.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};M.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};M.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Jt(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};M.prototype.writeBigInt64LE=fi(function(t,r=0){return i1(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});M.prototype.writeBigInt64BE=fi(function(t,r=0){return a1(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function s1(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function o1(e,t,r,n,i){return t=+t,r=r>>>0,i||s1(e,t,r,4,34028234663852886e22,-34028234663852886e22),Ka.write(e,t,r,n,23,4),r+4}M.prototype.writeFloatLE=function(t,r,n){return o1(this,t,r,!0,n)};M.prototype.writeFloatBE=function(t,r,n){return o1(this,t,r,!1,n)};function l1(e,t,r,n,i){return t=+t,r=r>>>0,i||s1(e,t,r,8,17976931348623157e292,-17976931348623157e292),Ka.write(e,t,r,n,52,8),r+8}M.prototype.writeDoubleLE=function(t,r,n){return l1(this,t,r,!0,n)};M.prototype.writeDoubleBE=function(t,r,n){return l1(this,t,r,!1,n)};M.prototype.copy=function(t,r,n,i){if(!M.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a2**32?i=Jv(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Jv(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function Jv(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function kR(e,t,r){Ja(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Lo(t,e.length-(r+1))}function c1(e,t,r,n,i,a){if(e>r||e3?t===0||t===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${t}${s} and <= ${r}${s}`,new Za.ERR_OUT_OF_RANGE("value",o,e)}kR(n,i,a)}function Ja(e,t){if(typeof e!="number")throw new Za.ERR_INVALID_ARG_TYPE(t,"number",e)}function Lo(e,t,r){throw Math.floor(e)!==e?(Ja(e,r),new Za.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Za.ERR_BUFFER_OUT_OF_BOUNDS:new Za.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var TR=/[^+/0-9A-Za-z-_]/g;function CR(e){if(e=e.split("=")[0],e=e.trim().replace(TR,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ah(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function PR(e){let t=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function u1(e){return rh.toByteArray(CR(e))}function Mc(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function pn(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ch(e){return e!==e}var MR=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function fi(e){return typeof BigInt=="undefined"?OR:e}function OR(){throw new Error("BigInt not supported")}});var f1,fh,Buffer,g=JP(()=>{f1=require("obsidian");f1.Platform.isMobileApp?fh=uh().Buffer:fh=global.Buffer;Buffer=fh});var h1=F((JH,d1)=>{"use strict";g();var dr=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.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=e.timeout||dr.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||dr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||dr.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=dr.DEFAULT_MAX_PENDING};dr.DEFAULT_TIMEOUT=0;dr.DEFAULT_MAX_OCCUPATION_TIME=0;dr.DEFAULT_MAX_EXECUTION_TIME=0;dr.DEFAULT_MAX_PENDING=1e3;dr.prototype.acquire=function(e,t,r,n){if(Array.isArray(e))return this._acquireBatch(e,t,r,n);if(typeof t!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof r!="function"&&(n=r,r=null,s=new this.Promise(function(b,x){i=b,a=x})),n=n||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,x,E){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[e]&&f.queues[e].length===0&&delete f.queues[e],f.domainReentrant&&delete f.domains[e]),o||(s?x?a(x):i(E):typeof r=="function"&&r(x,E),o=!0),b&&f.queues[e]&&f.queues[e].length>0&&f.queues[e].shift()()},h=function(b){if(o)return d(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[e]=process.domain);var x=n.maxExecutionTime||f.maxExecutionTime;if(x&&(u=setTimeout(function(){f.queues[e]&&d(b,new Error("Maximum execution time is exceeded "+e))},x)),t.length===1){var E=!1;try{t(function(_,k){E||(E=!0,d(b,_,k))})}catch(_){E||(E=!0,d(b,_))}}else f._promiseTry(function(){return t()}).then(function(_){d(b,void 0,_)},function(_){d(b,_)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=n.maxPending||f.maxPending;if(!f.queues[e])f.queues[e]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[e])h(!1);else if(f.queues[e].length>=p)d(!1,new Error("Too many pending tasks in queue "+e));else{var m=function(){h(!0)};n.skipQueue?f.queues[e].unshift(m):f.queues[e].push(m);var v=n.timeout||f.timeout;v&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+e))},v))}var y=n.maxOccupationTime||f.maxOccupationTime;if(y&&(c=setTimeout(function(){f.queues[e]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+e))},y)),s)return s};dr.prototype._acquireBatch=function(e,t,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(o,l){return function(c){i.acquire(o,l,c,n)}},s=e.reduceRight(function(o,l){return a(l,o)},t);if(typeof r=="function")s(r);else return new this.Promise(function(o,l){s.length===1?s(function(c,u){c?l(c):o(u)}):o(s())})};dr.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0};dr.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(t){return this.Promise.reject(t)}};d1.exports=dr});var m1=F((eU,p1)=>{"use strict";g();p1.exports=h1()});var g1=F((rU,dh)=>{g();typeof Object.create=="function"?dh.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:dh.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var ph=F((hh,y1)=>{g();var Oc=uh(),mn=Oc.Buffer;function v1(e,t){for(var r in e)t[r]=e[r]}mn.from&&mn.alloc&&mn.allocUnsafe&&mn.allocUnsafeSlow?y1.exports=Oc:(v1(Oc,hh),hh.Buffer=Qi);function Qi(e,t,r){return mn(e,t,r)}Qi.prototype=Object.create(mn.prototype);v1(mn,Qi);Qi.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return mn(e,t,r)};Qi.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=mn(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};Qi.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return mn(e)};Qi.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Oc.SlowBuffer(e)}});var _1=F((aU,b1)=>{g();var w1=ph().Buffer;function Ic(e,t){this._block=w1.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Ic.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=w1.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,a=this._len,s=0;s=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 n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a};Ic.prototype._update=function(){throw new Error("_update must be implemented by subclass")};b1.exports=Ic});var E1=F((oU,S1)=>{g();var IR=g1(),x1=_1(),FR=ph().Buffer,$R=[1518500249,1859775393,-1894007588,-899497514],LR=new Array(80);function Do(){this.init(),this._w=LR,x1.call(this,64,56)}IR(Do,x1);Do.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function DR(e){return e<<1|e>>>31}function NR(e){return e<<5|e>>>27}function BR(e){return e<<30|e>>>2}function jR(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Do.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)t[o]=e.readInt32BE(o*4);for(;o<80;++o)t[o]=DR(t[o-3]^t[o-8]^t[o-14]^t[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=NR(r)+jR(c,n,i,a)+s+t[l]+$R[c]|0;s=a,a=i,i=BR(n),n=r,r=u}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Do.prototype._hash=function(){var e=FR.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};S1.exports=Do});var k1=F(mh=>{g();var A1;(function(e){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof mh=="object"?e(mh):typeof define=="function"&&define.amd?define(function(){var t={};return e(t),t}):e(A1={}):e(A1={})})(function(e){e.version="1.2.2";function t(){for(var w=0,A=new Array(256),S=0;S!=256;++S)w=S,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,A[S]=w;return typeof Int32Array!="undefined"?new Int32Array(A):A}var r=t();function n(w){var A=0,S=0,T=0,P=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(T=0;T!=256;++T)P[T]=w[T];for(T=0;T!=256;++T)for(S=w[T],A=256+T;A<4096;A+=256)S=P[A]=S>>>8^w[S&255];var I=[];for(T=1;T!=16;++T)I[T-1]=typeof Int32Array!="undefined"?P.subarray(T*256,T*256+256):P.slice(T*256,T*256+256);return I}var i=n(r),a=i[0],s=i[1],o=i[2],l=i[3],c=i[4],u=i[5],f=i[6],d=i[7],h=i[8],p=i[9],m=i[10],v=i[11],y=i[12],b=i[13],x=i[14];function E(w,A){for(var S=A^-1,T=0,P=w.length;T>>8^r[(S^w.charCodeAt(T++))&255];return~S}function _(w,A){for(var S=A^-1,T=w.length-15,P=0;P>8&255]^y[w[P++]^S>>16&255]^v[w[P++]^S>>>24]^m[w[P++]]^p[w[P++]]^h[w[P++]]^d[w[P++]]^f[w[P++]]^u[w[P++]]^c[w[P++]]^l[w[P++]]^o[w[P++]]^s[w[P++]]^a[w[P++]]^r[w[P++]];for(T+=15;P>>8^r[(S^w[P++])&255];return~S}function k(w,A){for(var S=A^-1,T=0,P=w.length,I=0,N=0;T>>8^r[(S^I)&255]:I<2048?(S=S>>>8^r[(S^(192|I>>6&31))&255],S=S>>>8^r[(S^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,N=w.charCodeAt(T++)&1023,S=S>>>8^r[(S^(240|I>>8&7))&255],S=S>>>8^r[(S^(128|I>>2&63))&255],S=S>>>8^r[(S^(128|N>>6&15|(I&3)<<4))&255],S=S>>>8^r[(S^(128|N&63))&255]):(S=S>>>8^r[(S^(224|I>>12&15))&255],S=S>>>8^r[(S^(128|I>>6&63))&255],S=S>>>8^r[(S^(128|I&63))&255]);return~S}e.table=r,e.bstr=E,e.buf=_,e.str=k})});var Bn=F(Ut=>{"use strict";g();var HR=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function UR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Ut.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)UR(r,n)&&(e[n]=r[n])}}return e};Ut.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var GR={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var a=0;a{"use strict";g();var VR=Bn(),WR=4,T1=0,C1=1,qR=2;function ts(e){for(var t=e.length;--t>=0;)e[t]=0}var YR=0,F1=1,XR=2,ZR=3,KR=258,xh=29,Go=256,Bo=Go+1+xh,es=30,Sh=19,$1=2*Bo+1,ea=15,gh=16,JR=7,Eh=256,L1=16,D1=17,N1=18,bh=[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],Fc=[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],QR=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],e5=512,jn=new Array((Bo+2)*2);ts(jn);var No=new Array(es*2);ts(No);var jo=new Array(e5);ts(jo);var Ho=new Array(KR-ZR+1);ts(Ho);var Ah=new Array(xh);ts(Ah);var $c=new Array(es);ts($c);function vh(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var j1,H1,U1;function yh(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function G1(e){return e<256?jo[e]:jo[256+(e>>>7)]}function Uo(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Qt(e,t,r){e.bi_valid>gh-r?(e.bi_buf|=t<>gh-e.bi_valid,e.bi_valid+=r-gh):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function t5(e){e.bi_valid===16?(Uo(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function r5(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length,c,u,f,d,h,p,m=0;for(d=0;d<=ea;d++)e.bl_count[d]=0;for(r[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;c<$1;c++)u=e.heap[c],d=r[r[u*2+1]*2+1]+1,d>l&&(d=l,m++),r[u*2+1]=d,!(u>n)&&(e.bl_count[d]++,h=0,u>=o&&(h=s[u-o]),p=r[u*2],e.opt_len+=p*(d+h),a&&(e.static_len+=p*(i[u*2+1]+h)));if(m!==0){do{for(d=l-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(d=l;d!==0;d--)for(u=e.bl_count[d];u!==0;)f=e.heap[--c],!(f>n)&&(r[f*2+1]!==d&&(e.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function V1(e,t,r){var n=new Array(ea+1),i=0,a,s;for(a=1;a<=ea;a++)n[a]=i=i+r[a-1]<<1;for(s=0;s<=t;s++){var o=e[s*2+1];o!==0&&(e[s*2]=z1(n[o]++,o))}}function n5(){var e,t,r,n,i,a=new Array(ea+1);for(r=0,n=0;n>=7;n8?Uo(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function i5(e,t,r,n){q1(e),n&&(Uo(e,r),Uo(e,~r)),VR.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function P1(e,t,r,n){var i=t*2,a=r*2;return e[i]>1;s>=1;s--)wh(e,r,s);c=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],wh(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,r[c*2]=r[s*2]+r[o*2],e.depth[c]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,r[s*2+1]=r[o*2+1]=c,e.heap[1]=c++,wh(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],r5(e,t),V1(r,l,e.bl_count)}function M1(e,t,r){var n,i=-1,a,s=t[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=t[(n+1)*2+1],!(++o=3&&e.bl_tree[B1[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function s5(e,t,r,n){var i;for(Qt(e,t-257,5),Qt(e,r-1,5),Qt(e,n-4,4),i=0;i>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return T1;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return C1;for(r=32;r0?(e.strm.data_type===qR&&(e.strm.data_type=o5(e)),_h(e,e.l_desc),_h(e,e.d_desc),s=a5(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?Y1(e,t,r,n):e.strategy===WR||a===i?(Qt(e,(F1<<1)+(n?1:0),3),R1(e,jn,No)):(Qt(e,(XR<<1)+(n?1:0),3),s5(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),R1(e,e.dyn_ltree,e.dyn_dtree)),W1(e),n&&q1(e)}function f5(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Ho[r]+Go+1)*2]++,e.dyn_dtree[G1(t)*2]++),e.last_lit===e.lit_bufsize-1}rs._tr_init=l5;rs._tr_stored_block=Y1;rs._tr_flush_block=u5;rs._tr_tally=f5;rs._tr_align=c5});var kh=F((mU,Z1)=>{"use strict";g();function d5(e,t,r,n){for(var i=e&65535|0,a=e>>>16&65535|0,s=0;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+t[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}Z1.exports=d5});var Th=F((vU,K1)=>{"use strict";g();function h5(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var p5=h5();function m5(e,t,r,n){var i=p5,a=n+r;e^=-1;for(var s=n;s>>8^i[(e^t[s])&255];return e^-1}K1.exports=m5});var Lc=F((wU,J1)=>{"use strict";g();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 oy=F(wn=>{"use strict";g();var Gt=Bn(),Mr=X1(),ry=kh(),di=Th(),g5=Lc(),ia=0,v5=1,y5=3,vi=4,Q1=5,yn=0,ey=1,Or=-2,w5=-3,Ch=-5,b5=-1,_5=1,Dc=2,x5=3,S5=4,E5=0,A5=2,Hc=8,k5=9,T5=15,C5=8,P5=29,R5=256,Rh=R5+1+P5,M5=30,O5=19,I5=2*Rh+1,F5=15,be=3,mi=258,Kr=mi+be+1,$5=32,Uc=42,Mh=69,Nc=73,Bc=91,jc=103,ta=113,Vo=666,vt=1,Wo=2,ra=3,as=4,L5=3;function gi(e,t){return e.msg=g5[t],t}function ty(e){return(e<<1)-(e>4?9:0)}function pi(e){for(var t=e.length;--t>=0;)e[t]=0}function hi(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Gt.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function At(e,t){Mr._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,hi(e.strm)}function ke(e,t){e.pending_buf[e.pending++]=t}function zo(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function D5(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,Gt.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=ry(e.adler,t,i,r):e.state.wrap===2&&(e.adler=di(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function ny(e,t){var r=e.max_chain_length,n=e.strstart,i,a,s=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-Kr?e.strstart-(e.w_size-Kr):0,c=e.window,u=e.w_mask,f=e.prev,d=e.strstart+mi,h=c[n+s-1],p=c[n+s];e.prev_length>=e.good_match&&(r>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,!(c[i+s]!==p||c[i+s-1]!==h||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(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]===c[++i]&&ns){if(e.match_start=t,s=a,a>=o)break;h=c[n+s-1],p=c[n+s]}}while((t=f[t&u])>l&&--r!==0);return s<=e.lookahead?s:e.lookahead}function na(e){var t=e.w_size,r,n,i,a,s;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Kr)){Gt.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);a+=t}if(e.strm.avail_in===0)break;if(n=D5(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=be)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(na(e),e.lookahead===0&&t===ia)return vt;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,At(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Kr&&(At(e,!1),e.strm.avail_out===0))return vt}return e.insert=0,t===vi?(At(e,!0),e.strm.avail_out===0?ra:as):(e.strstart>e.block_start&&(At(e,!1),e.strm.avail_out===0),vt)}function Ph(e,t){for(var r,n;;){if(e.lookahead=be&&(e.ins_h=(e.ins_h<=be)if(n=Mr._tr_tally(e,e.strstart-e.match_start,e.match_length-be),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=be){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=be&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=be-1)),e.prev_length>=be&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-be,n=Mr._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-be),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=be&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=e.strstart+mi;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=be?(r=Mr._tr_tally(e,1,e.match_length-be),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Mr._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(At(e,!1),e.strm.avail_out===0))return vt}return e.insert=0,t===vi?(At(e,!0),e.strm.avail_out===0?ra:as):e.last_lit&&(At(e,!1),e.strm.avail_out===0)?vt:Wo}function j5(e,t){for(var r;;){if(e.lookahead===0&&(na(e),e.lookahead===0)){if(t===ia)return vt;break}if(e.match_length=0,r=Mr._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(At(e,!1),e.strm.avail_out===0))return vt}return e.insert=0,t===vi?(At(e,!0),e.strm.avail_out===0?ra:as):e.last_lit&&(At(e,!1),e.strm.avail_out===0)?vt:Wo}function vn(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var is;is=[new vn(0,0,0,0,N5),new vn(4,4,8,4,Ph),new vn(4,5,16,8,Ph),new vn(4,6,32,32,Ph),new vn(4,4,16,16,ns),new vn(8,16,32,32,ns),new vn(8,16,128,128,ns),new vn(8,32,128,256,ns),new vn(32,128,258,1024,ns),new vn(32,258,258,4096,ns)];function H5(e){e.window_size=2*e.w_size,pi(e.head),e.max_lazy_match=is[e.level].max_lazy,e.good_match=is[e.level].good_length,e.nice_match=is[e.level].nice_length,e.max_chain_length=is[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=be-1,e.match_available=0,e.ins_h=0}function U5(){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=Hc,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 Gt.Buf16(I5*2),this.dyn_dtree=new Gt.Buf16((2*M5+1)*2),this.bl_tree=new Gt.Buf16((2*O5+1)*2),pi(this.dyn_ltree),pi(this.dyn_dtree),pi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Gt.Buf16(F5+1),this.heap=new Gt.Buf16(2*Rh+1),pi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Gt.Buf16(2*Rh+1),pi(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 iy(e){var t;return!e||!e.state?gi(e,Or):(e.total_in=e.total_out=0,e.data_type=A5,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Uc:ta,e.adler=t.wrap===2?0:1,t.last_flush=ia,Mr._tr_init(t),yn)}function ay(e){var t=iy(e);return t===yn&&H5(e.state),t}function G5(e,t){return!e||!e.state||e.state.wrap!==2?Or:(e.state.gzhead=t,yn)}function sy(e,t,r,n,i,a){if(!e)return Or;var s=1;if(t===b5&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>k5||r!==Hc||n<8||n>15||t<0||t>9||a<0||a>S5)return gi(e,Or);n===8&&(n=9);var o=new U5;return e.state=o,o.strm=e,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<Q1||t<0)return e?gi(e,Or):Or;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===Vo&&t!==vi)return gi(e,e.avail_out===0?Ch:Or);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Uc)if(n.wrap===2)e.adler=0,ke(n,31),ke(n,139),ke(n,8),n.gzhead?(ke(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ke(n,n.gzhead.time&255),ke(n,n.gzhead.time>>8&255),ke(n,n.gzhead.time>>16&255),ke(n,n.gzhead.time>>24&255),ke(n,n.level===9?2:n.strategy>=Dc||n.level<2?4:0),ke(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ke(n,n.gzhead.extra.length&255),ke(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=di(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Mh):(ke(n,0),ke(n,0),ke(n,0),ke(n,0),ke(n,0),ke(n,n.level===9?2:n.strategy>=Dc||n.level<2?4:0),ke(n,L5),n.status=ta);else{var s=Hc+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=Dc||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=$5),s+=31-s%31,n.status=ta,zo(n,s),n.strstart!==0&&(zo(n,e.adler>>>16),zo(n,e.adler&65535)),e.adler=1}if(n.status===Mh)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),hi(e),i=n.pending,n.pending===n.pending_buf_size));)ke(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Nc)}else n.status=Nc;if(n.status===Nc)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),hi(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Bc)}else n.status=Bc;if(n.status===Bc)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),hi(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(e.adler=di(e.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=jc)}else n.status=jc;if(n.status===jc&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&hi(e),n.pending+2<=n.pending_buf_size&&(ke(n,e.adler&255),ke(n,e.adler>>8&255),e.adler=0,n.status=ta)):n.status=ta),n.pending!==0){if(hi(e),e.avail_out===0)return n.last_flush=-1,yn}else if(e.avail_in===0&&ty(t)<=ty(r)&&t!==vi)return gi(e,Ch);if(n.status===Vo&&e.avail_in!==0)return gi(e,Ch);if(e.avail_in!==0||n.lookahead!==0||t!==ia&&n.status!==Vo){var l=n.strategy===Dc?j5(n,t):n.strategy===x5?B5(n,t):is[n.level].func(n,t);if((l===ra||l===as)&&(n.status=Vo),l===vt||l===ra)return e.avail_out===0&&(n.last_flush=-1),yn;if(l===Wo&&(t===v5?Mr._tr_align(n):t!==Q1&&(Mr._tr_stored_block(n,0,0,!1),t===y5&&(pi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),hi(e),e.avail_out===0))return n.last_flush=-1,yn}return t!==vi?yn:n.wrap<=0?ey:(n.wrap===2?(ke(n,e.adler&255),ke(n,e.adler>>8&255),ke(n,e.adler>>16&255),ke(n,e.adler>>24&255),ke(n,e.total_in&255),ke(n,e.total_in>>8&255),ke(n,e.total_in>>16&255),ke(n,e.total_in>>24&255)):(zo(n,e.adler>>>16),zo(n,e.adler&65535)),hi(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?yn:ey)}function W5(e){var t;return!e||!e.state?Or:(t=e.state.status,t!==Uc&&t!==Mh&&t!==Nc&&t!==Bc&&t!==jc&&t!==ta&&t!==Vo?gi(e,Or):(e.state=null,t===ta?gi(e,w5):yn))}function q5(e,t){var r=t.length,n,i,a,s,o,l,c,u;if(!e||!e.state||(n=e.state,s=n.wrap,s===2||s===1&&n.status!==Uc||n.lookahead))return Or;for(s===1&&(e.adler=ry(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(s===0&&(pi(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new Gt.Buf8(n.w_size),Gt.arraySet(u,t,r-n.w_size,n.w_size,0),t=u,r=n.w_size),o=e.avail_in,l=e.next_in,c=e.input,e.avail_in=r,e.next_in=0,e.input=t,na(n);n.lookahead>=be;){i=n.strstart,a=n.lookahead-(be-1);do n.ins_h=(n.ins_h<{"use strict";g();var Gc=Bn(),ly=!0,cy=!0;try{String.fromCharCode.apply(null,[0])}catch(e){ly=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){cy=!1}var qo=new Gc.Buf8(256);for(Hn=0;Hn<256;Hn++)qo[Hn]=Hn>=252?6:Hn>=248?5:Hn>=240?4:Hn>=224?3:Hn>=192?2:1;var Hn;qo[254]=qo[254]=1;ss.string2buf=function(e){var t,r,n,i,a,s=e.length,o=0;for(i=0;i>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};function uy(e,t){if(t<65534&&(e.subarray&&cy||!e.subarray&&ly))return String.fromCharCode.apply(null,Gc.shrinkBuf(e,t));for(var r="",n=0;n4){o[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return uy(o,n)};ss.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+qo[e[r]]>t?r:t}});var Ih=F((AU,fy)=>{"use strict";g();function Y5(){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}fy.exports=Y5});var my=F(Zo=>{"use strict";g();var Yo=oy(),Xo=Bn(),$h=Oh(),Lh=Lc(),X5=Ih(),py=Object.prototype.toString,Z5=0,Fh=4,os=0,dy=1,hy=2,K5=-1,J5=0,Q5=8;function aa(e){if(!(this instanceof aa))return new aa(e);this.options=Xo.assign({level:K5,method:Q5,chunkSize:16384,windowBits:15,memLevel:8,strategy:J5,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new X5,this.strm.avail_out=0;var r=Yo.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==os)throw new Error(Lh[r]);if(t.header&&Yo.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=$h.string2buf(t.dictionary):py.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Yo.deflateSetDictionary(this.strm,n),r!==os)throw new Error(Lh[r]);this._dict_set=!0}}aa.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=t===~~t?t:t===!0?Fh:Z5,typeof e=="string"?r.input=$h.string2buf(e):py.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Xo.Buf8(n),r.next_out=0,r.avail_out=n),i=Yo.deflate(r,a),i!==dy&&i!==os)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===Fh||a===hy))&&(this.options.to==="string"?this.onData($h.buf2binstring(Xo.shrinkBuf(r.output,r.next_out))):this.onData(Xo.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==dy);return a===Fh?(i=Yo.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===os):(a===hy&&(this.onEnd(os),r.avail_out=0),!0)};aa.prototype.onData=function(e){this.chunks.push(e)};aa.prototype.onEnd=function(e){e===os&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Xo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Dh(e,t){var r=new aa(t);if(r.push(e,!0),r.err)throw r.msg||Lh[r.err];return r.result}function eM(e,t){return t=t||{},t.raw=!0,Dh(e,t)}function tM(e,t){return t=t||{},t.gzip=!0,Dh(e,t)}Zo.Deflate=aa;Zo.deflate=Dh;Zo.deflateRaw=eM;Zo.gzip=tM});var vy=F((PU,gy)=>{"use strict";g();var zc=30,rM=12;gy.exports=function(t,r){var n,i,a,s,o,l,c,u,f,d,h,p,m,v,y,b,x,E,_,k,w,A,S,T,P;n=t.state,i=t.next_in,T=t.input,a=i+(t.avail_in-5),s=t.next_out,P=t.output,o=s-(r-t.avail_out),l=s+(t.avail_out-257),c=n.dmax,u=n.wsize,f=n.whave,d=n.wnext,h=n.window,p=n.hold,m=n.bits,v=n.lencode,y=n.distcode,b=(1<>>24,p>>>=_,m-=_,_=E>>>16&255,_===0)P[s++]=E&65535;else if(_&16){k=E&65535,_&=15,_&&(m<_&&(p+=T[i++]<>>=_,m-=_),m<15&&(p+=T[i++]<>>24,p>>>=_,m-=_,_=E>>>16&255,_&16){if(w=E&65535,_&=15,m<_&&(p+=T[i++]<c){t.msg="invalid distance too far back",n.mode=zc;break e}if(p>>>=_,m-=_,_=s-o,w>_){if(_=w-_,_>f&&n.sane){t.msg="invalid distance too far back",n.mode=zc;break e}if(A=0,S=h,d===0){if(A+=u-_,_2;)P[s++]=S[A++],P[s++]=S[A++],P[s++]=S[A++],k-=3;k&&(P[s++]=S[A++],k>1&&(P[s++]=S[A++]))}else{A=s-w;do P[s++]=P[A++],P[s++]=P[A++],P[s++]=P[A++],k-=3;while(k>2);k&&(P[s++]=P[A++],k>1&&(P[s++]=P[A++]))}}else if(_&64){t.msg="invalid distance code",n.mode=zc;break e}else{E=y[(E&65535)+(p&(1<<_)-1)];continue r}break}}else if(_&64)if(_&32){n.mode=rM;break e}else{t.msg="invalid literal/length code",n.mode=zc;break e}else{E=v[(E&65535)+(p&(1<<_)-1)];continue t}break}}while(i>3,i-=k,m-=k<<3,p&=(1<{"use strict";g();var yy=Bn(),ls=15,wy=852,by=592,_y=0,Nh=1,xy=2,nM=[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],iM=[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],aM=[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],sM=[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];Sy.exports=function(t,r,n,i,a,s,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,m=0,v=0,y=0,b=0,x=0,E,_,k,w,A,S=null,T=0,P,I=new yy.Buf16(ls+1),N=new yy.Buf16(ls+1),L=null,ee=0,fe,J,Q;for(u=0;u<=ls;u++)I[u]=0;for(f=0;f=1&&I[h]===0;h--);if(p>h&&(p=h),h===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(t===_y||h!==1))return-1;for(N[1]=0,u=1;uwy||t===xy&&b>by)return 1;for(;;){fe=u-v,o[f]P?(J=L[ee+o[f]],Q=S[T+o[f]]):(J=96,Q=0),E=1<>v)+_]=fe<<24|J<<16|Q|0;while(_!==0);for(E=1<>=1;if(E!==0?(x&=E-1,x+=E):x=0,f++,--I[u]===0){if(u===h)break;u=r[n+o[f]]}if(u>p&&(x&w)!==k){for(v===0&&(v=p),A+=d,m=u-v,y=1<wy||t===xy&&b>by)return 1;k=x&w,a[k]=p<<24|m<<16|A-s|0}}return x!==0&&(a[A+x]=u-v<<24|64<<16|0),l.bits=p,0}});var aw=F(Jr=>{"use strict";g();var hr=Bn(),zh=kh(),bn=Th(),oM=vy(),Ko=Ey(),lM=0,Zy=1,Ky=2,Ay=4,cM=5,Vc=6,sa=0,uM=1,fM=2,Ir=-2,Jy=-3,Vh=-4,dM=-5,ky=8,Qy=1,Ty=2,Cy=3,Py=4,Ry=5,My=6,Oy=7,Iy=8,Fy=9,$y=10,Yc=11,Un=12,Bh=13,Ly=14,jh=15,Dy=16,Ny=17,By=18,jy=19,Wc=20,qc=21,Hy=22,Uy=23,Gy=24,zy=25,Vy=26,Hh=27,Wy=28,qy=29,Be=30,Wh=31,hM=32,pM=852,mM=592,gM=15,vM=gM;function Yy(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function yM(){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 hr.Buf16(320),this.work=new hr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ew(e){var t;return!e||!e.state?Ir:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Qy,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new hr.Buf32(pM),t.distcode=t.distdyn=new hr.Buf32(mM),t.sane=1,t.back=-1,sa)}function tw(e){var t;return!e||!e.state?Ir:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,ew(e))}function rw(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Ir:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,tw(e))}function nw(e,t){var r,n;return e?(n=new yM,e.state=n,n.window=null,r=rw(e,t),r!==sa&&(e.state=null),r):Ir}function wM(e){return nw(e,vM)}var Xy=!0,Uh,Gh;function bM(e){if(Xy){var t;for(Uh=new hr.Buf32(512),Gh=new hr.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ko(Zy,e.lens,0,288,Uh,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ko(Ky,e.lens,0,32,Gh,0,e.work,{bits:5}),Xy=!1}e.lencode=Uh,e.lenbits=9,e.distcode=Gh,e.distbits=5}function iw(e,t,r,n){var i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(hr.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),hr.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(hr.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,r.check=bn(r.check,S,2,0),c=0,u=0,r.mode=Ty;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=Be;break}if((c&15)!==ky){e.msg="unknown compression method",r.mode=Be;break}if(c>>>=4,u-=4,w=(c&15)+8,r.wbits===0)r.wbits=w;else if(w>r.wbits){e.msg="invalid window size",r.mode=Be;break}r.dmax=1<>8&1),r.flags&512&&(S[0]=c&255,S[1]=c>>>8&255,r.check=bn(r.check,S,2,0)),c=0,u=0,r.mode=Cy;case Cy:for(;u<32;){if(o===0)break e;o--,c+=n[a++]<>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,r.check=bn(r.check,S,4,0)),c=0,u=0,r.mode=Py;case Py:for(;u<16;){if(o===0)break e;o--,c+=n[a++]<>8),r.flags&512&&(S[0]=c&255,S[1]=c>>>8&255,r.check=bn(r.check,S,2,0)),c=0,u=0,r.mode=Ry;case Ry:if(r.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=n[a++]<>>8&255,r.check=bn(r.check,S,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=My;case My:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),hr.arraySet(r.head.extra,n,a,h,w)),r.flags&512&&(r.check=bn(r.check,n,h,a)),o-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=Oy;case Oy:if(r.flags&2048){if(o===0)break e;h=0;do w=n[a+h++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w));while(w&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Un;break;case $y:for(;u<32;){if(o===0)break e;o--,c+=n[a++]<>>=u&7,u-=u&7,r.mode=Hh;break}for(;u<3;){if(o===0)break e;o--,c+=n[a++]<>>=1,u-=1,c&3){case 0:r.mode=Ly;break;case 1:if(bM(r),r.mode=Wc,t===Vc){c>>>=2,u-=2;break e}break;case 2:r.mode=Ny;break;case 3:e.msg="invalid block type",r.mode=Be}c>>>=2,u-=2;break;case Ly:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=Be;break}if(r.length=c&65535,c=0,u=0,r.mode=jh,t===Vc)break e;case jh:r.mode=Dy;case Dy:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;hr.arraySet(i,n,a,h,s),o-=h,a+=h,l-=h,s+=h,r.length-=h;break}r.mode=Un;break;case Ny:for(;u<14;){if(o===0)break e;o--,c+=n[a++]<>>=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){e.msg="too many length or distance symbols",r.mode=Be;break}r.have=0,r.mode=By;case By:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},A=Ko(lM,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,A){e.msg="invalid code lengths set",r.mode=Be;break}r.have=0,r.mode=jy;case jy:for(;r.have>>24,b=v>>>16&255,x=v&65535,!(y<=u);){if(o===0)break e;o--,c+=n[a++]<>>=y,u-=y,r.lens[r.have++]=x;else{if(x===16){for(P=y+2;u>>=y,u-=y,r.have===0){e.msg="invalid bit length repeat",r.mode=Be;break}w=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(x===17){for(P=y+3;u>>=y,u-=y,w=0,h=3+(c&7),c>>>=3,u-=3}else{for(P=y+7;u>>=y,u-=y,w=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Be;break}for(;h--;)r.lens[r.have++]=w}}if(r.mode===Be)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=Be;break}if(r.lenbits=9,T={bits:r.lenbits},A=Ko(Zy,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,A){e.msg="invalid literal/lengths set",r.mode=Be;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},A=Ko(Ky,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,A){e.msg="invalid distances set",r.mode=Be;break}if(r.mode=Wc,t===Vc)break e;case Wc:r.mode=qc;case qc:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=o,r.hold=c,r.bits=u,oM(e,d),s=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,o=e.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,x=v&65535,!(y<=u);){if(o===0)break e;o--,c+=n[a++]<>E)],y=v>>>24,b=v>>>16&255,x=v&65535,!(E+y<=u);){if(o===0)break e;o--,c+=n[a++]<>>=E,u-=E,r.back+=E}if(c>>>=y,u-=y,r.back+=y,r.length=x,b===0){r.mode=Vy;break}if(b&32){r.back=-1,r.mode=Un;break}if(b&64){e.msg="invalid literal/length code",r.mode=Be;break}r.extra=b&15,r.mode=Hy;case Hy:if(r.extra){for(P=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Uy;case Uy:for(;v=r.distcode[c&(1<>>24,b=v>>>16&255,x=v&65535,!(y<=u);){if(o===0)break e;o--,c+=n[a++]<>E)],y=v>>>24,b=v>>>16&255,x=v&65535,!(E+y<=u);){if(o===0)break e;o--,c+=n[a++]<>>=E,u-=E,r.back+=E}if(c>>>=y,u-=y,r.back+=y,b&64){e.msg="invalid distance code",r.mode=Be;break}r.offset=x,r.extra=b&15,r.mode=Gy;case Gy:if(r.extra){for(P=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Be;break}r.mode=zy;case zy:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Be;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),m=r.window}else m=i,p=s-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[s++]=m[p++];while(--h);r.length===0&&(r.mode=qc);break;case Vy:if(l===0)break e;i[s++]=r.length,l--,r.mode=qc;break;case Hh:if(r.wrap){for(;u<32;){if(o===0)break e;o--,c|=n[a++]<{"use strict";g();sw.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 lw=F((DU,ow)=>{"use strict";g();function AM(){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}ow.exports=AM});var uw=F(Qo=>{"use strict";g();var cs=aw(),Jo=Bn(),Xc=Oh(),nt=qh(),Yh=Lc(),kM=Ih(),TM=lw(),cw=Object.prototype.toString;function oa(e){if(!(this instanceof oa))return new oa(e);this.options=Jo.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new kM,this.strm.avail_out=0;var r=cs.inflateInit2(this.strm,t.windowBits);if(r!==nt.Z_OK)throw new Error(Yh[r]);if(this.header=new TM,cs.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Xc.string2buf(t.dictionary):cw.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=cs.inflateSetDictionary(this.strm,t.dictionary),r!==nt.Z_OK)))throw new Error(Yh[r])}oa.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,c,u=!1;if(this.ended)return!1;s=t===~~t?t:t===!0?nt.Z_FINISH:nt.Z_NO_FLUSH,typeof e=="string"?r.input=Xc.binstring2buf(e):cw.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Jo.Buf8(n),r.next_out=0,r.avail_out=n),a=cs.inflate(r,nt.Z_NO_FLUSH),a===nt.Z_NEED_DICT&&i&&(a=cs.inflateSetDictionary(this.strm,i)),a===nt.Z_BUF_ERROR&&u===!0&&(a=nt.Z_OK,u=!1),a!==nt.Z_STREAM_END&&a!==nt.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===nt.Z_STREAM_END||r.avail_in===0&&(s===nt.Z_FINISH||s===nt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Xc.utf8border(r.output,r.next_out),l=r.next_out-o,c=Xc.buf2string(r.output,o),r.next_out=l,r.avail_out=n-l,l&&Jo.arraySet(r.output,r.output,o,l,0),this.onData(c)):this.onData(Jo.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)&&a!==nt.Z_STREAM_END);return a===nt.Z_STREAM_END&&(s=nt.Z_FINISH),s===nt.Z_FINISH?(a=cs.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===nt.Z_OK):(s===nt.Z_SYNC_FLUSH&&(this.onEnd(nt.Z_OK),r.avail_out=0),!0)};oa.prototype.onData=function(e){this.chunks.push(e)};oa.prototype.onEnd=function(e){e===nt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Jo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Xh(e,t){var r=new oa(t);if(r.push(e,!0),r.err)throw r.msg||Yh[r.err];return r.result}function CM(e,t){return t=t||{},t.raw=!0,Xh(e,t)}Qo.Inflate=oa;Qo.inflate=Xh;Qo.inflateRaw=CM;Qo.ungzip=Xh});var hw=F((HU,dw)=>{"use strict";g();var PM=Bn().assign,RM=my(),MM=uw(),OM=qh(),fw={};PM(fw,RM,MM,OM);dw.exports=fw});var gw=F((GU,mw)=>{"use strict";g();var pw=(e,t)=>function(...r){let n=t.promiseModule;return new n((i,a)=>{t.multiArgs?r.push((...s)=>{t.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):t.errorFirst?r.push((s,o)=>{s?a(s):i(o)}):r.push(i),e.apply(this,r)})};mw.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);let r=typeof e;if(!(e!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":r}\``);let n=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return t.include?t.include.some(s):!t.exclude.some(s)},i;r==="function"?i=function(...a){return t.excludeMain?e(...a):pw(e,t).apply(this,a)}:i=Object.create(Object.getPrototypeOf(e));for(let a in e){let s=e[a];i[a]=typeof s=="function"&&n(a)?pw(s,t):s}return i}});var Aw=F((VU,Ew)=>{g();function vw(e){return Array.isArray(e)?e:[e]}var Jh="",yw=" ",Zh="\\",IM=/^\s+$/,FM=/(?:[^\\]|^)\\$/,$M=/^\\!/,LM=/^\\#/,DM=/\r?\n/g,NM=/^\.*\/|^\.+$/,Kh="/",_w="node-ignore";typeof Symbol!="undefined"&&(_w=Symbol.for("node-ignore"));var ww=_w,BM=(e,t,r)=>Object.defineProperty(e,t,{value:r}),jM=/([0-z])-([0-z])/g,xw=()=>!1,HM=e=>e.replace(jM,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:Jh),UM=e=>{let{length:t}=e;return e.slice(0,t-t%2)},GM=[[/^\uFEFF/,()=>Jh],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?yw:Jh)],[/(\\+?)\s/g,(e,t)=>{let{length:r}=t;return t.slice(0,r-r%2)+yw}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6{let n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Zh],[/\\\\/g,()=>Zh],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,i)=>t===Zh?`\\[${r}${UM(n)}${i}`:i==="]"&&n.length%2===0?`[${HM(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],bw=Object.create(null),zM=(e,t)=>{let r=bw[e];return r||(r=GM.reduce((n,[i,a])=>n.replace(i,a.bind(e)),e),bw[e]=r),t?new RegExp(r,"i"):new RegExp(r)},tp=e=>typeof e=="string",VM=e=>e&&tp(e)&&!IM.test(e)&&!FM.test(e)&&e.indexOf("#")!==0,WM=e=>e.split(DM),Qh=class{constructor(t,r,n,i){this.origin=t,this.pattern=r,this.negative=n,this.regex=i}},qM=(e,t)=>{let r=e,n=!1;e.indexOf("!")===0&&(n=!0,e=e.substr(1)),e=e.replace($M,"!").replace(LM,"#");let i=zM(e,t);return new Qh(r,e,n,i)},YM=(e,t)=>{throw new t(e)},Gn=(e,t,r)=>tp(e)?e?Gn.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),Sw=e=>NM.test(e);Gn.isNotRelative=Sw;Gn.convert=e=>e;var ep=class{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){BM(this,ww,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[ww]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(VM(t)){let r=qM(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,vw(tp(t)?WM(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,r){let n=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&n!==i||s&&!n&&!i&&!r)return;a.regex.test(t)&&(n=!s,i=s)}),{ignored:n,unignored:i}}_test(t,r,n,i){let a=t&&Gn.convert(t);return Gn(a,t,this._allowRelativePaths?xw:YM),this._t(a,r,n,i)}_t(t,r,n,i){if(t in r)return r[t];if(i||(i=t.split(Kh)),i.pop(),!i.length)return r[t]=this._testOne(t,n);let a=this._t(i.join(Kh)+Kh,r,n,i);return r[t]=a.ignored?a:this._testOne(t,n)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return vw(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},Zc=e=>new ep(e),XM=e=>Gn(e&&Gn.convert(e),e,xw);Zc.isPathValid=XM;Zc.default=Zc;Ew.exports=Zc;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Gn.convert=e;let t=/^[a-z]:\//i;Gn.isNotRelative=r=>t.test(r)||Sw(r)}});var Tw=F((qU,kw)=>{"use strict";g();function ZM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _n(e,t,r){return t=t instanceof RegExp?t:new RegExp(ZM(t),"g"),e.replace(t,r)}var KM={clean:function(t){if(typeof t!="string")throw new Error("Expected a string, received: "+t);return t=_n(t,"./","/"),t=_n(t,"..","."),t=_n(t," ","-"),t=_n(t,/^[~^:?*\\\-]/g,""),t=_n(t,/[~^:?*\\]/g,"-"),t=_n(t,/[~^:?*\\\-]$/g,""),t=_n(t,"@{","-"),t=_n(t,/\.$/g,""),t=_n(t,/\/$/g,""),t=_n(t,/\.lock$/g,""),t}};kw.exports=KM});var Pw=F((XU,Cw)=>{g();Cw.exports=function(e,t){var r=e,n=t,i=r.length,a=n.length,s=!1,o=null,l=i+1,c=[],u=[],f=[],d="",h=-1,p=0,m=1,v,y,b=function(){i>=a&&(v=r,y=i,r=n,n=v,i=a,a=y,s=!0,l=i+1)},x=function(w,A,S){return{x:w,y:A,k:S}},E=function(w,A){return{elem:w,t:A}},_=function(w,A,S){var T,P,I;for(A>S?T=c[w-1+l]:T=c[w+1+l],I=Math.max(A,S),P=I-w;P=0;--I)for(;TP-T?(s?f[f.length]=new E(n[P],h):f[f.length]=new E(n[P],m),++S,++P):w[I].y-w[I].x=w+1;--L)S[L+l]=_(L,S[L-1+l]+1,S[L+1+l]);S[w+l]=_(w,S[w-1+l]+1,S[w+1+l])}while(S[w+l]!==a);for(o=w+2*T,P=c[w+l],I=[];P!==-1;)I[I.length]=new x(u[P].x,u[P].y,null),P=u[P].k;k(I)}}}});var Ow=F((KU,Mw)=>{g();var JM=Pw();function QM(e,t){var r=new JM(e,t);r.compose();for(var n=r.getses(),i,a,s=e.length-1,o=t.length-1,l=n.length-1;l>=0;--l)n[l].t===r.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):n[l].t===r.SES_DELETE?s--:n[l].t===r.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function Rw(e,t){for(var r=[],n=e.length,i=t.length,a=QM(e,t);a!==null;a=a.chain){var s=n-a.file1index-1,o=i-a.file2index-1;n=a.file1index,i=a.file2index,(s||o)&&r.push({file1:[n+1,s],file2:[i+1,o]})}return r.reverse(),r}function e6(e,t,r){var n,i=Rw(t,e),a=Rw(t,r),s=[];function o(N,L){s.push([N.file1[0],L,N.file1[1],N.file2[0],N.file2[1]])}for(n=0;nc&&(l.push([1,c,N-c]),c=N)}for(var f=0;fm)break;m=Math.max(m,y+v[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[e.length,-1,t.length,-1],2:[r.length,-1,t.length,-1]};for(n=d;n<=f;n++){h=s[n];var x=h[1],E=b[x],_=h[0],k=_+h[2],w=h[3],A=w+h[4];E[0]=Math.min(w,E[0]),E[1]=Math.max(A,E[1]),E[2]=Math.min(_,E[2]),E[3]=Math.max(k,E[3])}var S=b[0][0]+(p-b[0][2]),T=b[0][1]+(m-b[0][3]),P=b[2][0]+(p-b[2][2]),I=b[2][1]+(m-b[2][3]);l.push([-1,S,T-S,p,m-p,P,I-P])}c=m}return u(t.length),l}function t6(e,t,r){var n=[],i=[e,t,r],a=e6(e,t,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function l(h){for(var p=0;p{g();var Ts=1e3,Cs=Ts*60,Ps=Cs*60,pa=Ps*24,i8=pa*7,a8=pa*365.25;$2.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return s8(e);if(r==="number"&&isFinite(e))return t.long?l8(e):o8(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function s8(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*a8;case"weeks":case"week":case"w":return r*i8;case"days":case"day":case"d":return r*pa;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ps;case"minutes":case"minute":case"mins":case"min":case"m":return r*Cs;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ts;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function o8(e){var t=Math.abs(e);return t>=pa?Math.round(e/pa)+"d":t>=Ps?Math.round(e/Ps)+"h":t>=Cs?Math.round(e/Cs)+"m":t>=Ts?Math.round(e/Ts)+"s":e+"ms"}function l8(e){var t=Math.abs(e);return t>=pa?vu(e,t,pa,"day"):t>=Ps?vu(e,t,Ps,"hour"):t>=Cs?vu(e,t,Cs,"minute"):t>=Ts?vu(e,t,Ts,"second"):e+" ms"}function vu(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var N2=F((sG,D2)=>{g();function c8(e){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=i,r.enabled=s,r.humanize=L2(),r.destroy=c,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let f=0;for(let d=0;d{if(k==="%%")return"%";E++;let A=r.formatters[w];if(typeof A=="function"){let S=v[E];k=A.call(y,S),v.splice(E,1),E--}return k}),r.formatArgs.call(y,v),(y.log||r.log).apply(y,v)}return m.namespace=u,m.useColors=r.useColors(),m.color=r.selectColor(u),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,p=r.enabled(u)),p),set:v=>{d=v}}),typeof r.init=="function"&&r.init(m),m}function n(u,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function i(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let f,d=(typeof u=="string"?u:"").split(/[\s,]+/),h=d.length;for(f=0;f"-"+f)].join(",");return r.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,d;for(f=0,d=r.skips.length;f{g();gr.formatArgs=f8;gr.save=d8;gr.load=h8;gr.useColors=u8;gr.storage=p8();gr.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();gr.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 u8(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function f8(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+yu.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}gr.log=console.debug||console.log||(()=>{});function d8(e){try{e?gr.storage.setItem("debug",e):gr.storage.removeItem("debug")}catch(t){}}function h8(){let e;try{e=gr.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function p8(){try{return localStorage}catch(e){}}yu.exports=N2()(gr);var{formatters:m8}=yu.exports;m8.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var B2=F(vr=>{"use strict";g();var g8=vr&&vr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vr,"__esModule",{value:!0});var v8=require("fs"),y8=g8(wu()),Rs=y8.default("@kwsites/file-exists");function w8(e,t,r){Rs("checking %s",e);try{let n=v8.statSync(e);return n.isFile()&&t?(Rs("[OK] path represents a file"),!0):n.isDirectory()&&r?(Rs("[OK] path represents a directory"),!0):(Rs("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return Rs("[FAIL] path is not accessible: %o",n),!1;throw Rs("[FATAL] %o",n),n}}function b8(e,t=vr.READABLE){return w8(e,(t&vr.FILE)>0,(t&vr.FOLDER)>0)}vr.exists=b8;vr.FILE=1;vr.FOLDER=2;vr.READABLE=vr.FILE+vr.FOLDER});var j2=F(bu=>{"use strict";g();function _8(e){for(var t in e)bu.hasOwnProperty(t)||(bu[t]=e[t])}Object.defineProperty(bu,"__esModule",{value:!0});_8(B2())});var Mp=F(ma=>{"use strict";g();Object.defineProperty(ma,"__esModule",{value:!0});ma.createDeferred=ma.deferred=void 0;function Rp(){let e,t,r="pending";return{promise:new Promise((i,a)=>{e=i,t=a}),done(i){r==="pending"&&(r="resolved",e(i))},fail(i){r==="pending"&&(r="rejected",t(i))},get fulfilled(){return r!=="pending"},get status(){return r}}}ma.deferred=Rp;ma.createDeferred=Rp;ma.default=Rp});var Px=F((JG,Cx)=>{"use strict";g();Cx.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 Mx=F((ez,Rx)=>{g();var Sm={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}};Rx.exports=function(e,t,r,n){if(!Sm.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!Sm[r].hasOwnProperty(t))throw new Error("Cannot convert from "+t+" to "+r);var i=Sm[r][t]*e;return n!==!1?(n=Math.pow(10,parseInt(n)||5),Math.round(i*n)/n):i}});var Vx=F(Yn=>{"use strict";g();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.fromRgba=Ls;Yn.fromRgb=Em;Yn.fromHsla=Vu;Yn.fromHsl=Gx;Yn.fromString=zx;Yn.default=void 0;var Ox=$x(Px()),I$=$x(Mx());function $x(e){return e&&e.__esModule?e:{default:e}}function F$(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ix(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1}function j$(e,t,r){var n=e/255,i=t/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case n:return(i-a)/l%6;case i:return(a-n)/l+2;default:return(n-i)/l+4}}();return[f*60,u*100,c*100]}function H$(e,t,r){var n=e/60,i=t/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),l=a-s/2,c=function(){return n<1?[s,o,0]:n<2?[o,s,0]:n<3?[0,s,o]:n<4?[0,o,s]:n<5?[o,0,s]:[s,0,o]}(),u=qt(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var U$=function(){function e(t){var r=qt(t,4),n=r[0],i=r[1],a=r[2],s=r[3];F$(this,e),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return $$(e,[{key:"toRgbString",value:function(){var r=qt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return s===1?"rgb(".concat(n,", ").concat(i,", ").concat(a,")"):"rgba(".concat(n,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),n=qt(r,4),i=n[0],a=n[1],s=n[2],o=n[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=qt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(n).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=qt(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=j$(n,i,a),l=qt(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),e}();function Ls(e){var t=qt(e,4),r=t[0],n=t[1],i=t[2],a=t[3];return new U$([r,n,i,a])}function Em(e){var t=qt(e,3),r=t[0],n=t[1],i=t[2];return Ls([r,n,i,1])}function Vu(e){var t=qt(e,4),r=t[0],n=t[1],i=t[2],a=t[3],s=H$(r,n,i),o=qt(s,3),l=o[0],c=o[1],u=o[2];return Ls([l,c,u,a])}function Gx(e){var t=qt(e,3),r=t[0],n=t[1],i=t[2];return Vu([r,n,i,1])}function G$(e){var t=Lx.exec(e)||Dx.exec(e),r=qt(t,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,Ls([n,i,a,s])}function z$(e){var t=Nx.exec(e)||jx.exec(e)||Bx.exec(e)||Hx.exec(e),r=qt(t,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=$l(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=$l(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=$l(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/($l(s,"%")?100:1),Ls([n,i,a,s])}function V$(e){var t=Ux.exec(e),r=qt(t,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,I$.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/($l(o,"%")?100:1),Vu([n,a,s,o])}function zx(e){return Ox.default[e]?Em(Ox.default[e]):Lx.test(e)||Dx.test(e)?G$(e):Nx.test(e)||jx.test(e)||Bx.test(e)||Hx.test(e)?z$(e):Ux.test(e)?V$(e):null}var W$={fromString:zx,fromRgb:Em,fromRgba:Ls,fromHsl:Gx,fromHsla:Vu};Yn.default=W$});var Am=F((iz,qx)=>{"use strict";g();var Wx=Object.prototype.toString;qx.exports=function(t){var r=Wx.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Wx.call(t.callee)==="[object Function]"),n}});var rS=F((sz,tS)=>{"use strict";g();var eS;Object.keys||(Ll=Object.prototype.hasOwnProperty,km=Object.prototype.toString,Yx=Am(),Tm=Object.prototype.propertyIsEnumerable,Xx=!Tm.call({toString:null},"toString"),Zx=Tm.call(function(){},"prototype"),Dl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wu=function(e){var t=e.constructor;return t&&t.prototype===e},Kx={$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},Jx=function(){if(typeof window=="undefined")return!1;for(var e in window)try{if(!Kx["$"+e]&&Ll.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{Wu(window[e])}catch(t){return!0}}catch(t){return!0}return!1}(),Qx=function(e){if(typeof window=="undefined"||!Jx)return Wu(e);try{return Wu(e)}catch(t){return!1}},eS=function(t){var r=t!==null&&typeof t=="object",n=km.call(t)==="[object Function]",i=Yx(t),a=r&&km.call(t)==="[object String]",s=[];if(!r&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var o=Zx&&n;if(a&&t.length>0&&!Ll.call(t,0))for(var l=0;l0)for(var c=0;c{"use strict";g();var q$=Array.prototype.slice,Y$=Am(),nS=Object.keys,qu=nS?function(t){return nS(t)}:rS(),iS=Object.keys;qu.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return Y$(n)?iS(q$.call(n)):iS(n)})}else Object.keys=qu;return Object.keys||qu};aS.exports=qu});var oS=F((uz,sS)=>{"use strict";g();sS.exports=Error});var cS=F((dz,lS)=>{"use strict";g();lS.exports=EvalError});var fS=F((pz,uS)=>{"use strict";g();uS.exports=RangeError});var hS=F((gz,dS)=>{"use strict";g();dS.exports=ReferenceError});var Cm=F((yz,pS)=>{"use strict";g();pS.exports=SyntaxError});var Xn=F((bz,mS)=>{"use strict";g();mS.exports=TypeError});var vS=F((xz,gS)=>{"use strict";g();gS.exports=URIError});var Nl=F((Ez,yS)=>{"use strict";g();yS.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;t[r]=i;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var a=Object.getOwnPropertySymbols(t);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(t,r);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var Xu=F((kz,bS)=>{"use strict";g();var wS=typeof Symbol!="undefined"&&Symbol,X$=Nl();bS.exports=function(){return typeof wS!="function"||typeof Symbol!="function"||typeof wS("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:X$()}});var xS=F((Cz,_S)=>{"use strict";g();var Pm={__proto__:null,foo:{}},Z$=Object;_S.exports=function(){return{__proto__:Pm}.foo===Pm.foo&&!(Pm instanceof Z$)}});var AS=F((Rz,ES)=>{"use strict";g();var K$="Function.prototype.bind called on incompatible ",J$=Object.prototype.toString,Q$=Math.max,eL="[object Function]",SS=function(t,r){for(var n=[],i=0;i{"use strict";g();var nL=AS();kS.exports=Function.prototype.bind||nL});var Rm=F((Fz,TS)=>{"use strict";g();var iL=Function.prototype.call,aL=Object.prototype.hasOwnProperty,sL=Zu();TS.exports=sL.call(iL,aL)});var tn=F((Lz,OS)=>{"use strict";g();var we,oL=oS(),lL=cS(),cL=fS(),uL=hS(),js=Cm(),Bs=Xn(),fL=vS(),MS=Function,Mm=function(e){try{return MS('"use strict"; return ('+e+").constructor;")()}catch(t){}},ba=Object.getOwnPropertyDescriptor;if(ba)try{ba({},"")}catch(e){ba=null}var Om=function(){throw new Bs},dL=ba?function(){try{return arguments.callee,Om}catch(e){try{return ba(arguments,"callee").get}catch(t){return Om}}}():Om,Ds=Xu()(),hL=xS()(),xt=Object.getPrototypeOf||(hL?function(e){return e.__proto__}:null),Ns={},pL=typeof Uint8Array=="undefined"||!xt?we:xt(Uint8Array),_a={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?we:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?we:ArrayBuffer,"%ArrayIteratorPrototype%":Ds&&xt?xt([][Symbol.iterator]()):we,"%AsyncFromSyncIteratorPrototype%":we,"%AsyncFunction%":Ns,"%AsyncGenerator%":Ns,"%AsyncGeneratorFunction%":Ns,"%AsyncIteratorPrototype%":Ns,"%Atomics%":typeof Atomics=="undefined"?we:Atomics,"%BigInt%":typeof BigInt=="undefined"?we:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?we:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?we:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?we:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oL,"%eval%":eval,"%EvalError%":lL,"%Float32Array%":typeof Float32Array=="undefined"?we:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?we:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?we:FinalizationRegistry,"%Function%":MS,"%GeneratorFunction%":Ns,"%Int8Array%":typeof Int8Array=="undefined"?we:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?we:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?we:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ds&&xt?xt(xt([][Symbol.iterator]())):we,"%JSON%":typeof JSON=="object"?JSON:we,"%Map%":typeof Map=="undefined"?we:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Ds||!xt?we:xt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?we:Promise,"%Proxy%":typeof Proxy=="undefined"?we:Proxy,"%RangeError%":cL,"%ReferenceError%":uL,"%Reflect%":typeof Reflect=="undefined"?we:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?we:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Ds||!xt?we:xt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?we:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ds&&xt?xt(""[Symbol.iterator]()):we,"%Symbol%":Ds?Symbol:we,"%SyntaxError%":js,"%ThrowTypeError%":dL,"%TypedArray%":pL,"%TypeError%":Bs,"%Uint8Array%":typeof Uint8Array=="undefined"?we:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?we:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?we:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?we:Uint32Array,"%URIError%":fL,"%WeakMap%":typeof WeakMap=="undefined"?we:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?we:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?we:WeakSet};if(xt)try{null.error}catch(e){CS=xt(xt(e)),_a["%Error.prototype%"]=CS}var CS,mL=function e(t){var r;if(t==="%AsyncFunction%")r=Mm("async function () {}");else if(t==="%GeneratorFunction%")r=Mm("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Mm("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&xt&&(r=xt(i.prototype))}return _a[t]=r,r},PS={__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"]},Bl=Zu(),Ku=Rm(),gL=Bl.call(Function.call,Array.prototype.concat),vL=Bl.call(Function.apply,Array.prototype.splice),RS=Bl.call(Function.call,String.prototype.replace),Ju=Bl.call(Function.call,String.prototype.slice),yL=Bl.call(Function.call,RegExp.prototype.exec),wL=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bL=/\\(\\)?/g,_L=function(t){var r=Ju(t,0,1),n=Ju(t,-1);if(r==="%"&&n!=="%")throw new js("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new js("invalid intrinsic syntax, expected opening `%`");var i=[];return RS(t,wL,function(a,s,o,l){i[i.length]=o?RS(l,bL,"$1"):s||a}),i},xL=function(t,r){var n=t,i;if(Ku(PS,n)&&(i=PS[n],n="%"+i[0]+"%"),Ku(_a,n)){var a=_a[n];if(a===Ns&&(a=mL(n)),typeof a=="undefined"&&!r)throw new Bs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new js("intrinsic "+t+" does not exist!")};OS.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new Bs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Bs('"allowMissing" argument must be a boolean');if(yL(/^%?[^%]*%?$/,t)===null)throw new js("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=_L(t),i=n.length>0?n[0]:"",a=xL("%"+i+"%",r),s=a.name,o=a.value,l=!1,c=a.alias;c&&(i=c[0],vL(n,gL([0,1],c)));for(var u=1,f=!0;u=n.length){var m=ba(o,d);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[d]}else f=Ku(o,d),o=o[d];f&&!l&&(_a[s]=o)}}return o}});var ef=F((Nz,IS)=>{"use strict";g();var SL=tn(),Qu=SL("%Object.defineProperty%",!0)||!1;if(Qu)try{Qu({},"a",{value:1})}catch(e){Qu=!1}IS.exports=Qu});var rf=F((jz,FS)=>{"use strict";g();var EL=tn(),tf=EL("%Object.getOwnPropertyDescriptor%",!0);if(tf)try{tf([],"length")}catch(e){tf=null}FS.exports=tf});var nf=F((Uz,DS)=>{"use strict";g();var $S=ef(),AL=Cm(),Hs=Xn(),LS=rf();DS.exports=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new Hs("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Hs("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Hs("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Hs("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Hs("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Hs("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!LS&&LS(t,r);if($S)$S(t,r,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)t[r]=n;else throw new AL("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var af=F((zz,BS)=>{"use strict";g();var Im=ef(),NS=function(){return!!Im};NS.hasArrayLengthDefineBug=function(){if(!Im)return null;try{return Im([],"length",{value:1}).length!==1}catch(t){return!0}};BS.exports=NS});var Ci=F((Wz,GS)=>{"use strict";g();var kL=Yu(),TL=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",CL=Object.prototype.toString,PL=Array.prototype.concat,jS=nf(),RL=function(e){return typeof e=="function"&&CL.call(e)==="[object Function]"},HS=af()(),ML=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!RL(n)||!n())return}HS?jS(e,t,r,!0):jS(e,t,r)},US=function(e,t){var r=arguments.length>2?arguments[2]:{},n=kL(t);TL&&(n=PL.call(n,Object.getOwnPropertySymbols(t)));for(var i=0;i{"use strict";g();var OL=tn(),zS=nf(),IL=af()(),VS=rf(),WS=Xn(),FL=OL("%Math.floor%");qS.exports=function(t,r){if(typeof t!="function")throw new WS("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||FL(r)!==r)throw new WS("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in t&&VS){var s=VS(t,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!n)&&(IL?zS(t,"length",r,!0,!0):zS(t,"length",r)),t}});var xa=F((Zz,sf)=>{"use strict";g();var Fm=Zu(),of=tn(),$L=YS(),LL=Xn(),KS=of("%Function.prototype.apply%"),JS=of("%Function.prototype.call%"),QS=of("%Reflect.apply%",!0)||Fm.call(JS,KS),XS=ef(),DL=of("%Math.max%");sf.exports=function(t){if(typeof t!="function")throw new LL("a function is required");var r=QS(Fm,JS,arguments);return $L(r,1+DL(0,t.length-(arguments.length-1)),!0)};var ZS=function(){return QS(Fm,KS,arguments)};XS?XS(sf.exports,"apply",{value:ZS}):sf.exports.apply=ZS});var br=F((Jz,rE)=>{"use strict";g();var eE=tn(),tE=xa(),NL=tE(eE("String.prototype.indexOf"));rE.exports=function(t,r){var n=eE(t,!!r);return typeof n=="function"&&NL(t,".prototype.")>-1?tE(n):n}});var $m=F((eV,oE)=>{"use strict";g();var BL=Yu(),aE=Nl()(),sE=br(),nE=Object,jL=sE("Array.prototype.push"),iE=sE("Object.prototype.propertyIsEnumerable"),HL=aE?Object.getOwnPropertySymbols:null;oE.exports=function(t,r){if(t==null)throw new TypeError("target must be an object");var n=nE(t);if(arguments.length===1)return n;for(var i=1;i{"use strict";g();var Lm=$m(),UL=function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},n=0;n{"use strict";g();var zL=Ci(),VL=Dm();cE.exports=function(){var t=VL();return zL(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t}});var pE=F((sV,hE)=>{"use strict";g();var WL=Ci(),qL=xa(),YL=$m(),fE=Dm(),XL=uE(),ZL=qL.apply(fE()),dE=function(t,r){return ZL(Object,arguments)};WL(dE,{getPolyfill:fE,implementation:YL,shim:XL});hE.exports=dE});var gE=F((lV,mE)=>{"use strict";g();var Hl=function(){return typeof function(){}.name=="string"},jl=Object.getOwnPropertyDescriptor;if(jl)try{jl([],"length")}catch(e){jl=null}Hl.functionsHaveConfigurableNames=function(){if(!Hl()||!jl)return!1;var t=jl(function(){},"name");return!!t&&!!t.configurable};var KL=Function.prototype.bind;Hl.boundFunctionsHaveNames=function(){return Hl()&&typeof KL=="function"&&function(){}.bind().name!==""};mE.exports=Hl});var wE=F((uV,yE)=>{"use strict";g();var vE=nf(),JL=af()(),QL=gE().functionsHaveConfigurableNames(),eD=Xn();yE.exports=function(t,r){if(typeof t!="function")throw new eD("`fn` is not a function");var n=arguments.length>2&&!!arguments[2];return(!n||QL)&&(JL?vE(t,"name",r,!0,!0):vE(t,"name",r)),t}});var Nm=F((dV,bE)=>{"use strict";g();var tD=wE(),rD=Xn(),nD=Object;bE.exports=tD(function(){if(this==null||this!==nD(this))throw new rD("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var Bm=F((pV,_E)=>{"use strict";g();var iD=Nm(),aD=Ci().supportsDescriptors,sD=Object.getOwnPropertyDescriptor;_E.exports=function(){if(aD&&/a/mig.flags==="gim"){var t=sD(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(n,"sticky",{get:function(){r+="y"}}),t.get.call(n),r==="dy")return t.get}}return iD}});var EE=F((gV,SE)=>{"use strict";g();var oD=Ci().supportsDescriptors,lD=Bm(),cD=Object.getOwnPropertyDescriptor,uD=Object.defineProperty,fD=TypeError,xE=Object.getPrototypeOf,dD=/a/;SE.exports=function(){if(!oD||!xE)throw new fD("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=lD(),r=xE(dD),n=cD(r,"flags");return(!n||n.get!==t)&&uD(r,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var CE=F((yV,TE)=>{"use strict";g();var hD=Ci(),pD=xa(),mD=Nm(),AE=Bm(),gD=EE(),kE=pD(AE());hD(kE,{getPolyfill:AE,implementation:mD,shim:gD});TE.exports=kE});var Pi=F((bV,PE)=>{"use strict";g();var vD=Nl();PE.exports=function(){return vD()&&!!Symbol.toStringTag}});var Hm=F((xV,ME)=>{"use strict";g();var yD=Pi()(),wD=br(),jm=wD("Object.prototype.toString"),lf=function(t){return yD&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:jm(t)==="[object Arguments]"},RE=function(t){return lf(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jm(t)!=="[object Array]"&&jm(t.callee)==="[object Function]"},bD=function(){return lf(arguments)}();lf.isLegacyArguments=RE;ME.exports=bD?lf:RE});var OE=F(()=>{g()});var JE=F((TV,KE)=>{g();var Km=typeof Map=="function"&&Map.prototype,Um=Object.getOwnPropertyDescriptor&&Km?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,uf=Km&&Um&&typeof Um.get=="function"?Um.get:null,IE=Km&&Map.prototype.forEach,Jm=typeof Set=="function"&&Set.prototype,Gm=Object.getOwnPropertyDescriptor&&Jm?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ff=Jm&&Gm&&typeof Gm.get=="function"?Gm.get:null,FE=Jm&&Set.prototype.forEach,_D=typeof WeakMap=="function"&&WeakMap.prototype,Gl=_D?WeakMap.prototype.has:null,xD=typeof WeakSet=="function"&&WeakSet.prototype,zl=xD?WeakSet.prototype.has:null,SD=typeof WeakRef=="function"&&WeakRef.prototype,$E=SD?WeakRef.prototype.deref:null,ED=Boolean.prototype.valueOf,AD=Object.prototype.toString,kD=Function.prototype.toString,TD=String.prototype.match,Qm=String.prototype.slice,Mi=String.prototype.replace,CD=String.prototype.toUpperCase,LE=String.prototype.toLowerCase,VE=RegExp.prototype.test,DE=Array.prototype.concat,An=Array.prototype.join,PD=Array.prototype.slice,NE=Math.floor,Wm=typeof BigInt=="function"?BigInt.prototype.valueOf:null,zm=Object.getOwnPropertySymbols,qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Us=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ot=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Us||!0)?Symbol.toStringTag:null,WE=Object.prototype.propertyIsEnumerable,BE=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function jE(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||VE.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e=="number"){var n=e<0?-NE(-e):NE(e);if(n!==e){var i=String(n),a=Qm.call(t,i.length+1);return Mi.call(i,r,"$&_")+"."+Mi.call(Mi.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Mi.call(t,r,"$&_")}var Ym=OE(),HE=Ym.custom,UE=YE(HE)?HE:null;KE.exports=function e(t,r,n,i){var a=r||{};if(Ri(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ri(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=Ri(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ri(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ri(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof t=="undefined")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return ZE(t,a);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var l=String(t);return o?jE(t,l):l}if(typeof t=="bigint"){var c=String(t)+"n";return o?jE(t,c):c}var u=typeof a.depth=="undefined"?5:a.depth;if(typeof n=="undefined"&&(n=0),n>=u&&u>0&&typeof t=="object")return Xm(t)?"[Array]":"[Object]";var f=qD(a,n);if(typeof i=="undefined")i=[];else if(XE(i,t)>=0)return"[Circular]";function d(N,L,ee){if(L&&(i=PD.call(i),i.push(L)),ee){var fe={depth:a.depth};return Ri(a,"quoteStyle")&&(fe.quoteStyle=a.quoteStyle),e(N,fe,n+1,i)}return e(N,a,n+1,i)}if(typeof t=="function"&&!GE(t)){var h=ND(t),p=cf(t,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(p.length>0?" { "+An.call(p,", ")+" }":"")}if(YE(t)){var m=Us?Mi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):qm.call(t);return typeof t=="object"&&!Us?Ul(m):m}if(zD(t)){for(var v="<"+LE.call(String(t.nodeName)),y=t.attributes||[],b=0;b",v}if(Xm(t)){if(t.length===0)return"[]";var x=cf(t,d);return f&&!WD(x)?"["+Zm(x,f)+"]":"[ "+An.call(x,", ")+" ]"}if(OD(t)){var E=cf(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!WE.call(t,"cause")?"{ ["+String(t)+"] "+An.call(DE.call("[cause]: "+d(t.cause),E),", ")+" }":E.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+An.call(E,", ")+" }"}if(typeof t=="object"&&s){if(UE&&typeof t[UE]=="function"&&Ym)return Ym(t,{depth:u-n});if(s!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(BD(t)){var _=[];return IE&&IE.call(t,function(N,L){_.push(d(L,t,!0)+" => "+d(N,t))}),zE("Map",uf.call(t),_,f)}if(UD(t)){var k=[];return FE&&FE.call(t,function(N){k.push(d(N,t))}),zE("Set",ff.call(t),k,f)}if(jD(t))return Vm("WeakMap");if(GD(t))return Vm("WeakSet");if(HD(t))return Vm("WeakRef");if(FD(t))return Ul(d(Number(t)));if(LD(t))return Ul(d(Wm.call(t)));if($D(t))return Ul(ED.call(t));if(ID(t))return Ul(d(String(t)));if(typeof window!="undefined"&&t===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&t===globalThis||typeof global!="undefined"&&t===global)return"{ [object globalThis] }";if(!MD(t)&&!GE(t)){var w=cf(t,d),A=BE?BE(t)===Object.prototype:t instanceof Object||t.constructor===Object,S=t instanceof Object?"":"null prototype",T=!A&&Ot&&Object(t)===t&&Ot in t?Qm.call(Oi(t),8,-1):S?"Object":"",P=A||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",I=P+(T||S?"["+An.call(DE.call([],T||[],S||[]),": ")+"] ":"");return w.length===0?I+"{}":f?I+"{"+Zm(w,f)+"}":I+"{ "+An.call(w,", ")+" }"}return String(t)};function qE(e,t,r){var n=(r.quoteStyle||t)==="double"?'"':"'";return n+e+n}function RD(e){return Mi.call(String(e),/"/g,""")}function Xm(e){return Oi(e)==="[object Array]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function MD(e){return Oi(e)==="[object Date]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function GE(e){return Oi(e)==="[object RegExp]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function OD(e){return Oi(e)==="[object Error]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function ID(e){return Oi(e)==="[object String]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function FD(e){return Oi(e)==="[object Number]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function $D(e){return Oi(e)==="[object Boolean]"&&(!Ot||!(typeof e=="object"&&Ot in e))}function YE(e){if(Us)return e&&typeof e=="object"&&e instanceof Symbol;if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||!qm)return!1;try{return qm.call(e),!0}catch(t){}return!1}function LD(e){if(!e||typeof e!="object"||!Wm)return!1;try{return Wm.call(e),!0}catch(t){}return!1}var DD=Object.prototype.hasOwnProperty||function(e){return e in this};function Ri(e,t){return DD.call(e,t)}function Oi(e){return AD.call(e)}function ND(e){if(e.name)return e.name;var t=TD.call(kD.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function XE(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;rt.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return ZE(Qm.call(e,0,t.maxStringLength),t)+n}var i=Mi.call(Mi.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,VD);return qE(i,"single",t)}function VD(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+CD.call(t.toString(16))}function Ul(e){return"Object("+e+")"}function Vm(e){return e+" { ? }"}function zE(e,t,r,n){var i=n?Zm(r,n):An.call(r,", ");return e+" ("+t+") {"+i+"}"}function WD(e){for(var t=0;t=0)return!1;return!0}function qD(e,t){var r;if(e.indent===" ")r=" ";else if(typeof e.indent=="number"&&e.indent>0)r=An.call(Array(e.indent+1)," ");else return null;return{base:r,prev:An.call(Array(t+1),r)}}function Zm(e,t){if(e.length===0)return"";var r=` -`+t.prev+t.base;return r+An.call(e,","+r)+` -`+t.prev}function cf(e,t){var r=Xm(e),n=[];if(r){n.length=e.length;for(var i=0;i{"use strict";g();var QE=tn(),Gs=br(),YD=JE(),XD=Xn(),df=QE("%WeakMap%",!0),hf=QE("%Map%",!0),ZD=Gs("WeakMap.prototype.get",!0),KD=Gs("WeakMap.prototype.set",!0),JD=Gs("WeakMap.prototype.has",!0),QD=Gs("Map.prototype.get",!0),eN=Gs("Map.prototype.set",!0),tN=Gs("Map.prototype.has",!0),eg=function(e,t){for(var r=e,n;(n=r.next)!==null;r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n},rN=function(e,t){var r=eg(e,t);return r&&r.value},nN=function(e,t,r){var n=eg(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}},iN=function(e,t){return!!eg(e,t)};eA.exports=function(){var t,r,n,i={assert:function(a){if(!i.has(a))throw new XD("Side channel does not contain "+YD(a))},get:function(a){if(df&&a&&(typeof a=="object"||typeof a=="function")){if(t)return ZD(t,a)}else if(hf){if(r)return QD(r,a)}else if(n)return rN(n,a)},has:function(a){if(df&&a&&(typeof a=="object"||typeof a=="function")){if(t)return JD(t,a)}else if(hf){if(r)return tN(r,a)}else if(n)return iN(n,a);return!1},set:function(a,s){df&&a&&(typeof a=="object"||typeof a=="function")?(t||(t=new df),KD(t,a,s)):hf?(r||(r=new hf),eN(r,a,s)):(n||(n={key:{},next:null}),nN(n,a,s))}};return i}});var rA=F((MV,tA)=>{"use strict";g();var aN=Rm(),Vl=tg()(),Zn=Xn(),rg={assert:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Zn("`O` is not an object");if(typeof t!="string")throw new Zn("`slot` must be a string");if(Vl.assert(e),!rg.has(e,t))throw new Zn("`"+t+"` is not present on `O`")},get:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Zn("`O` is not an object");if(typeof t!="string")throw new Zn("`slot` must be a string");var r=Vl.get(e);return r&&r["$"+t]},has:function(e,t){if(!e||typeof e!="object"&&typeof e!="function")throw new Zn("`O` is not an object");if(typeof t!="string")throw new Zn("`slot` must be a string");var r=Vl.get(e);return!!r&&aN(r,"$"+t)},set:function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Zn("`O` is not an object");if(typeof t!="string")throw new Zn("`slot` must be a string");var n=Vl.get(e);n||(n={},Vl.set(e,n)),n["$"+t]=r}};Object.freeze&&Object.freeze(rg);tA.exports=rg});var aA=F((IV,iA)=>{"use strict";g();var Wl=rA(),sN=SyntaxError,nA=typeof StopIteration=="object"?StopIteration:null;iA.exports=function(t){if(!nA)throw new sN("this environment lacks StopIteration");Wl.set(t,"[[Done]]",!1);var r={next:function(){var i=Wl.get(this,"[[Iterator]]"),a=Wl.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Wl.set(i,"[[Done]]",!0),s!==nA)throw s;return{done:!0,value:void 0}}}};return Wl.set(r,"[[Iterator]]",t),r}});var ng=F(($V,sA)=>{g();var oN={}.toString;sA.exports=Array.isArray||function(e){return oN.call(e)=="[object Array]"}});var ig=F((DV,oA)=>{"use strict";g();var lN=String.prototype.valueOf,cN=function(t){try{return lN.call(t),!0}catch(r){return!1}},uN=Object.prototype.toString,fN="[object String]",dN=Pi()();oA.exports=function(t){return typeof t=="string"?!0:typeof t!="object"?!1:dN?cN(t):uN.call(t)===fN}});var sg=F((BV,uA)=>{"use strict";g();var ag=typeof Map=="function"&&Map.prototype?Map:null,hN=typeof Set=="function"&&Set.prototype?Set:null,pf;ag||(pf=function(t){return!1});var cA=ag?Map.prototype.has:null,lA=hN?Set.prototype.has:null;!pf&&!cA&&(pf=function(t){return!1});uA.exports=pf||function(t){if(!t||typeof t!="object")return!1;try{if(cA.call(t),lA)try{lA.call(t)}catch(r){return!0}return t instanceof ag}catch(r){}return!1}});var lg=F((HV,hA)=>{"use strict";g();var pN=typeof Map=="function"&&Map.prototype?Map:null,og=typeof Set=="function"&&Set.prototype?Set:null,mf;og||(mf=function(t){return!1});var fA=pN?Map.prototype.has:null,dA=og?Set.prototype.has:null;!mf&&!dA&&(mf=function(t){return!1});hA.exports=mf||function(t){if(!t||typeof t!="object")return!1;try{if(dA.call(t),fA)try{fA.call(t)}catch(r){return!0}return t instanceof og}catch(r){}return!1}});var AA=F((GV,yf)=>{"use strict";g();var pA=Hm(),mA=aA();Xu()()||Nl()()?(gf=Symbol.iterator,yf.exports=function(t){if(t!=null&&typeof t[gf]!="undefined")return t[gf]();if(pA(t))return Array.prototype[gf].call(t)}):(gA=ng(),vA=ig(),cg=tn(),yA=cg("%Map%",!0),wA=cg("%Set%",!0),Dr=br(),ug=Dr("Array.prototype.push"),fg=Dr("String.prototype.charCodeAt"),bA=Dr("String.prototype.slice"),_A=function(t,r){var n=t.length;if(r+1>=n)return r+1;var i=fg(t,r);if(i<55296||i>56319)return r+1;var a=fg(t,r+1);return a<56320||a>57343?r+1:r+2},vf=function(t){var r=0;return{next:function(){var i=r>=t.length,a;return i||(a=t[r],r+=1),{done:i,value:a}}}},dg=function(t,r){if(gA(t)||pA(t))return vf(t);if(vA(t)){var n=0;return{next:function(){var a=_A(t,n),s=bA(t,n,a);return n=a,{done:a>t.length,value:s}}}}if(r&&typeof t["_es6-shim iterator_"]!="undefined")return t["_es6-shim iterator_"]()},!yA&&!wA?yf.exports=function(t){if(t!=null)return dg(t,!0)}:(xA=sg(),SA=lg(),hg=Dr("Map.prototype.forEach",!0),pg=Dr("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(mg=Dr("Map.prototype.iterator",!0),gg=Dr("Set.prototype.iterator",!0)),vg=Dr("Map.prototype.@@iterator",!0)||Dr("Map.prototype._es6-shim iterator_",!0),yg=Dr("Set.prototype.@@iterator",!0)||Dr("Set.prototype._es6-shim iterator_",!0),EA=function(t){if(xA(t)){if(mg)return mA(mg(t));if(vg)return vg(t);if(hg){var r=[];return hg(t,function(i,a){ug(r,[a,i])}),vf(r)}}if(SA(t)){if(gg)return mA(gg(t));if(yg)return yg(t);if(pg){var n=[];return pg(t,function(i){ug(n,i)}),vf(n)}}},yf.exports=function(t){return EA(t)||dg(t)}));var gf,gA,vA,cg,yA,wA,Dr,ug,fg,bA,_A,vf,dg,xA,SA,hg,pg,mg,gg,vg,yg,EA});var wg=F((VV,TA)=>{"use strict";g();var kA=function(e){return e!==e};TA.exports=function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||kA(t)&&kA(r))}});var bg=F((qV,CA)=>{"use strict";g();var mN=wg();CA.exports=function(){return typeof Object.is=="function"?Object.is:mN}});var RA=F((XV,PA)=>{"use strict";g();var gN=bg(),vN=Ci();PA.exports=function(){var t=gN();return vN(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var FA=F((KV,IA)=>{"use strict";g();var yN=Ci(),wN=xa(),bN=wg(),MA=bg(),_N=RA(),OA=wN(MA(),Object);yN(OA,{getPolyfill:MA,implementation:bN,shim:_N});IA.exports=OA});var xg=F((QV,NA)=>{"use strict";g();var xN=xa(),DA=br(),SN=tn(),_g=SN("%ArrayBuffer%",!0),wf=DA("ArrayBuffer.prototype.byteLength",!0),EN=DA("Object.prototype.toString"),$A=!!_g&&!wf&&new _g(0).slice,LA=!!$A&&xN($A);NA.exports=wf||LA?function(t){if(!t||typeof t!="object")return!1;try{return wf?wf(t):LA(t,0),!0}catch(r){return!1}}:_g?function(t){return EN(t)==="[object ArrayBuffer]"}:function(t){return!1}});var jA=F((tW,BA)=>{"use strict";g();var AN=Date.prototype.getDay,kN=function(t){try{return AN.call(t),!0}catch(r){return!1}},TN=Object.prototype.toString,CN="[object Date]",PN=Pi()();BA.exports=function(t){return typeof t!="object"||t===null?!1:PN?kN(t):TN.call(t)===CN}});var VA=F((nW,zA)=>{"use strict";g();var Sg=br(),HA=Pi()(),UA,GA,Eg,Ag;HA&&(UA=Sg("Object.prototype.hasOwnProperty"),GA=Sg("RegExp.prototype.exec"),Eg={},bf=function(){throw Eg},Ag={toString:bf,valueOf:bf},typeof Symbol.toPrimitive=="symbol"&&(Ag[Symbol.toPrimitive]=bf));var bf,RN=Sg("Object.prototype.toString"),MN=Object.getOwnPropertyDescriptor,ON="[object RegExp]";zA.exports=HA?function(t){if(!t||typeof t!="object")return!1;var r=MN(t,"lastIndex"),n=r&&UA(r,"value");if(!n)return!1;try{GA(t,Ag)}catch(i){return i===Eg}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:RN(t)===ON}});var YA=F((aW,qA)=>{"use strict";g();var IN=br(),WA=IN("SharedArrayBuffer.prototype.byteLength",!0);qA.exports=WA?function(t){if(!t||typeof t!="object")return!1;try{return WA(t),!0}catch(r){return!1}}:function(t){return!1}});var ZA=F((oW,XA)=>{"use strict";g();var FN=Number.prototype.toString,$N=function(t){try{return FN.call(t),!0}catch(r){return!1}},LN=Object.prototype.toString,DN="[object Number]",NN=Pi()();XA.exports=function(t){return typeof t=="number"?!0:typeof t!="object"?!1:NN?$N(t):LN.call(t)===DN}});var QA=F((cW,JA)=>{"use strict";g();var KA=br(),BN=KA("Boolean.prototype.toString"),jN=KA("Object.prototype.toString"),HN=function(t){try{return BN(t),!0}catch(r){return!1}},UN="[object Boolean]",GN=Pi()();JA.exports=function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:GN&&Symbol.toStringTag in t?HN(t):jN(t)===UN}});var nk=F((fW,kg)=>{"use strict";g();var zN=Object.prototype.toString,VN=Xu()();VN?(ek=Symbol.prototype.toString,tk=/^Symbol\(.*\)$/,rk=function(t){return typeof t.valueOf()!="symbol"?!1:tk.test(ek.call(t))},kg.exports=function(t){if(typeof t=="symbol")return!0;if(zN.call(t)!=="[object Symbol]")return!1;try{return rk(t)}catch(r){return!1}}):kg.exports=function(t){return!1};var ek,tk,rk});var sk=F((hW,ak)=>{"use strict";g();var ik=typeof BigInt!="undefined"&&BigInt;ak.exports=function(){return typeof ik=="function"&&typeof BigInt=="function"&&typeof ik(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var ck=F((mW,Tg)=>{"use strict";g();var WN=sk()();WN?(ok=BigInt.prototype.valueOf,lk=function(t){try{return ok.call(t),!0}catch(r){}return!1},Tg.exports=function(t){return t===null||typeof t=="undefined"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:lk(t)}):Tg.exports=function(t){return!1};var ok,lk});var fk=F((vW,uk)=>{"use strict";g();var qN=ig(),YN=ZA(),XN=QA(),ZN=nk(),KN=ck();uk.exports=function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(qN(t))return"String";if(YN(t))return"Number";if(XN(t))return"Boolean";if(ZN(t))return"Symbol";if(KN(t))return"BigInt"}});var pk=F((wW,hk)=>{"use strict";g();var _f=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,dk=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,xf;_f||(xf=function(t){return!1});var Pg=_f?_f.prototype.has:null,Cg=dk?dk.prototype.has:null;!xf&&!Pg&&(xf=function(t){return!1});hk.exports=xf||function(t){if(!t||typeof t!="object")return!1;try{if(Pg.call(t,Pg),Cg)try{Cg.call(t,Cg)}catch(r){return!0}return t instanceof _f}catch(r){}return!1}});var gk=F((_W,Mg)=>{"use strict";g();var JN=tn(),mk=br(),QN=JN("%WeakSet%",!0),Rg=mk("WeakSet.prototype.has",!0);Rg?(Sf=mk("WeakMap.prototype.has",!0),Mg.exports=function(t){if(!t||typeof t!="object")return!1;try{if(Rg(t,Rg),Sf)try{Sf(t,Sf)}catch(r){return!0}return t instanceof QN}catch(r){}return!1}):Mg.exports=function(t){return!1};var Sf});var yk=F((SW,vk)=>{"use strict";g();var eB=sg(),tB=lg(),rB=pk(),nB=gk();vk.exports=function(t){if(t&&typeof t=="object"){if(eB(t))return"Map";if(tB(t))return"Set";if(rB(t))return"WeakMap";if(nB(t))return"WeakSet"}return!1}});var xk=F((AW,_k)=>{"use strict";g();var bk=Function.prototype.toString,zs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ig,Ef;if(typeof zs=="function"&&typeof Object.defineProperty=="function")try{Ig=Object.defineProperty({},"length",{get:function(){throw Ef}}),Ef={},zs(function(){throw 42},null,Ig)}catch(e){e!==Ef&&(zs=null)}else zs=null;var iB=/^\s*class\b/,Fg=function(t){try{var r=bk.call(t);return iB.test(r)}catch(n){return!1}},Og=function(t){try{return Fg(t)?!1:(bk.call(t),!0)}catch(r){return!1}},Af=Object.prototype.toString,aB="[object Object]",sB="[object Function]",oB="[object GeneratorFunction]",lB="[object HTMLAllCollection]",cB="[object HTML document.all class]",uB="[object HTMLCollection]",fB=typeof Symbol=="function"&&!!Symbol.toStringTag,dB=!(0 in[,]),$g=function(){return!1};typeof document=="object"&&(wk=document.all,Af.call(wk)===Af.call(document.all)&&($g=function(t){if((dB||!t)&&(typeof t=="undefined"||typeof t=="object"))try{var r=Af.call(t);return(r===lB||r===cB||r===uB||r===aB)&&t("")==null}catch(n){}return!1}));var wk;_k.exports=zs?function(t){if($g(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{zs(t,null,Ig)}catch(r){if(r!==Ef)return!1}return!Fg(t)&&Og(t)}:function(t){if($g(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(fB)return Og(t);if(Fg(t))return!1;var r=Af.call(t);return r!==sB&&r!==oB&&!/^\[object HTML/.test(r)?!1:Og(t)}});var Ak=F((TW,Ek)=>{"use strict";g();var hB=xk(),pB=Object.prototype.toString,Sk=Object.prototype.hasOwnProperty,mB=function(t,r,n){for(var i=0,a=t.length;i=3&&(i=n),pB.call(t)==="[object Array]"?mB(t,r,i):typeof t=="string"?gB(t,r,i):vB(t,r,i)};Ek.exports=yB});var Tk=F((PW,kk)=>{"use strict";g();kk.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Pk=F((MW,Ck)=>{"use strict";g();var Lg=Tk(),wB=typeof globalThis=="undefined"?global:globalThis;Ck.exports=function(){for(var t=[],r=0;r{"use strict";g();var Tf=Ak(),bB=Pk(),Rk=xa(),Bg=br(),kf=rf(),_B=Bg("Object.prototype.toString"),Ok=Pi()(),Mk=typeof globalThis=="undefined"?global:globalThis,Ng=bB(),jg=Bg("String.prototype.slice"),Dg=Object.getPrototypeOf,xB=Bg("Array.prototype.indexOf",!0)||function(t,r){for(var n=0;n-1?r:r!=="Object"?!1:EB(t)}return kf?SB(t):null}});var Dk=F(($W,Lk)=>{"use strict";g();var AB=br(),$k=AB("ArrayBuffer.prototype.byteLength",!0),kB=xg();Lk.exports=function(t){return kB(t)?$k?$k(t):t.byteLength:NaN}});var lT=F((DW,oT)=>{"use strict";g();var iT=pE(),kn=br(),Nk=CE(),TB=tn(),Vs=AA(),CB=tg(),Bk=FA(),jk=Hm(),Hk=ng(),Uk=xg(),Gk=jA(),zk=VA(),Vk=YA(),Wk=Yu(),qk=fk(),Yk=yk(),Xk=Fk(),Zk=Dk(),Kk=kn("SharedArrayBuffer.prototype.byteLength",!0),Jk=kn("Date.prototype.getTime"),Hg=Object.getPrototypeOf,Qk=kn("Object.prototype.toString"),Rf=TB("%Set%",!0),Ug=kn("Map.prototype.has",!0),Mf=kn("Map.prototype.get",!0),eT=kn("Map.prototype.size",!0),Of=kn("Set.prototype.add",!0),aT=kn("Set.prototype.delete",!0),If=kn("Set.prototype.has",!0),Pf=kn("Set.prototype.size",!0);function tT(e,t,r,n){for(var i=Vs(e),a;(a=i.next())&&!a.done;)if(rn(t,a.value,r,n))return aT(e,a.value),!0;return!1}function sT(e){if(typeof e=="undefined")return null;if(typeof e!="object")return typeof e=="symbol"?!1:typeof e=="string"||typeof e=="number"?+e==+e:!0}function PB(e,t,r,n,i,a){var s=sT(r);if(s!=null)return s;var o=Mf(t,s),l=iT({},i,{strict:!1});return typeof o=="undefined"&&!Ug(t,s)||!rn(n,o,l,a)?!1:!Ug(e,s)&&rn(n,o,l,a)}function RB(e,t,r){var n=sT(r);return n!=null?n:If(t,n)&&!If(e,n)}function rT(e,t,r,n,i,a){for(var s=Vs(e),o,l;(o=s.next())&&!o.done;)if(l=o.value,rn(r,l,i,a)&&rn(n,Mf(t,l),i,a))return aT(e,l),!0;return!1}function rn(e,t,r,n){var i=r||{};if(i.strict?Bk(e,t):e===t)return!0;var a=qk(e),s=qk(t);if(a!==s)return!1;if(!e||!t||typeof e!="object"&&typeof t!="object")return i.strict?Bk(e,t):e==t;var o=n.has(e),l=n.has(t),c;if(o&&l){if(n.get(e)===n.get(t))return!0}else c={};return o||n.set(e,c),l||n.set(t,c),IB(e,t,i,n)}function nT(e){return!e||typeof e!="object"||typeof e.length!="number"||typeof e.copy!="function"||typeof e.slice!="function"||e.length>0&&typeof e[0]!="number"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function MB(e,t,r,n){if(Pf(e)!==Pf(t))return!1;for(var i=Vs(e),a=Vs(t),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new Rf),Of(l,s.value);else if(!If(t,s.value)){if(r.strict||!RB(e,t,s.value))return!1;l||(l=new Rf),Of(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!tT(l,o.value,r.strict,n))return!1}else if(!r.strict&&!If(e,o.value)&&!tT(l,o.value,r.strict,n))return!1;return Pf(l)===0}return!0}function OB(e,t,r,n){if(eT(e)!==eT(t))return!1;for(var i=Vs(e),a=Vs(t),s,o,l,c,u,f;(s=i.next())&&!s.done;)if(c=s.value[0],u=s.value[1],c&&typeof c=="object")l||(l=new Rf),Of(l,c);else if(f=Mf(t,c),typeof f=="undefined"&&!Ug(t,c)||!rn(u,f,r,n)){if(r.strict||!PB(e,t,c,u,r,n))return!1;l||(l=new Rf),Of(l,c)}if(l){for(;(o=a.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!rT(l,e,c,f,r,n))return!1}else if(!r.strict&&(!e.has(c)||!rn(Mf(e,c),f,r,n))&&!rT(l,e,c,f,iT({},r,{strict:!1}),n))return!1;return Pf(l)===0}return!0}function IB(e,t,r,n){var i,a;if(typeof e!=typeof t||e==null||t==null||Qk(e)!==Qk(t)||jk(e)!==jk(t))return!1;var s=Hk(e),o=Hk(t);if(s!==o)return!1;var l=e instanceof Error,c=t instanceof Error;if(l!==c||(l||c)&&(e.name!==t.name||e.message!==t.message))return!1;var u=zk(e),f=zk(t);if(u!==f||(u||f)&&(e.source!==t.source||Nk(e)!==Nk(t)))return!1;var d=Gk(e),h=Gk(t);if(d!==h||(d||h)&&Jk(e)!==Jk(t)||r.strict&&Hg&&Hg(e)!==Hg(t))return!1;var p=Xk(e),m=Xk(t);if(p!==m)return!1;if(p||m){if(e.length!==t.length)return!1;for(i=0;i=0;i--)if(k[i]!=w[i])return!1;for(i=k.length-1;i>=0;i--)if(a=k[i],!rn(e[a],t[a],r,n))return!1;var A=Yk(e),S=Yk(t);return A!==S?!1:A==="Set"||S==="Set"?MB(e,t,r,n):A==="Map"?OB(e,t,r,n):!0}oT.exports=function(t,r,n){return rn(t,r,n,CB())}});var Zg=F((exports,module)=>{g();(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(e){return Object.prototype.toString.call(e)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return typeof e=="object"&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e,t){return function(r){return new Sha256(t,!0).update(r)[e]()}},createMethod=function(e){var t=createOutputMethod("hex",e);NODE_JS&&(t=nodeWrap(t,e)),t.create=function(){return new Sha256(e)},t.update=function(i){return t.create().update(i)};for(var r=0;r>2]|=e[i]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|n&63)<=57344?(o[a>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|n&63)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|n&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}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 e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,c,u,f,d,h,p,m,v,y,b,x;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(x=t&r,c=0;c<64;c+=4)this.first?(this.is224?(v=300032,h=l[0]-1413257819,o=h-150054599<<0,n=h+24177077<<0):(v=704751109,h=l[0]-210244248,o=h-1521486534<<0,n=h+143694565<<0),this.first=!1):(u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),v=e&t,d=v^e&r^x,m=i&a^~i&s,h=o+f+m+K[c]+l[c],p=u+d,o=n+h<<0,n=h+p<<0),u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=n&e,d=y^n&t^v,m=o&i^~o&a,h=s+f+m+K[c+1]+l[c+1],p=u+d,s=r+h<<0,r=h+p<<0,u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,d=b^r&e^y,m=s&o^~s&i,h=a+f+m+K[c+2]+l[c+2],p=u+d,a=t+h<<0,t=h+p<<0,u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),x=t&r,d=x^t&n^b,m=a&s^~a&o,h=i+f+m+K[c+3]+l[c+3],p=u+d,i=e+h<<0,e=h+p<<0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=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[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[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[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[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[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]+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];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 e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,e&255,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24&255,r>>16&255,r>>8&255,r&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&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 e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};function HmacSha256(e,t,r){var n,i=typeof e;if(i==="string"){var a=[],s=e.length,o=0,l;for(n=0;n>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|e.charCodeAt(++n)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);e=a}else if(i==="object"){if(e===null)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR)}else throw new Error(ERROR);e.length>64&&(e=new Sha256(t,!0).update(e).array());var c=[],u=[];for(n=0;n<64;++n){var f=e[n]||0;c[n]=92^f,u[n]=54^f}Sha256.call(this,t,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 e=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),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 RC=F(A0=>{g();(function(e){var t=/\S/,r=/\"/g,n=/\n/g,i=/\r/g,a=/\\/g,s=/\u2028/,o=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(A,S){var T=A.length,P=0,I=1,N=2,L=P,ee=null,fe=null,J="",Q=[],Pe=!1,ge=0,z=0,Y="{{",O="}}";function he(){J.length>0&&(Q.push({tag:"_t",text:new String(J)}),J="")}function Ge(){for(var ct=!0,rt=z;rt"&&(Ie.indent=Q[Et].text.toString()),Q.splice(Et,1));else rt||Q.push({tag:` -`});Pe=!1,z=Q.length}function Re(ct,rt){var Et="="+O,Ie=ct.indexOf(Et,rt),H=c(ct.substring(ct.indexOf("=",rt)+1,Ie)).split(" ");return Y=H[0],O=H[H.length-1],Ie+Et.length-1}for(S&&(S=S.split(" "),Y=S[0],O=S[1]),ge=0;ge0;){if(L=w.shift(),N&&N.tag=="<"&&!(L.tag in f))throw new Error("Illegal content in < super tag.");if(e.tags[L.tag]<=e.tags.$||h(L,T))S.push(L),L.nodes=d(w,L.tag,S,T);else if(L.tag=="/"){if(S.length===0)throw new Error("Closing tag without opener: /"+L.n);if(I=S.pop(),L.n!=I.n&&!p(L.n,I.n,T))throw new Error("Nesting error: "+I.n+" vs. "+L.n);return I.end=L.i,P}else L.tag==` -`&&(L.last=w.length==0||w[0].tag==` -`);P.push(L)}if(S.length>0)throw new Error("missing closing tag: "+S.pop().n);return P}function h(w,A){for(var S=0,T=A.length;S":E,"<":function(w,A){var S={partials:{},code:"",subs:{},inPartial:!0};e.walk(w.nodes,S);var T=A.partials[E(w,A)];T.subs=S.subs,T.partials=S.partials},$:function(w,A){var S={subs:{},code:"",partials:A.partials,prefix:w.n};e.walk(w.nodes,S),A.subs[w.n]=S.code,A.inPartial||(A.code+='t.sub("'+b(w.n)+'",c,p,i);')},"\n":function(w,A){A.code+=k('"\\n"'+(w.last?"":" + i"))},_v:function(w,A){A.code+="t.b(t.v(t."+x(w.n)+'("'+b(w.n)+'",c,p,0)));'},_t:function(w,A){A.code+=k('"'+b(w.text)+'"')},"{":_,"&":_};function _(w,A){A.code+="t.b(t.t(t."+x(w.n)+'("'+b(w.n)+'",c,p,0)));'}function k(w){return"t.b("+w+");"}e.walk=function(w,A){for(var S,T=0,P=w.length;T{g();var Wj={};(function(e){e.Template=function(d,h,p,m){d=d||{},this.r=d.code||this.r,this.c=p,this.options=m||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},e.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,m){return this.ri([h],p||{},m)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],m=h[p.name];if(p.instance&&p.base==m)return p.instance;if(typeof m=="string"){if(!this.c)throw new Error("No compiler available.");m=this.c.compile(m,this.options)}if(!m)return null;if(this.partials[d].base=m,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);m=r(m,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=m,m},rp:function(d,h,p,m){var v=this.ep(d,p);return v?v.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);return}for(var v=0;v=0;E--)if(y=h[E],v=t(d,y,x),v!==void 0){b=!0;break}return b?(!m&&typeof v=="function"&&(v=this.mv(v,h,p)),v):m?!1:""},ls:function(d,h,p,m,v){var y=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(c(d.call(h,m)),h,p)),this.options.delimiters=y,!1},ct:function(d,h,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,p)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,p,m,v,y,b){var x,E=h[h.length-1],_=d.call(E);return typeof _=="function"?m?!0:(x=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(_,E,p,x.substring(v,y),b)):_},mv:function(d,h,p){var m=h[h.length-1],v=d.call(m);return typeof v=="function"?this.ct(c(v.call(m)),m,p):v},sub:function(d,h,p,m){var v=this.subs[d];v&&(this.activeSub=d,v(h,p,this,m),this.activeSub=!1)}};function t(d,h,p){var m;return h&&typeof h=="object"&&(h[d]!==void 0?m=h[d]:p&&h.get&&typeof h.get=="function"&&(m=h.get(d))),m}function r(d,h,p,m,v,y){function b(){}b.prototype=d;function x(){}x.prototype=d.subs;var E,_=new b;_.subs=new x,_.subsText={},_.buf="",m=m||{},_.stackSubs=m,_.subsText=y;for(E in h)m[E]||(m[E]=h[E]);for(E in m)_.subs[E]=m[E];v=v||{},_.stackPartials=v;for(E in p)v[E]||(v[E]=p[E]);for(E in v)_.partials[E]=v[E];return _}var n=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(n,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof k0!="undefined"?k0:Wj)});var T0=F((WX,OC)=>{g();var hd=RC();hd.Template=MC().Template;hd.template=hd.Template;OC.exports=hd});var MP=F((xc,$v)=>{g();(function(t,r){typeof xc=="object"&&typeof $v=="object"?$v.exports=r():typeof define=="function"&&define.amd?define([],r):typeof xc=="object"?xc.feather=r():t.feather=r()})(typeof self!="undefined"?self:xc,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=0)}({"./dist/icons.json":function(e){e.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',table:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(e,t,r){var n,i;(function(){"use strict";var a=function(){function s(){}s.prototype=Object.create(null);function o(m,v){for(var y=v.length,b=0;b1?arguments[1]:void 0,v=m!==void 0,y=0,b=c(d),x,E,_,k;if(v&&(m=n(m,p>2?arguments[2]:void 0,2)),b!=null&&!(h==Array&&s(b)))for(k=b.call(d),E=new h;!(_=k.next()).done;y++)l(E,y,v?a(k,m,[_.value,y],!0):_.value);else for(x=o(d.length),E=new h(x);x>y;y++)l(E,y,v?m(d[y],y):d[y]);return E.length=y,E}},"./node_modules/core-js/internals/array-includes.js":function(e,t,r){var n=r("./node_modules/core-js/internals/to-indexed-object.js"),i=r("./node_modules/core-js/internals/to-length.js"),a=r("./node_modules/core-js/internals/to-absolute-index.js");e.exports=function(s){return function(o,l,c){var u=n(o),f=i(u.length),d=a(c,f),h;if(s&&l!=l){for(;f>d;)if(h=u[d++],h!=h)return!0}else for(;f>d;d++)if((s||d in u)&&u[d]===l)return s||d||0;return!s&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(e,t,r){var n=r("./node_modules/core-js/internals/a-function.js");e.exports=function(i,a,s){if(n(i),a===void 0)return i;switch(s){case 0:return function(){return i.call(a)};case 1:return function(o){return i.call(a,o)};case 2:return function(o,l){return i.call(a,o,l)};case 3:return function(o,l,c){return i.call(a,o,l,c)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(e,t,r){var n=r("./node_modules/core-js/internals/an-object.js");e.exports=function(i,a,s,o){try{return o?a(n(s)[0],s[1]):a(s)}catch(c){var l=i.return;throw l!==void 0&&n(l.call(i)),c}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(e,t,r){var n=r("./node_modules/core-js/internals/well-known-symbol.js"),i=n("iterator"),a=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(l){}e.exports=function(l,c){if(!c&&!a)return!1;var u=!1;try{var f={};f[i]=function(){return{next:function(){return{done:u=!0}}}},l(f)}catch(d){}return u}},"./node_modules/core-js/internals/classof-raw.js":function(e,t){var r={}.toString;e.exports=function(n){return r.call(n).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(e,t,r){var n=r("./node_modules/core-js/internals/classof-raw.js"),i=r("./node_modules/core-js/internals/well-known-symbol.js"),a=i("toStringTag"),s=n(function(){return arguments}())=="Arguments",o=function(l,c){try{return l[c]}catch(u){}};e.exports=function(l){var c,u,f;return l===void 0?"Undefined":l===null?"Null":typeof(u=o(c=Object(l),a))=="string"?u:s?n(c):(f=n(c))=="Object"&&typeof c.callee=="function"?"Arguments":f}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(e,t,r){var n=r("./node_modules/core-js/internals/has.js"),i=r("./node_modules/core-js/internals/own-keys.js"),a=r("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),s=r("./node_modules/core-js/internals/object-define-property.js");e.exports=function(o,l){for(var c=i(l),u=s.f,f=a.f,d=0;d",x="java"+y+":",E;for(p.style.display="none",o.appendChild(p),p.src=String(x),E=p.contentWindow.document,E.open(),E.write(v+y+b+"document.F=Object"+v+"/"+y+b),E.close(),h=E.F;m--;)delete h[f][a[m]];return h()};e.exports=Object.create||function(m,v){var y;return m!==null?(d[f]=n(m),y=new d,d[f]=null,y[u]=m):y=h(),v===void 0?y:i(y,v)},s[u]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(e,t,r){var n=r("./node_modules/core-js/internals/descriptors.js"),i=r("./node_modules/core-js/internals/object-define-property.js"),a=r("./node_modules/core-js/internals/an-object.js"),s=r("./node_modules/core-js/internals/object-keys.js");e.exports=n?Object.defineProperties:function(l,c){a(l);for(var u=s(c),f=u.length,d=0,h;f>d;)i.f(l,h=u[d++],c[h]);return l}},"./node_modules/core-js/internals/object-define-property.js":function(e,t,r){var n=r("./node_modules/core-js/internals/descriptors.js"),i=r("./node_modules/core-js/internals/ie8-dom-define.js"),a=r("./node_modules/core-js/internals/an-object.js"),s=r("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;t.f=n?o:function(c,u,f){if(a(c),u=s(u,!0),a(f),i)try{return o(c,u,f)}catch(d){}if("get"in f||"set"in f)throw TypeError("Accessors not supported");return"value"in f&&(c[u]=f.value),c}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(e,t,r){var n=r("./node_modules/core-js/internals/descriptors.js"),i=r("./node_modules/core-js/internals/object-property-is-enumerable.js"),a=r("./node_modules/core-js/internals/create-property-descriptor.js"),s=r("./node_modules/core-js/internals/to-indexed-object.js"),o=r("./node_modules/core-js/internals/to-primitive.js"),l=r("./node_modules/core-js/internals/has.js"),c=r("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;t.f=n?u:function(d,h){if(d=s(d),h=o(h,!0),c)try{return u(d,h)}catch(p){}if(l(d,h))return a(!i.f.call(d,h),d[h])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(e,t,r){var n=r("./node_modules/core-js/internals/object-keys-internal.js"),i=r("./node_modules/core-js/internals/enum-bug-keys.js"),a=i.concat("length","prototype");t.f=Object.getOwnPropertyNames||function(o){return n(o,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(e,t){t.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(e,t,r){var n=r("./node_modules/core-js/internals/has.js"),i=r("./node_modules/core-js/internals/to-object.js"),a=r("./node_modules/core-js/internals/shared-key.js"),s=r("./node_modules/core-js/internals/correct-prototype-getter.js"),o=a("IE_PROTO"),l=Object.prototype;e.exports=s?Object.getPrototypeOf:function(c){return c=i(c),n(c,o)?c[o]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?l:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(e,t,r){var n=r("./node_modules/core-js/internals/has.js"),i=r("./node_modules/core-js/internals/to-indexed-object.js"),a=r("./node_modules/core-js/internals/array-includes.js"),s=r("./node_modules/core-js/internals/hidden-keys.js"),o=a(!1);e.exports=function(l,c){var u=i(l),f=0,d=[],h;for(h in u)!n(s,h)&&n(u,h)&&d.push(h);for(;c.length>f;)n(u,h=c[f++])&&(~o(d,h)||d.push(h));return d}},"./node_modules/core-js/internals/object-keys.js":function(e,t,r){var n=r("./node_modules/core-js/internals/object-keys-internal.js"),i=r("./node_modules/core-js/internals/enum-bug-keys.js");e.exports=Object.keys||function(s){return n(s,i)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(e,t,r){"use strict";var n={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!n.call({1:2},1);t.f=a?function(o){var l=i(this,o);return!!l&&l.enumerable}:n},"./node_modules/core-js/internals/object-set-prototype-of.js":function(e,t,r){var n=r("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,a={},s;try{s=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,s.call(a,[]),i=a instanceof Array}catch(o){}return function(l,c){return n(l,c),i?s.call(l,c):l.__proto__=c,l}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(e,t,r){var n=r("./node_modules/core-js/internals/global.js"),i=r("./node_modules/core-js/internals/object-get-own-property-names.js"),a=r("./node_modules/core-js/internals/object-get-own-property-symbols.js"),s=r("./node_modules/core-js/internals/an-object.js"),o=n.Reflect;e.exports=o&&o.ownKeys||function(c){var u=i.f(s(c)),f=a.f;return f?u.concat(f(c)):u}},"./node_modules/core-js/internals/path.js":function(e,t,r){e.exports=r("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(e,t,r){var n=r("./node_modules/core-js/internals/global.js"),i=r("./node_modules/core-js/internals/shared.js"),a=r("./node_modules/core-js/internals/hide.js"),s=r("./node_modules/core-js/internals/has.js"),o=r("./node_modules/core-js/internals/set-global.js"),l=r("./node_modules/core-js/internals/function-to-string.js"),c=r("./node_modules/core-js/internals/internal-state.js"),u=c.get,f=c.enforce,d=String(l).split("toString");i("inspectSource",function(h){return l.call(h)}),(e.exports=function(h,p,m,v){var y=v?!!v.unsafe:!1,b=v?!!v.enumerable:!1,x=v?!!v.noTargetGet:!1;if(typeof m=="function"&&(typeof p=="string"&&!s(m,"name")&&a(m,"name",p),f(m).source=d.join(typeof p=="string"?p:"")),h===n){b?h[p]=m:o(p,m);return}else y?!x&&h[p]&&(b=!0):delete h[p];b?h[p]=m:a(h,p,m)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||l.call(this)})},"./node_modules/core-js/internals/require-object-coercible.js":function(e,t){e.exports=function(r){if(r==null)throw TypeError("Can't call method on "+r);return r}},"./node_modules/core-js/internals/set-global.js":function(e,t,r){var n=r("./node_modules/core-js/internals/global.js"),i=r("./node_modules/core-js/internals/hide.js");e.exports=function(a,s){try{i(n,a,s)}catch(o){n[a]=s}return s}},"./node_modules/core-js/internals/set-to-string-tag.js":function(e,t,r){var n=r("./node_modules/core-js/internals/object-define-property.js").f,i=r("./node_modules/core-js/internals/has.js"),a=r("./node_modules/core-js/internals/well-known-symbol.js"),s=a("toStringTag");e.exports=function(o,l,c){o&&!i(o=c?o:o.prototype,s)&&n(o,s,{configurable:!0,value:l})}},"./node_modules/core-js/internals/shared-key.js":function(e,t,r){var n=r("./node_modules/core-js/internals/shared.js"),i=r("./node_modules/core-js/internals/uid.js"),a=n("keys");e.exports=function(s){return a[s]||(a[s]=i(s))}},"./node_modules/core-js/internals/shared.js":function(e,t,r){var n=r("./node_modules/core-js/internals/global.js"),i=r("./node_modules/core-js/internals/set-global.js"),a=r("./node_modules/core-js/internals/is-pure.js"),s="__core-js_shared__",o=n[s]||i(s,{});(e.exports=function(l,c){return o[l]||(o[l]=c!==void 0?c:{})})("versions",[]).push({version:"3.1.3",mode:a?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(e,t,r){var n=r("./node_modules/core-js/internals/to-integer.js"),i=r("./node_modules/core-js/internals/require-object-coercible.js");e.exports=function(a,s,o){var l=String(i(a)),c=n(s),u=l.length,f,d;return c<0||c>=u?o?"":void 0:(f=l.charCodeAt(c),f<55296||f>56319||c+1===u||(d=l.charCodeAt(c+1))<56320||d>57343?o?l.charAt(c):f:o?l.slice(c,c+2):(f-55296<<10)+(d-56320)+65536)}},"./node_modules/core-js/internals/to-absolute-index.js":function(e,t,r){var n=r("./node_modules/core-js/internals/to-integer.js"),i=Math.max,a=Math.min;e.exports=function(s,o){var l=n(s);return l<0?i(l+o,0):a(l,o)}},"./node_modules/core-js/internals/to-indexed-object.js":function(e,t,r){var n=r("./node_modules/core-js/internals/indexed-object.js"),i=r("./node_modules/core-js/internals/require-object-coercible.js");e.exports=function(a){return n(i(a))}},"./node_modules/core-js/internals/to-integer.js":function(e,t){var r=Math.ceil,n=Math.floor;e.exports=function(i){return isNaN(i=+i)?0:(i>0?n:r)(i)}},"./node_modules/core-js/internals/to-length.js":function(e,t,r){var n=r("./node_modules/core-js/internals/to-integer.js"),i=Math.min;e.exports=function(a){return a>0?i(n(a),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(e,t,r){var n=r("./node_modules/core-js/internals/require-object-coercible.js");e.exports=function(i){return Object(n(i))}},"./node_modules/core-js/internals/to-primitive.js":function(e,t,r){var n=r("./node_modules/core-js/internals/is-object.js");e.exports=function(i,a){if(!n(i))return i;var s,o;if(a&&typeof(s=i.toString)=="function"&&!n(o=s.call(i))||typeof(s=i.valueOf)=="function"&&!n(o=s.call(i))||!a&&typeof(s=i.toString)=="function"&&!n(o=s.call(i)))return o;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(e,t){var r=0,n=Math.random();e.exports=function(i){return"Symbol(".concat(i===void 0?"":i,")_",(++r+n).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(e,t,r){var n=r("./node_modules/core-js/internals/is-object.js"),i=r("./node_modules/core-js/internals/an-object.js");e.exports=function(a,s){if(i(a),!n(s)&&s!==null)throw TypeError("Can't set "+String(s)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(e,t,r){var n=r("./node_modules/core-js/internals/global.js"),i=r("./node_modules/core-js/internals/shared.js"),a=r("./node_modules/core-js/internals/uid.js"),s=r("./node_modules/core-js/internals/native-symbol.js"),o=n.Symbol,l=i("wks");e.exports=function(c){return l[c]||(l[c]=s&&o[c]||(s?o:a)("Symbol."+c))}},"./node_modules/core-js/modules/es.array.from.js":function(e,t,r){var n=r("./node_modules/core-js/internals/export.js"),i=r("./node_modules/core-js/internals/array-from.js"),a=r("./node_modules/core-js/internals/check-correctness-of-iteration.js"),s=!a(function(o){Array.from(o)});n({target:"Array",stat:!0,forced:s},{from:i})},"./node_modules/core-js/modules/es.string.iterator.js":function(e,t,r){"use strict";var n=r("./node_modules/core-js/internals/string-at.js"),i=r("./node_modules/core-js/internals/internal-state.js"),a=r("./node_modules/core-js/internals/define-iterator.js"),s="String Iterator",o=i.set,l=i.getterFor(s);a(String,"String",function(c){o(this,{type:s,string:String(c),index:0})},function(){var u=l(this),f=u.string,d=u.index,h;return d>=f.length?{value:void 0,done:!0}:(h=n(f,d,!0),u.index+=h.length,{value:h,done:!1})})},"./node_modules/webpack/buildin/global.js":function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(n){typeof window=="object"&&(r=window)}e.exports=r},"./src/default-attrs.json":function(e){e.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(h){for(var p=1;p2&&arguments[2]!==void 0?arguments[2]:[];u(this,h),this.name=p,this.contents=m,this.tags=v,this.attrs=n({},l.default,{class:"feather feather-"+p})}return i(h,[{key:"toSvg",value:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=n({},this.attrs,m,{class:(0,s.default)(this.attrs.class,m.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),h}();function d(h){return Object.keys(h).map(function(p){return p+'="'+h[p]+'"'}).join(" ")}t.default=f},"./src/icons.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("./src/icon.js"),i=c(n),a=r("./dist/icons.json"),s=c(a),o=r("./src/tags.json"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}t.default=Object.keys(s.default).map(function(u){return new i.default(u,s.default[u],l.default[u])}).reduce(function(u,f){return u[f.name]=f,u},{})},"./src/index.js":function(e,t,r){"use strict";var n=r("./src/icons.js"),i=c(n),a=r("./src/to-svg.js"),s=c(a),o=r("./src/replace.js"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}e.exports={icons:i.default,toSvg:s.default,replace:l.default}},"./src/replace.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(d){for(var h=1;h0&&arguments[0]!==void 0?arguments[0]:{};if(typeof document=="undefined")throw new Error("`feather.replace()` only works in a browser environment.");var h=document.querySelectorAll("[data-feather]");Array.from(h).forEach(function(p){return u(p,d)})}function u(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=f(d),m=p["data-feather"];if(delete p["data-feather"],o.default[m]===void 0){console.warn("feather: '"+m+"' is not a valid icon");return}var v=o.default[m].toSvg(n({},h,p,{class:(0,a.default)(h.class,p.class)})),y=new DOMParser().parseFromString(v,"image/svg+xml"),b=y.querySelector("svg");d.parentNode.replaceChild(b,d)}function f(d){return Array.from(d.attributes).reduce(function(h,p){return h[p.name]=p.value,h},{})}t.default=c},"./src/tags.json":function(e){e.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],"chevron-down":["expand"],"chevron-up":["collapse"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-buoy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("./src/icons.js"),i=a(n);function a(o){return o&&o.__esModule?o:{default:o}}function s(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!o)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[o])throw new Error("No icon matching '"+o+"'. See the complete list of icons at https://feathericons.com");return i.default[o].toSvg(l)}t.default=s},0:function(e,t,r){r("./node_modules/core-js/es/array/from.js"),e.exports=r("./src/index.js")}})})});var UH={};QP(UH,{default:()=>Qd});module.exports=eR(UH);g();g();var tl=ze(m1(),1),Ep=ze(E1(),1),t2=ze(k1(),1),uu=ze(hw(),1),Qc=ze(gw(),1),r2=ze(Aw(),1),Qr=ze(Tw(),1),n2=ze(Ow(),1),Se=class e extends Error{constructor(t){super(t),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(t){let r=new e(t.message);return r.code=t.code,r.data=t.data,r.caller=t.caller,r.stack=t.stack,r}get isIsomorphicGitError(){return!0}},rl=class e extends Se{constructor(t){super(`Modifying the index is not possible because you have unmerged files: ${t.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=e.code,this.data={filepaths:t}}};rl.code="UnmergedPathsError";var le=class e extends Se{constructor(t){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${t}`),this.code=this.name=e.code,this.data={message:t}}};le.code="InternalError";var ds=class e extends Se{constructor(t){super(`The filepath "${t}" contains unsafe character sequences`),this.code=this.name=e.code,this.data={filepath:t}}};ds.code="UnsafeFilepathError";var Fr=class{constructor(t){this.buffer=t,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(t){this._start=t}slice(t){let r=this.buffer.slice(this._start,this._start+t);return this._start+=t,r}toString(t,r){let n=this.buffer.toString(t,this._start,this._start+r);return this._start+=r,n}write(t,r,n){let i=this.buffer.write(t,this._start,r,n);return this._start+=r,i}copy(t,r,n){let i=t.copy(this.buffer,this._start,r,n);return this._start+=i,i}readUInt8(){let t=this.buffer.readUInt8(this._start);return this._start+=1,t}writeUInt8(t){let r=this.buffer.writeUInt8(t,this._start);return this._start+=1,r}readUInt16BE(){let t=this.buffer.readUInt16BE(this._start);return this._start+=2,t}writeUInt16BE(t){let r=this.buffer.writeUInt16BE(t,this._start);return this._start+=2,r}readUInt32BE(){let t=this.buffer.readUInt32BE(this._start);return this._start+=4,t}writeUInt32BE(t){let r=this.buffer.writeUInt32BE(t,this._start);return this._start+=4,r}};function fu(e,t){return-(et)}function i2(e,t){return fu(e.path,t.path)}function a2(e){let t=e>0?e>>12:0;t!==4&&t!==8&&t!==10&&t!==14&&(t=8);let r=e&511;return r&73?r=493:r=420,t!==8&&(r=0),(t<<12)+r}var xn=2**32;function Iw(e,t,r,n){if(e!==void 0&&t!==void 0)return[e,t];r===void 0&&(r=n.valueOf());let i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function hs(e){let[t,r]=Iw(e.ctimeSeconds,e.ctimeNanoseconds,e.ctimeMs,e.ctime),[n,i]=Iw(e.mtimeSeconds,e.mtimeNanoseconds,e.mtimeMs,e.mtime);return{ctimeSeconds:t%xn,ctimeNanoseconds:r%xn,mtimeSeconds:n%xn,mtimeNanoseconds:i%xn,dev:e.dev%xn,ino:e.ino%xn,mode:a2(e.mode%xn),uid:e.uid%xn,gid:e.gid%xn,size:e.size>-1?e.size%xn:0}}function r6(e){let t="";for(let r of new Uint8Array(e))r<16&&(t+="0"),t+=r.toString(16);return t}var rp=null;async function Vn(e){return rp===null&&(rp=await i6()),rp?s2(e):n6(e)}function n6(e){return new Ep.default().update(e).digest("hex")}async function s2(e){let t=await crypto.subtle.digest("SHA-1",e);return r6(t)}async function i6(){try{if(await s2(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(e){}return!1}function a6(e){return{assumeValid:!!(e&32768),extended:!!(e&16384),stage:(e&12288)>>12,nameLength:e&4095}}function s6(e){let t=e.flags;return t.extended=!1,t.nameLength=Math.min(Buffer.from(e.path).length,4095),(t.assumeValid?32768:0)+(t.extended?16384:0)+((t.stage&3)<<12)+(t.nameLength&4095)}var dp=class e{constructor(t,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=t||new Map}_addEntry(t){if(t.flags.stage===0)t.stages=[t],this._entries.set(t.path,t),this._unmergedPaths.delete(t.path);else{let r=this._entries.get(t.path);r||(this._entries.set(t.path,t),r=t),r.stages[t.flags.stage]=t,this._unmergedPaths.add(t.path)}}static async from(t){if(Buffer.isBuffer(t))return e.fromBuffer(t);if(t===null)return new e(null);throw new le("invalid type passed to GitIndex.from")}static async fromBuffer(t){if(t.length===0)throw new le("Index file is empty (.git/index)");let r=new e,n=new Fr(t),i=n.toString("utf8",4);if(i!=="DIRC")throw new le(`Invalid dircache magic file number: ${i}`);let a=await Vn(t.slice(0,-20)),s=t.slice(-20).toString("hex");if(s!==a)throw new le(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=n.readUInt32BE();if(o!==2)throw new le(`Unsupported dircache version: ${o}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&ct.stages.length>1?t.stages.filter(r=>r):t)}*[Symbol.iterator](){for(let t of this.entries)yield t}insert({filepath:t,stats:r,oid:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=hs(r);let a=Buffer.from(t),s={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:t,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),this._dirty=!0}delete({filepath:t}){if(this._entries.has(t))this._entries.delete(t);else for(let r of this._entries.keys())r.startsWith(t+"/")&&this._entries.delete(r);this._unmergedPaths.has(t)&&this._unmergedPaths.delete(t),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:t}){return this._entries.has(t)}render(){return this.entries.map(t=>`${t.mode.toString(8)} ${t.oid} ${t.path}`).join(` -`)}static async _entryToBuffer(t){let r=Buffer.from(t.path),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Fr(i),s=hs(t);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(t.oid,20,"hex"),a.writeUInt16BE(s6(t)),a.write(t.path,r.length,"utf8"),i}async toObject(){let t=Buffer.alloc(12),r=new Fr(t);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(e._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(e._entryToBuffer(l));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([t,i]),s=await Vn(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function eu(e,t,r=!0,n=!0){let i=hs(e),a=hs(t);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size}var np=null,us=Symbol("IndexCache");function o6(){return{map:new Map,stats:new Map}}async function l6(e,t,r){let n=await e.lstat(t),i=await e.read(t),a=await dp.from(i);r.map.set(t,a),r.stats.set(t,n)}async function c6(e,t,r){let n=r.stats.get(t);if(n===void 0)return!0;let i=await e.lstat(t);return n===null||i===null?!1:eu(n,i)}var yt=class{static async acquire({fs:t,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[us]||(n[us]=o6());let s=`${r}/index`;np===null&&(np=new tl.default({maxPending:1/0}));let o,l=[];return await np.acquire(s,async()=>{await c6(t,s,n[us])&&await l6(t,s,n[us]);let c=n[us].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new rl(l);if(o=await a(c),c._dirty){let u=await c.toObject();await t.write(s,u),n[us].stats.set(s,await t.lstat(s)),c._dirty=!1}}),o}};function tu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>-1&&(e=e.slice(t+1)),e}function ps(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?".":t===0?"/":e.slice(0,t)}function o2(e){let t=new Map,r=function(i){if(!t.has(i)){let a={type:"tree",fullpath:i,basename:tu(i),metadata:{},children:[]};t.set(i,a),a.parent=r(ps(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return t.get(i)},n=function(i,a){if(!t.has(i)){let s={type:"blob",fullpath:i,basename:tu(i),metadata:a,parent:r(ps(i)),children:[]};s.parent&&s.parent.children.push(s),t.set(i,s)}return t.get(i)};r(".");for(let i of e)n(i.path,i);return t}function u6(e){switch(e){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new le(`Unexpected GitTree entry mode: ${e.toString(8)}`)}var hp=class{constructor({fs:t,gitdir:r,cache:n}){this.treePromise=yt.acquire({fs:t,gitdir:r,cache:n},async function(a){return o2(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(t){let r=t._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let a=i.children.map(s=>s.fullpath);return a.sort(fu),a}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){let n=(await this.treePromise).get(t._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let i=n.type==="tree"?{}:hs(n.metadata);t._type=n.type==="tree"?"tree":u6(i.mode),t._mode=i.mode,n.type==="tree"?t._stat=void 0:t._stat=i}return t._stat}async content(t){}async oid(t){if(t._oid===!1){let n=(await this.treePromise).get(t._fullpath);t._oid=n.metadata.oid}return t._oid}},du=Symbol("GitWalkSymbol");function hu(){let e=Object.create(null);return Object.defineProperty(e,du,{value:function({fs:t,gitdir:r,cache:n}){return new hp({fs:t,gitdir:r,cache:n})}}),Object.freeze(e),e}var Le=class e extends Se{constructor(t){super(`Could not find ${t}.`),this.code=this.name=e.code,this.data={what:t}}};Le.code="NotFoundError";var zt=class e extends Se{constructor(t,r,n,i){super(`Object ${t} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=e.code,this.data={oid:t,actual:r,expected:n,filepath:i}}};zt.code="ObjectTypeError";var _i=class e extends Se{constructor(t){super(`Expected a 40-char hex object id but saw "${t}".`),this.code=this.name=e.code,this.data={value:t}}};_i.code="InvalidOidError";var nl=class e extends Se{constructor(t){super(`Could not find a fetch refspec for remote "${t}". Make sure the config file has an entry like the following: -[remote "${t}"] +var zM=Object.create;var Rl=Object.defineProperty;var VM=Object.getOwnPropertyDescriptor;var WM=Object.getOwnPropertyNames;var YM=Object.getPrototypeOf,XM=Object.prototype.hasOwnProperty;var Jy=t=>{throw TypeError(t)};var ZM=(t,e,r)=>e in t?Rl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var KM=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),JM=(t,e)=>{for(var r in e)Rl(t,r,{get:e[r],enumerable:!0})},Qy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of WM(e))!XM.call(t,i)&&i!==r&&Rl(t,i,{get:()=>e[i],enumerable:!(n=VM(e,i))||n.enumerable});return t};var bt=(t,e,r)=>(r=t!=null?zM(YM(t)):{},Qy(e||!t||!t.__esModule?Rl(r,"default",{value:t,enumerable:!0}):r,t)),QM=t=>Qy(Rl({},"__esModule",{value:!0}),t);var vt=(t,e,r)=>ZM(t,typeof e!="symbol"?e+"":e,r),Gp=(t,e,r)=>e.has(t)||Jy("Cannot "+r);var le=(t,e,r)=>(Gp(t,e,"read from private field"),r?r.call(t):e.get(t)),wt=(t,e,r)=>e.has(t)?Jy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Ot=(t,e,r,n)=>(Gp(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),vi=(t,e,r)=>(Gp(t,e,"access private method"),r);var rb=I(Wu=>{"use strict";p();Wu.byteLength=tD;Wu.toByteArray=nD;Wu.fromByteArray=sD;var Dn=[],Yr=[],eD=typeof Uint8Array!="undefined"?Uint8Array:Array,qp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(La=0,eb=qp.length;La0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function tD(t){var e=tb(t),r=e[0],n=e[1];return(r+n)*3/4-n}function rD(t,e,r){return(e+r)*3/4-r}function nD(t){var e,r=tb(t),n=r[0],i=r[1],a=new eD(rD(t,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Yr[t.charCodeAt(l)]<<2|Yr[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Yr[t.charCodeAt(l)]<<10|Yr[t.charCodeAt(l+1)]<<4|Yr[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function iD(t){return Dn[t>>18&63]+Dn[t>>12&63]+Dn[t>>6&63]+Dn[t&63]}function aD(t,e,r){for(var n,i=[],a=e;ao?o:s+a));return n===1?(e=t[r-1],i.push(Dn[e>>2]+Dn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Dn[e>>10]+Dn[e>>4&63]+Dn[e<<2&63]+"=")),i.join("")}});var nb=I(zp=>{p();zp.read=function(t,e,r,n,i){var a,s,o=i*8-n-1,l=(1<>1,c=-7,f=r?i-1:0,d=r?-1:1,h=t[e+f];for(f+=d,a=h&(1<<-c)-1,h>>=-c,c+=o;c>0;a=a*256+t[e+f],f+=d,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=s*256+t[e+f],f+=d,c-=8);if(a===0)a=1-u;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-u}return(h?-1:1)*s*Math.pow(2,a-n)};zp.write=function(t,e,r,n,i,a){var s,o,l,u=a*8-i-1,c=(1<>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,m=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=c?(o=0,s=c):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+h]=o&255,h+=m,o/=256,i-=8);for(s=s<0;t[r+h]=s&255,h+=m,s/=256,u-=8);t[r+h-m]|=g*128}});var em=I(Ws=>{"use strict";p();var Vp=rb(),zs=nb(),ib=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ws.Buffer=$;Ws.SlowBuffer=dD;Ws.INSPECT_MAX_BYTES=50;var Yu=2147483647;Ws.kMaxLength=Yu;$.TYPED_ARRAY_SUPPORT=oD();!$.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oD(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function wi(t){if(t>Yu)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Zp(t)}return lb(t,e,r)}$.poolSize=8192;function lb(t,e,r){if(typeof t=="string")return cD(t,e);if(ArrayBuffer.isView(t))return uD(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ln(t,ArrayBuffer)||t&&Ln(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ln(t,SharedArrayBuffer)||t&&Ln(t.buffer,SharedArrayBuffer)))return Yp(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);let i=fD(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.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)}$.from=function(t,e,r){return lb(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function cb(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 lD(t,e,r){return cb(t),t<=0?wi(t):e!==void 0?typeof r=="string"?wi(t).fill(e,r):wi(t).fill(e):wi(t)}$.alloc=function(t,e,r){return lD(t,e,r)};function Zp(t){return cb(t),wi(t<0?0:Kp(t)|0)}$.allocUnsafe=function(t){return Zp(t)};$.allocUnsafeSlow=function(t){return Zp(t)};function cD(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ub(t,e)|0,n=wi(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Wp(t){let e=t.length<0?0:Kp(t.length)|0,r=wi(e);for(let n=0;n=Yu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yu.toString(16)+" bytes");return t|0}function dD(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(Ln(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),Ln(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let a=0,s=Math.min(n,i);ai.length?($.isBuffer(s)||(s=$.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if($.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function ub(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ln(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Xp(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return yb(t).length;default:if(i)return n?-1:Xp(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=ub;function hD(t,e,r){let n=!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 SD(this,e,r);case"utf8":case"utf-8":return db(this,e,r);case"ascii":return _D(this,e,r);case"latin1":case"binary":return xD(this,e,r);case"base64":return yD(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ED(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Na(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.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+=" ... "),""};ib&&($.prototype[ib]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,a){if(Ln(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=n-r,l=Math.min(s,o),u=this.slice(i,a),c=e.slice(r,n);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Qp(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:ab(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ab(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ab(t,e,r,n,i){let a=1,s=t.length,o=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,r/=2}function l(c,f){return a===1?c[f]:c.readUInt16BE(f*a)}let u;if(i){let c=-1;for(u=r;us&&(r=s-o),u=r;u>=0;u--){let c=!0;for(let f=0;fi&&(n=i)):n=i;let a=e.length;n>a/2&&(n=a/2);let s;for(s=0;s>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-r;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return pD(this,e,r,n);case"utf8":case"utf-8":return mD(this,e,r,n);case"ascii":case"latin1":case"binary":return gD(this,e,r,n);case"base64":return vD(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wD(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function yD(t,e,r){return e===0&&r===t.length?Vp.fromByteArray(t):Vp.fromByteArray(t.slice(e,r))}function db(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=r){let l,u,c,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=t[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(f=(a&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(f=(a&15)<<18|(l&63)<<12|(u&63)<<6|c&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=o}return bD(n)}var sb=4096;function bD(t){let e=t.length;if(e<=sb)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=e;an&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e],a=1,s=0;for(;++s>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e+--r],a=1;for(;r>0&&(a*=256);)i+=this[e+--r]*a;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||_t(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||_t(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||_t(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readBigUInt64LE=Zi(function(e){e=e>>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||_t(e,r,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||_t(e,r,this.length);let i=r,a=1,s=this[e+--i];for(;i>0&&(a*=256);)s+=this[e+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*r)),s};$.prototype.readInt8=function(e,r){return e=e>>>0,r||_t(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||_t(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||_t(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readBigInt64LE=Zi(function(e){e=e>>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Vs(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Il(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||_t(e,4,this.length),zs.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||_t(e,4,this.length),zs.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||_t(e,8,this.length),zs.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||_t(e,8,this.length),zs.read(this,e,!1,52,8)};function ur(t,e,r,n,i,a){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;ur(this,e,r,n,o,0)}let a=1,s=0;for(this[r]=e&255;++s>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;ur(this,e,r,n,o,0)}let a=n-1,s=1;for(this[r+a]=e&255;--a>=0&&(s*=256);)this[r+a]=e/s&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(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};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(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 hb(t,e,r,n,i){wb(e,n,i,t,r,7);let a=Number(e&BigInt(4294967295));t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function pb(t,e,r,n,i){wb(e,n,i,t,r,7);let a=Number(e&BigInt(4294967295));t[r+7]=a,a=a>>8,t[r+6]=a,a=a>>8,t[r+5]=a,a=a>>8,t[r+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}$.prototype.writeBigUInt64LE=Zi(function(e,r=0){return hb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Zi(function(e,r=0){return pb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);ur(this,e,r,n,l-1,-l)}let a=0,s=1,o=0;for(this[r]=e&255;++a>0)-o&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);ur(this,e,r,n,l-1,-l)}let a=n-1,s=1,o=0;for(this[r+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[r+a+1]!==0&&(o=1),this[r+a]=(e/s>>0)-o&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(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};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(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};$.prototype.writeBigInt64LE=Zi(function(e,r=0){return hb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Zi(function(e,r=0){return pb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function gb(t,e,r,n,i){return e=+e,r=r>>>0,i||mb(t,e,r,4,34028234663852886e22,-34028234663852886e22),zs.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return gb(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return gb(this,e,r,!1,n)};function vb(t,e,r,n,i){return e=+e,r=r>>>0,i||mb(t,e,r,8,17976931348623157e292,-17976931348623157e292),zs.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return vb(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return vb(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let a;if(typeof e=="number")for(a=r;a2**32?i=ob(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ob(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ob(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function kD(t,e,r){Vs(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Il(e,t.length-(r+1))}function wb(t,e,r,n,i,a){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${e}${s} and <= ${r}${s}`,new qs.ERR_OUT_OF_RANGE("value",o,t)}kD(n,i,a)}function Vs(t,e){if(typeof t!="number")throw new qs.ERR_INVALID_ARG_TYPE(e,"number",t)}function Il(t,e,r){throw Math.floor(t)!==t?(Vs(t,r),new qs.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new qs.ERR_BUFFER_OUT_OF_BOUNDS:new qs.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var AD=/[^+/0-9A-Za-z-_]/g;function TD(t){if(t=t.split("=")[0],t=t.trim().replace(AD,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Xp(t,e){e=e||1/0;let r,n=t.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function CD(t){let e=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function yb(t){return Vp.toByteArray(TD(t))}function Xu(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Ln(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Qp(t){return t!==t}var RD=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Zi(t){return typeof BigInt=="undefined"?ID:t}function ID(){throw new Error("BigInt not supported")}});var bb,tm,Buffer,p=KM(()=>{bb=require("obsidian");bb.Platform.isMobileApp?tm=em().Buffer:tm=global.Buffer;Buffer=tm});var xb=I((D9,_b)=>{"use strict";p();var Rr=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||Rr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Rr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Rr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Rr.DEFAULT_MAX_PENDING};Rr.DEFAULT_TIMEOUT=0;Rr.DEFAULT_MAX_OCCUPATION_TIME=0;Rr.DEFAULT_MAX_EXECUTION_TIME=0;Rr.DEFAULT_MAX_PENDING=1e3;Rr.prototype.acquire=function(t,e,r,n){if(Array.isArray(t))return this._acquireBatch(t,e,r,n);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof r!="function"&&(n=r,r=null,s=new this.Promise(function(b,E){i=b,a=E})),n=n||{};var o=!1,l=null,u=null,c=null,f=this,d=function(b,E,x){u&&(clearTimeout(u),u=null),c&&(clearTimeout(c),c=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(s?E?a(E):i(x):typeof r=="function"&&r(E,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 E=n.maxExecutionTime||f.maxExecutionTime;if(E&&(c=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},E)),e.length===1){var x=!1;try{e(function(k,A){x||(x=!0,d(b,k,A))})}catch(k){x||(x=!0,d(b,k))}}else f._promiseTry(function(){return e()}).then(function(k){d(b,void 0,k)},function(k){d(b,k)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var m=n.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)};n.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var v=n.timeout||f.timeout;v&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},v))}var w=n.maxOccupationTime||f.maxOccupationTime;if(w&&(u=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};Rr.prototype._acquireBatch=function(t,e,r,n){typeof r!="function"&&(n=r,r=null);var i=this,a=function(o,l){return function(u){i.acquire(o,l,u,n)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof r=="function")s(r);else return new this.Promise(function(o,l){s.length===1?s(function(u,c){u?l(u):o(c)}):o(s())})};Rr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Rr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};_b.exports=Rr});var Eb=I((N9,Sb)=>{"use strict";p();Sb.exports=xb()});var kb=I((H9,rm)=>{p();typeof Object.create=="function"?rm.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:rm.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Ku=I((nm,Tb)=>{p();var Zu=em(),Nn=Zu.Buffer;function Ab(t,e){for(var r in t)e[r]=t[r]}Nn.from&&Nn.alloc&&Nn.allocUnsafe&&Nn.allocUnsafeSlow?Tb.exports=Zu:(Ab(Zu,nm),nm.Buffer=Ba);function Ba(t,e,r){return Nn(t,e,r)}Ba.prototype=Object.create(Nn.prototype);Ab(Nn,Ba);Ba.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Nn(t,e,r)};Ba.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Nn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ba.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Nn(t)};Ba.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Zu.SlowBuffer(t)}});var Ju=I((G9,Cb)=>{p();var $D={}.toString;Cb.exports=Array.isArray||function(t){return $D.call(t)=="[object Array]"}});var fr=I((z9,Pb)=>{"use strict";p();Pb.exports=TypeError});var Qu=I((W9,Rb)=>{"use strict";p();Rb.exports=Object});var im=I((X9,Ib)=>{"use strict";p();Ib.exports=Error});var Fb=I((K9,$b)=>{"use strict";p();$b.exports=EvalError});var Mb=I((Q9,Ob)=>{"use strict";p();Ob.exports=RangeError});var Lb=I((t7,Db)=>{"use strict";p();Db.exports=ReferenceError});var ef=I((n7,Nb)=>{"use strict";p();Nb.exports=SyntaxError});var Hb=I((a7,Bb)=>{"use strict";p();Bb.exports=URIError});var jb=I((o7,Ub)=>{"use strict";p();Ub.exports=Math.abs});var qb=I((c7,Gb)=>{"use strict";p();Gb.exports=Math.floor});var Vb=I((f7,zb)=>{"use strict";p();zb.exports=Math.max});var Yb=I((h7,Wb)=>{"use strict";p();Wb.exports=Math.min});var Zb=I((m7,Xb)=>{"use strict";p();Xb.exports=Math.pow});var Jb=I((v7,Kb)=>{"use strict";p();Kb.exports=Math.round});var e_=I((y7,Qb)=>{"use strict";p();Qb.exports=Number.isNaN||function(e){return e!==e}});var r_=I((_7,t_)=>{"use strict";p();var FD=e_();t_.exports=function(e){return FD(e)||e===0?e:e<0?-1:1}});var i_=I((S7,n_)=>{"use strict";p();n_.exports=Object.getOwnPropertyDescriptor});var Ki=I((k7,a_)=>{"use strict";p();var tf=i_();if(tf)try{tf([],"length")}catch(t){tf=null}a_.exports=tf});var $l=I((T7,s_)=>{"use strict";p();var rf=Object.defineProperty||!1;if(rf)try{rf({},"a",{value:1})}catch(t){rf=!1}s_.exports=rf});var Fl=I((P7,o_)=>{"use strict";p();o_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(var a 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 s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var nf=I((I7,c_)=>{"use strict";p();var l_=typeof Symbol!="undefined"&&Symbol,OD=Fl();c_.exports=function(){return typeof l_!="function"||typeof Symbol!="function"||typeof l_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:OD()}});var am=I((F7,u_)=>{"use strict";p();u_.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var sm=I((M7,f_)=>{"use strict";p();var MD=Qu();f_.exports=MD.getPrototypeOf||null});var p_=I((L7,h_)=>{"use strict";p();var DD="Function.prototype.bind called on incompatible ",LD=Object.prototype.toString,ND=Math.max,BD="[object Function]",d_=function(e,r){for(var n=[],i=0;i{"use strict";p();var jD=p_();m_.exports=Function.prototype.bind||jD});var af=I((U7,g_)=>{"use strict";p();g_.exports=Function.prototype.call});var sf=I((G7,v_)=>{"use strict";p();v_.exports=Function.prototype.apply});var y_=I((z7,w_)=>{"use strict";p();w_.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var om=I((W7,b_)=>{"use strict";p();var GD=Ys(),qD=sf(),zD=af(),VD=y_();b_.exports=VD||GD.call(zD,qD)});var of=I((X7,__)=>{"use strict";p();var WD=Ys(),YD=fr(),XD=af(),ZD=om();__.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new YD("a function is required");return ZD(WD,XD,e)}});var T_=I((K7,A_)=>{"use strict";p();var KD=of(),x_=Ki(),E_;try{E_=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var lm=!!E_&&x_&&x_(Object.prototype,"__proto__"),k_=Object,S_=k_.getPrototypeOf;A_.exports=lm&&typeof lm.get=="function"?KD([lm.get]):typeof S_=="function"?function(e){return S_(e==null?e:k_(e))}:!1});var lf=I((Q7,I_)=>{"use strict";p();var C_=am(),P_=sm(),R_=T_();I_.exports=C_?function(e){return C_(e)}:P_?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return P_(e)}:R_?function(e){return R_(e)}:null});var cf=I((tY,$_)=>{"use strict";p();var JD=Function.prototype.call,QD=Object.prototype.hasOwnProperty,eL=Ys();$_.exports=eL.call(JD,QD)});var Bn=I((nY,N_)=>{"use strict";p();var be,tL=Qu(),rL=im(),nL=Fb(),iL=Mb(),aL=Lb(),Js=ef(),Ks=fr(),sL=Hb(),oL=jb(),lL=qb(),cL=Vb(),uL=Yb(),fL=Zb(),dL=Jb(),hL=r_(),D_=Function,cm=function(t){try{return D_('"use strict"; return ('+t+").constructor;")()}catch(e){}},Ol=Ki(),pL=$l(),um=function(){throw new Ks},mL=Ol?function(){try{return arguments.callee,um}catch(t){try{return Ol(arguments,"callee").get}catch(e){return um}}}():um,Xs=nf()(),xt=lf(),gL=sm(),vL=am(),L_=sf(),Ml=af(),Zs={},wL=typeof Uint8Array=="undefined"||!xt?be:xt(Uint8Array),Ha={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?be:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?be:ArrayBuffer,"%ArrayIteratorPrototype%":Xs&&xt?xt([][Symbol.iterator]()):be,"%AsyncFromSyncIteratorPrototype%":be,"%AsyncFunction%":Zs,"%AsyncGenerator%":Zs,"%AsyncGeneratorFunction%":Zs,"%AsyncIteratorPrototype%":Zs,"%Atomics%":typeof Atomics=="undefined"?be:Atomics,"%BigInt%":typeof BigInt=="undefined"?be:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?be:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?be:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?be:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":rL,"%eval%":eval,"%EvalError%":nL,"%Float16Array%":typeof Float16Array=="undefined"?be:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?be:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?be:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?be:FinalizationRegistry,"%Function%":D_,"%GeneratorFunction%":Zs,"%Int8Array%":typeof Int8Array=="undefined"?be:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?be:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?be:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xs&&xt?xt(xt([][Symbol.iterator]())):be,"%JSON%":typeof JSON=="object"?JSON:be,"%Map%":typeof Map=="undefined"?be:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Xs||!xt?be:xt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":tL,"%Object.getOwnPropertyDescriptor%":Ol,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?be:Promise,"%Proxy%":typeof Proxy=="undefined"?be:Proxy,"%RangeError%":iL,"%ReferenceError%":aL,"%Reflect%":typeof Reflect=="undefined"?be:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?be:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Xs||!xt?be:xt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?be:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xs&&xt?xt(""[Symbol.iterator]()):be,"%Symbol%":Xs?Symbol:be,"%SyntaxError%":Js,"%ThrowTypeError%":mL,"%TypedArray%":wL,"%TypeError%":Ks,"%Uint8Array%":typeof Uint8Array=="undefined"?be:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?be:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?be:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?be:Uint32Array,"%URIError%":sL,"%WeakMap%":typeof WeakMap=="undefined"?be:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?be:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?be:WeakSet,"%Function.prototype.call%":Ml,"%Function.prototype.apply%":L_,"%Object.defineProperty%":pL,"%Object.getPrototypeOf%":gL,"%Math.abs%":oL,"%Math.floor%":lL,"%Math.max%":cL,"%Math.min%":uL,"%Math.pow%":fL,"%Math.round%":dL,"%Math.sign%":hL,"%Reflect.getPrototypeOf%":vL};if(xt)try{null.error}catch(t){F_=xt(xt(t)),Ha["%Error.prototype%"]=F_}var F_,yL=function t(e){var r;if(e==="%AsyncFunction%")r=cm("async function () {}");else if(e==="%GeneratorFunction%")r=cm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=cm("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&xt&&(r=xt(i.prototype))}return Ha[e]=r,r},O_={__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"]},Dl=Ys(),uf=cf(),bL=Dl.call(Ml,Array.prototype.concat),_L=Dl.call(L_,Array.prototype.splice),M_=Dl.call(Ml,String.prototype.replace),ff=Dl.call(Ml,String.prototype.slice),xL=Dl.call(Ml,RegExp.prototype.exec),SL=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,EL=/\\(\\)?/g,kL=function(e){var r=ff(e,0,1),n=ff(e,-1);if(r==="%"&&n!=="%")throw new Js("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Js("invalid intrinsic syntax, expected opening `%`");var i=[];return M_(e,SL,function(a,s,o,l){i[i.length]=o?M_(l,EL,"$1"):s||a}),i},AL=function(e,r){var n=e,i;if(uf(O_,n)&&(i=O_[n],n="%"+i[0]+"%"),uf(Ha,n)){var a=Ha[n];if(a===Zs&&(a=yL(n)),typeof a=="undefined"&&!r)throw new Ks("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:a}}throw new Js("intrinsic "+e+" does not exist!")};N_.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ks("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ks('"allowMissing" argument must be a boolean');if(xL(/^%?[^%]*%?$/,e)===null)throw new Js("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=kL(e),i=n.length>0?n[0]:"",a=AL("%"+i+"%",r),s=a.name,o=a.value,l=!1,u=a.alias;u&&(i=u[0],_L(n,bL([0,1],u)));for(var c=1,f=!0;c=n.length){var g=Ol(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=uf(o,d),o=o[d];f&&!l&&(Ha[s]=o)}}return o}});var St=I((aY,U_)=>{"use strict";p();var B_=Bn(),H_=of(),TL=H_([B_("%String.prototype.indexOf%")]);U_.exports=function(e,r){var n=B_(e,!!r);return typeof n=="function"&&TL(e,".prototype.")>-1?H_([n]):n}});var z_=I((oY,q_)=>{"use strict";p();var G_=Function.prototype.toString,Qs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,dm,df;if(typeof Qs=="function"&&typeof Object.defineProperty=="function")try{dm=Object.defineProperty({},"length",{get:function(){throw df}}),df={},Qs(function(){throw 42},null,dm)}catch(t){t!==df&&(Qs=null)}else Qs=null;var CL=/^\s*class\b/,hm=function(e){try{var r=G_.call(e);return CL.test(r)}catch(n){return!1}},fm=function(e){try{return hm(e)?!1:(G_.call(e),!0)}catch(r){return!1}},hf=Object.prototype.toString,PL="[object Object]",RL="[object Function]",IL="[object GeneratorFunction]",$L="[object HTMLAllCollection]",FL="[object HTML document.all class]",OL="[object HTMLCollection]",ML=typeof Symbol=="function"&&!!Symbol.toStringTag,DL=!(0 in[,]),pm=function(){return!1};typeof document=="object"&&(j_=document.all,hf.call(j_)===hf.call(document.all)&&(pm=function(e){if((DL||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=hf.call(e);return(r===$L||r===FL||r===OL||r===PL)&&e("")==null}catch(n){}return!1}));var j_;q_.exports=Qs?function(e){if(pm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Qs(e,null,dm)}catch(r){if(r!==df)return!1}return!hm(e)&&fm(e)}:function(e){if(pm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(ML)return fm(e);if(hm(e))return!1;var r=hf.call(e);return r!==RL&&r!==IL&&!/^\[object HTML/.test(r)?!1:fm(e)}});var Y_=I((cY,W_)=>{"use strict";p();var LL=z_(),NL=Object.prototype.toString,V_=Object.prototype.hasOwnProperty,BL=function(e,r,n){for(var i=0,a=e.length;i=3&&(i=n),jL(e)?BL(e,r,i):typeof e=="string"?HL(e,r,i):UL(e,r,i)}});var Z_=I((fY,X_)=>{"use strict";p();X_.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var J_=I((hY,K_)=>{"use strict";p();var mm=Z_(),GL=typeof globalThis=="undefined"?global:globalThis;K_.exports=function(){for(var e=[],r=0;r{"use strict";p();var Q_=$l(),qL=ef(),eo=fr(),ex=Ki();tx.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new eo("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new eo("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new eo("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new eo("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new eo("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new eo("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!ex&&ex(e,r);if(Q_)Q_(e,r,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[r]=n;else throw new qL("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var mf=I((vY,nx)=>{"use strict";p();var gm=$l(),rx=function(){return!!gm};rx.hasArrayLengthDefineBug=function(){if(!gm)return null;try{return gm([],"length",{value:1}).length!==1}catch(e){return!0}};nx.exports=rx});var lx=I((yY,ox)=>{"use strict";p();var zL=Bn(),ix=pf(),VL=mf()(),ax=Ki(),sx=fr(),WL=zL("%Math.floor%");ox.exports=function(e,r){if(typeof e!="function")throw new sx("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||WL(r)!==r)throw new sx("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&ax){var s=ax(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!n)&&(VL?ix(e,"length",r,!0,!0):ix(e,"length",r)),e}});var ux=I((_Y,cx)=>{"use strict";p();var YL=Ys(),XL=sf(),ZL=om();cx.exports=function(){return ZL(YL,XL,arguments)}});var Ua=I((SY,gf)=>{"use strict";p();var KL=lx(),fx=$l(),JL=of(),dx=ux();gf.exports=function(e){var r=JL(arguments),n=e.length-(arguments.length-1);return KL(r,1+(n>0?n:0),!0)};fx?fx(gf.exports,"apply",{value:dx}):gf.exports.apply=dx});var Ji=I((kY,hx)=>{"use strict";p();var QL=Fl();hx.exports=function(){return QL()&&!!Symbol.toStringTag}});var bm=I((TY,vx)=>{"use strict";p();var yf=Y_(),eN=J_(),px=Ua(),wm=St(),wf=Ki(),vf=lf(),tN=wm("Object.prototype.toString"),gx=Ji()(),mx=typeof globalThis=="undefined"?global:globalThis,vm=eN(),ym=wm("String.prototype.slice"),rN=wm("Array.prototype.indexOf",!0)||function(e,r){for(var n=0;n-1?r:r!=="Object"?!1:iN(e)}return wf?nN(e):null}});var yx=I((PY,wx)=>{"use strict";p();var aN=bm();wx.exports=function(e){return!!aN(e)}});var _x=I((IY,bx)=>{"use strict";p();var sN=fr(),oN=St(),lN=oN("TypedArray.prototype.buffer",!0),cN=yx();bx.exports=lN||function(e){if(!cN(e))throw new sN("Not a Typed Array");return e.buffer}});var Ex=I((FY,Sx)=>{"use strict";p();var Hn=Ku().Buffer,uN=Ju(),fN=_x(),dN=ArrayBuffer.isView||function(e){try{return fN(e),!0}catch(r){return!1}},hN=typeof Uint8Array!="undefined",xx=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",pN=xx&&(Hn.prototype instanceof Uint8Array||Hn.TYPED_ARRAY_SUPPORT);Sx.exports=function(e,r){if(e instanceof Hn)return e;if(typeof e=="string")return Hn.from(e,r);if(xx&&dN(e)){if(e.byteLength===0)return Hn.alloc(0);if(pN){var n=Hn.from(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength===e.byteLength)return n}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=Hn.from(i);if(a.length===e.byteLength)return a}if(hN&&e instanceof Uint8Array)return Hn.from(e);var s=uN(e);if(s)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||Hn.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Hn.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var Ax=I((MY,kx)=>{"use strict";p();var mN=Ku().Buffer,gN=Ex();function _f(t,e){this._block=mN.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}_f.prototype.update=function(t,e){t=gN(t,e||"utf8");for(var r=this._block,n=this._blockSize,i=t.length,a=this._len,s=0;s=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 n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};_f.prototype._update=function(){throw new Error("_update must be implemented by subclass")};kx.exports=_f});var Px=I((LY,Cx)=>{"use strict";p();var vN=kb(),Tx=Ax(),wN=Ku().Buffer,yN=[1518500249,1859775393,-1894007588,-899497514],bN=new Array(80);function Ll(){this.init(),this._w=bN,Tx.call(this,64,56)}vN(Ll,Tx);Ll.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _N(t){return t<<1|t>>>31}function xN(t){return t<<5|t>>>27}function SN(t){return t<<30|t>>>2}function EN(t,e,r,n){return t===0?e&r|~e&n:t===2?e&r|e&n|r&n:e^r^n}Ll.prototype._update=function(t){for(var e=this._w,r=this._a|0,n=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=_N(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var u=~~(l/20),c=xN(r)+EN(u,n,i,a)+s+e[l]+yN[u]|0;s=a,a=i,i=SN(n),n=r,r=c}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ll.prototype._hash=function(){var t=wN.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};Cx.exports=Ll});var $x=I((BY,Ix)=>{"use strict";p();function Un(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function Rx(t,e){for(var r="",n=0,i=-1,a=0,s,o=0;o<=t.length;++o){if(o2){var l=r.lastIndexOf("/");if(l!==r.length-1){l===-1?(r="",n=0):(r=r.slice(0,l),n=r.length-1-r.lastIndexOf("/")),i=o,a=0;continue}}else if(r.length===2||r.length===1){r="",n=0,i=o,a=0;continue}}e&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+t.slice(i+1,o):r=t.slice(i+1,o),n=o-i-1;i=o,a=0}else s===46&&a!==-1?++a:a=-1}return r}function kN(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+t+n:n}var to={resolve:function(){for(var e="",r=!1,n,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(n===void 0&&(n=process.cwd()),a=n),Un(a),a.length!==0&&(e=a+"/"+e,r=a.charCodeAt(0)===47)}return e=Rx(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Un(e),e.length===0)return".";var r=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Rx(e,!r),e.length===0&&!r&&(e="."),e.length>0&&n&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return Un(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":to.normalize(e)},relative:function(e,r){if(Un(e),Un(r),e===r||(e=to.resolve(e),r=to.resolve(r),e===r))return"";for(var n=1;nu){if(r.charCodeAt(s+f)===47)return r.slice(s+f+1);if(f===0)return r.slice(s+f)}else a>u&&(e.charCodeAt(n+f)===47?c=f:f===0&&(c=0));break}var d=e.charCodeAt(n+f),h=r.charCodeAt(s+f);if(d!==h)break;d===47&&(c=f)}var m="";for(f=n+c+1;f<=i;++f)(f===i||e.charCodeAt(f)===47)&&(m.length===0?m+="..":m+="/..");return m.length>0?m+r.slice(s+c):(s+=c,r.charCodeAt(s)===47&&++s,r.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(Un(e),e.length===0)return".";for(var r=e.charCodeAt(0),n=r===47,i=-1,a=!0,s=e.length-1;s>=1;--s)if(r=e.charCodeAt(s),r===47){if(!a){i=s;break}}else a=!1;return i===-1?n?"/":".":n&&i===1?"//":e.slice(0,i)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Un(e);var n=0,i=-1,a=!0,s;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var o=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(u===47){if(!a){n=s+1;break}}else l===-1&&(a=!1,l=s+1),o>=0&&(u===r.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=l))}return n===i?i=l:i===-1&&(i=e.length),e.slice(n,i)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!a){n=s+1;break}}else i===-1&&(a=!1,i=s+1);return i===-1?"":e.slice(n,i)}},extname:function(e){Un(e);for(var r=-1,n=0,i=-1,a=!0,s=0,o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!a){n=o+1;break}continue}i===-1&&(a=!1,i=o+1),l===46?r===-1?r=o:s!==1&&(s=1):r!==-1&&(s=-1)}return r===-1||i===-1||s===0||s===1&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return kN("/",e)},parse:function(e){Un(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var n=e.charCodeAt(0),i=n===47,a;i?(r.root="/",a=1):a=0;for(var s=-1,o=0,l=-1,u=!0,c=e.length-1,f=0;c>=a;--c){if(n=e.charCodeAt(c),n===47){if(!u){o=c+1;break}continue}l===-1&&(u=!1,l=c+1),n===46?s===-1?s=c:f!==1&&(f=1):s!==-1&&(f=-1)}return s===-1||l===-1||f===0||f===1&&s===l-1&&s===o+1?l!==-1&&(o===0&&i?r.base=r.name=e.slice(1,l):r.base=r.name=e.slice(o,l)):(o===0&&i?(r.name=e.slice(1,s),r.base=e.slice(1,l)):(r.name=e.slice(o,s),r.base=e.slice(o,l)),r.ext=e.slice(s,l)),o>0?r.dir=e.slice(0,o-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};to.posix=to;Ix.exports=to});var Ox=I(_m=>{p();var Fx;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof _m=="object"?t(_m):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(Fx={}):t(Fx={})})(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 n(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 F=[];for(T=1;T!=16;++T)F[T-1]=typeof Int32Array!="undefined"?P.subarray(T*256,T*256+256):P.slice(T*256,T*256+256);return F}var i=n(r),a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],f=i[6],d=i[7],h=i[8],m=i[9],g=i[10],v=i[11],w=i[12],b=i[13],E=i[14];function x(y,S){for(var _=S^-1,T=0,P=y.length;T>>8^r[(_^y.charCodeAt(T++))&255];return~_}function k(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++]]^c[y[P++]]^u[y[P++]]^l[y[P++]]^o[y[P++]]^s[y[P++]]^a[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,F=0,D=0;T>>8^r[(_^F)&255]:F<2048?(_=_>>>8^r[(_^(192|F>>6&31))&255],_=_>>>8^r[(_^(128|F&63))&255]):F>=55296&&F<57344?(F=(F&1023)+64,D=y.charCodeAt(T++)&1023,_=_>>>8^r[(_^(240|F>>8&7))&255],_=_>>>8^r[(_^(128|F>>2&63))&255],_=_>>>8^r[(_^(128|D>>6&15|(F&3)<<4))&255],_=_>>>8^r[(_^(128|D&63))&255]):(_=_>>>8^r[(_^(224|F>>12&15))&255],_=_>>>8^r[(_^(128|F>>6&63))&255],_=_>>>8^r[(_^(128|F&63))&255]);return~_}t.table=r,t.bstr=x,t.buf=k,t.str=A})});var yi=I(er=>{"use strict";p();var AN=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function TN(t,e){return Object.prototype.hasOwnProperty.call(t,e)}er.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 n in r)TN(r,n)&&(t[n]=r[n])}}return t};er.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var CN={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+n),i);return}for(var a=0;a{"use strict";p();var RN=yi(),IN=4,Mx=0,Dx=1,$N=2;function no(t){for(var e=t.length;--e>=0;)t[e]=0}var FN=0,jx=1,ON=2,MN=3,DN=258,Cm=29,Gl=256,Bl=Gl+1+Cm,ro=30,Pm=19,Gx=2*Bl+1,ja=15,xm=16,LN=7,Rm=256,qx=16,zx=17,Vx=18,Am=[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],xf=[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],NN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Wx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],BN=512,bi=new Array((Bl+2)*2);no(bi);var Nl=new Array(ro*2);no(Nl);var Hl=new Array(BN);no(Hl);var Ul=new Array(DN-MN+1);no(Ul);var Im=new Array(Cm);no(Im);var Sf=new Array(ro);no(Sf);function Sm(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Yx,Xx,Zx;function Em(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Kx(t){return t<256?Hl[t]:Hl[256+(t>>>7)]}function jl(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function dr(t,e,r){t.bi_valid>xm-r?(t.bi_buf|=e<>xm-t.bi_valid,t.bi_valid+=r-xm):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function HN(t){t.bi_valid===16?(jl(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 UN(t,e){var r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,u,c,f,d,h,m,g=0;for(d=0;d<=ja;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;ul&&(d=l,g++),r[c*2+1]=d,!(c>n)&&(t.bl_count[d]++,h=0,c>=o&&(h=s[c-o]),m=r[c*2],t.opt_len+=m*(d+h),a&&(t.static_len+=m*(i[c*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(c=t.bl_count[d];c!==0;)f=t.heap[--u],!(f>n)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),c--)}}function Qx(t,e,r){var n=new Array(ja+1),i=0,a,s;for(a=1;a<=ja;a++)n[a]=i=i+r[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=Jx(n[o]++,o))}}function jN(){var t,e,r,n,i,a=new Array(ja+1);for(r=0,n=0;n>=7;n8?jl(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 GN(t,e,r,n){t1(t),n&&(jl(t,r),jl(t,~r)),RN.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function Lx(t,e,r,n){var i=e*2,a=r*2;return t[i]>1;s>=1;s--)km(t,r,s);u=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],km(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,r[u*2]=r[s*2]+r[o*2],t.depth[u]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,r[s*2+1]=r[o*2+1]=u,t.heap[1]=u++,km(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],UN(t,e),Qx(r,l,t.bl_count)}function Bx(t,e,r){var n,i=-1,a,s=e[0*2+1],o=0,l=7,u=4;for(s===0&&(l=138,u=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=e[(n+1)*2+1],!(++o=3&&t.bl_tree[Wx[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function zN(t,e,r,n){var i;for(dr(t,e-257,5),dr(t,r-1,5),dr(t,n-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Mx;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Dx;for(r=32;r0?(t.strm.data_type===$N&&(t.strm.data_type=VN(t)),Tm(t,t.l_desc),Tm(t,t.d_desc),s=qN(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?r1(t,e,r,n):t.strategy===IN||a===i?(dr(t,(jx<<1)+(n?1:0),3),Nx(t,bi,Nl)):(dr(t,(ON<<1)+(n?1:0),3),zN(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),Nx(t,t.dyn_ltree,t.dyn_dtree)),e1(t),n&&t1(t)}function ZN(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[(Ul[r]+Gl+1)*2]++,t.dyn_dtree[Kx(e)*2]++),t.last_lit===t.lit_bufsize-1}io._tr_init=WN;io._tr_stored_block=r1;io._tr_flush_block=XN;io._tr_tally=ZN;io._tr_align=YN});var $m=I((WY,i1)=>{"use strict";p();function KN(t,e,r,n){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+e[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}i1.exports=KN});var Fm=I((XY,a1)=>{"use strict";p();function JN(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var QN=JN();function eB(t,e,r,n){var i=QN,a=n+r;t^=-1;for(var s=n;s>>8^i[(t^e[s])&255];return t^-1}a1.exports=eB});var Ef=I((KY,s1)=>{"use strict";p();s1.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 m1=I(zn=>{"use strict";p();var tr=yi(),Xr=n1(),u1=$m(),Qi=Fm(),tB=Ef(),Va=0,rB=1,nB=3,ia=4,o1=5,qn=0,l1=1,Zr=-2,iB=-3,Om=-5,aB=-1,sB=1,kf=2,oB=3,lB=4,cB=0,uB=2,Pf=8,fB=9,dB=15,hB=8,pB=29,mB=256,Dm=mB+1+pB,gB=30,vB=19,wB=2*Dm+1,yB=15,ke=3,ra=258,mn=ra+ke+1,bB=32,Rf=42,Lm=69,Af=73,Tf=91,Cf=103,Ga=113,zl=666,yt=1,Vl=2,qa=3,oo=4,_B=3;function na(t,e){return t.msg=tB[e],e}function c1(t){return(t<<1)-(t>4?9:0)}function ta(t){for(var e=t.length;--e>=0;)t[e]=0}function ea(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(tr.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 Mt(t,e){Xr._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,ea(t.strm)}function Pe(t,e){t.pending_buf[t.pending++]=e}function ql(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function xB(t,e,r,n){var i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,tr.arraySet(e,t.input,t.next_in,i,r),t.state.wrap===1?t.adler=u1(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Qi(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)}function f1(t,e){var r=t.max_chain_length,n=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-mn?t.strstart-(t.w_size-mn):0,u=t.window,c=t.w_mask,f=t.prev,d=t.strstart+ra,h=u[n+s-1],m=u[n+s];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(u[i+s]!==m||u[i+s-1]!==h||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&ns){if(t.match_start=e,s=a,a>=o)break;h=u[n+s-1],m=u[n+s]}}while((e=f[e&c])>l&&--r!==0);return s<=t.lookahead?s:t.lookahead}function za(t){var e=t.w_size,r,n,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-mn)){tr.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,r=n;do i=t.head[--r],t.head[r]=i>=e?i-e:0;while(--n);n=e,r=n;do i=t.prev[--r],t.prev[r]=i>=e?i-e:0;while(--n);a+=e}if(t.strm.avail_in===0)break;if(n=xB(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=n,t.lookahead+t.insert>=ke)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(za(t),t.lookahead===0&&e===Va)return yt;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((t.strstart===0||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Mt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-mn&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):(t.strstart>t.block_start&&(Mt(t,!1),t.strm.avail_out===0),yt)}function Mm(t,e){for(var r,n;;){if(t.lookahead=ke&&(t.ins_h=(t.ins_h<=ke)if(n=Xr._tr_tally(t,t.strstart-t.match_start,t.match_length-ke),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ke){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=ke&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ke-1)),t.prev_length>=ke&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ke,n=Xr._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ke),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=ke&&t.strstart>0&&(i=t.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=t.strstart+ra;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ke?(r=Xr._tr_tally(t,1,t.match_length-ke),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Xr._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):t.last_lit&&(Mt(t,!1),t.strm.avail_out===0)?yt:Vl}function kB(t,e){for(var r;;){if(t.lookahead===0&&(za(t),t.lookahead===0)){if(e===Va)return yt;break}if(t.match_length=0,r=Xr._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Mt(t,!1),t.strm.avail_out===0))return yt}return t.insert=0,e===ia?(Mt(t,!0),t.strm.avail_out===0?qa:oo):t.last_lit&&(Mt(t,!1),t.strm.avail_out===0)?yt:Vl}function Gn(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var so;so=[new Gn(0,0,0,0,SB),new Gn(4,4,8,4,Mm),new Gn(4,5,16,8,Mm),new Gn(4,6,32,32,Mm),new Gn(4,4,16,16,ao),new Gn(8,16,32,32,ao),new Gn(8,16,128,128,ao),new Gn(8,32,128,256,ao),new Gn(32,128,258,1024,ao),new Gn(32,258,258,4096,ao)];function AB(t){t.window_size=2*t.w_size,ta(t.head),t.max_lazy_match=so[t.level].max_lazy,t.good_match=so[t.level].good_length,t.nice_match=so[t.level].nice_length,t.max_chain_length=so[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ke-1,t.match_available=0,t.ins_h=0}function TB(){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=Pf,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 tr.Buf16(wB*2),this.dyn_dtree=new tr.Buf16((2*gB+1)*2),this.bl_tree=new tr.Buf16((2*vB+1)*2),ta(this.dyn_ltree),ta(this.dyn_dtree),ta(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new tr.Buf16(yB+1),this.heap=new tr.Buf16(2*Dm+1),ta(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new tr.Buf16(2*Dm+1),ta(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 d1(t){var e;return!t||!t.state?na(t,Zr):(t.total_in=t.total_out=0,t.data_type=uB,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Rf:Ga,t.adler=e.wrap===2?0:1,e.last_flush=Va,Xr._tr_init(e),qn)}function h1(t){var e=d1(t);return e===qn&&AB(t.state),e}function CB(t,e){return!t||!t.state||t.state.wrap!==2?Zr:(t.state.gzhead=e,qn)}function p1(t,e,r,n,i,a){if(!t)return Zr;var s=1;if(e===aB&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>fB||r!==Pf||n<8||n>15||e<0||e>9||a<0||a>lB)return na(t,Zr);n===8&&(n=9);var o=new TB;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<o1||e<0)return t?na(t,Zr):Zr;if(n=t.state,!t.output||!t.input&&t.avail_in!==0||n.status===zl&&e!==ia)return na(t,t.avail_out===0?Om:Zr);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===Rf)if(n.wrap===2)t.adler=0,Pe(n,31),Pe(n,139),Pe(n,8),n.gzhead?(Pe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pe(n,n.gzhead.time&255),Pe(n,n.gzhead.time>>8&255),Pe(n,n.gzhead.time>>16&255),Pe(n,n.gzhead.time>>24&255),Pe(n,n.level===9?2:n.strategy>=kf||n.level<2?4:0),Pe(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Pe(n,n.gzhead.extra.length&255),Pe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Qi(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Lm):(Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,0),Pe(n,n.level===9?2:n.strategy>=kf||n.level<2?4:0),Pe(n,_B),n.status=Ga);else{var s=Pf+(n.w_bits-8<<4)<<8,o=-1;n.strategy>=kf||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,s|=o<<6,n.strstart!==0&&(s|=bB),s+=31-s%31,n.status=Ga,ql(n,s),n.strstart!==0&&(ql(n,t.adler>>>16),ql(n,t.adler&65535)),t.adler=1}if(n.status===Lm)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size));)Pe(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Af)}else n.status=Af;if(n.status===Af)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.gzindex=0,n.status=Tf)}else n.status=Tf;if(n.status===Tf)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),ea(t),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}n.gzindexi&&(t.adler=Qi(t.adler,n.pending_buf,n.pending-i,i)),a===0&&(n.status=Cf)}else n.status=Cf;if(n.status===Cf&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ea(t),n.pending+2<=n.pending_buf_size&&(Pe(n,t.adler&255),Pe(n,t.adler>>8&255),t.adler=0,n.status=Ga)):n.status=Ga),n.pending!==0){if(ea(t),t.avail_out===0)return n.last_flush=-1,qn}else if(t.avail_in===0&&c1(e)<=c1(r)&&e!==ia)return na(t,Om);if(n.status===zl&&t.avail_in!==0)return na(t,Om);if(t.avail_in!==0||n.lookahead!==0||e!==Va&&n.status!==zl){var l=n.strategy===kf?kB(n,e):n.strategy===oB?EB(n,e):so[n.level].func(n,e);if((l===qa||l===oo)&&(n.status=zl),l===yt||l===qa)return t.avail_out===0&&(n.last_flush=-1),qn;if(l===Vl&&(e===rB?Xr._tr_align(n):e!==o1&&(Xr._tr_stored_block(n,0,0,!1),e===nB&&(ta(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),ea(t),t.avail_out===0))return n.last_flush=-1,qn}return e!==ia?qn:n.wrap<=0?l1:(n.wrap===2?(Pe(n,t.adler&255),Pe(n,t.adler>>8&255),Pe(n,t.adler>>16&255),Pe(n,t.adler>>24&255),Pe(n,t.total_in&255),Pe(n,t.total_in>>8&255),Pe(n,t.total_in>>16&255),Pe(n,t.total_in>>24&255)):(ql(n,t.adler>>>16),ql(n,t.adler&65535)),ea(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?qn:l1)}function IB(t){var e;return!t||!t.state?Zr:(e=t.state.status,e!==Rf&&e!==Lm&&e!==Af&&e!==Tf&&e!==Cf&&e!==Ga&&e!==zl?na(t,Zr):(t.state=null,e===Ga?na(t,iB):qn))}function $B(t,e){var r=e.length,n,i,a,s,o,l,u,c;if(!t||!t.state||(n=t.state,s=n.wrap,s===2||s===1&&n.status!==Rf||n.lookahead))return Zr;for(s===1&&(t.adler=u1(t.adler,e,r,0)),n.wrap=0,r>=n.w_size&&(s===0&&(ta(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new tr.Buf8(n.w_size),tr.arraySet(c,e,r-n.w_size,n.w_size,0),e=c,r=n.w_size),o=t.avail_in,l=t.next_in,u=t.input,t.avail_in=r,t.next_in=0,t.input=e,za(n);n.lookahead>=ke;){i=n.strstart,a=n.lookahead-(ke-1);do n.ins_h=(n.ins_h<{"use strict";p();var If=yi(),g1=!0,v1=!0;try{String.fromCharCode.apply(null,[0])}catch(t){g1=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){v1=!1}var Wl=new If.Buf8(256);for(_i=0;_i<256;_i++)Wl[_i]=_i>=252?6:_i>=248?5:_i>=240?4:_i>=224?3:_i>=192?2:1;var _i;Wl[254]=Wl[254]=1;lo.string2buf=function(t){var e,r,n,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e};function w1(t,e){if(e<65534&&(t.subarray&&v1||!t.subarray&&g1))return String.fromCharCode.apply(null,If.shrinkBuf(t,e));for(var r="",n=0;n4){o[n++]=65533,r+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&r1){o[n++]=65533;continue}i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|i&1023)}return w1(o,n)};lo.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+Wl[t[r]]>e?r:e}});var Bm=I((nX,y1)=>{"use strict";p();function FB(){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}y1.exports=FB});var S1=I(Zl=>{"use strict";p();var Yl=m1(),Xl=yi(),Um=Nm(),jm=Ef(),OB=Bm(),x1=Object.prototype.toString,MB=0,Hm=4,co=0,b1=1,_1=2,DB=-1,LB=0,NB=8;function Wa(t){if(!(this instanceof Wa))return new Wa(t);this.options=Xl.assign({level:DB,method:NB,chunkSize:16384,windowBits:15,memLevel:8,strategy:LB,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 OB,this.strm.avail_out=0;var r=Yl.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==co)throw new Error(jm[r]);if(e.header&&Yl.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=Um.string2buf(e.dictionary):x1.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Yl.deflateSetDictionary(this.strm,n),r!==co)throw new Error(jm[r]);this._dict_set=!0}}Wa.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Hm:MB,typeof t=="string"?r.input=Um.string2buf(t):x1.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 Xl.Buf8(n),r.next_out=0,r.avail_out=n),i=Yl.deflate(r,a),i!==b1&&i!==co)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(a===Hm||a===_1))&&(this.options.to==="string"?this.onData(Um.buf2binstring(Xl.shrinkBuf(r.output,r.next_out))):this.onData(Xl.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==b1);return a===Hm?(i=Yl.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===co):(a===_1&&(this.onEnd(co),r.avail_out=0),!0)};Wa.prototype.onData=function(t){this.chunks.push(t)};Wa.prototype.onEnd=function(t){t===co&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Xl.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Gm(t,e){var r=new Wa(e);if(r.push(t,!0),r.err)throw r.msg||jm[r.err];return r.result}function BB(t,e){return e=e||{},e.raw=!0,Gm(t,e)}function HB(t,e){return e=e||{},e.gzip=!0,Gm(t,e)}Zl.Deflate=Wa;Zl.deflate=Gm;Zl.deflateRaw=BB;Zl.gzip=HB});var k1=I((oX,E1)=>{"use strict";p();var $f=30,UB=12;E1.exports=function(e,r){var n,i,a,s,o,l,u,c,f,d,h,m,g,v,w,b,E,x,k,A,y,S,_,T,P;n=e.state,i=e.next_in,T=e.input,a=i+(e.avail_in-5),s=e.next_out,P=e.output,o=s-(r-e.avail_out),l=s+(e.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,d=n.wnext,h=n.window,m=n.hold,g=n.bits,v=n.lencode,w=n.distcode,b=(1<>>24,m>>>=k,g-=k,k=x>>>16&255,k===0)P[s++]=x&65535;else if(k&16){A=x&65535,k&=15,k&&(g>>=k,g-=k),g<15&&(m+=T[i++]<>>24,m>>>=k,g-=k,k=x>>>16&255,k&16){if(y=x&65535,k&=15,gu){e.msg="invalid distance too far back",n.mode=$f;break e}if(m>>>=k,g-=k,k=s-o,y>k){if(k=y-k,k>f&&n.sane){e.msg="invalid distance too far back",n.mode=$f;break e}if(S=0,_=h,d===0){if(S+=c-k,k2;)P[s++]=_[S++],P[s++]=_[S++],P[s++]=_[S++],A-=3;A&&(P[s++]=_[S++],A>1&&(P[s++]=_[S++]))}else{S=s-y;do P[s++]=P[S++],P[s++]=P[S++],P[s++]=P[S++],A-=3;while(A>2);A&&(P[s++]=P[S++],A>1&&(P[s++]=P[S++]))}}else if(k&64){e.msg="invalid distance code",n.mode=$f;break e}else{x=w[(x&65535)+(m&(1<>3,i-=A,g-=A<<3,m&=(1<{"use strict";p();var A1=yi(),uo=15,T1=852,C1=592,P1=0,qm=1,R1=2,jB=[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],GB=[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],qB=[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],zB=[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];I1.exports=function(e,r,n,i,a,s,o,l){var u=l.bits,c=0,f=0,d=0,h=0,m=0,g=0,v=0,w=0,b=0,E=0,x,k,A,y,S,_=null,T=0,P,F=new A1.Buf16(uo+1),D=new A1.Buf16(uo+1),M=null,re=0,ye,me,fe;for(c=0;c<=uo;c++)F[c]=0;for(f=0;f=1&&F[h]===0;h--);if(m>h&&(m=h),h===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===P1||h!==1))return-1;for(D[1]=0,c=1;cT1||e===R1&&b>C1)return 1;for(;;){ye=c-v,o[f]P?(me=M[re+o[f]],fe=_[T+o[f]]):(me=96,fe=0),x=1<>v)+k]=ye<<24|me<<16|fe|0;while(k!==0);for(x=1<>=1;if(x!==0?(E&=x-1,E+=x):E=0,f++,--F[c]===0){if(c===h)break;c=r[n+o[f]]}if(c>m&&(E&y)!==A){for(v===0&&(v=m),S+=d,g=c-v,w=1<T1||e===R1&&b>C1)return 1;A=E&y,a[A]=m<<24|g<<16|S-s|0}}return E!==0&&(a[S+E]=c-v<<24|64<<16|0),l.bits=m,0}});var hS=I(gn=>{"use strict";p();var Ir=yi(),Zm=$m(),Vn=Fm(),VB=k1(),Kl=$1(),WB=0,iS=1,aS=2,F1=4,YB=5,Ff=6,Ya=0,XB=1,ZB=2,Kr=-2,sS=-3,Km=-4,KB=-5,O1=8,oS=1,M1=2,D1=3,L1=4,N1=5,B1=6,H1=7,U1=8,j1=9,G1=10,Df=11,xi=12,zm=13,q1=14,Vm=15,z1=16,V1=17,W1=18,Y1=19,Of=20,Mf=21,X1=22,Z1=23,K1=24,J1=25,Q1=26,Wm=27,eS=28,tS=29,Ye=30,Jm=31,JB=32,QB=852,eH=592,tH=15,rH=tH;function rS(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function nH(){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 Ir.Buf16(320),this.work=new Ir.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function lS(t){var e;return!t||!t.state?Kr:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=oS,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Ir.Buf32(QB),e.distcode=e.distdyn=new Ir.Buf32(eH),e.sane=1,e.back=-1,Ya)}function cS(t){var e;return!t||!t.state?Kr:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,lS(t))}function uS(t,e){var r,n;return!t||!t.state||(n=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Kr:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,cS(t))}function fS(t,e){var r,n;return t?(n=new nH,t.state=n,n.window=null,r=uS(t,e),r!==Ya&&(t.state=null),r):Kr}function iH(t){return fS(t,rH)}var nS=!0,Ym,Xm;function aH(t){if(nS){var e;for(Ym=new Ir.Buf32(512),Xm=new Ir.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(Kl(iS,t.lens,0,288,Ym,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Kl(aS,t.lens,0,32,Xm,0,t.work,{bits:5}),nS=!1}t.lencode=Ym,t.lenbits=9,t.distcode=Xm,t.distbits=5}function dS(t,e,r,n){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Ir.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),Ir.arraySet(a.window,e,r-n,i,a.wnext),n-=i,n?(Ir.arraySet(a.window,e,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,r.check=Vn(r.check,_,2,0),u=0,c=0,r.mode=M1;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Ye;break}if((u&15)!==O1){t.msg="unknown compression method",r.mode=Ye;break}if(u>>>=4,c-=4,y=(u&15)+8,r.wbits===0)r.wbits=y;else if(y>r.wbits){t.msg="invalid window size",r.mode=Ye;break}r.dmax=1<>8&1),r.flags&512&&(_[0]=u&255,_[1]=u>>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0,r.mode=D1;case D1:for(;c<32;){if(o===0)break e;o--,u+=n[a++]<>>8&255,_[2]=u>>>16&255,_[3]=u>>>24&255,r.check=Vn(r.check,_,4,0)),u=0,c=0,r.mode=L1;case L1:for(;c<16;){if(o===0)break e;o--,u+=n[a++]<>8),r.flags&512&&(_[0]=u&255,_[1]=u>>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0,r.mode=N1;case N1:if(r.flags&1024){for(;c<16;){if(o===0)break e;o--,u+=n[a++]<>>8&255,r.check=Vn(r.check,_,2,0)),u=0,c=0}else r.head&&(r.head.extra=null);r.mode=B1;case B1: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)),Ir.arraySet(r.head.extra,n,a,h,y)),r.flags&512&&(r.check=Vn(r.check,n,h,a)),o-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=H1;case H1:if(r.flags&2048){if(o===0)break e;h=0;do y=n[a+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=xi;break;case G1:for(;c<32;){if(o===0)break e;o--,u+=n[a++]<>>=c&7,c-=c&7,r.mode=Wm;break}for(;c<3;){if(o===0)break e;o--,u+=n[a++]<>>=1,c-=1,u&3){case 0:r.mode=q1;break;case 1:if(aH(r),r.mode=Of,e===Ff){u>>>=2,c-=2;break e}break;case 2:r.mode=V1;break;case 3:t.msg="invalid block type",r.mode=Ye}u>>>=2,c-=2;break;case q1:for(u>>>=c&7,c-=c&7;c<32;){if(o===0)break e;o--,u+=n[a++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=Ye;break}if(r.length=u&65535,u=0,c=0,r.mode=Vm,e===Ff)break e;case Vm:r.mode=z1;case z1:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Ir.arraySet(i,n,a,h,s),o-=h,a+=h,l-=h,s+=h,r.length-=h;break}r.mode=xi;break;case V1:for(;c<14;){if(o===0)break e;o--,u+=n[a++]<>>=5,c-=5,r.ndist=(u&31)+1,u>>>=5,c-=5,r.ncode=(u&15)+4,u>>>=4,c-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Ye;break}r.have=0,r.mode=W1;case W1:for(;r.have>>=3,c-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},S=Kl(WB,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid code lengths set",r.mode=Ye;break}r.have=0,r.mode=Y1;case Y1:for(;r.have>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=w,c-=w,r.lens[r.have++]=E;else{if(E===16){for(P=w+2;c>>=w,c-=w,r.have===0){t.msg="invalid bit length repeat",r.mode=Ye;break}y=r.lens[r.have-1],h=3+(u&3),u>>>=2,c-=2}else if(E===17){for(P=w+3;c>>=w,c-=w,y=0,h=3+(u&7),u>>>=3,c-=3}else{for(P=w+7;c>>=w,c-=w,y=0,h=11+(u&127),u>>>=7,c-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Ye;break}for(;h--;)r.lens[r.have++]=y}}if(r.mode===Ye)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Ye;break}if(r.lenbits=9,T={bits:r.lenbits},S=Kl(iS,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,S){t.msg="invalid literal/lengths set",r.mode=Ye;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},S=Kl(aS,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,S){t.msg="invalid distances set",r.mode=Ye;break}if(r.mode=Of,e===Ff)break e;case Of:r.mode=Mf;case Mf:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,r.hold=u,r.bits=c,VB(t,d),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,u=r.hold,c=r.bits,r.mode===xi&&(r.back=-1);break}for(r.back=0;v=r.lencode[u&(1<>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>x)],w=v>>>24,b=v>>>16&255,E=v&65535,!(x+w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=x,c-=x,r.back+=x}if(u>>>=w,c-=w,r.back+=w,r.length=E,b===0){r.mode=Q1;break}if(b&32){r.back=-1,r.mode=xi;break}if(b&64){t.msg="invalid literal/length code",r.mode=Ye;break}r.extra=b&15,r.mode=X1;case X1:if(r.extra){for(P=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Z1;case Z1:for(;v=r.distcode[u&(1<>>24,b=v>>>16&255,E=v&65535,!(w<=c);){if(o===0)break e;o--,u+=n[a++]<>x)],w=v>>>24,b=v>>>16&255,E=v&65535,!(x+w<=c);){if(o===0)break e;o--,u+=n[a++]<>>=x,c-=x,r.back+=x}if(u>>>=w,c-=w,r.back+=w,b&64){t.msg="invalid distance code",r.mode=Ye;break}r.offset=E,r.extra=b&15,r.mode=K1;case K1:if(r.extra){for(P=r.extra;c>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Ye;break}r.mode=J1;case J1: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=Ye;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=i,m=s-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[s++]=g[m++];while(--h);r.length===0&&(r.mode=Mf);break;case Q1:if(l===0)break e;i[s++]=r.length,l--,r.mode=Mf;break;case Wm:if(r.wrap){for(;c<32;){if(o===0)break e;o--,u|=n[a++]<{"use strict";p();pS.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 gS=I((mX,mS)=>{"use strict";p();function uH(){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}mS.exports=uH});var wS=I(Ql=>{"use strict";p();var fo=hS(),Jl=yi(),Lf=Nm(),lt=Qm(),eg=Ef(),fH=Bm(),dH=gS(),vS=Object.prototype.toString;function Xa(t){if(!(this instanceof Xa))return new Xa(t);this.options=Jl.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 fH,this.strm.avail_out=0;var r=fo.inflateInit2(this.strm,e.windowBits);if(r!==lt.Z_OK)throw new Error(eg[r]);if(this.header=new dH,fo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Lf.string2buf(e.dictionary):vS.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=fo.inflateSetDictionary(this.strm,e.dictionary),r!==lt.Z_OK)))throw new Error(eg[r])}Xa.prototype.push=function(t,e){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,u,c=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?lt.Z_FINISH:lt.Z_NO_FLUSH,typeof t=="string"?r.input=Lf.binstring2buf(t):vS.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 Jl.Buf8(n),r.next_out=0,r.avail_out=n),a=fo.inflate(r,lt.Z_NO_FLUSH),a===lt.Z_NEED_DICT&&i&&(a=fo.inflateSetDictionary(this.strm,i)),a===lt.Z_BUF_ERROR&&c===!0&&(a=lt.Z_OK,c=!1),a!==lt.Z_STREAM_END&&a!==lt.Z_OK)return this.onEnd(a),this.ended=!0,!1;r.next_out&&(r.avail_out===0||a===lt.Z_STREAM_END||r.avail_in===0&&(s===lt.Z_FINISH||s===lt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Lf.utf8border(r.output,r.next_out),l=r.next_out-o,u=Lf.buf2string(r.output,o),r.next_out=l,r.avail_out=n-l,l&&Jl.arraySet(r.output,r.output,o,l,0),this.onData(u)):this.onData(Jl.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&a!==lt.Z_STREAM_END);return a===lt.Z_STREAM_END&&(s=lt.Z_FINISH),s===lt.Z_FINISH?(a=fo.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===lt.Z_OK):(s===lt.Z_SYNC_FLUSH&&(this.onEnd(lt.Z_OK),r.avail_out=0),!0)};Xa.prototype.onData=function(t){this.chunks.push(t)};Xa.prototype.onEnd=function(t){t===lt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Jl.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function tg(t,e){var r=new Xa(e);if(r.push(t,!0),r.err)throw r.msg||eg[r.err];return r.result}function hH(t,e){return e=e||{},e.raw=!0,tg(t,e)}Ql.Inflate=Xa;Ql.inflate=tg;Ql.inflateRaw=hH;Ql.ungzip=tg});var _S=I((yX,bS)=>{"use strict";p();var pH=yi().assign,mH=S1(),gH=wS(),vH=Qm(),yS={};pH(yS,mH,gH,vH);bS.exports=yS});var ES=I((_X,SS)=>{"use strict";p();var xS=(t,e)=>function(...r){let n=e.promiseModule;return new n((i,a)=>{e.multiArgs?r.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?r.push((s,o)=>{s?a(s):i(o)}):r.push(i),t.apply(this,r)})};SS.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 n=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;r==="function"?i=function(...a){return e.excludeMain?t(...a):xS(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&n(a)?xS(s,e):s}return i}});var FS=I((SX,$S)=>{p();function kS(t){return Array.isArray(t)?t:[t]}var ig="",AS=" ",rg="\\",wH=/^\s+$/,yH=/(?:[^\\]|^)\\$/,bH=/^\\!/,_H=/^\\#/,xH=/\r?\n/g,SH=/^\.*\/|^\.+$/,ng="/",PS="node-ignore";typeof Symbol!="undefined"&&(PS=Symbol.for("node-ignore"));var TS=PS,EH=(t,e,r)=>Object.defineProperty(t,e,{value:r}),kH=/([0-z])-([0-z])/g,RS=()=>!1,AH=t=>t.replace(kH,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:ig),TH=t=>{let{length:e}=t;return t.slice(0,e-e%2)},CH=[[/^\uFEFF/,()=>ig],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?AS:ig)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+AS}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>rg],[/\\\\/g,()=>rg],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===rg?`\\[${r}${TH(n)}${i}`:i==="]"&&n.length%2===0?`[${AH(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],CS=Object.create(null),PH=(t,e)=>{let r=CS[t];return r||(r=CH.reduce((n,[i,a])=>n.replace(i,a.bind(t)),t),CS[t]=r),e?new RegExp(r,"i"):new RegExp(r)},og=t=>typeof t=="string",RH=t=>t&&og(t)&&!wH.test(t)&&!yH.test(t)&&t.indexOf("#")!==0,IH=t=>t.split(xH),ag=class{constructor(e,r,n,i){this.origin=e,this.pattern=r,this.negative=n,this.regex=i}},$H=(t,e)=>{let r=t,n=!1;t.indexOf("!")===0&&(n=!0,t=t.substr(1)),t=t.replace(bH,"!").replace(_H,"#");let i=PH(t,e);return new ag(r,t,n,i)},FH=(t,e)=>{throw new e(t)},Si=(t,e,r)=>og(t)?t?Si.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),IS=t=>SH.test(t);Si.isNotRelative=IS;Si.convert=t=>t;var sg=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){EH(this,TS,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[TS]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(RH(e)){let r=$H(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,kS(og(e)?IH(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let n=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&n!==i||s&&!n&&!i&&!r)return;a.regex.test(e)&&(n=!s,i=s)}),{ignored:n,unignored:i}}_test(e,r,n,i){let a=e&&Si.convert(e);return Si(a,e,this._allowRelativePaths?RS:FH),this._t(a,r,n,i)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(ng)),i.pop(),!i.length)return r[e]=this._testOne(e,n);let a=this._t(i.join(ng)+ng,r,n,i);return r[e]=a.ignored?a:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return kS(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Nf=t=>new sg(t),OH=t=>Si(t&&Si.convert(t),t,RS);Nf.isPathValid=OH;Nf.default=Nf;$S.exports=Nf;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,"/");Si.convert=t;let e=/^[a-z]:\//i;Si.isNotRelative=r=>e.test(r)||IS(r)}});var MS=I((kX,OS)=>{"use strict";p();function MH(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wn(t,e,r){return e=e instanceof RegExp?e:new RegExp(MH(e),"g"),t.replace(e,r)}var DH={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Wn(e,"./","/"),e=Wn(e,"..","."),e=Wn(e," ","-"),e=Wn(e,/^[~^:?*\\\-]/g,""),e=Wn(e,/[~^:?*\\]/g,"-"),e=Wn(e,/[~^:?*\\\-]$/g,""),e=Wn(e,"@{","-"),e=Wn(e,/\.$/g,""),e=Wn(e,/\/$/g,""),e=Wn(e,/\.lock$/g,""),e}};OS.exports=DH});var LS=I((TX,DS)=>{p();DS.exports=function(t,e){var r=t,n=e,i=r.length,a=n.length,s=!1,o=null,l=i+1,u=[],c=[],f=[],d="",h=-1,m=0,g=1,v,w,b=function(){i>=a&&(v=r,w=i,r=n,n=v,i=a,a=w,s=!0,l=i+1)},E=function(y,S,_){return{x:y,y:S,k:_}},x=function(y,S){return{elem:y,t:S}},k=function(y,S,_){var T,P,F;for(S>_?T=u[y-1+l]:T=u[y+1+l],F=Math.max(S,_),P=F-y;P=0;--F)for(;TP-T?(s?f[f.length]=new x(n[P],h):f[f.length]=new x(n[P],g),++_,++P):y[F].y-y[F].x=y+1;--M)_[M+l]=k(M,_[M-1+l]+1,_[M+1+l]);_[y+l]=k(y,_[y-1+l]+1,_[y+1+l])}while(_[y+l]!==a);for(o=y+2*T,P=u[y+l],F=[];P!==-1;)F[F.length]=new E(c[P].x,c[P].y,null),P=c[P].k;A(F)}}}});var HS=I((PX,BS)=>{p();var LH=LS();function NH(t,e){var r=new LH(t,e);r.compose();for(var n=r.getses(),i,a,s=t.length-1,o=e.length-1,l=n.length-1;l>=0;--l)n[l].t===r.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):n[l].t===r.SES_DELETE?s--:n[l].t===r.SES_ADD&&o--;var u={file1index:-1,file2index:-1,chain:null};return a?(a.chain=u,i):u}function NS(t,e){for(var r=[],n=t.length,i=e.length,a=NH(t,e);a!==null;a=a.chain){var s=n-a.file1index-1,o=i-a.file2index-1;n=a.file1index,i=a.file2index,(s||o)&&r.push({file1:[n+1,s],file2:[i+1,o]})}return r.reverse(),r}function BH(t,e,r){var n,i=NS(e,t),a=NS(e,r),s=[];function o(D,M){s.push([D.file1[0],M,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;nu&&(l.push([1,u,D-u]),u=D)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(c(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(n=d;n<=f;n++){h=s[n];var E=h[1],x=b[E],k=h[0],A=k+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(k,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]),F=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,F-P])}u=g}return c(e.length),l}function HH(t,e,r){var n=[],i=[t,e,r],a=BH(t,e,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function l(h){for(var m=0;m{"use strict";p();Object.defineProperty(W,"__esModule",{value:!0});function ha(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var tc=ha(Eb()),cE=ha(Px()),O=$x(),UH=ha(Ox()),Fg=ha(_S()),lg=ha(ES()),jH=ha(FS()),Xn=ha(MS()),GH=ha(HS()),Ae=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}},rc=class t extends Ae{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}}};rc.code="UnmergedPathsError";var de=class t extends Ae{constructor(e){super(`An internal error caused this command to fail. 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}}};de.code="InternalError";var po=class t extends Ae{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};po.code="UnsafeFilepathError";var Jr=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 n=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,n}write(e,r,n){let i=this.buffer.write(e,this._start,r,n);return this._start+=r,i}copy(e,r,n){let i=e.copy(this.buffer,this._start,r,n);return this._start+=i,i}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 Kf(t,e){return-(te)}function uE(t,e){return Kf(t.path,e.path)}function fE(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 Yn=2**32;function US(t,e,r,n){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=n.valueOf());let i=Math.floor(r/1e3),a=(r-i*1e3)*1e6;return[i,a]}function mo(t){let[e,r]=US(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[n,i]=US(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Yn,ctimeNanoseconds:r%Yn,mtimeSeconds:n%Yn,mtimeNanoseconds:i%Yn,dev:t.dev%Yn,ino:t.ino%Yn,mode:fE(t.mode%Yn),uid:t.uid%Yn,gid:t.gid%Yn,size:t.size>-1?t.size%Yn:0}}function qH(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var cg=null;async function ki(t){return cg===null&&(cg=await VH()),cg?dE(t):zH(t)}function zH(t){return new cE().update(t).digest("hex")}async function dE(t){let e=await crypto.subtle.digest("SHA-1",t);return qH(e)}async function VH(){try{if(await dE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function WH(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function YH(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 _g=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 de("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new de("Index file is empty (.git/index)");let r=new t,n=new Jr(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new de(`Invalid dircache magic file number: ${i}`);let a=await ki(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new de(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=n.readUInt32BE();if(o!==2)throw new de(`Unsupported dircache version: ${o}`);let l=n.readUInt32BE(),u=0;for(;!n.eof()&&ue.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:n,stage:i=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=mo(r);let a=Buffer.from(e),s={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:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),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),n=Math.ceil((62+r.length+1)/8)*8,i=Buffer.alloc(n),a=new Jr(i),s=mo(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(YH(e)),a.write(e.path,r.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),r=new Jr(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let n=[];for(let o of this.entries)if(n.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&n.push(t._entryToBuffer(l));n=await Promise.all(n);let i=Buffer.concat(n),a=Buffer.concat([e,i]),s=await ki(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Uf(t,e,r=!0,n=!0){let i=mo(t),a=mo(e);return r&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||n&&i.ino!==a.ino||i.size!==a.size}var ug=null,fg=Symbol("IndexCache");function XH(){return{map:new Map,stats:new Map}}async function ZH(t,e,r){let[n,i]=await Promise.all([t.lstat(e),t.read(e)]),a=await _g.from(i);r.map.set(e,a),r.stats.set(e,n)}async function KH(t,e,r){let n=r.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await t.lstat(e);return i===null?!1:Uf(n,i)}var ct=class{static async acquire({fs:e,gitdir:r,cache:n,allowUnmerged:i=!0},a){n[fg]||(n[fg]=XH());let s=`${r}/index`;ug===null&&(ug=new tc({maxPending:1/0}));let o,l=[];return await ug.acquire(s,async()=>{let u=n[fg];await KH(e,s,u)&&await ZH(e,s,u);let c=u.map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new rc(l);if(o=await a(c),c._dirty){let f=await c.toObject();await e.write(s,f),u.stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jf(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function go(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function hE(t){let e=new Map,r=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jf(i),metadata:{},children:[]};e.set(i,a),a.parent=r(go(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},n=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jf(i),metadata:a,parent:r(go(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};r(".");for(let i of t)n(i.path,i);return e}function JH(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new de(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var xg=class{constructor({fs:e,gitdir:r,cache:n}){this.treePromise=ct.acquire({fs:e,gitdir:r,cache:n},async function(a){return hE(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let r=e._fullpath,i=(await this.treePromise).get(r);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Kf),a}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:mo(n.metadata);e._type=n.type==="tree"?"tree":JH(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},Jf=Symbol("GitWalkSymbol");function ts(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,gitdir:r,cache:n}){return new xg({fs:e,gitdir:r,cache:n})}}),Object.freeze(t),t}var Le=class t extends Ae{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Le.code="NotFoundError";var rr=class t extends Ae{constructor(e,r,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:n,filepath:i}}};rr.code="ObjectTypeError";var oa=class t extends Ae{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};oa.code="InvalidOidError";var nc=class t extends Ae{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following: +[remote "${e}"] fetch = +refs/heads/*:refs/remotes/origin/* -`),this.code=this.name=e.code,this.data={remote:t}}};nl.code="NoRefspecError";var ru=class e{constructor(t){if(this.refs=new Map,this.parsedConfig=[],t){let r=null;this.parsedConfig=t.trim().split(` -`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{let a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(t){return new e(t)}delete(t){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==t),this.refs.delete(t)}toString(){return this.parsedConfig.map(({line:t})=>t).join(` +`),this.code=this.name=t.code,this.data={remote:e}}};nc.code="NoRefspecError";var Gf=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(` +`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let a=n.slice(1);return this.refs.set(r+"^{}",a),{line:n,ref:r,peeled:a}}else{let a=n.slice(0,i);return r=n.slice(i+1),this.refs.set(r,a),{line:n,ref:r,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` `)+` -`}},nu=class e{constructor({remotePath:t,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:t,localPath:r,force:n,matchPrefix:i})}static from(t){let[r,n,i,a,s]=t.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=i==="*";if(l!==(s==="*"))throw new le("Invalid refspec");return new e({remotePath:n,localPath:a,force:o,matchPrefix:l})}translate(t){if(this.matchPrefix){if(t.startsWith(this.remotePath))return this.localPath+t.replace(this.remotePath,"")}else if(t===this.remotePath)return this.localPath;return null}reverseTranslate(t){if(this.matchPrefix){if(t.startsWith(this.localPath))return this.remotePath+t.replace(this.localPath,"")}else if(t===this.localPath)return this.remotePath;return null}},pp=class e{constructor(t=[]){this.rules=t}static from(t){let r=[];for(let n of t)r.push(nu.from(n));return new e(r)}add(t){let r=nu.from(t);this.rules.push(r)}translate(t){let r=[];for(let n of this.rules)for(let i of t){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(t){let r=null;for(let n of this.rules){let i=n.translate(t);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(t=>t.matchPrefix).map(t=>t.localPath.replace(/\/$/,""))}};function f6(e,t){let r=e.replace(/\^\{\}$/,""),n=t.replace(/\^\{\}$/,""),i=-(rn);return i===0?e.endsWith("^{}")?1:-1:i}var Fw=new Map;function $w(e){let t=Fw.get(e);return t||(t=d6(e),Fw.set(e,t)),t}function d6(e){return e=e.split("/./").join("/").replace(/\/{2,}/g,"/"),e==="/."?"/":e==="./"||(e.startsWith("./")&&(e=e.slice(2)),e.endsWith("/.")&&(e=e.slice(0,-2)),e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e==="")?".":e}function $(...e){return $w(e.map($w).join("/"))}var h6=e=>{e=e.toLowerCase();let t=parseInt(e);return e.endsWith("k")&&(t*=1024),e.endsWith("m")&&(t*=1024*1024),e.endsWith("g")&&(t*=1024*1024*1024),t},el=e=>{if(e=e.trim().toLowerCase(),e==="true"||e==="yes"||e==="on")return!0;if(e==="false"||e==="no"||e==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${e}`)},Lw={core:{filemode:el,bare:el,logallrefupdates:el,symlinks:el,ignorecase:el,bigFileThreshold:h6}},p6=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,m6=/^[A-Za-z0-9-.]+$/,g6=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,v6=/^[A-Za-z][A-Za-z-]*$/,y6=/^(.*?)( *[#;].*)$/,w6=e=>{let t=p6.exec(e);if(t!=null){let[r,n]=t.slice(1);return[r,n]}return null},b6=e=>{let t=g6.exec(e);if(t!=null){let[r,n="true"]=t.slice(1),i=_6(n),a=x6(i);return[r,a]}return null},_6=e=>{let t=y6.exec(e);if(t==null)return e;let[r,n]=t.slice(1);return Dw(r)&&Dw(n)?`${r}${n}`:r},Dw=e=>(e.match(/(?:^|[^\\])"/g)||[]).length%2!==0,x6=e=>e.split("").reduce((t,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?t:t+r},""),Nw=e=>e!=null?e.toLowerCase():null,mp=(e,t,r)=>[Nw(e),t,Nw(r)].filter(n=>n!=null).join("."),Bw=e=>{let t=e.split("."),r=t.shift(),n=t.pop(),i=t.length?t.join("."):void 0;return{section:r,subsection:i,name:n,path:mp(r,i,n),sectionPath:mp(r,i,null)}},S6=(e,t)=>e.reduce((r,n,i)=>t(n)?i:r,-1),gp=class e{constructor(t){let r=null,n=null;this.parsedConfig=t?t.split(` -`).map(i=>{let a=null,s=null,o=i.trim(),l=w6(o),c=l!=null;if(c)[r,n]=l;else{let f=b6(o);f!=null&&([a,s]=f)}let u=mp(r,n,a);return{line:i,isSection:c,section:r,subsection:n,name:a,value:s,path:u}}):[]}static from(t){return new e(t)}async get(t,r=!1){let n=Bw(t).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let l=Lw[a]&&Lw[a][s];return l?l(o):o});return r?i:i.pop()}async getall(t){return this.get(t,!0)}async getSubsections(t){return this.parsedConfig.filter(r=>r.section===t&&r.isSection).map(r=>r.subsection)}async deleteSection(t,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===t&&n.subsection===r))}async append(t,r){return this.set(t,r,!0)}async set(t,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=Bw(t),c=S6(this.parsedConfig,u=>u.path===o);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(d=>d.path===l),f={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(m6.test(i)&&v6.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let d={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(d,f)}}}toString(){return this.parsedConfig.map(({line:t,section:r,subsection:n,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:t).join(` -`)}},We=class{static async get({fs:t,gitdir:r}){let n=await t.read(`${r}/config`,{encoding:"utf8"});return gp.from(n)}static async save({fs:t,gitdir:r,config:n}){await t.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},Kc=e=>[`${e}`,`refs/${e}`,`refs/tags/${e}`,`refs/heads/${e}`,`refs/remotes/${e}`,`refs/remotes/${e}/HEAD`],E6=["config","description","index","shallow","commondir"],ip;async function yi(e,t){return ip===void 0&&(ip=new tl.default),ip.acquire(e,t)}var W=class e{static async updateRemoteRefs({fs:t,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new _i(v);let u=await We.get({fs:t,gitdir:r});if(!o){if(o=await u.getall(`remote.${n}.fetch`),o.length===0)throw new nl(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=pp.from(o),d=new Map;if(c){let v=await e.listRefs({fs:t,gitdir:r,filepath:"refs/tags"});await e.deleteRefs({fs:t,gitdir:r,refs:v.map(y=>`refs/tags/${y}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await e.exists({fs:t,gitdir:r,ref:v})){let y=i.get(v);d.set(v,y)}}let h=f.translate([...i.keys()]);for(let[v,y]of h){let b=i.get(v);d.set(y,b)}let p=f.translate([...a.keys()]);for(let[v,y]of p){let b=a.get(v),x=f.translateOne(b);x&&d.set(y,`ref: ${x}`)}let m=[];if(l){for(let v of f.localNamespaces()){let y=(await e.listRefs({fs:t,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of y)d.has(b)||m.push(b)}m.length>0&&await e.deleteRefs({fs:t,gitdir:r,refs:m})}for(let[v,y]of d)await yi(v,async()=>t.write($(r,v),`${y.trim()} -`,"utf8"));return{pruned:m}}static async writeRef({fs:t,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new _i(i);await yi(n,async()=>t.write($(r,n),`${i.trim()} -`,"utf8"))}static async writeSymbolicRef({fs:t,gitdir:r,ref:n,value:i}){await yi(n,async()=>t.write($(r,n),`ref: ${i.trim()} -`,"utf8"))}static async deleteRef({fs:t,gitdir:r,ref:n}){return e.deleteRefs({fs:t,gitdir:r,refs:[n]})}static async deleteRefs({fs:t,gitdir:r,refs:n}){await Promise.all(n.map(o=>t.rm($(r,o))));let i=await yi("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"})),a=ru.from(i),s=a.refs.size;for(let o of n)a.refs.has(o)&&a.delete(o);a.refs.sizet.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:t,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),e.resolve({fs:t,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await e.packedRefs({fs:t,gitdir:r}),s=Kc(n).filter(o=>!E6.includes(o));for(let o of s){let l=await yi(o,async()=>await t.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return e.resolve({fs:t,gitdir:r,ref:l.trim(),depth:i})}throw new Le(n)}static async exists({fs:t,gitdir:r,ref:n}){try{return await e.expand({fs:t,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:t,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await e.packedRefs({fs:t,gitdir:r}),a=Kc(n);for(let s of a)if(await yi(s,async()=>t.exists(`${r}/${s}`))||i.has(s))return s;throw new Le(n)}static async expandAgainstMap({ref:t,map:r}){let n=Kc(t);for(let i of n)if(await r.has(i))return i;throw new Le(t)}static resolveAgainstMap({ref:t,fullref:r=t,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:t};if(t.startsWith("ref: "))return t=t.slice(5),e.resolveAgainstMap({ref:t,fullref:r,depth:n,map:i});if(t.length===40&&/[0-9a-f]{40}/.test(t))return{fullref:r,oid:t};let a=Kc(t);for(let s of a){let o=i.get(s);if(o)return e.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new Le(t)}static async packedRefs({fs:t,gitdir:r}){let n=await yi("packed-refs",async()=>t.read(`${r}/packed-refs`,{encoding:"utf8"}));return ru.from(n).refs}static async listRefs({fs:t,gitdir:r,filepath:n}){let i=e.packedRefs({fs:t,gitdir:r}),a=null;try{a=await t.readdirDeep(`${r}/${n}`),a=a.map(s=>s.replace(`${r}/${n}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(n)&&(s=s.replace(n+"/",""),a.includes(s)||a.push(s));return a.sort(f6),a}static async listBranches({fs:t,gitdir:r,remote:n}){return n?e.listRefs({fs:t,gitdir:r,filepath:`refs/remotes/${n}`}):e.listRefs({fs:t,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:t,gitdir:r}){return(await e.listRefs({fs:t,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function A6(e,t){return fu(jw(e),jw(t))}function jw(e){return e.mode==="040000"?e.path+"/":e.path}function l2(e){switch(e){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new le(`Unexpected GitTree entry mode: ${e}`)}function k6(e){let t=[],r=0;for(;r`${t.mode} ${t.type} ${t.oid} ${t.path}`).join(` -`)}toObject(){let t=[...this._entries];return t.sort(A6),Buffer.concat(t.map(r=>{let n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let t of this._entries)yield t}},xi=class{static wrap({type:t,object:r}){return Buffer.concat([Buffer.from(`${t} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(t){let r=t.indexOf(32),n=t.indexOf(0),i=t.slice(0,r).toString("utf8"),a=t.slice(r+1,n).toString("utf8"),s=t.length-(n+1);if(parseInt(a)!==s)throw new le(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(t.slice(n+1))}}};async function P6({fs:e,gitdir:t,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await e.read(`${t}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function R6(e,t){let r=new Fr(e),n=Hw(r);if(n!==t.byteLength)throw new le(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${t.length} bytes`);let i=Hw(r),a,s=Gw(r,t);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Fr(a);for(o.copy(s);!r.eof();)o.copy(Gw(r,t));let l=o.tell();if(i!==l)throw new le(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function Hw(e){let t=0,r=0,n=null;do n=e.readUInt8(),t|=(n&127)<>=1,i+=8;return n}function Gw(e,t){let r=e.readUInt8(),n=128,i=15,a=112;if(r&n){let s=Uw(e,r&i,4),o=Uw(e,(r&a)>>4,3);return o===0&&(o=65536),t.slice(s,s+o)}else return e.slice(r)}function M6(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function c2(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:M6(e)}var iu=class{constructor(t){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=c2(t),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(t){if(!this.eof())return this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t),this.buffer.slice(this.undoCursor,this.cursor)}async skip(t){this.eof()||(this.started||await this._init(),this.cursor+t>this.buffer.length&&(this._trim(),await this._accumulate(t)),this._moveCursor(t))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:t,value:r}=await this.stream.next();return t&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(t){this.undoCursor=this.cursor,this.cursor+=t,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(t){if(this._ended)return;let r=[this.buffer];for(;this.cursor+t>O6(r);){let n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function O6(e){return e.reduce((t,r)=>t+r.length,0)}async function I6(e,t){let r=new iu(e),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new le(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new le(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){let s=r.tell(),{type:o,length:l,ofs:c,reference:u}=await F6(r),f=new uu.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new le(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new le("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await t({data:f.result,type:o,num:a,offset:s,end:h,reference:u,ofs:c})}}}}async function F6(e){let t=await e.byte(),r=t>>4&7,n=t&15;if(t&128){let s=4;do t=await e.byte(),n|=(t&127)<i+1<<7|a,-1)}function N6(e,t){let r=t,n=4,i=null;do i=e.readUInt8(),r|=(i&127)<2048*1024*1024)throw new le("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+4*255);let s=n.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=E);let _=Math.floor((u-E)*100/u);_!==f&&n&&await n({phase:"Receiving objects",loaded:u-E,total:u}),f=_,y=i[y],["commit","tree","blob","tag"].includes(y)?a[x]={type:y,offset:x}:y==="ofs-delta"?a[x]={type:y,offset:x}:y==="ref-delta"&&(a[x]={type:y,offset:x})});let d=Object.keys(a).map(Number);for(let[v,y]of d.entries()){let b=v+1===d.length?t.byteLength-20:d[v+1],x=a[y],E=t2.default.buf(t.slice(y,b))>>>0;x.end=b,x.crc=E}let h=new e({pack:Promise.resolve(t),packfileSha:s,crcs:l,hashes:o,offsets:c,getExternalRefDelta:r});f=null;let p=0,m=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in a){v=Number(v);let y=Math.floor(p*100/u);y!==f&&n&&await n({phase:"Resolving deltas",loaded:p,total:u}),p++,f=y;let b=a[v];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:x,object:E}=await h.readSlice({start:v});m[h.readDepth]+=1;let _=await Vn(xi.wrap({type:x,object:E}));b.oid=_,o.push(_),c.set(_,v),l[_]=b.crc}catch(x){continue}}return o.sort(),h}async toBuffer(){let t=[],r=(c,u)=>{t.push(Buffer.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let n=new Fr(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++;n.writeUInt32BE(u)}t.push(n.buffer);for(let c of this.hashes)r(c,"hex");let i=new Fr(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);t.push(i.buffer);let a=new Fr(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)a.writeUInt32BE(this.offsets.get(c));t.push(a.buffer),r(this.packfileSha,"hex");let s=Buffer.concat(t),o=await Vn(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,l])}async load({pack:t}){this.pack=t}async unload(){this.pack=null}async read({oid:t}){if(!this.offsets.get(t)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(t);throw new le(`Could not read object ${t} from packfile`)}let r=this.offsets.get(t);return this.readSlice({start:r})}async readSlice({start:t}){if(this.offsetCache[t])return Object.assign({},this.offsetCache[t]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new le("Tried to read from a GitPackIndex with no packfile loaded into memory");let n=(await this.pack).slice(t),i=new Fr(n),a=i.readUInt8(),s=a&112,o=r[s];if(o===void 0)throw new le("Unrecognized type: 0b"+s.toString(2));let l=a&15,c=l;a&128&&(c=N6(i,l));let f=null,d=null;if(o==="ofs_delta"){let p=D6(i),m=t-p;({object:f,type:o}=await this.readSlice({start:m}))}if(o==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:p}))}let h=n.slice(i.tell());if(d=Buffer.from(await u2(h)),d.byteLength!==c)throw new le(`Packfile told us object would have length ${c} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(R6(d,f))),this.readDepth>3&&(this.offsetCache[t]={type:o,object:d}),{type:o,format:"content",object:d}}},Jc=Symbol("PackfileCache");async function B6({fs:e,filename:t,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){let a=await e.read(t);return il.fromIdx({idx:a,getExternalRefDelta:r})}function Ap({fs:e,cache:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){t[Jc]||(t[Jc]=new Map);let s=t[Jc].get(r);return s||(s=B6({fs:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),t[Jc].set(r,s)),s}async function j6({fs:e,cache:t,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let s=await e.readdir($(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,c=await Ap({fs:e,cache:t,filename:l,getExternalRefDelta:a});if(c.error)throw new le(c.error);if(c.offsets.has(n)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=e.read(f)}let u=await c.read({oid:n,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function qe({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){let a=u=>qe({fs:e,cache:t,gitdir:r,oid:u}),s;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await P6({fs:e,gitdir:r,oid:n})),!s){if(s=await j6({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a}),!s)throw new Le(n);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await u2(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await Vn(s.object);if(o!==n)throw new le(`SHA check failed! Expected ${n}, computed ${o}`);let{object:l,type:c}=xi.unwrap(s.object);if(s.type=c,s.object=l,s.format="content",i==="content")return s;throw new le(`invalid requested format "${i}"`)}var en=class e extends Se{constructor(t,r,n=!0){super(`Failed to create ${t} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${t}.)`:""}`),this.code=this.name=e.code,this.data={noun:t,where:r,canForce:n}}};en.code="AlreadyExistsError";var al=class e extends Se{constructor(t,r,n){super(`Found multiple ${t} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=e.code,this.data={nouns:t,short:r,matches:n}}};al.code="AmbiguousError";var sl=class e extends Se{constructor(t){super(`Your local changes to the following files would be overwritten by checkout: ${t.join(", ")}`),this.code=this.name=e.code,this.data={filepaths:t}}};sl.code="CheckoutConflictError";var ol=class e extends Se{constructor(t,r){super(`Failed to checkout "${t}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=e.code,this.data={ref:t,oid:r}}};ol.code="CommitNotFetchedError";var ll=class e extends Se{constructor(){super("Empty response from git server."),this.code=this.name=e.code,this.data={}}};ll.code="EmptyServerResponseError";var cl=class e extends Se{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=e.code,this.data={}}};cl.code="FastForwardError";var ul=class e extends Se{constructor(t,r){super(`One or more branches were not updated: ${t}`),this.code=this.name=e.code,this.data={prettyDetails:t,result:r}}};ul.code="GitPushError";var ms=class e extends Se{constructor(t,r,n){super(`HTTP Error: ${t} ${r}`),this.code=this.name=e.code,this.data={statusCode:t,statusMessage:r,response:n}}};ms.code="HttpError";var Si=class e extends Se{constructor(t){let r="invalid filepath";t==="leading-slash"||t==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':t==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=e.code,this.data={reason:t}}};Si.code="InvalidFilepathError";var Wn=class e extends Se{constructor(t,r){super(`"${t}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=e.code,this.data={ref:t,suggestion:r}}};Wn.code="InvalidRefNameError";var fl=class e extends Se{constructor(t){super(`Maximum search depth of ${t} exceeded.`),this.code=this.name=e.code,this.data={depth:t}}};fl.code="MaxDepthError";var gs=class e extends Se{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=e.code,this.data={}}};gs.code="MergeNotSupportedError";var vs=class e extends Se{constructor(t,r,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${t.toString()}. Fix conflicts then commit the result.`),this.code=this.name=e.code,this.data={filepaths:t,bothModified:r,deleteByUs:n,deleteByTheirs:i}}};vs.code="MergeConflictError";var Vt=class e extends Se{constructor(t){super(`No name was provided for ${t} in the argument or in the .git/config file.`),this.code=this.name=e.code,this.data={role:t}}};Vt.code="MissingNameError";var er=class e extends Se{constructor(t){super(`The function requires a "${t}" parameter but none was provided.`),this.code=this.name=e.code,this.data={parameter:t}}};er.code="MissingParameterError";var dl=class e extends Se{constructor(t){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=e.code,this.data={errors:t},this.errors=t}};dl.code="MultipleGitError";var ua=class e extends Se{constructor(t,r){super(`Expected "${t}" but received "${r}".`),this.code=this.name=e.code,this.data={expected:t,actual:r}}};ua.code="ParseError";var ys=class e extends Se{constructor(t){let r="";t==="not-fast-forward"?r=" because it was not a simple fast-forward":t==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=e.code,this.data={reason:t}}};ys.code="PushRejectedError";var wi=class e extends Se{constructor(t,r){super(`Remote does not support the "${t}" so the "${r}" parameter cannot be used.`),this.code=this.name=e.code,this.data={capability:t,parameter:r}}};wi.code="RemoteCapabilityError";var hl=class e extends Se{constructor(t,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${t}`),this.code=this.name=e.code,this.data={preview:t,response:r}}};hl.code="SmartHttpError";var pl=class e extends Se{constructor(t,r,n){super(`Git remote "${t}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=e.code,this.data={url:t,transport:r,suggestion:n}}};pl.code="UnknownTransportError";var ml=class e extends Se{constructor(t){super(`Cannot parse remote URL: "${t}"`),this.code=this.name=e.code,this.data={url:t}}};ml.code="UrlParseError";var ws=class e extends Se{constructor(){super("The operation was canceled."),this.code=this.name=e.code,this.data={}}};ws.code="UserCanceledError";var gl=class e extends Se{constructor(t){super(`Could not merge index: Entry for '${t}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=e.code,this.data={filepath:t}}};gl.code="IndexResetError";var vl=class e extends Se{constructor(t){super(`"${t}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=e.code,this.data={ref:t}}};vl.code="NoCommitError";var wl=Object.freeze({__proto__:null,AlreadyExistsError:en,AmbiguousError:al,CheckoutConflictError:sl,CommitNotFetchedError:ol,EmptyServerResponseError:ll,FastForwardError:cl,GitPushError:ul,HttpError:ms,InternalError:le,InvalidFilepathError:Si,InvalidOidError:_i,InvalidRefNameError:Wn,MaxDepthError:fl,MergeNotSupportedError:gs,MergeConflictError:vs,MissingNameError:Vt,MissingParameterError:er,MultipleGitError:dl,NoRefspecError:nl,NotFoundError:Le,ObjectTypeError:zt,ParseError:ua,PushRejectedError:ys,RemoteCapabilityError:wi,SmartHttpError:hl,UnknownTransportError:pl,UnsafeFilepathError:ds,UrlParseError:ml,UserCanceledError:ws,UnmergedPathsError:rl,IndexResetError:gl,NoCommitError:vl});function vp({name:e,email:t,timestamp:r,timezoneOffset:n}){return n=H6(n),`${e} <${t}> ${r} ${n}`}function H6(e){let t=U6(G6(e));e=Math.abs(e);let r=Math.floor(e/60);e-=r*60;let n=String(r),i=String(e);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(t===-1?"-":"+")+n+i}function U6(e){return Math.sign(e)||(Object.is(e,-0)?-1:1)}function G6(e){return e===0?e:-e}function zn(e){return e=e.replace(/\r/g,""),e=e.replace(/^\n+/,""),e=e.replace(/\n+$/,"")+` -`,e}function au(e){let[,t,r,n,i]=e.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:t,email:r,timestamp:Number(n),timezoneOffset:z6(i)}}function z6(e){let[,t,r,n]=e.match(/(\+|-)(\d\d)(\d\d)/);return n=(t==="+"?1:-1)*(Number(r)*60+Number(n)),V6(n)}function V6(e){return e===0?e:-e}var pr=class e{constructor(t){if(typeof t=="string")this._tag=t;else if(Buffer.isBuffer(t))this._tag=t.toString("utf8");else if(typeof t=="object")this._tag=e.render(t);else throw new le("invalid type passed to GitAnnotatedTag constructor")}static from(t){return new e(t)}static render(t){return`object ${t.object} -type ${t.type} -tag ${t.tag} -tagger ${vp(t.tagger)} +`}},qf=class t{constructor({remotePath:e,localPath:r,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:r,force:n,matchPrefix:i})}static from(e){let[r,n,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=i==="*";if(l!==(s==="*"))throw new de("Invalid refspec");return new t({remotePath:n,localPath:a,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Sg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let n of e)r.push(qf.from(n));return new t(r)}add(e){let r=qf.from(e);this.rules.push(r)}translate(e){let r=[];for(let n of this.rules)for(let i of e){let a=n.translate(i);a&&r.push([i,a])}return r}translateOne(e){let r=null;for(let n of this.rules){let i=n.translate(e);i&&(r=i)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function QH(t,e){let r=t.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(rn);return i===0?t.endsWith("^{}")?1:-1:i}var e3=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},ec=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},jS={core:{filemode:ec,bare:ec,logallrefupdates:ec,symlinks:ec,ignorecase:ec,bigFileThreshold:e3}},t3=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,r3=/^[A-Za-z0-9-.]+$/,n3=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,i3=/^[A-Za-z][A-Za-z-]*$/,a3=/^(.*?)( *[#;].*)$/,s3=t=>{let e=t3.exec(t);if(e!=null){let[r,n]=e.slice(1);return[r,n]}return null},o3=t=>{let e=n3.exec(t);if(e!=null){let[r,n="true"]=e.slice(1),i=l3(n),a=c3(i);return[r,a]}return null},l3=t=>{let e=a3.exec(t);if(e==null)return t;let[r,n]=e.slice(1);return GS(r)&&GS(n)?`${r}${n}`:r},GS=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,c3=t=>t.split("").reduce((e,r,n,i)=>{let a=r==='"'&&i[n-1]!=="\\",s=r==="\\"&&i[n+1]==='"';return a||s?e:e+r},""),qS=t=>t!=null?t.toLowerCase():null,Eg=(t,e,r)=>[qS(t),e,qS(r)].filter(n=>n!=null).join("."),zS=t=>{let e=t.split("."),r=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:r,subsection:i,name:n,path:Eg(r,i,n),sectionPath:Eg(r,i,null),isSection:!!r}},u3=(t,e)=>t.reduce((r,n,i)=>e(n)?i:r,-1),kg=class t{constructor(e){let r=null,n=null;this.parsedConfig=e?e.split(` +`).map(i=>{let a=null,s=null,o=i.trim(),l=s3(o),u=l!=null;if(u)[r,n]=l;else{let f=o3(o);f!=null&&([a,s]=f)}let c=Eg(r,n,a);return{line:i,isSection:u,section:r,subsection:n,name:a,value:s,path:c}}):[]}static from(e){return new t(e)}async get(e,r=!1){let n=zS(e).path,i=this.parsedConfig.filter(a=>a.path===n).map(({section:a,name:s,value:o})=>{let l=jS[a]&&jS[a][s];return l?l(o):o});return r?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,n=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l,isSection:u}=zS(e),c=u3(this.parsedConfig,f=>f.path===o);if(r==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let f=this.parsedConfig[c],d=Object.assign({},f,{name:s,value:r,modified:!0});n?this.parsedConfig.splice(c+1,0,d):this.parsedConfig[c]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:a,name:s,value:r,modified:!0,path:o};if(r3.test(i)&&i3.test(s))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:u,section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:n,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:n!=null?`[${r} "${n}"]`:`[${r}]`:e).join(` +`)}},nt=class{static async get({fs:e,gitdir:r}){let n=await e.read(`${r}/config`,{encoding:"utf8"});return kg.from(n)}static async save({fs:e,gitdir:r,config:n}){await e.write(`${r}/config`,n.toString(),{encoding:"utf8"})}},Bf=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],f3=["config","description","index","shallow","commondir"],dg;async function aa(t,e){return dg===void 0&&(dg=new tc),dg.acquire(t,e)}var z=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:n,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:u=!1}){for(let v of i.values())if(!v.match(/[0-9a-f]{40}/))throw new oa(v);let c=await nt.get({fs:e,gitdir:r});if(!o){if(o=await c.getall(`remote.${n}.fetch`),o.length===0)throw new nc(n);o.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=Sg.from(o),d=new Map;if(u){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(w=>`refs/tags/${w}`)})}if(s){for(let v of i.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let w=i.get(v);d.set(v,w)}}let h=f.translate([...i.keys()]);for(let[v,w]of h){let b=i.get(v);d.set(w,b)}let m=f.translate([...a.keys()]);for(let[v,w]of m){let b=a.get(v),E=f.translateOne(b);E&&d.set(w,`ref: ${E}`)}let g=[];if(l){for(let v of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(b=>`${v}/${b}`);for(let b of w)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,w]of d)await aa(v,async()=>e.write(O.join(r,v),`${w.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:n,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new oa(i);await aa(n,async()=>e.write(O.join(r,n),`${i.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:n,value:i}){await aa(n,async()=>e.write(O.join(r,n),`ref: ${i.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:n}){return t.deleteRefs({fs:e,gitdir:r,refs:[n]})}static async deleteRefs({fs:e,gitdir:r,refs:n}){await Promise.all(n.map(o=>e.rm(O.join(r,o))));let i=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),a=Gf.from(i),s=a.refs.size;for(let o of n)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${r}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:n,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),t.resolve({fs:e,gitdir:r,ref:n,depth:i});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let a=await t.packedRefs({fs:e,gitdir:r}),s=Bf(n).filter(o=>!f3.includes(o));for(let o of s){let l=await aa(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:i})}throw new Le(n)}static async exists({fs:e,gitdir:r,ref:n}){try{return await t.expand({fs:e,gitdir:r,ref:n}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:r,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await t.packedRefs({fs:e,gitdir:r}),a=Bf(n);for(let s of a)if(await aa(s,async()=>e.exists(`${r}/${s}`))||i.has(s))return s;throw new Le(n)}static async expandAgainstMap({ref:e,map:r}){let n=Bf(e);for(let i of n)if(await r.has(i))return i;throw new Le(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let a=Bf(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:n,map:i})}throw new Le(e)}static async packedRefs({fs:e,gitdir:r}){let n=await aa("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return Gf.from(n).refs}static async listRefs({fs:e,gitdir:r,filepath:n}){let i=t.packedRefs({fs:e,gitdir:r}),a=null;try{a=await e.readdirDeep(`${r}/${n}`),a=a.map(s=>s.replace(`${r}/${n}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(n)&&(s=s.replace(n+"/",""),a.includes(s)||a.push(s));return a.sort(QH),a}static async listBranches({fs:e,gitdir:r,remote:n}){return n?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${n}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function d3(t,e){return Kf(VS(t),VS(e))}function VS(t){return t.mode==="040000"?t.path+"/":t.path}function pE(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new de(`Unexpected GitTree entry mode: ${t}`)}function h3(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(d3),Buffer.concat(e.map(r=>{let n=Buffer.from(r.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(r.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(r.oid,"hex");return Buffer.concat([n,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},la=class{static wrap({type:e,object:r}){return Buffer.concat([Buffer.from(`${e} ${r.byteLength.toString()}\0`),Buffer.from(r)])}static unwrap(e){let r=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,r).toString("utf8"),a=e.slice(r+1,n).toString("utf8"),s=e.length-(n+1);if(parseInt(a)!==s)throw new de(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(n+1))}}};async function mE({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`,i=await t.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function g3(t,e){let r=new Jr(t),n=WS(r);if(n!==e.byteLength)throw new de(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=WS(r),a,s=XS(r,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new Jr(a);for(o.copy(s);!r.eof();)o.copy(XS(r,e));let l=o.tell();if(i!==l)throw new de(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function WS(t){let e=0,r=0,n=null;do n=t.readUInt8(),e|=(n&127)<>=1,i+=8;return n}function XS(t,e){let r=t.readUInt8(),n=128,i=15,a=112;if(r&n){let s=YS(t,r&i,4),o=YS(t,(r&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(r)}function v3(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function gE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:v3(t)}var zf=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=gE(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?Buffer.alloc(0):(r&&(r=Buffer.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>w3(r);){let n=await this._next();if(this._ended)break;r.push(n)}this.buffer=Buffer.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function w3(t){return t.reduce((e,r)=>e+r.length,0)}async function y3(t,e){let r=new zf(t),n=await r.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new de(`Invalid PACK header '${n}'`);let i=await r.read(4);if(i=i.readUInt32BE(0),i!==2)throw new de(`Invalid packfile version: ${i}`);let a=await r.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!r.eof()&&a--;){let s=r.tell(),{type:o,length:l,ofs:u,reference:c}=await b3(r),f=new Fg.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new de(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new de("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:a,offset:s,end:h,reference:c,ofs:u})}}}}async function b3(t){let e=await t.byte(),r=e>>4&7,n=e&15;if(e&128){let s=4;do e=await t.byte(),n|=(e&127)<i+1<<7|a,-1)}function E3(t,e){let r=e,n=4,i=null;do i=t.readUInt8(),r|=(i&127)<2048*1024*1024)throw new de("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+4*255);let s=n.readUInt32BE(),o=[];for(let c=0;c{c===null&&(c=x);let k=Math.floor((c-x)*100/c);k!==f&&n&&await n({phase:"Receiving objects",loaded:c-x,total:c}),f=k,w=i[w],["commit","tree","blob","tag"].includes(w)?a[E]={type:w,offset:E}:w==="ofs-delta"?a[E]={type:w,offset:E}:w==="ref-delta"&&(a[E]={type:w,offset:E})});let d=Object.keys(a).map(Number);for(let[v,w]of d.entries()){let b=v+1===d.length?e.byteLength-20:d[v+1],E=a[w],x=UH.buf(e.slice(w,b))>>>0;E.end=b,E.crc=x}let h=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:u,getExternalRefDelta:r});f=null;let m=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in a){v=Number(v);let w=Math.floor(m*100/c);w!==f&&n&&await n({phase:"Resolving deltas",loaded:m,total:c}),m++,f=w;let b=a[v];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:E,object:x}=await h.readSlice({start:v});g[h.readDepth]+=1;let k=await ki(la.wrap({type:E,object:x}));b.oid=k,o.push(k),u.set(k,v),l[k]=b.crc}catch(E){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(u,c)=>{e.push(Buffer.from(u,c))};r("ff744f63","hex"),r("00000002","hex");let n=new Jr(Buffer.alloc(256*4));for(let u=0;u<256;u++){let c=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=u&&c++;n.writeUInt32BE(c)}e.push(n.buffer);for(let u of this.hashes)r(u,"hex");let i=new Jr(Buffer.alloc(this.hashes.length*4));for(let u of this.hashes)i.writeUInt32BE(this.crcs[u]);e.push(i.buffer);let a=new Jr(Buffer.alloc(this.hashes.length*4));for(let u of this.hashes)a.writeUInt32BE(this.offsets.get(u));e.push(a.buffer),r(this.packfileSha,"hex");let s=Buffer.concat(e),o=await ki(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,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 de(`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 de("Tried to read from a GitPackIndex with no packfile loaded into memory");let n=(await this.pack).slice(e),i=new Jr(n),a=i.readUInt8(),s=a&112,o=r[s];if(o===void 0)throw new de("Unrecognized type: 0b"+s.toString(2));let l=a&15,u=l;a&128&&(u=E3(i,l));let f=null,d=null;if(o==="ofs_delta"){let m=S3(i),g=e-m;({object:f,type:o}=await this.readSlice({start:g}))}if(o==="ref_delta"){let m=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:m}))}let h=n.slice(i.tell());if(d=Buffer.from(await vE(h)),d.byteLength!==u)throw new de(`Packfile told us object would have length ${u} but it had length ${d.byteLength}`);return f&&(d=Buffer.from(g3(d,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:d}),{type:o,format:"content",object:d}}},Hf=Symbol("PackfileCache");async function k3({fs:t,filename:e,getExternalRefDelta:r,emitter:n,emitterPrefix:i}){let a=await t.read(e);return ic.fromIdx({idx:a,getExternalRefDelta:r})}function Og({fs:t,cache:e,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}){e[Hf]||(e[Hf]=new Map);let s=e[Hf].get(r);return s||(s=k3({fs:t,filename:r,getExternalRefDelta:n,emitter:i,emitterPrefix:a}),e[Hf].set(r,s)),s}async function A3({fs:t,cache:e,gitdir:r,oid:n,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(O.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,u=await Og({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(u.error)throw new de(u.error);if(u.offsets.has(n)){if(!u.pack){let f=l.replace(/idx$/,"pack");u.pack=t.read(f)}let c=await u.read({oid:n,getExternalRefDelta:a});return c.format="content",c.source=`objects/pack/${o.replace(/idx$/,"pack")}`,c}}return null}async function qe({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=c=>qe({fs:t,cache:e,gitdir:r,oid:c}),s;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await mE({fs:t,gitdir:r,oid:n})),!s){if(s=await A3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a}),!s)throw new Le(n);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await vE(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await ki(s.object);if(o!==n)throw new de(`SHA check failed! Expected ${n}, computed ${o}`);let{object:l,type:u}=la.unwrap(s.object);if(s.type=u,s.object=l,s.format="content",i==="content")return s;throw new de(`invalid requested format "${i}"`)}var vn=class t extends Ae{constructor(e,r,n=!0){super(`Failed to create ${e} at ${r} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:n}}};vn.code="AlreadyExistsError";var ac=class t extends Ae{constructor(e,r,n){super(`Found multiple ${e} matching "${r}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:n}}};ac.code="AmbiguousError";var sc=class t extends Ae{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}}};sc.code="CheckoutConflictError";var oc=class t extends Ae{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}}};oc.code="CommitNotFetchedError";var lc=class t extends Ae{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};lc.code="EmptyServerResponseError";var cc=class t extends Ae{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};cc.code="FastForwardError";var uc=class t extends Ae{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};uc.code="GitPushError";var vo=class t extends Ae{constructor(e,r,n){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:n}}};vo.code="HttpError";var ca=class t extends Ae{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}}};ca.code="InvalidFilepathError";var wn=class t extends Ae{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}}};wn.code="InvalidRefNameError";var fc=class t extends Ae{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};fc.code="MaxDepthError";var wo=class t extends Ae{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};wo.code="MergeNotSupportedError";var yo=class t extends Ae{constructor(e,r,n,i){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:n,deleteByTheirs:i}}};yo.code="MergeConflictError";var zt=class t extends Ae{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}}};zt.code="MissingNameError";var hr=class t extends Ae{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};hr.code="MissingParameterError";var dc=class t extends Ae{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}};dc.code="MultipleGitError";var Ja=class t extends Ae{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};Ja.code="ParseError";var bo=class t extends Ae{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}}};bo.code="PushRejectedError";var sa=class t extends Ae{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}}};sa.code="RemoteCapabilityError";var hc=class t extends Ae{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}}};hc.code="SmartHttpError";var pc=class t extends Ae{constructor(e,r,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:n}}};pc.code="UnknownTransportError";var mc=class t extends Ae{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};mc.code="UrlParseError";var _o=class t extends Ae{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};_o.code="UserCanceledError";var gc=class t extends Ae{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}}};gc.code="IndexResetError";var vc=class t extends Ae{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}}};vc.code="NoCommitError";var wE=Object.freeze({__proto__:null,AlreadyExistsError:vn,AmbiguousError:ac,CheckoutConflictError:sc,CommitNotFetchedError:oc,EmptyServerResponseError:lc,FastForwardError:cc,GitPushError:uc,HttpError:vo,InternalError:de,InvalidFilepathError:ca,InvalidOidError:oa,InvalidRefNameError:wn,MaxDepthError:fc,MergeNotSupportedError:wo,MergeConflictError:yo,MissingNameError:zt,MissingParameterError:hr,MultipleGitError:dc,NoRefspecError:nc,NotFoundError:Le,ObjectTypeError:rr,ParseError:Ja,PushRejectedError:bo,RemoteCapabilityError:sa,SmartHttpError:hc,UnknownTransportError:pc,UnsafeFilepathError:po,UrlParseError:mc,UserCanceledError:_o,UnmergedPathsError:rc,IndexResetError:gc,NoCommitError:vc});function Ag({name:t,email:e,timestamp:r,timezoneOffset:n}){return n=T3(n),`${t} <${e}> ${r} ${n}`}function T3(t){let e=C3(P3(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let n=String(r),i=String(t);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(e===-1?"-":"+")+n+i}function C3(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function P3(t){return t===0?t:-t}function Ei(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function Vf(t){let[,e,r,n,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(n),timezoneOffset:R3(i)}}function R3(t){let[,e,r,n]=t.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(r)*60+Number(n)),I3(n)}function I3(t){return t===0?t:-t}var Fr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new de("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} +type ${e.type} +tag ${e.tag} +tagger ${Ag(e.tagger)} -${t.message} -${t.gpgsig?t.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` +${e.message} +${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` -`))}message(){let t=this.withoutSignature();return t.slice(t.indexOf(` +`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(` -`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let t=this.justHeaders().split(` -`),r=[];for(let i of t)i[0]===" "?r[r.length-1]+=` -`+i.slice(1):r.push(i);let n={};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.tagger&&(n.tagger=au(n.tagger)),n.committer&&(n.committer=au(n.committer)),n}withoutSignature(){let t=zn(this._tag);return t.indexOf(` ------BEGIN PGP SIGNATURE-----`)===-1?t:t.slice(0,t.lastIndexOf(` +`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(` +`),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=` +`+i.slice(1):r.push(i);let n={};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.tagger&&(n.tagger=Vf(n.tagger)),n.committer&&(n.committer=Vf(n.committer)),n}withoutSignature(){let e=Ei(this._tag);return e.indexOf(` +-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(` -----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(` ------BEGIN PGP SIGNATURE-----`)===-1)return;let t=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return zn(t)}payload(){return this.withoutSignature()+` -`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(t,r,n){let i=t.payload(),{signature:a}=await r({payload:i,secretKey:n});a=zn(a);let s=i+a;return e.from(s)}};function sp(e){return e.trim().split(` -`).map(t=>" "+t).join(` +-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Ei(e)}payload(){return this.withoutSignature()+` +`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,r,n){let i=e.payload(),{signature:a}=await r({payload:i,secretKey:n});a=Ei(a);let s=i+a;return t.from(s)}};function pg(t){return t.trim().split(` +`).map(e=>" "+e).join(` `)+` -`}function W6(e){return e.split(` -`).map(t=>t.replace(/^ /,"")).join(` -`)}var rr=class e{constructor(t){if(typeof t=="string")this._commit=t;else if(Buffer.isBuffer(t))this._commit=t.toString("utf8");else if(typeof t=="object")this._commit=e.render(t);else throw new le("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:t,signature:r}){let n=e.justHeaders(t),i=e.justMessage(t),a=zn(n+` -gpgsig`+sp(r)+` -`+i);return new e(a)}static from(t){return new e(t)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return e.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(t){return zn(t.slice(t.indexOf(` +`}function $3(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var mr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new de("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let n=t.justHeaders(e),i=t.justMessage(e),a=Ei(n+` +gpgsig`+pg(r)+` +`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Ei(e.slice(e.indexOf(` -`)+2))}static justHeaders(t){return t.slice(0,t.indexOf(` +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` -`))}parseHeaders(){let t=e.justHeaders(this._commit).split(` -`),r=[];for(let i of t)i[0]===" "?r[r.length-1]+=` -`+i.slice(1):r.push(i);let n={parent:[]};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.author&&(n.author=au(n.author)),n.committer&&(n.committer=au(n.committer)),n}static renderHeaders(t){let r="";if(t.tree?r+=`tree ${t.tree} +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),r=[];for(let i of e)i[0]===" "?r[r.length-1]+=` +`+i.slice(1):r.push(i);let n={parent:[]};for(let i of r){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(n[a])?n[a].push(s):n[a]=s}return n.author&&(n.author=Vf(n.author)),n.committer&&(n.committer=Vf(n.committer)),n}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree} `:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 -`,t.parent){if(t.parent.length===void 0)throw new le("commit 'parent' property should be an array");for(let a of t.parent)r+=`parent ${a} -`}let n=t.author;r+=`author ${vp(n)} -`;let i=t.committer||t.author;return r+=`committer ${vp(i)} -`,t.gpgsig&&(r+="gpgsig"+sp(t.gpgsig)),r}static render(t){return e.renderHeaders(t)+` -`+zn(t.message)}render(){return this._commit}withoutSignature(){let t=zn(this._commit);if(t.indexOf(` -gpgsig`)===-1)return t;let r=t.slice(0,t.indexOf(` -gpgsig`)),n=t.slice(t.indexOf(`-----END PGP SIGNATURE----- -`)+28);return zn(r+` -`+n)}isolateSignature(){let t=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return W6(t)}static async sign(t,r,n){let i=t.withoutSignature(),a=e.justMessage(t._commit),{signature:s}=await r({payload:i,secretKey:n});s=zn(s);let l=e.justHeaders(t._commit)+` -gpgsig`+sp(s)+` -`+a;return e.from(l)}};async function bs({fs:e,cache:t,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:tr.from([]),oid:n};let{type:i,object:a}=await qe({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=pr.from(a).parse().object,bs({fs:e,cache:t,gitdir:r,oid:n});if(i==="commit")return n=rr.from(a).parse().tree,bs({fs:e,cache:t,gitdir:r,oid:n});if(i!=="tree")throw new zt(n,i,"tree");return{tree:tr.from(a),oid:n}}var yp=class{constructor({fs:t,gitdir:r,ref:n,cache:i}){this.fs=t,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await W.resolve({fs:t,gitdir:r,ref:n})}catch(c){c instanceof Le&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await bs({fs:t,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){let r=t._fullpath,{fs:n,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(r);if(!o)throw new Error(`No obj for ${r}`);let 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 qe({fs:n,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new zt(l,c,o.type);let f=tr.from(u);for(let d of f)s.set($(r,d.path),d);return f.entries().map(d=>$(r,d.path))}async type(t){if(t._type===!1){let r=await this.mapPromise,{type:n}=r.get(t._fullpath);t._type=n}return t._type}async mode(t){if(t._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(t._fullpath);t._mode=a2(parseInt(n,8))}return t._mode}async stat(t){}async content(t){if(t._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(t._fullpath).oid,{type:l,object:c}=await qe({fs:n,cache:i,gitdir:a,oid:o});l!=="blob"?t._content=void 0:t._content=new Uint8Array(c)}return t._content}async oid(t){if(t._oid===!1){let n=(await this.mapPromise).get(t._fullpath);t._oid=n.oid}return t._oid}};function bi({ref:e="HEAD"}={}){let t=Object.create(null);return Object.defineProperty(t,du,{value:function({fs:r,gitdir:n,cache:i}){return new yp({fs:r,gitdir:n,ref:e,cache:i})}}),Object.freeze(t),t}var wp=class{constructor({fs:t,dir:r,gitdir:n,cache:i}){this.fs=t,this.cache=i,this.dir=r,this.gitdir=n;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(t){let r=t._fullpath,{fs:n,dir:i}=this,a=await n.readdir($(i,r));return a===null?null:a.map(s=>$(r,s))}async type(t){return t._type===!1&&await t.stat(),t._type}async mode(t){return t._mode===!1&&await t.stat(),t._mode}async stat(t){if(t._stat===!1){let{fs:r,dir:n}=this,i=await r.lstat(`${n}/${t._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${t._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),t._type=a,i=hs(i),t._mode=i.mode,i.size===-1&&t._actualSize&&(i.size=t._actualSize),t._stat=i}return t._stat}async content(t){if(t._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await t.type()==="tree")t._content=void 0;else{let s=await(await We.get({fs:r,gitdir:i})).get("core.autocrlf"),o=await r.read(`${n}/${t._fullpath}`,{autocrlf:s});t._actualSize=o.length,t._stat&&t._stat.size===-1&&(t._stat.size=t._actualSize),t._content=new Uint8Array(o)}}return t._content}async oid(t){if(t._oid===!1){let{fs:r,gitdir:n,cache:i}=this,a;await yt.acquire({fs:r,gitdir:n,cache:i},async function(s){let o=s.entriesMap.get(t._fullpath),l=await t.stat(),u=await(await We.get({fs:r,gitdir:n})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||eu(l,o,u,f)?await t.content()===void 0?a=void 0:(a=await Vn(xi.wrap({type:"blob",object:await t.content()})),o&&a===o.oid&&(!u||l.mode===o.mode)&&eu(l,o,u,f)&&s.insert({filepath:t._fullpath,stats:l,oid:a})):a=o.oid}),t._oid=a}return t._oid}};function pu(){let e=Object.create(null);return Object.defineProperty(e,du,{value:function({fs:t,dir:r,gitdir:n,cache:i}){return new wp({fs:t,dir:r,gitdir:n,cache:i})}}),Object.freeze(e),e}function q6(e,t){let r=t-e;return Array.from({length:r},(n,i)=>e+i)}var f2=typeof Array.prototype.flat=="undefined"?e=>e.reduce((t,r)=>t.concat(r),[]):e=>e.flat(),bp=class{constructor(){this.value=null}consider(t){t!=null&&(this.value===null?this.value=t:tc,reduce:s=async(l,c)=>{let u=f2(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(h=>h[du]({fs:e,dir:r,gitdir:n,cache:t})),c=new Array(l.length).fill("."),u=q6(0,l.length),f=async h=>{u.map(v=>{h[v]=h[v]&&new l[v].ConstructEntry(h[v])});let m=(await Promise.all(u.map(v=>h[v]?l[v].readdir(h[v]):[]))).map(v=>v===null?[]:v).map(v=>v[Symbol.iterator]());return{entries:h,children:Y6(m)}},d=async h=>{let{entries:p,children:m}=await f(h),v=p.find(b=>b&&b._fullpath)._fullpath,y=await a(v,p);if(y!==null){let b=await o(d,m);return b=b.filter(x=>x!==void 0),s(y,b)}};return d(c)}async function _p(e,t){let r=await e.readdir(t);r==null?await e.rm(t):r.length?await Promise.all(r.map(n=>{let i=$(t,n);return e.lstat(i).then(a=>{if(a)return a.isDirectory()?_p(e,i):e.rm(i)})})).then(()=>e.rmdir(t)):await e.rmdir(t)}function X6(e){return Z6(e)&&zw(e.then)&&zw(e.catch)}function Z6(e){return e&&typeof e=="object"}function zw(e){return typeof e=="function"}function Vw(e){return X6((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(e))}var Ww=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function qw(e,t){if(Vw(t))for(let r of Ww)e[`_${r}`]=t[r].bind(t);else for(let r of Ww)e[`_${r}`]=(0,Qc.default)(t[r].bind(t));Vw(t)?t.rm?e._rm=t.rm.bind(t):t.rmdir.length>1?e._rm=t.rmdir.bind(t):e._rm=_p.bind(null,e):t.rm?e._rm=(0,Qc.default)(t.rm.bind(t)):t.rmdir.length>2?e._rm=(0,Qc.default)(t.rmdir.bind(t)):e._rm=_p.bind(null,e)}var X=class{constructor(t){if(typeof t._original_unwrapped_fs!="undefined")return t;let r=Object.getOwnPropertyDescriptor(t,"promises");r&&r.enumerable?qw(this,t.promises):qw(this,t),this._original_unwrapped_fs=t}async exists(t,r={}){try{return await this._stat(t),!0}catch(n){if(n.code==="ENOENT"||n.code==="ENOTDIR")return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(t,r={}){try{let n=await this._readFile(t,r);if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,` -`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(t,r,n={}){try{await this._writeFile(t,r,n);return}catch(i){await this.mkdir(ps(t)),await this._writeFile(t,r,n)}}async mkdir(t,r=!1){try{await this._mkdir(t);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=ps(t);if(i==="."||i==="/"||i===t)throw n;await this.mkdir(i),await this.mkdir(t,!0)}}}async rm(t){try{await this._unlink(t)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(t,r){try{r&&r.recursive?await this._rm(t,r):await this._rmdir(t)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(t){try{let r=await this._readdir(t);return r.sort(fu),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(t){let r=await this._readdir(t);return(await Promise.all(r.map(async i=>{let a=t+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(t){try{return await this._lstat(t)}catch(r){if(r.code==="ENOENT")return null;throw r}}async readlink(t,r={encoding:"buffer"}){try{let n=await this._readlink(t,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}async writelink(t,r){return this._symlink(r.toString("utf8"),t)}};function C(e,t){if(t===void 0)throw new er(e)}async function su(e,t){return!e&&!t?!1:e&&!t||!e&&t?!0:!(await e.type()==="tree"&&await t.type()==="tree"||await e.type()===await t.type()&&await e.mode()===await t.mode()&&await e.oid()===await t.oid())}async function K6({fs:e,dir:t,gitdir:r=$(t,".git"),commit:n="HEAD",cache:i={}}){try{C("fs",e),C("dir",t),C("gitdir",r);let a=new X(e),s=[bi({ref:n}),pu(),hu()],o=[];await yt.acquire({fs:a,gitdir:r,cache:i},async function(c){o=c.unmergedPaths});let l=await _s({fs:a,cache:i,dir:t,gitdir:r,trees:s,map:async function(c,[u,f,d]){let h=!await su(f,d),p=o.includes(c),m=!await su(d,u);if(h||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(m)return!1;throw new gl(c)}});await yt.acquire({fs:a,gitdir:r,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${t}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${t}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var xs=class{static async isIgnored({fs:t,dir:r,gitdir:n=$(r,".git"),filepath:i}){if(tu(i)===".git")return!0;if(i===".")return!1;let a="",s=$(n,"info","exclude");await t.exists(s)&&(a=await t.read(s,"utf8"));let o=[{gitignore:$(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;uxp({dir:t,gitdir:r,fs:o,filepath:n,index:l,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function xp({dir:e,gitdir:t,fs:r,filepath:n,index:i,force:a,parallel:s}){n=Array.isArray(n)?n:[n];let o=n.map(async f=>{if(!a&&await xs.isIgnored({fs:r,dir:e,gitdir:t,filepath:f}))return;let d=await r.lstat($(e,f));if(!d)throw new Le(f);if(d.isDirectory()){let h=await r.readdir($(e,f));if(s){let p=h.map(m=>xp({dir:e,gitdir:t,fs:r,filepath:[$(f,m)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of h)await xp({dir:e,gitdir:t,fs:r,filepath:[$(f,p)],index:i,force:a,parallel:s})}else{let p=await(await We.get({fs:r,gitdir:t})).get("core.autocrlf"),m=d.isSymbolicLink()?await r.readlink($(e,f)).then(tO):await r.read($(e,f),{autocrlf:p});if(m===null)throw new Le(f);let v=await mr({fs:r,gitdir:t,type:"blob",object:m});i.insert({filepath:f,stats:d,oid:v})}}),l=await Promise.allSettled(o),c=l.filter(f=>f.status==="rejected").map(f=>f.reason);if(c.length>1)throw new dl(c);if(c.length===1)throw c[0];return l.filter(f=>f.status==="fulfilled"&&f.value).map(f=>f.value)}async function yl({fs:e,gitdir:t,path:r}){return(await We.get({fs:e,gitdir:t})).get(r)}function h2(e,...t){for(let r of t)if(r)for(let n of Object.keys(r)){let i=r[n];i!==void 0&&(e[n]=i)}return e}async function fa({fs:e,gitdir:t,author:r,commit:n}){let i=Math.floor(Date.now()/1e3),a={name:await yl({fs:e,gitdir:t,path:"user.name"}),email:await yl({fs:e,gitdir:t,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=h2({},a,n?n.author:void 0,r);if(s.name!==void 0)return s}async function Ss({fs:e,gitdir:t,author:r,committer:n,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await yl({fs:e,gitdir:t,path:"user.name"}),email:await yl({fs:e,gitdir:t,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=h2({},s,i?i.committer:void 0,r,n);if(o.name!==void 0)return o}async function p2({fs:e,cache:t,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=pr.from(a).parse().object,p2({fs:e,cache:t,gitdir:r,oid:n});if(i!=="commit")throw new zt(n,i,"commit");return{commit:rr.from(a),oid:n}}async function ou({fs:e,cache:t,gitdir:r,oid:n}){let{commit:i,oid:a}=await p2({fs:e,cache:t,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function mu({fs:e,cache:t,onSign:r,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let p=!1;f||(f=await W.resolve({fs:e,gitdir:n,ref:"HEAD",depth:2}));let m,v;try{m=await W.resolve({fs:e,gitdir:n,ref:f}),v=await ou({fs:e,gitdir:n,oid:m,cache:{}})}catch(x){p=!0}if(l&&p)throw new vl(f);let y=l?await fa({fs:e,gitdir:n,author:a,commit:v.commit}):await fa({fs:e,gitdir:n,author:a});if(!y)throw new Vt("author");let b=l?await Ss({fs:e,gitdir:n,author:y,committer:s,commit:v.commit}):await Ss({fs:e,gitdir:n,author:y,committer:s});if(!b)throw new Vt("committer");return yt.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async function(x){let _=o2(x.entries).get(".");if(h||(h=await m2({fs:e,gitdir:n,inode:_,dryRun:c})),d?d=await Promise.all(d.map(A=>W.resolve({fs:e,gitdir:n,ref:A}))):l?d=v.commit.parent:d=m?[m]:[],!i)if(l)i=v.commit.message;else throw new er("message");let k=rr.from({tree:h,parent:d,author:y,committer:b,message:i});o&&(k=await rr.sign(k,r,o));let w=await mr({fs:e,gitdir:n,type:"commit",object:k.toObject(),dryRun:c});return!u&&!c&&await W.writeRef({fs:e,gitdir:n,ref:f,value:w}),w})}async function m2({fs:e,gitdir:t,inode:r,dryRun:n}){let i=r.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await m2({fs:e,gitdir:t,inode:l,dryRun:n}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=tr.from(a);return await mr({fs:e,gitdir:t,type:"tree",object:s.toObject(),dryRun:n})}async function bl({fs:e,cache:t,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new Si("leading-slash");if(i.endsWith("/"))throw new Si("trailing-slash");let a=n,s=await bs({fs:e,cache:t,gitdir:r,oid:n}),o=s.tree;if(i==="")n=s.oid;else{let l=i.split("/");n=await g2({fs:e,cache:t,gitdir:r,tree:o,pathArray:l,oid:a,filepath:i})}return n}async function g2({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of n)if(l.path===o){if(i.length===0)return l.oid;{let{type:c,object:u}=await qe({fs:e,cache:t,gitdir:r,oid:l.oid});if(c!=="tree")throw new zt(a,c,"tree",s);return n=tr.from(u),g2({fs:e,cache:t,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s})}}throw new Le(`file or directory found at "${a}:${s}"`)}async function ks({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await bl({fs:e,cache:t,gitdir:r,oid:n,filepath:i}));let{tree:a,oid:s}=await bs({fs:e,cache:t,gitdir:r,oid:n});return{oid:s,tree:a.entries()}}async function kp({fs:e,gitdir:t,tree:r}){let n=tr.from(r).toObject();return await mr({fs:e,gitdir:t,type:"tree",object:n,format:"content"})}async function nO({fs:e,cache:t,onSign:r,gitdir:n,ref:i,oid:a,note:s,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await W.resolve({gitdir:n,fs:e,ref:i})}catch(y){if(!(y instanceof Le))throw y}let h=(await ks({fs:e,cache:t,gitdir:n,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(y=>y.path!==a);else for(let y of h)if(y.path===a)throw new en("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await mr({fs:e,gitdir:n,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:p,type:"blob"});let m=await kp({fs:e,gitdir:n,tree:h});return await mu({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:m,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' -`,author:l,committer:c,signingKey:u})}async function iO({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{C("fs",e),C("gitdir",n),C("oid",a),C("note",s),u&&C("onSign",t);let d=new X(e),h=await fa({fs:d,gitdir:n,author:l});if(!h)throw new Vt("author");let p=await Ss({fs:d,gitdir:n,author:h,committer:c});if(!p)throw new Vt("committer");return await nO({fs:new X(d),cache:f,onSign:t,gitdir:n,ref:i,oid:a,note:s,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function v2({fs:e,gitdir:t,remote:r,url:n,force:i}){if(r!==Qr.default.clean(r))throw new Wn(r,Qr.default.clean(r));let a=await We.get({fs:e,gitdir:t});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new en("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await We.save({fs:e,gitdir:t,config:a})}async function aO({fs:e,dir:t,gitdir:r=$(t,".git"),remote:n,url:i,force:a=!1}){try{return C("fs",e),C("gitdir",r),C("remote",n),C("url",i),await v2({fs:new X(e),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function sO({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await W.exists({fs:e,gitdir:n,ref:i}))throw new en("tag",i);let f=await W.resolve({fs:e,gitdir:n,ref:l||"HEAD"}),{type:d}=await qe({fs:e,cache:t,gitdir:n,oid:f}),h=pr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(h=await pr.sign(h,r,c));let p=await mr({fs:e,gitdir:n,type:"tag",object:h.toObject()});await W.writeRef({fs:e,gitdir:n,ref:i,value:p})}async function oO({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{C("fs",e),C("gitdir",n),C("ref",i),c&&C("onSign",t);let d=new X(e),h=await fa({fs:d,gitdir:n,author:a});if(!h)throw new Vt("tagger");return await sO({fs:d,cache:f,onSign:t,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function lO({fs:e,gitdir:t,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Qr.default.clean(r))throw new Wn(r,Qr.default.clean(r));let s=`refs/heads/${r}`;if(!a&&await W.exists({fs:e,gitdir:t,ref:s}))throw new en("branch",r,!1);let o;try{o=await W.resolve({fs:e,gitdir:t,ref:n||"HEAD"})}catch(l){}o&&await W.writeRef({fs:e,gitdir:t,ref:s,value:o}),i&&await W.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:s})}async function cO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return C("fs",e),C("gitdir",r),C("ref",n),await lO({fs:new X(e),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var y2=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);async function Tp({fs:e,cache:t,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0}){let p;if(n)try{p=await W.resolve({fs:e,gitdir:a,ref:"HEAD"})}catch(v){p="0000000000000000000000000000000000000000"}let m;try{m=await W.resolve({fs:e,gitdir:a,ref:o})}catch(v){if(o==="HEAD")throw v;let y=`${s}/${o}`;if(m=await W.resolve({fs:e,gitdir:a,ref:y}),h){let b=await We.get({fs:e,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await We.save({fs:e,gitdir:a,config:b})}await W.writeRef({fs:e,gitdir:a,ref:`refs/heads/${o}`,value:m})}if(!c){let v;try{v=await uO({fs:e,cache:t,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(_){throw _ instanceof Le&&_.data.what===m?new ol(o,m):_}let y=v.filter(([_])=>_==="conflict").map(([_,k])=>k);if(y.length>0)throw new sl(y);let b=v.filter(([_])=>_==="error").map(([_,k])=>k);if(b.length>0)throw new le(b.join(", "));if(f){n&&await n({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"});return}let x=0,E=v.length;await yt.acquire({fs:e,gitdir:a,cache:t},async function(_){await Promise.all(v.filter(([k])=>k==="delete"||k==="delete-index").map(async function([k,w]){let A=`${i}/${w}`;k==="delete"&&await e.rm(A),_.delete({filepath:w}),r&&await r({phase:"Updating workdir",loaded:++x,total:E})}))}),await yt.acquire({fs:e,gitdir:a,cache:t},async function(_){for(let[k,w]of v)if(k==="rmdir"||k==="rmdir-index"){let A=`${i}/${w}`;try{k==="rmdir-index"&&_.delete({filepath:w}),await e.rmdir(A),r&&await r({phase:"Updating workdir",loaded:++x,total:E})}catch(S){if(S.code==="ENOTEMPTY")console.log(`Did not delete ${w} because directory is not empty`);else throw S}}}),await Promise.all(v.filter(([_])=>_==="mkdir"||_==="mkdir-index").map(async function([_,k]){let w=`${i}/${k}`;await e.mkdir(w),r&&await r({phase:"Updating workdir",loaded:++x,total:E})})),await yt.acquire({fs:e,gitdir:a,cache:t},async function(_){await Promise.all(v.filter(([k])=>k==="create"||k==="create-index"||k==="update"||k==="mkdir-index").map(async function([k,w,A,S,T]){let P=`${i}/${w}`;try{if(k!=="create-index"&&k!=="mkdir-index"){let{object:N}=await qe({fs:e,cache:t,gitdir:a,oid:A});if(T&&await e.rm(P),S===33188)await e.write(P,N);else if(S===33261)await e.write(P,N,{mode:511});else if(S===40960)await e.writelink(P,N);else throw new le(`Invalid mode 0o${S.toString(8)} detected in blob ${A}`)}let I=await e.lstat(P);S===33261&&(I.mode=493),k==="mkdir-index"&&(I.mode=57344),_.insert({filepath:w,stats:I,oid:A}),r&&await r({phase:"Updating workdir",loaded:++x,total:E})}catch(I){console.log(I)}}))}),n&&await n({previousHead:p,newHead:m,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let v=await W.expand({fs:e,gitdir:a,ref:o});v.startsWith("refs/heads")?await W.writeSymbolicRef({fs:e,gitdir:a,ref:"HEAD",value:v}):await W.writeRef({fs:e,gitdir:a,ref:"HEAD",value:m})}}async function uO({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return _s({fs:e,cache:t,dir:n,gitdir:i,trees:[bi({ref:a}),pu(),hu()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>y2(c,p)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return s&&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()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?s?["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",c];case"blob":return await d.oid()!==await f.oid()?s?["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()&&!s)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(s)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=f2(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function fO({fs:e,onProgress:t,onPostCheckout:r,dir:n,gitdir:i=$(n,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:c=s===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={}}){try{C("fs",e),C("dir",n),C("gitdir",i);let p=s||"HEAD";return await Tp({fs:new X(e),cache:h,onProgress:t,onPostCheckout:r,dir:n,gitdir:i,remote:a,ref:p,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d})}catch(p){throw p.caller="git.checkout",p}}var dO=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function ca(e){let t=dO.exec(e);return t?t[1]==="remotes/"&&e.endsWith("/HEAD")?t[2].slice(0,-5):t[2]:e}async function ha({fs:e,gitdir:t,fullname:r=!1,test:n=!1}){let i=await W.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2});if(n)try{await W.resolve({fs:e,gitdir:t,ref:i})}catch(a){return}if(i.startsWith("refs/"))return r?i:ca(i)}function hO(e){return e=e.replace(/^git@([^:]+):/,"https://$1/"),e=e.replace(/^ssh:\/\//,"https://"),e}function w2({username:e="",password:t=""}){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}async function _l(e,t){let r=c2(e);for(;;){let{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function lu(e){let t=0,r=[];await _l(e,a=>{r.push(a),t+=a.byteLength});let n=new Uint8Array(t),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}function Yw(e){let t=e.match(/^https?:\/\/([^/]+)@/);if(t==null)return{url:e,auth:{}};t=t[1];let[r,n]=t.split(":");return e=e.replace(`${t}@`,""),{url:e,auth:{username:r,password:n}}}function Sp(e,t){let r=t.toString(16);return"0".repeat(e-r.length)+r}var Ve=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(t){typeof t=="string"&&(t=Buffer.from(t));let r=t.length+4,n=Sp(4,r);return Buffer.concat([Buffer.from(n,"utf8"),t])}static streamReader(t){let r=new iu(t);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await r.read(i-4);return a==null?!0:a}catch(i){return t.error=i,!0}}}};async function Xw(e){let t={},r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let n=r.indexOf("=");if(n>-1){let i=r.slice(0,n),a=r.slice(n+1);t[i]=a}else t[r]=!0}return{protocolVersion:2,capabilities2:t}}async function Zw(e,{service:t}){let r=new Set,n=new Map,i=new Map,a=Ve.streamReader(e),s=await a();for(;s===null;)s=await a();if(s===!0)throw new ll;if(s.includes("version 2"))return Xw(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${t}`)throw new ua(`# service=${t}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:r,refs:n,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return Xw(a);let[l,c]=lp(o,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=lp(l," "," ");for(n.set(f,u);;){let d=await a();if(d===!0)break;if(d!==null){let[h,p]=lp(d.toString("utf8")," "," ");n.set(p,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function lp(e,t,r){let n=e.trim().split(t);if(n.length!==2)throw new ua(`Two strings separated by '${r}'`,e.toString("utf8"));return n}var Kw=(e,t)=>e.endsWith("?")?`${e}${t}`:`${e}/${t.replace(/^https?:\/\//,"")}`,Jw=(e,t)=>{(t.username||t.password)&&(e.Authorization=w2(t)),t.headers&&Object.assign(e,t.headers)},cp=async e=>{try{let t=Buffer.from(await lu(e.body)),r=t.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:t}}catch(t){return{}}},Es=class{static async capabilities(){return["discover","connect"]}static async discover({http:t,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=Yw(l),h=s?Kw(s,f):f;(d.username||d.password)&&(c.Authorization=w2(d)),u===2&&(c["Git-Protocol"]="version=2");let p,m,v=!1;do if(p=await t.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),m=!1,p.statusCode===401||p.statusCode===203){let y=v?a:n;if(y){if(d=await y(f,{...d,headers:{...c}}),d&&d.cancel)throw new ws;d&&(Jw(c,d),v=!0,m=!0)}}else p.statusCode===200&&v&&i&&await i(f,d);while(m);if(p.statusCode!==200){let{response:y}=await cp(p);throw new ms(p.statusCode,p.statusMessage,y)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let y=await Zw(p.body,{service:o});return y.auth=d,y}else{let{preview:y,response:b,data:x}=await cp(p);try{let E=await Zw([x],{service:o});return E.auth=d,E}catch(E){throw new hl(y,b)}}}static async connect({http:t,onProgress:r,corsProxy:n,service:i,url:a,auth:s,body:o,headers:l}){let c=Yw(a);c&&(a=c.url),n&&(a=Kw(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,Jw(l,s);let u=await t.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=cp(u);throw new ms(u.statusCode,u.statusMessage,f)}return u}};function pO({url:e}){if(e.startsWith("git@"))return{transport:"ssh",address:e};let t=e.match(/(\w+)(:\/\/|::)(.*)/);if(t!==null){if(t[2]==="://")return{transport:t[1],address:t[0]};if(t[2]==="::")return{transport:t[1],address:t[3]}}}var As=class{static getRemoteHelperFor({url:t}){let r=new Map;r.set("http",Es),r.set("https",Es);let n=pO({url:t});if(!n)throw new ml(t);if(r.has(n.transport))return r.get(n.transport);throw new pl(t,n.transport,n.transport==="ssh"?hO(t):void 0)}},la=null,da=class{static async read({fs:t,gitdir:r}){la===null&&(la=new tl.default);let n=$(r,"shallow"),i=new Set;return await la.acquire(n,async function(){let a=await t.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` -`).map(s=>i.add(s))}),i}static async write({fs:t,gitdir:r,oids:n}){la===null&&(la=new tl.default);let i=$(r,"shallow");if(n.size>0){let a=[...n].join(` +`,e.parent){if(e.parent.length===void 0)throw new de("commit 'parent' property should be an array");for(let a of e.parent)r+=`parent ${a} +`}let n=e.author;r+=`author ${Ag(n)} +`;let i=e.committer||e.author;return r+=`committer ${Ag(i)} +`,e.gpgsig&&(r+="gpgsig"+pg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` +`+Ei(e.message)}render(){return this._commit}withoutSignature(){let e=Ei(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(` +gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return Ei(r+` +`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $3(e)}static async sign(e,r,n){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await r({payload:i,secretKey:n});s=Ei(s);let l=t.justHeaders(e._commit)+` +gpgsig`+pg(s)+` +`+a;return t.from(l)}};async function xo({fs:t,cache:e,gitdir:r,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:pr.from([]),oid:n};let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,xo({fs:t,cache:e,gitdir:r,oid:n});if(i==="commit")return n=mr.from(a).parse().tree,xo({fs:t,cache:e,gitdir:r,oid:n});if(i!=="tree")throw new rr(n,i,"tree");return{tree:pr.from(a),oid:n}}var Tg=class{constructor({fs:e,gitdir:r,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=r,this.mapPromise=(async()=>{let s=new Map,o;try{o=await z.resolve({fs:e,gitdir:r,ref:n})}catch(u){u instanceof Le&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await xo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:n,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:u,object:c}=await qe({fs:n,cache:i,gitdir:a,oid:l});if(u!==o.type)throw new rr(l,u,o.type);let f=pr.from(c);for(let d of f)s.set(O.join(r,d.path),d);return f.entries().map(d=>O.join(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:n}=r.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:n}=r.get(e._fullpath);e._mode=fE(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:n,cache:i,gitdir:a}=this,o=r.get(e._fullpath).oid,{type:l,object:u}=await qe({fs:n,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(u)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function $r({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Jf,{value:function({fs:r,gitdir:n,cache:i}){return new Tg({fs:r,gitdir:n,ref:t,cache:i})}}),Object.freeze(e),e}var Cg=class{constructor({fs:e,dir:r,gitdir:n,cache:i}){this.fs=e,this.cache=i,this.dir=r,this.gitdir=n,this.config=null;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:n,dir:i}=this,a=await n.readdir(O.join(i,r));return a===null?null:a.map(s=>O.join(r,s))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:n}=this,i=await r.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=mo(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await this._getGitConfig(r,i)).get("core.autocrlf"),o=await r.read(`${n}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:n,gitdir:i,cache:a}=this,s;await ct.acquire({fs:n,gitdir:i,cache:a},async function(o){let l=o.entriesMap.get(e._fullpath),u=await e.stat(),f=await(await r._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Uf(u,l,f,d)){let h=await e.content();h===void 0?s=void 0:(s=await ki(la.wrap({type:"blob",object:h})),l&&s===l.oid&&(!f||u.mode===l.mode)&&Uf(u,l,f,d)&&o.insert({filepath:e._fullpath,stats:u,oid:s}))}else s=l.oid}),e._oid=s}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await nt.get({fs:e,gitdir:r}),this.config)}};function Co(){let t=Object.create(null);return Object.defineProperty(t,Jf,{value:function({fs:e,dir:r,gitdir:n,cache:i}){return new Cg({fs:e,dir:r,gitdir:n,cache:i})}}),Object.freeze(t),t}function F3(t,e){let r=e-t;return Array.from({length:r},(n,i)=>t+i)}var yE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Pg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:eu,reduce:s=async(l,u)=>{let c=yE(u);return l!==void 0&&c.unshift(l),c},iterate:o=(l,u)=>Promise.all([...u].map(l))}){let l=i.map(h=>h[Jf]({fs:t,dir:r,gitdir:n,cache:e})),u=new Array(l.length).fill("."),c=F3(0,l.length),f=async h=>{c.map(v=>{let w=h[v];h[v]=w&&new l[v].ConstructEntry(w)});let g=(await Promise.all(c.map(v=>{let w=h[v];return w?l[v].readdir(w):[]}))).map(v=>(v===null?[]:v)[Symbol.iterator]());return{entries:h,children:O3(g)}},d=async h=>{let{entries:m,children:g}=await f(h),v=m.find(b=>b&&b._fullpath)._fullpath,w=await a(v,m);if(w!==null){let b=await o(d,g);return b=b.filter(E=>E!==void 0),s(w,b)}};return d(u)}async function Rg(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(n=>{let i=O.join(e,n);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?Rg(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function M3(t){return D3(t)&&ZS(t.then)&&ZS(t.catch)}function D3(t){return t&&typeof t=="object"}function ZS(t){return typeof t=="function"}function KS(t){return M3((r=>{try{return r.readFile().catch(n=>n)}catch(n){return n}})(t))}var JS=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function QS(t,e){if(KS(e))for(let r of JS)t[`_${r}`]=e[r].bind(e);else for(let r of JS)t[`_${r}`]=lg(e[r].bind(e));KS(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Rg.bind(null,t):e.rm?t._rm=lg(e.rm.bind(e)):e.rmdir.length>2?t._rm=lg(e.rmdir.bind(e)):t._rm=Rg.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?QS(this,e.promises):QS(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(n){if(n.code==="ENOENT"||n.code==="ENOTDIR"||(n.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,r={}){try{let n=await this._readFile(e,r);if(r.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,` +`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=Buffer.from(n)),n}catch(n){return null}}async write(e,r,n={}){try{await this._writeFile(e,r,n);return}catch(i){await this.mkdir(go(e)),await this._writeFile(e,r,n)}}async mkdir(e,r=!1){try{await this._mkdir(e);return}catch(n){if(n===null||n.code==="EEXIST")return;if(r)throw n;if(n.code==="ENOENT"){let i=go(e);if(i==="."||i==="/"||i===e)throw n;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Kf),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let n=await this._readlink(e,r);return Buffer.isBuffer(n)?n:Buffer.from(n)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function C(t,e){if(e===void 0)throw new hr(t)}async function Wf(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function bE({fs:t,dir:e,gitdir:r=O.join(e,".git"),commit:n="HEAD",cache:i={}}){try{C("fs",t),C("dir",e),C("gitdir",r);let a=new J(t),s=[$r({ref:n}),Co(),ts()],o=[];await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){o=u.unmergedPaths});let l=await ua({fs:a,cache:i,dir:e,gitdir:r,trees:s,map:async function(u,[c,f,d]){let h=!await Wf(f,d),m=o.includes(u),g=!await Wf(d,c);if(h||m)return c?{path:u,mode:await c.mode(),oid:await c.oid(),type:await c.type(),content:await c.content()}:void 0;if(g)return!1;throw new gc(u)}});await ct.acquire({fs:a,gitdir:r,cache:i},async function(u){for(let c of l)if(c!==!1){if(!c){await a.rmdir(`${e}/${c.path}`,{recursive:!0}),u.delete({filepath:c.path});continue}if(c.type==="blob"){let f=new TextDecoder().decode(c.content);await a.write(`${e}/${c.path}`,f,{mode:c.mode}),u.insert({filepath:c.path,oid:c.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var fa=class{static async isIgnored({fs:e,dir:r,gitdir:n=O.join(r,".git"),filepath:i}){if(jf(i)===".git")return!0;if(i===".")return!1;let a="",s=O.join(n,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:O.join(r,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let c=1;c{let c=await(await nt.get({fs:o,gitdir:r})).get("core.autocrlf");return Ig({dir:e,gitdir:r,fs:o,filepath:n,index:l,force:a,parallel:s,autocrlf:c})})}catch(o){throw o.caller="git.add",o}}async function Ig({dir:t,gitdir:e,fs:r,filepath:n,index:i,force:a,parallel:s,autocrlf:o}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!a&&await fa.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(O.join(t,d));if(!h)throw new Le(d);if(h.isDirectory()){let m=await r.readdir(O.join(t,d));if(s){let g=m.map(v=>Ig({dir:t,gitdir:e,fs:r,filepath:[O.join(d,v)],index:i,force:a,parallel:s,autocrlf:o}));await Promise.all(g)}else for(let g of m)await Ig({dir:t,gitdir:e,fs:r,filepath:[O.join(d,g)],index:i,force:a,parallel:s,autocrlf:o})}else{let m=h.isSymbolicLink()?await r.readlink(O.join(t,d)).then(xE):await r.read(O.join(t,d),{autocrlf:o});if(m===null)throw new Le(d);let g=await gr({fs:r,gitdir:e,type:"blob",object:m});i.insert({filepath:d,stats:h,oid:g})}}),u=await Promise.allSettled(l),c=u.filter(d=>d.status==="rejected").map(d=>d.reason);if(c.length>1)throw new dc(c);if(c.length===1)throw c[0];return u.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function wc({fs:t,gitdir:e,path:r}){return(await nt.get({fs:t,gitdir:e})).get(r)}function EE(t,...e){for(let r of e)if(r)for(let n of Object.keys(r)){let i=r[n];i!==void 0&&(t[n]=i)}return t}async function da({fs:t,gitdir:e,author:r,commit:n}){let i=Math.floor(Date.now()/1e3),a={name:await wc({fs:t,gitdir:e,path:"user.name"}),email:await wc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=EE({},a,n?n.author:void 0,r);if(s.name!==void 0)return s}async function So({fs:t,gitdir:e,author:r,committer:n,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await wc({fs:t,gitdir:e,path:"user.name"}),email:await wc({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=EE({},s,i?i.committer:void 0,r,n);if(o.name!==void 0)return o}async function kE({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,kE({fs:t,cache:e,gitdir:r,oid:n});if(i!=="commit")throw new rr(n,i,"commit");return{commit:mr.from(a),oid:n}}async function Eo({fs:t,cache:e,gitdir:r,oid:n}){let{commit:i,oid:a}=await kE({fs:t,cache:e,gitdir:r,oid:n});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Qf({fs:t,cache:e,onSign:r,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:u=!1,noUpdateBranch:c=!1,ref:f,parent:d,tree:h}){let m=!1;f||(f=await z.resolve({fs:t,gitdir:n,ref:"HEAD",depth:2}));let g,v;try{g=await z.resolve({fs:t,gitdir:n,ref:f}),v=await Eo({fs:t,gitdir:n,oid:g,cache:{}})}catch(E){m=!0}if(l&&m)throw new vc(f);let w=l?await da({fs:t,gitdir:n,author:a,commit:v.commit}):await da({fs:t,gitdir:n,author:a});if(!w)throw new zt("author");let b=l?await So({fs:t,gitdir:n,author:w,committer:s,commit:v.commit}):await So({fs:t,gitdir:n,author:w,committer:s});if(!b)throw new zt("committer");return ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async function(E){let k=hE(E.entries).get(".");if(h||(h=await AE({fs:t,gitdir:n,inode:k,dryRun:u})),d?d=await Promise.all(d.map(S=>z.resolve({fs:t,gitdir:n,ref:S}))):l?d=v.commit.parent:d=g?[g]:[],!i)if(l)i=v.commit.message;else throw new hr("message");let A=mr.from({tree:h,parent:d,author:w,committer:b,message:i});o&&(A=await mr.sign(A,r,o));let y=await gr({fs:t,gitdir:n,type:"commit",object:A.toObject(),dryRun:u});return!c&&!u&&await z.writeRef({fs:t,gitdir:n,ref:f,value:y}),y})}async function AE({fs:t,gitdir:e,inode:r,dryRun:n}){let i=r.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await AE({fs:t,gitdir:e,inode:l,dryRun:n}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=pr.from(a);return await gr({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:n})}async function yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i}){if(i.startsWith("/"))throw new ca("leading-slash");if(i.endsWith("/"))throw new ca("trailing-slash");let a=n,s=await xo({fs:t,cache:e,gitdir:r,oid:n}),o=s.tree;if(i==="")n=s.oid;else{let l=i.split("/");n=await TE({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:a,filepath:i})}return n}async function TE({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of n)if(l.path===o){if(i.length===0)return l.oid;{let{type:u,object:c}=await qe({fs:t,cache:e,gitdir:r,oid:l.oid});if(u!=="tree")throw new rr(a,u,"tree",s);return n=pr.from(c),TE({fs:t,cache:e,gitdir:r,tree:n,pathArray:i,oid:a,filepath:s})}}throw new Le(`file or directory found at "${a}:${s}"`)}async function Po({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){i!==void 0&&(n=await yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i}));let{tree:a,oid:s}=await xo({fs:t,cache:e,gitdir:r,oid:n});return{oid:s,tree:a.entries()}}async function bc({fs:t,gitdir:e,tree:r}){let n=pr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"tree",object:n,format:"content"})}async function H3({fs:t,cache:e,onSign:r,gitdir:n,ref:i,oid:a,note:s,force:o,author:l,committer:u,signingKey:c}){let f;try{f=await z.resolve({gitdir:n,fs:t,ref:i})}catch(w){if(!(w instanceof Le))throw w}let h=(await Po({fs:t,cache:e,gitdir:n,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(w=>w.path!==a);else for(let w of h)if(w.path===a)throw new vn("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let m=await gr({fs:t,gitdir:n,type:"blob",object:s,format:"content"});h.push({mode:"100644",path:a,oid:m,type:"blob"});let g=await bc({fs:t,gitdir:n,tree:h});return await Qf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:u,signingKey:c})}async function CE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:u,signingKey:c,cache:f={}}){try{C("fs",t),C("gitdir",n),C("oid",a),C("note",s),c&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:l});if(!h)throw new zt("author");let m=await So({fs:d,gitdir:n,author:h,committer:u});if(!m)throw new zt("committer");return await H3({fs:new J(d),cache:f,onSign:e,gitdir:n,ref:i,oid:a,note:s,force:o,author:h,committer:m,signingKey:c})}catch(d){throw d.caller="git.addNote",d}}async function PE({fs:t,gitdir:e,remote:r,url:n,force:i}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=await nt.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(r)&&n!==await a.get(`remote.${r}.url`))throw new vn("remote",r);await a.set(`remote.${r}.url`,n),await a.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await nt.save({fs:t,gitdir:e,config:a})}async function RE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n,url:i,force:a=!1}){try{return C("fs",t),C("gitdir",r),C("remote",n),C("url",i),await PE({fs:new J(t),gitdir:r,remote:n,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function U3({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!c&&await z.exists({fs:t,gitdir:n,ref:i}))throw new vn("tag",i);let f=await z.resolve({fs:t,gitdir:n,ref:l||"HEAD"}),{type:d}=await qe({fs:t,cache:e,gitdir:n,oid:f}),h=Fr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});u&&(h=await Fr.sign(h,r,u));let m=await gr({fs:t,gitdir:n,type:"tag",object:h.toObject()});await z.writeRef({fs:t,gitdir:n,ref:i,value:m})}async function IE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:u,force:c=!1,cache:f={}}){try{C("fs",t),C("gitdir",n),C("ref",i),u&&C("onSign",e);let d=new J(t),h=await da({fs:d,gitdir:n,author:a});if(!h)throw new zt("tagger");return await U3({fs:d,cache:f,onSign:e,gitdir:n,ref:i,tagger:h,message:s,gpgsig:o,object:l,signingKey:u,force:c})}catch(d){throw d.caller="git.annotatedTag",d}}async function j3({fs:t,gitdir:e,ref:r,object:n,checkout:i=!1,force:a=!1}){if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let s=`refs/heads/${r}`;if(!a&&await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",r,!1);let o;try{o=await z.resolve({fs:t,gitdir:e,ref:n||"HEAD"})}catch(l){}o&&await z.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function $E({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,checkout:a=!1,force:s=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),await j3({fs:new J(t),gitdir:r,ref:n,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var FE=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Mg({fs:t,cache:e,onProgress:r,onPostCheckout:n,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:u,noUpdateHead:c,dryRun:f,force:d,track:h=!0,nonBlocking:m=!1,batchSize:g=100}){let v;if(n)try{v=await z.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(b){v="0000000000000000000000000000000000000000"}let w;try{w=await z.resolve({fs:t,gitdir:a,ref:o})}catch(b){if(o==="HEAD")throw b;let E=`${s}/${o}`;if(w=await z.resolve({fs:t,gitdir:a,ref:E}),h){let x=await nt.get({fs:t,gitdir:a});await x.set(`branch.${o}.remote`,s),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await nt.save({fs:t,gitdir:a,config:x})}await z.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:w})}if(!u){let b;try{b=await G3({fs:t,cache:e,onProgress:r,dir:i,gitdir:a,ref:o,force:d,filepaths:l})}catch(y){throw y instanceof Le&&y.data.what===w?new oc(o,w):y}let E=b.filter(([y])=>y==="conflict").map(([y,S])=>S);if(E.length>0)throw new sc(E);let x=b.filter(([y])=>y==="error").map(([y,S])=>S);if(x.length>0)throw new de(x.join(", "));if(f){n&&await n({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"});return}let k=0,A=b.length;if(await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){await Promise.all(b.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,_]){let T=`${i}/${_}`;S==="delete"&&await t.rm(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}))}),await ct.acquire({fs:t,gitdir:a,cache:e},async function(y){for(let[S,_]of b)if(S==="rmdir"||S==="rmdir-index"){let T=`${i}/${_}`;try{S==="rmdir"&&await t.rmdir(T),y.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw P}}}),await Promise.all(b.filter(([y])=>y==="mkdir"||y==="mkdir-index").map(async function([y,S]){let _=`${i}/${S}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++k,total:A})})),m){let y=b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index"),S=await eE("Update Working Dir",y.map(([_,T,P,F,D])=>()=>z3({fs:t,cache:e,gitdir:a,dir:i},[_,T,P,F,D])),r,g);await ct.acquire({fs:t,gitdir:a,cache:e,allowUnmerged:!0},async function(_){await eE("Update Index",S.map(([T,P,F])=>()=>q3({index:_,fullpath:T,oid:P,stats:F})),r,g)})}else await ct.acquire({fs:t,gitdir:a,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,F]){let D=`${i}/${_}`;try{if(S!=="create-index"&&S!=="mkdir-index"){let{object:re}=await qe({fs:t,cache:e,gitdir:a,oid:T});if(F&&await t.rm(D),P===33188)await t.write(D,re);else if(P===33261)await t.write(D,re,{mode:511});else if(P===40960)await t.writelink(D,re);else throw new de(`Invalid mode 0o${P.toString(8)} detected in blob ${T}`)}let M=await t.lstat(D);P===33261&&(M.mode=493),S==="mkdir-index"&&(M.mode=57344),y.insert({filepath:_,stats:M,oid:T}),r&&await r({phase:"Updating workdir",loaded:++k,total:A})}catch(M){console.log(M)}}))});n&&await n({previousHead:v,newHead:w,type:l!=null&&l.length>0?"file":"branch"})}if(!c){let b=await z.expand({fs:t,gitdir:a,ref:o});b.startsWith("refs/heads")?await z.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:b}):await z.writeRef({fs:t,gitdir:a,ref:"HEAD",value:w})}}async function G3({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return ua({fs:t,cache:e,dir:n,gitdir:i,trees:[$r({ref:a}),Co(),ts()],map:async function(u,[c,f,d]){if(u===".")return;if(o&&!o.some(m=>FE(u,m)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!c,!!f].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(u)?["delete",u]:void 0;case"010":switch(await c.type()){case"tree":return["mkdir",u];case"blob":return["create",u,await c.oid(),await c.mode()];case"commit":return["mkdir-index",u,await c.oid(),await c.mode()];default:return["error",`new entry Unhandled type ${await c.type()}`]}case"011":switch(`${await c.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",u];case"blob-blob":return await c.oid()!==await f.oid()?s?["update",u,await c.oid(),await c.mode(),await c.mode()!==await f.mode()]:["conflict",u]:await c.mode()!==await f.mode()?s?["update",u,await c.oid(),await c.mode(),!0]:["conflict",u]:["create-index",u,await c.oid(),await c.mode()];case"commit-tree":return;case"commit-blob":return["conflict",u];default:return["error",`new entry Unhandled type ${c.type}`]}case"100":return["delete-index",u];case"101":switch(await d.type()){case"tree":return["rmdir-index",u];case"blob":return await d.oid()!==await f.oid()?s?["delete",u]:["conflict",u]:["delete",u];case"commit":return["rmdir-index",u];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await c.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await c.oid()&&await d.mode()===await c.mode()&&!s)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await c.oid())return s?["update",u,await c.oid(),await c.mode(),await c.mode()!==await f.mode()]:["conflict",u]}else if(s)return["update",u,await c.oid(),await c.mode(),await c.mode()!==await d.mode()];return await c.mode()!==await d.mode()?["update",u,await c.oid(),await c.mode(),!0]:await c.oid()!==await d.oid()?["update",u,await c.oid(),await c.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",u,await c.oid()];case"blob-tree":return["update-blob-to-tree",u];case"commit-commit":return["mkdir-index",u,await c.oid(),await c.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await c.type()}`]}}},reduce:async function(u,c){return c=yE(c),u?u&&u[0]==="rmdir"?(c.push(u),c):(c.unshift(u),c):c}})}async function q3({index:t,fullpath:e,stats:r,oid:n}){try{t.insert({filepath:e,stats:r,oid:n})}catch(i){console.warn(`Error inserting ${e} into index:`,i)}}async function z3({fs:t,cache:e,gitdir:r,dir:n},[i,a,s,o,l]){let u=`${n}/${a}`;if(i!=="create-index"&&i!=="mkdir-index"){let{object:f}=await qe({fs:t,cache:e,gitdir:r,oid:s});if(l&&await t.rm(u),o===33188)await t.write(u,f);else if(o===33261)await t.write(u,f,{mode:511});else if(o===40960)await t.writelink(u,f);else throw new de(`Invalid mode 0o${o.toString(8)} detected in blob ${s}`)}let c=await t.lstat(u);return o===33261&&(c.mode=493),i==="mkdir-index"&&(c.mode=57344),[a,s,c]}async function eE(t,e,r,n){let i=[];try{for(let a=0;al());(await Promise.allSettled(s)).forEach(l=>{l.status==="fulfilled"&&i.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:a+s.length,total:e.length})}return i}catch(a){console.error(`Error during ${t}: ${a}`)}return i}async function Dg({fs:t,onProgress:e,onPostCheckout:r,dir:n,gitdir:i=O.join(n,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:u=s===void 0,dryRun:c=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:m=!1,batchSize:g=100}){try{C("fs",t),C("dir",n),C("gitdir",i);let v=s||"HEAD";return await Mg({fs:new J(t),cache:h,onProgress:e,onPostCheckout:r,dir:n,gitdir:i,remote:a,ref:v,filepaths:o,noCheckout:l,noUpdateHead:u,dryRun:c,force:f,track:d,nonBlocking:m,batchSize:g})}catch(v){throw v.caller="git.checkout",v}}var V3=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Ka(t){let e=V3.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function pa({fs:t,gitdir:e,fullname:r=!1,test:n=!1}){let i=await z.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(n)try{await z.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return r?i:Ka(i)}function W3(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function OE({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function _c(t,e){let r=gE(t);for(;;){let{value:n,done:i}=await r.next();if(n&&await e(n),i)break}r.return&&r.return()}async function Yf(t){let e=0,r=[];await _c(t,a=>{r.push(a),e+=a.byteLength});let n=new Uint8Array(e),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}function tE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,n]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:n}}}function $g(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var Qe=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,n=$g(4,r);return Buffer.concat([Buffer.from(n,"utf8"),e])}static streamReader(e){let r=new zf(e);return async function(){try{let i=await r.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await r.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function rE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let n=r.indexOf("=");if(n>-1){let i=r.slice(0,n),a=r.slice(n+1);e[i]=a}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function nE(t,{service:e}){let r=new Set,n=new Map,i=new Map,a=Qe.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new lc;if(s.includes("version 2"))return rE(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Ja(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:r,refs:n,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return rE(a);let[l,u]=gg(o,"\0","\\x00");if(u.split(" ").map(c=>r.add(c)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[c,f]=gg(l," "," ");for(n.set(f,c);;){let d=await a();if(d===!0)break;if(d!==null){let[h,m]=gg(d.toString("utf8")," "," ");n.set(m,h)}}}for(let c of r)if(c.startsWith("symref=")){let f=c.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:n,symrefs:i}}function gg(t,e,r){let n=t.trim().split(e);if(n.length!==2)throw new Ja(`Two strings separated by '${r}'`,t.toString("utf8"));return n}var iE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,aE=(t,e)=>{(e.username||e.password)&&(t.Authorization=OE(e)),e.headers&&Object.assign(t,e.headers)},vg=async t=>{try{let e=Buffer.from(await Yf(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},ko=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:n,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:u,protocolVersion:c}){let{url:f,auth:d}=tE(l),h=s?iE(s,f):f;(d.username||d.password)&&(u.Authorization=OE(d)),c===2&&(u["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:u}),g=!1,m.statusCode===401||m.statusCode===203){let w=v?a:n;if(w){if(d=await w(f,{...d,headers:{...u}}),d&&d.cancel)throw new _o;d&&(aE(u,d),v=!0,g=!0)}}else m.statusCode===200&&v&&i&&await i(f,d);while(g);if(m.statusCode!==200){let{response:w}=await vg(m);throw new vo(m.statusCode,m.statusMessage,w)}if(m.headers["content-type"]===`application/x-${o}-advertisement`){let w=await nE(m.body,{service:o});return w.auth=d,w}else{let{preview:w,response:b,data:E}=await vg(m);try{let x=await nE([E],{service:o});return x.auth=d,x}catch(x){throw new hc(w,b)}}}static async connect({http:e,onProgress:r,corsProxy:n,service:i,url:a,auth:s,body:o,headers:l}){let u=tE(a);u&&(a=u.url),n&&(a=iE(n,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,aE(l,s);let c=await e.request({onProgress:r,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(c.statusCode!==200){let{response:f}=vg(c);throw new vo(c.statusCode,c.statusMessage,f)}return c}};function Y3({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 Ao=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",ko),r.set("https",ko);let n=Y3({url:e});if(!n)throw new mc(e);if(r.has(n.transport))return r.get(n.transport);throw new pc(e,n.transport,n.transport==="ssh"?W3(e):void 0)}},Za=null,Qa=class{static async read({fs:e,gitdir:r}){Za===null&&(Za=new tc);let n=O.join(r,"shallow"),i=new Set;return await Za.acquire(n,async function(){let a=await e.read(n,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` +`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:r,oids:n}){Za===null&&(Za=new tc);let i=O.join(r,"shallow");if(n.size>0){let a=[...n].join(` `)+` -`;await la.acquire(i,async function(){await t.write(i,a,{encoding:"utf8"})})}else await la.acquire(i,async function(){await t.rm(i)})}};async function mO({fs:e,gitdir:t,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return e.exists(`${t}/${n}`)}async function gO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await e.readdir($(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,l=await Ap({fs:e,cache:t,filename:o,getExternalRefDelta:i});if(l.error)throw new le(l.error);if(l.offsets.has(n))return!0}return!1}async function Qw({fs:e,cache:t,gitdir:r,oid:n,format:i="content"}){let a=o=>qe({fs:e,cache:t,gitdir:r,oid:o}),s=await mO({fs:e,gitdir:r,oid:n});return s||(s=await gO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:a})),s}function vO(e){let i="5041434b"+"00000002"+"00000000";return e.slice(0,12).toString("hex")===i}function b2(e,t){let r=e.map(n=>n.split("=",1)[0]);return t.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var gu={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},fs=class{constructor(){this._queue=[]}write(t){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:t})}else this._queue.push(t)}end(){if(this._ended=!0,this._waiting){let t=this._waiting;this._waiting=null,t({done:!0})}}destroy(t){this.error=t,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(t=>{this._waiting=t})}};function yO(e){let t=e.indexOf("\r"),r=e.indexOf(` -`);return t===-1&&r===-1?-1:t===-1?r+1:r===-1?t+1:r===t+1?r+1:Math.min(t,r)+1}function _2(e){let t=new fs,r="";return(async()=>(await _l(e,n=>{for(n=n.toString("utf8"),r+=n;;){let i=yO(r);if(i===-1)break;t.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&t.write(r),t.end()))(),t}var cu=class{static demux(t){let r=Ve.streamReader(t),n=new fs,i=new fs,a=new fs,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),t.error?i.destroy(t.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function wO(e){let{packetlines:t,packfile:r,progress:n}=cu.demux(e),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{_l(t,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new _i(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new _i(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");s.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(e.error?u(e.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{l||(e.error?u(e.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function bO({capabilities:e=[],wants:t=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];t=[...new Set(t)];let l=` ${e.join(" ")}`;for(let c of t)o.push(Ve.encode(`want ${c}${l} -`)),l="";for(let c of n)o.push(Ve.encode(`shallow ${c} -`));i!==null&&o.push(Ve.encode(`deepen ${i} -`)),a!==null&&o.push(Ve.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} -`));for(let c of s)o.push(Ve.encode(`deepen-not ${c} -`));o.push(Ve.flush());for(let c of r)o.push(Ve.encode(`have ${c} -`));return o.push(Ve.encode(`done -`)),o}async function Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:v=[],relative:y=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:k=!1}){let w=c||await ha({fs:e,gitdir:l,test:!0}),A=await We.get({fs:e,gitdir:l}),S=f||w&&await A.get(`branch.${w}.remote`)||"origin",T=d||await A.get(`remote.${S}.url`);if(typeof T=="undefined")throw new er("remote OR url");let P=u||w&&await A.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await A.get("http.corsProxy"));let I=As.getRemoteHelperFor({url:T}),N=await I.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:E,protocolVersion:1}),L=N.auth,ee=N.refs;if(ee.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new wi("shallow","depth");if(m!==null&&!N.capabilities.has("deepen-since"))throw new wi("deepen-since","since");if(v.length>0&&!N.capabilities.has("deepen-not"))throw new wi("deepen-not","exclude");if(y===!0&&!N.capabilities.has("deepen-relative"))throw new wi("deepen-relative","relative");let{oid:fe,fullref:J}=W.resolveAgainstMap({ref:P,map:ee});for(let H of ee.keys())H===J||H==="HEAD"||H.startsWith("refs/heads/")||b&&H.startsWith("refs/tags/")||ee.delete(H);let Q=b2([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${gu.agent}`]);y&&Q.push("deepen-relative");let Pe=x?[fe]:ee.values(),ge=x?[w]:await W.listRefs({fs:e,gitdir:l,filepath:"refs"}),z=[];for(let H of ge)try{H=await W.expand({fs:e,gitdir:l,ref:H});let Je=await W.resolve({fs:e,gitdir:l,ref:H});await Qw({fs:e,cache:t,gitdir:l,oid:Je})&&z.push(Je)}catch(Je){}z=[...new Set(z)];let Y=await da.read({fs:e,gitdir:l}),O=N.capabilities.has("shallow")?[...Y]:[],he=bO({capabilities:Q,wants:Pe,haves:z,shallows:O,depth:p,since:m,exclude:v}),Ge=Buffer.from(await lu(he)),gt=await I.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:L,body:[Ge],headers:E}),Re=await wO(gt.body);gt.headers&&(Re.headers=gt.headers);for(let H of Re.shallows)if(!Y.has(H))try{let{object:Je}=await qe({fs:e,cache:t,gitdir:l,oid:H}),D=new rr(Je),q=await Promise.all(D.headers().parent.map(Ne=>Qw({fs:e,cache:t,gitdir:l,oid:Ne})));q.length===0||q.every(Ne=>Ne)||Y.add(H)}catch(Je){Y.add(H)}for(let H of Re.unshallows)Y.delete(H);if(await da.write({fs:e,gitdir:l,oids:Y}),x){let H=new Map([[J,fe]]),Je=new Map,D=10,q=J;for(;D--;){let bt=N.symrefs.get(q);if(bt===void 0)break;Je.set(q,bt),q=bt}let ve=ee.get(q);ve&&H.set(q,ve);let{pruned:Ne}=await W.updateRemoteRefs({fs:e,gitdir:l,remote:S,refs:H,symrefs:Je,tags:b,prune:_});_&&(Re.pruned=Ne)}else{let{pruned:H}=await W.updateRemoteRefs({fs:e,gitdir:l,remote:S,refs:ee,symrefs:N.symrefs,tags:b,prune:_,pruneTags:k});_&&(Re.pruned=H)}if(Re.HEAD=N.symrefs.get("HEAD"),Re.HEAD===void 0){let{oid:H}=W.resolveAgainstMap({ref:"HEAD",map:ee});for(let[Je,D]of ee.entries())if(Je!=="HEAD"&&D===H){Re.HEAD=Je;break}}let ct=J.startsWith("refs/tags")?"tag":"branch";if(Re.FETCH_HEAD={oid:fe,description:`${ct} '${ca(J)}' of ${T}`},n||i){let H=_2(Re.progress);_l(H,async Je=>{if(i&&await i(Je),n){let D=Je.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);D&&await n({phase:D[1].trim(),loaded:parseInt(D[2],10),total:parseInt(D[3],10)})}})}let rt=Buffer.from(await lu(Re.packfile));if(gt.body.error)throw gt.body.error;let Et=rt.slice(-20).toString("hex"),Ie={defaultBranch:Re.HEAD,fetchHead:Re.FETCH_HEAD.oid,fetchHeadDescription:Re.FETCH_HEAD.description};if(Re.headers&&(Ie.headers=Re.headers),_&&(Ie.pruned=Re.pruned),Et!==""&&!vO(rt)){Ie.packfile=`objects/pack/pack-${Et}.pack`;let H=$(l,Ie.packfile);await e.write(H,rt);let Je=q=>qe({fs:e,cache:t,gitdir:l,oid:q}),D=await il.fromPack({pack:rt,getExternalRefDelta:Je,onProgress:n});await e.write(H.replace(/\.pack$/,".idx"),await D.toBuffer())}return Ie}async function x2({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:$(r,".git"),defaultBranch:i="master"}){if(await e.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>n+"/"+s);for(let s of a)await e.mkdir(s);await e.write(n+"/config",`[core] +`;await Za.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Za.acquire(i,async function(){await e.rm(i)})}};async function X3({fs:t,gitdir:e,oid:r}){let n=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${n}`)}async function Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=await t.readdir(O.join(r,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${r}/objects/pack/${s}`,l=await Og({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new de(l.error);if(l.offsets.has(n))return!0}return!1}async function sE({fs:t,cache:e,gitdir:r,oid:n,format:i="content"}){let a=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),s=await X3({fs:t,gitdir:r,oid:n});return s||(s=await Z3({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:a})),s}function K3(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function ME(t,e){let r=t.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return r.includes(i)})}var td={name:"isomorphic-git",version:"1.32.2",agent:"git/isomorphic-git@1.32.2"},ho=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function J3(t){let e=t.indexOf("\r"),r=t.indexOf(` +`);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function DE(t){let e=new ho,r="";return(async()=>(await _c(t,n=>{for(n=n.toString("utf8"),r+=n;;){let i=J3(r);if(i===-1)break;e.write(r.slice(0,i)),r=r.slice(i)}}),r.length>0&&e.write(r),e.end()))(),e}var Xf=class{static demux(e){let r=Qe.streamReader(e),n=new ho,i=new ho,a=new ho,s=async function(){let o=await r();if(o===null)return s();if(o===!0){n.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),n.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(o)}s()};return s(),{packetlines:n,packfile:i,progress:a}}};async function Q3(t){let{packetlines:e,packfile:r,progress:n}=Xf.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((u,c)=>{_c(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&c(new oa(h)),a.push(h)}else if(d.startsWith("ACK")){let[,h,m]=d.split(" ");s.push({oid:h,status:m}),m||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))}).finally(()=>{l||(t.error?c(t.error):u({shallows:i,unshallows:a,acks:s,nak:o,packfile:r,progress:n}))})})}function e8({capabilities:t=[],wants:e=[],haves:r=[],shallows:n=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let u of e)o.push(Qe.encode(`want ${u}${l} +`)),l="";for(let u of n)o.push(Qe.encode(`shallow ${u} +`));i!==null&&o.push(Qe.encode(`deepen ${i} +`)),a!==null&&o.push(Qe.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} +`));for(let u of s)o.push(Qe.encode(`deepen-not ${u} +`));o.push(Qe.flush());for(let u of r)o.push(Qe.encode(`have ${u} +`));return o.push(Qe.encode(`done +`)),o}async function Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:u,remoteRef:c,remote:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:E=!1,headers:x={},prune:k=!1,pruneTags:A=!1}){let y=u||await pa({fs:t,gitdir:l,test:!0}),S=await nt.get({fs:t,gitdir:l}),_=f||y&&await S.get(`branch.${y}.remote`)||"origin",T=d||await S.get(`remote.${_}.url`);if(typeof T=="undefined")throw new hr("remote OR url");let P=c||y&&await S.get(`branch.${y}.merge`)||u||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let F=Ao.getRemoteHelperFor({url:T}),D=await F.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:T,headers:x,protocolVersion:1}),M=D.auth,re=D.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(m!==null&&!D.capabilities.has("shallow"))throw new sa("shallow","depth");if(g!==null&&!D.capabilities.has("deepen-since"))throw new sa("deepen-since","since");if(v.length>0&&!D.capabilities.has("deepen-not"))throw new sa("deepen-not","exclude");if(w===!0&&!D.capabilities.has("deepen-relative"))throw new sa("deepen-relative","relative");let{oid:ye,fullref:me}=z.resolveAgainstMap({ref:P,map:re});for(let G of re.keys())G===me||G==="HEAD"||G.startsWith("refs/heads/")||b&&G.startsWith("refs/tags/")||re.delete(G);let fe=ME([...D.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${td.agent}`]);w&&fe.push("deepen-relative");let Ge=E?[ye]:re.values(),oe=E?[y]:await z.listRefs({fs:t,gitdir:l,filepath:"refs"}),B=[];for(let G of oe)try{G=await z.expand({fs:t,gitdir:l,ref:G});let Je=await z.resolve({fs:t,gitdir:l,ref:G});await sE({fs:t,cache:e,gitdir:l,oid:Je})&&B.push(Je)}catch(Je){}B=[...new Set(B)];let Z=await Qa.read({fs:t,gitdir:l}),H=D.capabilities.has("shallow")?[...Z]:[],Oe=e8({capabilities:fe,wants:Ge,haves:B,shallows:H,depth:m,since:g,exclude:v}),cr=Buffer.from(await Yf(Oe)),Gt=await F.connect({http:r,onProgress:n,corsProxy:h,service:"git-upload-pack",url:T,auth:M,body:[cr],headers:x}),Y=await Q3(Gt.body);Gt.headers&&(Y.headers=Gt.headers);for(let G of Y.shallows)if(!Z.has(G))try{let{object:Je}=await qe({fs:t,cache:e,gitdir:l,oid:G}),N=new mr(Je),X=await Promise.all(N.headers().parent.map(We=>sE({fs:t,cache:e,gitdir:l,oid:We})));X.length===0||X.every(We=>We)||Z.add(G)}catch(Je){Z.add(G)}for(let G of Y.unshallows)Z.delete(G);if(await Qa.write({fs:t,gitdir:l,oids:Z}),E){let G=new Map([[me,ye]]),Je=new Map,N=10,X=me;for(;N--;){let $t=D.symrefs.get(X);if($t===void 0)break;Je.set(X,$t),X=$t}let Ee=re.get(X);Ee&&G.set(X,Ee);let{pruned:We}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:G,symrefs:Je,tags:b,prune:k});k&&(Y.pruned=We)}else{let{pruned:G}=await z.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:re,symrefs:D.symrefs,tags:b,prune:k,pruneTags:A});k&&(Y.pruned=G)}if(Y.HEAD=D.symrefs.get("HEAD"),Y.HEAD===void 0){let{oid:G}=z.resolveAgainstMap({ref:"HEAD",map:re});for(let[Je,N]of re.entries())if(Je!=="HEAD"&&N===G){Y.HEAD=Je;break}}let Ie=me.startsWith("refs/tags")?"tag":"branch";if(Y.FETCH_HEAD={oid:ye,description:`${Ie} '${Ka(me)}' of ${T}`},n||i){let G=DE(Y.progress);_c(G,async Je=>{if(i&&await i(Je),n){let N=Je.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);N&&await n({phase:N[1].trim(),loaded:parseInt(N[2],10),total:parseInt(N[3],10)})}})}let Me=Buffer.from(await Yf(Y.packfile));if(Gt.body.error)throw Gt.body.error;let It=Me.slice(-20).toString("hex"),De={defaultBranch:Y.HEAD,fetchHead:Y.FETCH_HEAD.oid,fetchHeadDescription:Y.FETCH_HEAD.description};if(Y.headers&&(De.headers=Y.headers),k&&(De.pruned=Y.pruned),It!==""&&!K3(Me)){De.packfile=`objects/pack/pack-${It}.pack`;let G=O.join(l,De.packfile);await t.write(G,Me);let Je=X=>qe({fs:t,cache:e,gitdir:l,oid:X}),N=await ic.fromPack({pack:Me,getExternalRefDelta:Je,onProgress:n});await t.write(G.replace(/\.pack$/,".idx"),await N.toBuffer())}return De}async function LE({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O.join(r,".git"),defaultBranch:i="master"}){if(await t.exists(n+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>n+"/"+s);for(let s of a)await t.mkdir(s);await t.write(n+"/config",`[core] repositoryformatversion = 0 filemode = false - bare = ${t} -`+(t?"":` logallrefupdates = true + bare = ${e} +`+(e?"":` logallrefupdates = true `)+` symlinks = false ignorecase = true -`),await e.write(n+"/HEAD",`ref: refs/heads/${i} -`)}async function _O({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:v,exclude:y,relative:b,singleBranch:x,noCheckout:E,noTags:_,headers:k}){try{if(await x2({fs:e,gitdir:u}),await v2({fs:e,gitdir:u,remote:p,url:f,force:!1}),d){let S=await We.get({fs:e,gitdir:u});await S.set("http.corsProxy",d),await We.save({fs:e,gitdir:u,config:S})}let{defaultBranch:w,fetchHead:A}=await Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:v,exclude:y,relative:b,singleBranch:x,headers:k,tags:!_});if(A===null)return;h=h||w,h=h.replace("refs/heads/",""),await Tp({fs:e,cache:t,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:E})}catch(w){throw await e.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),w}}async function xO({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=$(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:v=[],relative:y=!1,singleBranch:b=!1,noCheckout:x=!1,noTags:E=!1,headers:_={},cache:k={}}){try{return C("fs",e),C("http",t),C("gitdir",c),x||C("dir",l),C("url",u),await _O({fs:new X(e),cache:k,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:v,relative:y,singleBranch:b,noCheckout:x,noTags:E,headers:_})}catch(w){throw w.caller="git.clone",w}}async function SO({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{C("fs",e),l||C("message",i),o&&C("onSign",t);let m=new X(e);return await mu({fs:m,cache:p,onSign:t,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(m){throw m.caller="git.commit",m}}async function EO({fs:e,dir:t,gitdir:r=$(t,".git"),fullname:n=!1,test:i=!1}){try{return C("fs",e),C("gitdir",r),await ha({fs:new X(e),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function AO({fs:e,gitdir:t,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await W.exists({fs:e,gitdir:t,ref:r}))throw new Le(r);let i=await W.expand({fs:e,gitdir:t,ref:r}),a=await ha({fs:e,gitdir:t,fullname:!0});if(i===a){let l=await W.resolve({fs:e,gitdir:t,ref:i});await W.writeRef({fs:e,gitdir:t,ref:"HEAD",value:l})}await W.deleteRef({fs:e,gitdir:t,ref:i});let s=ca(r),o=await We.get({fs:e,gitdir:t});await o.deleteSection("branch",s),await We.save({fs:e,gitdir:t,config:o})}async function kO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("ref",n),await AO({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function TO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{C("fs",e),C("ref",n),await W.deleteRef({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function CO({fs:e,gitdir:t,remote:r}){let n=await We.get({fs:e,gitdir:t});await n.deleteSection("remote",r),await We.save({fs:e,gitdir:t,config:n})}async function PO({fs:e,dir:t,gitdir:r=$(t,".git"),remote:n}){try{return C("fs",e),C("remote",n),await CO({fs:new X(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function RO({fs:e,gitdir:t,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await W.deleteRef({fs:e,gitdir:t,ref:r})}async function MO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("ref",n),await RO({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function OO({fs:e,gitdir:t,oid:r}){let n=r.slice(0,2);return(await e.readdir(`${t}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function IO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await e.readdir($(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,c=await Ap({fs:e,cache:t,filename:l,getExternalRefDelta:i});if(c.error)throw new le(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&a.push(u)}return a}async function FO({fs:e,cache:t,gitdir:r,oid:n}){let i=o=>qe({fs:e,cache:t,gitdir:r,oid:o}),a=await OO({fs:e,gitdir:r,oid:n}),s=await IO({fs:e,cache:t,gitdir:r,oid:n,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new al("oids",n,a):new Le(`an object matching "${n}"`)}async function $O({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await FO({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function LO({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n}){try{return C("fs",e),C("gitdir",r),C("ref",n),await W.expand({fs:new X(e),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function Pp({fs:e,cache:t,gitdir:r,oids:n}){let i={},a=n.length,s=n.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:c,index:u}of s)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of s)try{let{object:f}=await qe({fs:e,cache:t,gitdir:r,oid:c}),d=rr.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}s=Array.from(l.values())}return[]}var up=/^.*(\r?\n|$)/gm;function DO({branches:e,contents:t}){let r=e[1],n=e[2],i=t[0],a=t[1],s=t[2],o=a.match(up),l=i.match(up),c=s.match(up),u=(0,n2.default)(o,l,c),f=7,d="",h=!0;for(let p of u)p.ok&&(d+=p.ok.join("")),p.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} -`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)} -`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n} -`);return{cleanMerge:h,mergedText:d}}async function NO({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=bi({ref:a}),m=bi({ref:s}),v=bi({ref:o}),y=[],b=[],x=[],E=[],_=await _s({fs:e,cache:t,dir:r,gitdir:n,trees:[p,m,v],map:async function(k,[w,A,S]){let T=tu(k),P=await su(w,A),I=await su(S,A);switch(`${P}-${I}`){case"false-false":return{mode:await A.mode(),path:T,oid:await A.oid(),type:await A.type()};case"false-true":return S?{mode:await S.mode(),path:T,oid:await S.oid(),type:await S.type()}:void 0;case"true-false":return w?{mode:await w.mode(),path:T,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&A&&S&&await w.type()==="blob"&&await A.type()==="blob"&&await S.type()==="blob")return BO({fs:e,gitdir:n,path:T,ours:w,base:A,theirs:S,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async N=>{if(N.cleanMerge)d||i.insert({filepath:k,oid:N.mergeResult.oid,stage:0});else if(y.push(k),b.push(k),!d){let L=await A.oid(),ee=await w.oid(),fe=await S.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:L,stage:1}),i.insert({filepath:k,oid:ee,stage:2}),i.insert({filepath:k,oid:fe,stage:3})}return N.mergeResult});if(A&&!w&&S&&await A.type()==="blob"&&await S.type()==="blob"){if(y.push(k),x.push(k),!d){let N=await A.oid(),L=await S.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:N,stage:1}),i.insert({filepath:k,oid:L,stage:3})}return{mode:await S.mode(),oid:await S.oid(),type:"blob",path:T}}if(A&&w&&!S&&await A.type()==="blob"&&await w.type()==="blob"){if(y.push(k),E.push(k),!d){let N=await A.oid(),L=await w.oid();i.delete({filepath:k}),i.insert({filepath:k,oid:N,stage:1}),i.insert({filepath:k,oid:L,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:T}}if(A&&!w&&!S&&await A.type()==="blob")return;throw new gs}}},reduce:y.length!==0&&(!r||d)?void 0:async(k,w)=>{let A=w.filter(Boolean);if(k&&!(k&&k.type==="tree"&&A.length===0)){if(A.length>0){let T=new tr(A).toObject(),P=await mr({fs:e,gitdir:n,type:"tree",object:T,dryRun:f});k.oid=P}return k}}});return y.length!==0?(r&&!d&&await _s({fs:e,cache:t,dir:r,gitdir:n,trees:[bi({ref:_.oid})],map:async function(k,[w]){let A=`${r}/${k}`;if(await w.type()==="blob"){let S=await w.mode(),T=new TextDecoder().decode(await w.content());await e.write(A,T,{mode:S})}return!0}}),new vs(y,b,x,E)):_.oid}async function BO({fs:e,gitdir:t,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=DO}){let f="blob",d=await i.mode()===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await n.oid(),type:f}};if(await n.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:d,path:r,oid:await n.oid(),type:f}};let h=Buffer.from(await n.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),m=Buffer.from(await a.content()).toString("utf8"),{mergedText:v,cleanMerge:y}=await u({branches:[l,s,o],contents:[p,h,m],path:r}),b=await mr({fs:e,gitdir:t,type:"blob",object:Buffer.from(v,"utf8"),dryRun:c});return{cleanMerge:y,mergeResult:{mode:d,path:r,oid:b,type:f}}}async function S2({fs:e,cache:t,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:m,mergeDriver:v}){i===void 0&&(i=await ha({fs:e,gitdir:n,fullname:!0})),i=await W.expand({fs:e,gitdir:n,ref:i}),a=await W.expand({fs:e,gitdir:n,ref:a});let y=await W.resolve({fs:e,gitdir:n,ref:i}),b=await W.resolve({fs:e,gitdir:n,ref:a}),x=await Pp({fs:e,cache:t,gitdir:n,oids:[y,b]});if(x.length!==1)throw new gs;let E=x[0];if(E===b)return{oid:y,alreadyMerged:!0};if(s&&E===y)return!l&&!c&&await W.writeRef({fs:e,gitdir:n,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new cl;let _=await yt.acquire({fs:e,gitdir:n,cache:t,allowUnmerged:!1},async w=>NO({fs:e,cache:t,dir:r,gitdir:n,index:w,ourOid:y,theirOid:b,baseOid:E,ourName:ca(i),baseName:"base",theirName:ca(a),dryRun:l,abortOnConflict:u,mergeDriver:v}));if(_ instanceof vs)throw _;return f||(f=`Merge branch '${ca(a)}' into ${ca(i)}`),{oid:await mu({fs:e,cache:t,gitdir:n,message:f,ref:i,tree:_,parent:[y,b],author:d,committer:h,signingKey:p,onSign:m,dryRun:l,noUpdateBranch:c}),tree:_,mergeCommit:!0}}}async function E2({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:m,fastForward:v,fastForwardOnly:y,corsProxy:b,singleBranch:x,headers:E,author:_,committer:k,signingKey:w}){try{if(!u){let T=await ha({fs:e,gitdir:c});if(!T)throw new er("ref");u=T}let{fetchHead:A,fetchHeadDescription:S}=await Cp({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:x,headers:E,prune:p,pruneTags:m});await S2({fs:e,cache:t,gitdir:c,ours:u,theirs:A,fastForward:v,fastForwardOnly:y,message:`Merge ${S}`,author:_,committer:k,signingKey:w,dryRun:!1,noUpdateBranch:!1}),await Tp({fs:e,cache:t,onProgress:n,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(A){throw A.caller="git.pull",A}}async function jO({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=$(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:m={},cache:v={}}){try{C("fs",e),C("http",t),C("gitdir",l);let y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await E2({fs:new X(e),cache:v,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:m,author:y,committer:y})}catch(y){throw y.caller="git.fastForward",y}}async function HO({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=$(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:v=[],relative:y=!1,tags:b=!1,singleBranch:x=!1,headers:E={},prune:_=!1,pruneTags:k=!1,cache:w={}}){try{return C("fs",e),C("http",t),C("gitdir",l),await Cp({fs:new X(e),cache:w,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:m,exclude:v,relative:y,tags:b,singleBranch:x,headers:E,prune:_,pruneTags:k})}catch(A){throw A.caller="git.fetch",A}}async function UO({fs:e,dir:t,gitdir:r=$(t,".git"),oids:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oids",n),await Pp({fs:new X(e),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function A2({fs:e,filepath:t}){if(await e.exists($(t,".git")))return t;{let r=ps(t);if(r===t)throw new Le(`git root for ${t}`);return A2({fs:e,filepath:r})}}async function GO({fs:e,filepath:t}){try{return C("fs",e),C("filepath",t),await A2({fs:new X(e),filepath:t})}catch(r){throw r.caller="git.findRoot",r}}async function zO({fs:e,dir:t,gitdir:r=$(t,".git"),path:n}){try{return C("fs",e),C("gitdir",r),C("path",n),await yl({fs:new X(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function VO({fs:e,gitdir:t,path:r}){return(await We.get({fs:e,gitdir:t})).getall(r)}async function WO({fs:e,dir:t,gitdir:r=$(t,".git"),path:n}){try{return C("fs",e),C("gitdir",r),C("path",n),await VO({fs:new X(e),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function qO({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{C("http",e),C("url",a);let c=await As.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),m=u;for(let v of h)m[v]=m[v]||{},m=m[v];m[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),m=u;for(let v of h)m[v]=m[v]||{},m=m[v];m[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function k2(e,t,r,n){let i=[];for(let[a,s]of e.refs){if(t&&!a.startsWith(t))continue;if(a.endsWith("^{}")){if(n){let l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=s}continue}let o={ref:a,oid:s};r&&e.symrefs.has(a)&&(o.target=e.symrefs.get(a)),i.push(o)}return i}async function YO({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{C("http",e),C("url",a);let u=await As.getRemoteHelperFor({url:a}).discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,p]=d.split("=");p?f[h]=p:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:k2(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function XO({type:e,object:t,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(t=xi.wrap({type:e,object:t})),n=await Vn(t)),{oid:n,object:t}}async function ZO({object:e}){try{C("object",e),typeof e=="string"?e=Buffer.from(e,"utf8"):e=Buffer.from(e);let t="blob",{oid:r,object:n}=await XO({type:"blob",format:"content",object:e});return{oid:r,type:t,object:new Uint8Array(n),format:"wrapped"}}catch(t){throw t.caller="git.hashBlob",t}}async function KO({fs:e,cache:t,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=$(n,a);let s=await e.read(a),o=c=>qe({fs:e,cache:t,gitdir:i,oid:c}),l=await il.fromPack({pack:s,getExternalRefDelta:o,onProgress:r});return await e.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function JO({fs:e,onProgress:t,dir:r,gitdir:n=$(r,".git"),filepath:i,cache:a={}}){try{return C("fs",e),C("dir",r),C("gitdir",r),C("filepath",i),await KO({fs:new X(e),cache:a,onProgress:t,dir:r,gitdir:n,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function QO({fs:e,bare:t=!1,dir:r,gitdir:n=t?r:$(r,".git"),defaultBranch:i="master"}){try{return C("fs",e),C("gitdir",n),t||C("dir",r),await x2({fs:new X(e),bare:t,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function T2({fs:e,cache:t,gitdir:r,oid:n,ancestor:i,depth:a}){let s=await da.read({fs:e,gitdir:r});if(!n)throw new er("oid");if(!i)throw new er("ancestor");if(n===i)return!1;let o=[n],l=new Set,c=0;for(;o.length;){if(c++===a)throw new fl(a);let u=o.shift(),{type:f,object:d}=await qe({fs:e,cache:t,gitdir:r,oid:u});if(f!=="commit")throw new zt(u,f,"commit");let h=rr.from(d).parse();for(let p of h.parent)if(p===i)return!0;if(!s.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function eI({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,ancestor:i,depth:a=-1,cache:s={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),C("ancestor",i),await T2({fs:new X(e),cache:s,gitdir:r,oid:n,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function tI({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n}){try{return C("fs",e),C("dir",t),C("gitdir",r),C("filepath",n),xs.isIgnored({fs:new X(e),dir:t,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function rI({fs:e,dir:t,gitdir:r=$(t,".git"),remote:n}){try{return C("fs",e),C("gitdir",r),W.listBranches({fs:new X(e),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function nI({fs:e,gitdir:t,ref:r,cache:n}){if(r){let i=await W.resolve({gitdir:t,fs:e,ref:r}),a=[];return await C2({fs:e,cache:n,gitdir:t,oid:i,filenames:a,prefix:""}),a}else return yt.acquire({fs:e,gitdir:t,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function C2({fs:e,cache:t,gitdir:r,oid:n,filenames:i,prefix:a}){let{tree:s}=await ks({fs:e,cache:t,gitdir:r,oid:n});for(let o of s)o.type==="tree"?await C2({fs:e,cache:t,gitdir:r,oid:o.oid,filenames:i,prefix:$(a,o.path)}):i.push($(a,o.path))}async function iI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),await nI({fs:new X(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function aI({fs:e,cache:t,gitdir:r,ref:n}){let i;try{i=await W.resolve({gitdir:r,fs:e,ref:n})}catch(o){if(o instanceof Le)return[]}return(await ks({fs:e,cache:t,gitdir:r,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function sI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return C("fs",e),C("gitdir",r),C("ref",n),await aI({fs:new X(e),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function oI({fs:e,gitdir:t}){let r=await We.get({fs:e,gitdir:t}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{let s=await r.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function lI({fs:e,dir:t,gitdir:r=$(t,".git")}){try{return C("fs",e),C("gitdir",r),await oI({fs:new X(e),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function cI(e){let t=Ve.streamReader(e),r=[],n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,a,...s]=n.split(" "),o={ref:a,oid:i};for(let l of s){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}r.push(o)}return r}async function uI({prefix:e,symrefs:t,peelTags:r}){let n=[];return n.push(Ve.encode(`command=ls-refs -`)),n.push(Ve.encode(`agent=${gu.agent} -`)),(r||t||e)&&n.push(Ve.delim()),r&&n.push(Ve.encode("peel")),t&&n.push(Ve.encode("symrefs")),e&&n.push(Ve.encode(`ref-prefix ${e}`)),n.push(Ve.flush()),n}async function fI({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{C("http",e),C("url",a);let d=await Es.discover({http:e,onAuth:t,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return k2(d,c,u,f);let h=await uI({prefix:c,symrefs:u,peelTags:f}),p=await Es.connect({http:e,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return cI(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function dI({fs:e,dir:t,gitdir:r=$(t,".git")}){try{return C("fs",e),C("gitdir",r),W.listTags({fs:new X(e),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function hI(e,t){return e.committer.timestamp-t.committer.timestamp}var pI="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function e2({fs:e,cache:t,gitdir:r,oid:n,fileId:i}){if(i===pI)return;let a=n,s,o=await bs({fs:e,cache:t,gitdir:r,oid:n}),l=o.tree;return i===o.oid?s=o.path:(s=await P2({fs:e,cache:t,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function P2({fs:e,cache:t,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=$(o,c.path),s.push(u)):c.type==="tree"&&(u=qe({fs:e,cache:t,gitdir:r,oid:c.oid}).then(function({object:f}){return P2({fs:e,cache:t,gitdir:r,tree:tr.from(f),fileId:i,oid:a,filepaths:s,parentPath:$(o,c.path)})})),u});return await Promise.all(l),s}async function mI({fs:e,cache:t,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await da.read({fs:e,gitdir:r}),d=await W.resolve({fs:e,gitdir:r,ref:i}),h=[await ou({fs:e,cache:t,gitdir:r,oid:d})],p,m,v;function y(b){v&&n&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(n){let x;try{x=await bl({fs:e,cache:t,gitdir:r,oid:b.commit.tree,filepath:n}),m&&p!==x&&u.push(m),p=x,m=b,v=!0}catch(E){if(E instanceof Le){let _=l&&p;if(_&&(_=await e2({fs:e,cache:t,gitdir:r,oid:b.commit.tree,fileId:p}),_))if(Array.isArray(_)){if(m){let k=await e2({fs:e,cache:t,gitdir:r,oid:m.commit.tree,fileId:p});if(Array.isArray(k))if(_=_.filter(w=>k.indexOf(w)===-1),_.length===1)_=_[0],n=_,m&&u.push(m);else{_=!1,m&&u.push(m);break}}}else n=_,m&&u.push(m);if(!_){if(v&&p&&(u.push(m),!o))break;if(!o&&!l)throw E}m=b,v=!1}else throw E}}else u.push(b);if(a!==void 0&&u.length===a){y(b);break}if(!f.has(b.oid))for(let x of b.commit.parent){let E=await ou({fs:e,cache:t,gitdir:r,oid:x});h.map(_=>_.oid).includes(E.oid)||h.push(E)}h.length===0&&y(b),h.sort((x,E)=>hI(x.commit,E.commit))}return u}async function gI({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return C("fs",e),C("gitdir",r),C("ref",i),await mI({fs:new X(e),cache:c,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function vI({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:v}){try{C("fs",e),p&&C("onSign",t);let y=new X(e),b=await fa({fs:y,gitdir:n,author:d});if(!b&&(!o||!s))throw new Vt("author");let x=await Ss({fs:y,gitdir:n,author:b,committer:h});if(!x&&(!o||!s))throw new Vt("committer");return await S2({fs:y,cache:m,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:x,signingKey:p,onSign:t,mergeDriver:v})}catch(y){throw y.caller="git.merge",y}}var yI={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function R2({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),oids:i}){let a=new Ep.default,s=[];function o(u,f){let d=Buffer.from(u,f);s.push(d),a.update(d)}async function l({stype:u,object:f}){let d=yI[u],h=f.length,p=h>15?128:0,m=h&15;h=h>>>4;let v=(p|d|m).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o(Sp(2,v),"hex"),h=h>>>7;o(Buffer.from(await d2(f)))}o("PACK"),o("00000002","hex"),o(Sp(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await qe({fs:e,cache:t,gitdir:n,oid:u});await l({write:o,object:d,stype:f})}let c=a.digest();return s.push(c),s}async function wI({fs:e,cache:t,gitdir:r,oids:n,write:i}){let a=await R2({fs:e,cache:t,gitdir:r,oids:n}),s=Buffer.from(await lu(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await e.write($(r,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function bI({fs:e,dir:t,gitdir:r=$(t,".git"),oids:n,write:i=!1,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("oids",n),await wI({fs:new X(e),cache:a,gitdir:r,oids:n,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function _I({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=$(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:m=!0,fastForwardOnly:v=!1,corsProxy:y,singleBranch:b,headers:x={},author:E,committer:_,signingKey:k,cache:w={}}){try{C("fs",e),C("gitdir",l);let A=new X(e),S=await fa({fs:A,gitdir:l,author:E});if(!S)throw new Vt("author");let T=await Ss({fs:A,gitdir:l,author:S,committer:_});if(!T)throw new Vt("committer");return await E2({fs:A,cache:w,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:d,fastForward:m,fastForwardOnly:v,corsProxy:y,singleBranch:b,headers:x,author:S,committer:T,signingKey:k,prune:h,pruneTags:p})}catch(A){throw A.caller="git.pull",A}}async function xI({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),start:i,finish:a}){let s=await da.read({fs:e,gitdir:n}),o=new Set,l=new Set;for(let f of i)o.add(await W.resolve({fs:e,gitdir:n,ref:f}));for(let f of a)try{let d=await W.resolve({fs:e,gitdir:n,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await qe({fs:e,cache:t,gitdir:n,oid:f});if(d==="tag"){let m=pr.from(h).headers().object;return u(m)}if(d!=="commit")throw new zt(f,d,"commit");if(!s.has(f)){let m=rr.from(h).headers().parent;for(f of m)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function fp({fs:e,cache:t,dir:r,gitdir:n=$(r,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:c}=await qe({fs:e,cache:t,gitdir:n,oid:o});if(l==="tag"){let f=pr.from(c).headers().object;await s(f)}else if(l==="commit"){let f=rr.from(c).headers().tree;await s(f)}else if(l==="tree"){let u=tr.from(c);for(let f of u)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function SI(e){let t={},r="",n=Ve.streamReader(e),i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+` +`),await t.write(n+"/HEAD",`ref: refs/heads/${i} +`)}async function t8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:u,gitdir:c,url:f,corsProxy:d,ref:h,remote:m,depth:g,since:v,exclude:w,relative:b,singleBranch:E,noCheckout:x,noTags:k,headers:A,nonBlocking:y,batchSize:S=100}){try{if(await LE({fs:t,gitdir:c}),await PE({fs:t,gitdir:c,remote:m,url:f,force:!1}),d){let P=await nt.get({fs:t,gitdir:c});await P.set("http.corsProxy",d),await nt.save({fs:t,gitdir:c,config:P})}let{defaultBranch:_,fetchHead:T}=await Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,ref:h,remote:m,corsProxy:d,depth:g,since:v,exclude:w,relative:b,singleBranch:E,headers:A,tags:!k});if(T===null)return;h=h||_,h=h.replace("refs/heads/",""),await Mg({fs:t,cache:e,onProgress:n,onPostCheckout:l,dir:u,gitdir:c,ref:h,remote:m,noCheckout:x,nonBlocking:y,batchSize:S})}catch(_){throw await t.rmdir(c,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function NE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u=O.join(l,".git"),url:c,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:m=void 0,since:g=void 0,exclude:v=[],relative:w=!1,singleBranch:b=!1,noCheckout:E=!1,noTags:x=!1,headers:k={},cache:A={},nonBlocking:y=!1,batchSize:S=100}){try{return C("fs",t),C("http",e),C("gitdir",u),E||C("dir",l),C("url",c),await t8({fs:new J(t),cache:A,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:u,url:c,corsProxy:f,ref:d,remote:h,depth:m,since:g,exclude:v,relative:w,singleBranch:b,noCheckout:E,noTags:x,headers:k,nonBlocking:y,batchSize:S})}catch(_){throw _.caller="git.clone",_}}async function BE({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:u=!1,noUpdateBranch:c=!1,ref:f,parent:d,tree:h,cache:m={}}){try{C("fs",t),l||C("message",i),o&&C("onSign",e);let g=new J(t);return await Qf({fs:g,cache:m,onSign:e,gitdir:n,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:u,noUpdateBranch:c,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function HE({fs:t,dir:e,gitdir:r=O.join(e,".git"),fullname:n=!1,test:i=!1}){try{return C("fs",t),C("gitdir",r),await pa({fs:new J(t),gitdir:r,fullname:n,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function r8({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await z.exists({fs:t,gitdir:e,ref:r}))throw new Le(r);let i=await z.expand({fs:t,gitdir:e,ref:r}),a=await pa({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await z.resolve({fs:t,gitdir:e,ref:i});await z.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await z.deleteRef({fs:t,gitdir:e,ref:i});let s=Ka(r),o=await nt.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await nt.save({fs:t,gitdir:e,config:o})}async function UE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await r8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function jE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{C("fs",t),C("ref",n),await z.deleteRef({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function n8({fs:t,gitdir:e,remote:r}){let n=await nt.get({fs:t,gitdir:e});await n.deleteSection("remote",r),await nt.save({fs:t,gitdir:e,config:n})}async function GE({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n}){try{return C("fs",t),C("remote",n),await n8({fs:new J(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function i8({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await z.deleteRef({fs:t,gitdir:e,ref:r})}async function qE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("ref",n),await i8({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function a8({fs:t,gitdir:e,oid:r}){let n=r.slice(0,2);return(await t.readdir(`${e}/objects/${n}`)).map(a=>`${n}${a}`).filter(a=>a.startsWith(r))}async function s8({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i}){let a=[],s=await t.readdir(O.join(r,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${r}/objects/pack/${o}`,u=await Og({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(u.error)throw new de(u.error);for(let c of u.offsets.keys())c.startsWith(n)&&a.push(c)}return a}async function o8({fs:t,cache:e,gitdir:r,oid:n}){let i=o=>qe({fs:t,cache:e,gitdir:r,oid:o}),a=await a8({fs:t,gitdir:r,oid:n}),s=await s8({fs:t,cache:e,gitdir:r,oid:n,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new ac("oids",n,a):new Le(`an object matching "${n}"`)}async function zE({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await o8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.expandOid",a}}async function VE({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n}){try{return C("fs",t),C("gitdir",r),C("ref",n),await z.expand({fs:new J(t),gitdir:r,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function Ng({fs:t,cache:e,gitdir:r,oids:n}){let i={},a=n.length,s=n.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:u,index:c}of s)i[u]||(i[u]=new Set),i[u].add(c),i[u].size===a&&o.add(u);if(o.size>0)return[...o];let l=new Map;for(let{oid:u,index:c}of s)try{let{object:f}=await qe({fs:t,cache:e,gitdir:r,oid:u}),d=mr.from(f),{parent:h}=d.parseHeaders();for(let m of h)(!i[m]||!i[m].has(c))&&l.set(m+":"+c,{oid:m,index:c})}catch(f){}s=Array.from(l.values())}return[]}var wg=/^.*(\r?\n|$)/gm;function l8({branches:t,contents:e}){let r=t[1],n=t[2],i=e[0],a=e[1],s=e[2],o=a.match(wg),l=i.match(wg),u=s.match(wg),c=GH(o,l,u),f=7,d="",h=!0;for(let m of c)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)} ${n} +`);return{cleanMerge:h,mergedText:d}}async function c8({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:u="base",theirName:c="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let m=$r({ref:a}),g=$r({ref:s}),v=$r({ref:o}),w=[],b=[],E=[],x=[],k=await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[m,g,v],map:async function(A,[y,S,_]){let T=jf(A),P=await Wf(y,S),F=await Wf(_,S);switch(`${P}-${F}`){case"false-false":return{mode:await S.mode(),path:T,oid:await S.oid(),type:await S.type()};case"false-true":return!_&&await y.type()==="tree"?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:_?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!y&&await _.type()==="tree"?{mode:await _.mode(),path:T,oid:await _.oid(),type:await _.type()}:y?{mode:await y.mode(),path:T,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&_&&await y.type()==="tree"&&await _.type()==="tree")return{mode:await y.mode(),path:T,oid:await y.oid(),type:"tree"};if(y&&_&&await y.type()==="blob"&&await _.type()==="blob")return u8({fs:t,gitdir:n,path:T,ours:y,base:S,theirs:_,ourName:l,baseName:u,theirName:c,mergeDriver:h}).then(async D=>{if(D.cleanMerge)d||i.insert({filepath:A,oid:D.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!d){let M="";S&&await S.type()==="blob"&&(M=await S.oid());let re=await y.oid(),ye=await _.oid();i.delete({filepath:A}),M&&i.insert({filepath:A,oid:M,stage:1}),i.insert({filepath:A,oid:re,stage:2}),i.insert({filepath:A,oid:ye,stage:3})}return D.mergeResult});if(S&&!y&&_&&await S.type()==="blob"&&await _.type()==="blob"){if(w.push(A),E.push(A),!d){let D=await S.oid(),M=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:T}}if(S&&y&&!_&&await S.type()==="blob"&&await y.type()==="blob"){if(w.push(A),x.push(A),!d){let D=await S.oid(),M=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:D,stage:1}),i.insert({filepath:A,oid:M,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:T}}if(S&&!y&&!_&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new wo}}},reduce:w.length!==0&&(!r||d)?void 0:async(A,y)=>{let S=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let T=new pr(S).toObject(),P=await gr({fs:t,gitdir:n,type:"tree",object:T,dryRun:f});A.oid=P}return A}}});return w.length!==0?(r&&!d&&await ua({fs:t,cache:e,dir:r,gitdir:n,trees:[$r({ref:k.oid})],map:async function(A,[y]){let S=`${r}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),T=new TextDecoder().decode(await y.content());await t.write(S,T,{mode:_})}return!0}}),new yo(w,b,E,x)):k.oid}async function u8({fs:t,gitdir:e,path:r,ours:n,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:u,mergeDriver:c=l8}){let f="blob",d="100755",h="",m="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),m=Buffer.from(await i.content()).toString("utf8"));let g=d===await n.mode()?await a.mode():await n.mode();if(await n.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await a.oid(),type:f}};if(await a.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await n.oid(),type:f}};let v=Buffer.from(await n.content()).toString("utf8"),w=Buffer.from(await a.content()).toString("utf8"),{mergedText:b,cleanMerge:E}=await c({branches:[l,s,o],contents:[m,v,w],path:r}),x=await gr({fs:t,gitdir:e,type:"blob",object:Buffer.from(b,"utf8"),dryRun:u});return{cleanMerge:E,mergeResult:{mode:g,path:r,oid:x,type:f}}}async function WE({fs:t,cache:e,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,onSign:g,mergeDriver:v,allowUnrelatedHistories:w=!1}){i===void 0&&(i=await pa({fs:t,gitdir:n,fullname:!0})),i=await z.expand({fs:t,gitdir:n,ref:i}),a=await z.expand({fs:t,gitdir:n,ref:a});let b=await z.resolve({fs:t,gitdir:n,ref:i}),E=await z.resolve({fs:t,gitdir:n,ref:a}),x=await Ng({fs:t,cache:e,gitdir:n,oids:[b,E]});if(x.length!==1)if(x.length===0&&w)x.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new wo;let k=x[0];if(k===E)return{oid:b,alreadyMerged:!0};if(s&&k===b)return!l&&!u&&await z.writeRef({fs:t,gitdir:n,ref:i,value:E}),{oid:E,fastForward:!0};{if(o)throw new cc;let A=await ct.acquire({fs:t,gitdir:n,cache:e,allowUnmerged:!1},async S=>c8({fs:t,cache:e,dir:r,gitdir:n,index:S,ourOid:b,theirOid:E,baseOid:k,ourName:Ka(i),baseName:"base",theirName:Ka(a),dryRun:l,abortOnConflict:c,mergeDriver:v}));if(A instanceof yo)throw A;return f||(f=`Merge branch '${Ka(a)}' into ${Ka(i)}`),{oid:await Qf({fs:t,cache:e,gitdir:n,message:f,ref:i,tree:A,parent:[b,E],author:d,committer:h,signingKey:m,onSign:g,dryRun:l,noUpdateBranch:u}),tree:A,mergeCommit:!0}}}async function YE({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:u,ref:c,url:f,remote:d,remoteRef:h,prune:m,pruneTags:g,fastForward:v,fastForwardOnly:w,corsProxy:b,singleBranch:E,headers:x,author:k,committer:A,signingKey:y}){try{if(!c){let T=await pa({fs:t,gitdir:u});if(!T)throw new hr("ref");c=T}let{fetchHead:S,fetchHeadDescription:_}=await Lg({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,corsProxy:b,ref:c,url:f,remote:d,remoteRef:h,singleBranch:E,headers:x,prune:m,pruneTags:g});await WE({fs:t,cache:e,gitdir:u,ours:c,theirs:S,fastForward:v,fastForwardOnly:w,message:`Merge ${_}`,author:k,committer:A,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Mg({fs:t,cache:e,onProgress:n,dir:l,gitdir:u,ref:c,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function XE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,url:c,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};return await YE({fs:new J(t),cache:v,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:u,url:c,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 ZE({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,remote:c,remoteRef:f,url:d,corsProxy:h,depth:m=null,since:g=null,exclude:v=[],relative:w=!1,tags:b=!1,singleBranch:E=!1,headers:x={},prune:k=!1,pruneTags:A=!1,cache:y={}}){try{return C("fs",t),C("http",e),C("gitdir",l),await Lg({fs:new J(t),cache:y,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:u,remote:c,remoteRef:f,url:d,corsProxy:h,depth:m,since:g,exclude:v,relative:w,tags:b,singleBranch:E,headers:x,prune:k,pruneTags:A})}catch(S){throw S.caller="git.fetch",S}}async function KE({fs:t,dir:e,gitdir:r=O.join(e,".git"),oids:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oids",n),await Ng({fs:new J(t),cache:i,gitdir:r,oids:n})}catch(a){throw a.caller="git.findMergeBase",a}}async function JE({fs:t,filepath:e}){if(await t.exists(O.join(e,".git")))return e;{let r=go(e);if(r===e)throw new Le(`git root for ${e}`);return JE({fs:t,filepath:r})}}async function QE({fs:t,filepath:e}){try{return C("fs",t),C("filepath",e),await JE({fs:new J(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function ek({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n}){try{return C("fs",t),C("gitdir",r),C("path",n),await wc({fs:new J(t),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function f8({fs:t,gitdir:e,path:r}){return(await nt.get({fs:t,gitdir:e})).getall(r)}async function tk({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n}){try{return C("fs",t),C("gitdir",r),C("path",n),await f8({fs:new J(t),gitdir:r,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}async function rk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{C("http",t),C("url",a);let u=await Ao.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),c={capabilities:[...u.capabilities]};for(let[f,d]of u.refs){let h=f.split("/"),m=h.pop(),g=c;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}for(let[f,d]of u.symrefs){let h=f.split("/"),m=h.pop(),g=c;for(let v of h)g[v]=g[v]||{},g=g[v];g[m]=d}return c}catch(l){throw l.caller="git.getRemoteInfo",l}}function nk(t,e,r,n){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(n){let l=a.replace("^{}",""),u=i[i.length-1],c=u.ref===l?u:i.find(f=>f.ref===l);if(c===void 0)throw new Error("I did not expect this to happen");c.peeled=s}continue}let o={ref:a,oid:s};r&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function ik({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{C("http",t),C("url",a);let c=await Ao.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(c.protocolVersion===2)return{protocolVersion:c.protocolVersion,capabilities:c.capabilities2};let f={};for(let d of c.capabilities){let[h,m]=d.split("=");m?f[h]=m:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:nk(c,void 0,!0,!0)}}catch(u){throw u.caller="git.getRemoteInfo2",u}}async function d8({type:t,object:e,format:r="content",oid:n=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=la.wrap({type:t,object:e})),n=await ki(e)),{oid:n,object:e}}async function ak({object:t}){try{C("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:r,object:n}=await d8({type:"blob",format:"content",object:t});return{oid:r,type:e,object:new Uint8Array(n),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function h8({fs:t,cache:e,onProgress:r,dir:n,gitdir:i,filepath:a}){try{a=O.join(n,a);let s=await t.read(a),o=u=>qe({fs:t,cache:e,gitdir:i,oid:u}),l=await ic.fromPack({pack:s,getExternalRefDelta:o,onProgress:r});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function sk({fs:t,onProgress:e,dir:r,gitdir:n=O.join(r,".git"),filepath:i,cache:a={}}){try{return C("fs",t),C("dir",r),C("gitdir",r),C("filepath",i),await h8({fs:new J(t),cache:a,onProgress:e,dir:r,gitdir:n,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function ok({fs:t,bare:e=!1,dir:r,gitdir:n=e?r:O.join(r,".git"),defaultBranch:i="master"}){try{return C("fs",t),C("gitdir",n),e||C("dir",r),await LE({fs:new J(t),bare:e,dir:r,gitdir:n,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function lk({fs:t,cache:e,gitdir:r,oid:n,ancestor:i,depth:a}){let s=await Qa.read({fs:t,gitdir:r});if(!n)throw new hr("oid");if(!i)throw new hr("ancestor");if(n===i)return!1;let o=[n],l=new Set,u=0;for(;o.length;){if(u++===a)throw new fc(a);let c=o.shift(),{type:f,object:d}=await qe({fs:t,cache:e,gitdir:r,oid:c});if(f!=="commit")throw new rr(c,f,"commit");let h=mr.from(d).parse();for(let m of h.parent)if(m===i)return!0;if(!s.has(c))for(let m of h.parent)l.has(m)||(o.push(m),l.add(m))}return!1}async function ck({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,ancestor:i,depth:a=-1,cache:s={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),C("ancestor",i),await lk({fs:new J(t),cache:s,gitdir:r,oid:n,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function uk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n}){try{return C("fs",t),C("dir",e),C("gitdir",r),C("filepath",n),fa.isIgnored({fs:new J(t),dir:e,gitdir:r,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function fk({fs:t,dir:e,gitdir:r=O.join(e,".git"),remote:n}){try{return C("fs",t),C("gitdir",r),z.listBranches({fs:new J(t),gitdir:r,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function p8({fs:t,gitdir:e,ref:r,cache:n}){if(r){let i=await z.resolve({gitdir:e,fs:t,ref:r}),a=[];return await dk({fs:t,cache:n,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return ct.acquire({fs:t,gitdir:e,cache:n},async function(i){return i.entries.map(a=>a.path)})}async function dk({fs:t,cache:e,gitdir:r,oid:n,filenames:i,prefix:a}){let{tree:s}=await Po({fs:t,cache:e,gitdir:r,oid:n});for(let o of s)o.type==="tree"?await dk({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:i,prefix:O.join(a,o.path)}):i.push(O.join(a,o.path))}async function hk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),await p8({fs:new J(t),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listFiles",a}}async function m8({fs:t,cache:e,gitdir:r,ref:n}){let i;try{i=await z.resolve({gitdir:r,fs:t,ref:n})}catch(o){if(o instanceof Le)return[]}return(await Po({fs:t,cache:e,gitdir:r,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function pk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="refs/notes/commits",cache:i={}}){try{return C("fs",t),C("gitdir",r),C("ref",n),await m8({fs:new J(t),cache:i,gitdir:r,ref:n})}catch(a){throw a.caller="git.listNotes",a}}async function mk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n}){try{return C("fs",t),C("gitdir",r),z.listRefs({fs:new J(t),gitdir:r,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function g8({fs:t,gitdir:e}){let r=await nt.get({fs:t,gitdir:e}),n=await r.getSubsections("remote");return Promise.all(n.map(async a=>{let s=await r.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function gk({fs:t,dir:e,gitdir:r=O.join(e,".git")}){try{return C("fs",t),C("gitdir",r),await g8({fs:new J(t),gitdir:r})}catch(n){throw n.caller="git.listRemotes",n}}async function v8(t){let e=Qe.streamReader(t),r=[],n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,a,...s]=n.split(" "),o={ref:a,oid:i};for(let l of s){let[u,c]=l.split(":");u==="symref-target"?o.target=c:u==="peeled"&&(o.peeled=c)}r.push(o)}return r}async function w8({prefix:t,symrefs:e,peelTags:r}){let n=[];return n.push(Qe.encode(`command=ls-refs +`)),n.push(Qe.encode(`agent=${td.agent} +`)),(r||e||t)&&n.push(Qe.delim()),r&&n.push(Qe.encode("peel")),e&&n.push(Qe.encode("symrefs")),t&&n.push(Qe.encode(`ref-prefix ${t}`)),n.push(Qe.flush()),n}async function vk({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:u,symrefs:c,peelTags:f}){try{C("http",t),C("url",a);let d=await ko.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:n,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(d.protocolVersion===1)return nk(d,u,c,f);let h=await w8({prefix:u,symrefs:c,peelTags:f}),m=await ko.connect({http:t,auth:d.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:h});return v8(m.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function wk({fs:t,dir:e,gitdir:r=O.join(e,".git")}){try{return C("fs",t),C("gitdir",r),z.listTags({fs:new J(t),gitdir:r})}catch(n){throw n.caller="git.listTags",n}}function y8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function oE({fs:t,cache:e,gitdir:r,oid:n,fileId:i}){if(i===b8)return;let a=n,s,o=await xo({fs:t,cache:e,gitdir:r,oid:n}),l=o.tree;return i===o.oid?s=o.path:(s=await yk({fs:t,cache:e,gitdir:r,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function yk({fs:t,cache:e,gitdir:r,tree:n,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=n.entries().map(function(u){let c;return u.oid===i?(c=O.join(o,u.path),s.push(c)):u.type==="tree"&&(c=qe({fs:t,cache:e,gitdir:r,oid:u.oid}).then(function({object:f}){return yk({fs:t,cache:e,gitdir:r,tree:pr.from(f),fileId:i,oid:a,filepaths:s,parentPath:O.join(o,u.path)})})),c});return await Promise.all(l),s}async function _8({fs:t,cache:e,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l}){let u=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),c=[],f=await Qa.read({fs:t,gitdir:r}),d=await z.resolve({fs:t,gitdir:r,ref:i}),h=[await Eo({fs:t,cache:e,gitdir:r,oid:d})],m,g,v;function w(b){v&&n&&c.push(b)}for(;h.length>0;){let b=h.pop();if(u!==void 0&&b.commit.committer.timestamp<=u)break;if(n){let E;try{E=await yc({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:n}),g&&m!==E&&c.push(g),m=E,g=b,v=!0}catch(x){if(x instanceof Le){let k=l&&m;if(k&&(k=await oE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:m}),k))if(Array.isArray(k)){if(g){let A=await oE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:m});if(Array.isArray(A))if(k=k.filter(y=>A.indexOf(y)===-1),k.length===1)k=k[0],n=k,g&&c.push(g);else{k=!1,g&&c.push(g);break}}}else n=k,g&&c.push(g);if(!k){if(v&&m&&(c.push(g),!o))break;if(!o&&!l)throw x}g=b,v=!1}else throw x}}else c.push(b);if(a!==void 0&&c.length===a){w(b);break}if(!f.has(b.oid))for(let E of b.commit.parent){let x=await Eo({fs:t,cache:e,gitdir:r,oid:E});h.map(k=>k.oid).includes(x.oid)||h.push(x)}h.length===0&&w(b),h.sort((E,x)=>y8(E.commit,x.commit))}return c}async function bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:u={}}){try{return C("fs",t),C("gitdir",r),C("ref",i),await _8({fs:new J(t),cache:u,gitdir:r,filepath:n,ref:i,depth:a,since:s,force:o,follow:l})}catch(c){throw c.caller="git.log",c}}async function _k({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:u=!1,abortOnConflict:c=!0,message:f,author:d,committer:h,signingKey:m,cache:g={},mergeDriver:v,allowUnrelatedHistories:w=!1}){try{C("fs",t),m&&C("onSign",e);let b=new J(t),E=await da({fs:b,gitdir:n,author:d});if(!E&&(!o||!s))throw new zt("author");let x=await So({fs:b,gitdir:n,author:E,committer:h});if(!x&&(!o||!s))throw new zt("committer");return await WE({fs:b,cache:g,dir:r,gitdir:n,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:u,abortOnConflict:c,message:f,author:E,committer:x,signingKey:m,onSign:e,mergeDriver:v,allowUnrelatedHistories:w})}catch(b){throw b.caller="git.merge",b}}var x8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function xk({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),oids:i}){let a=new cE,s=[];function o(c,f){let d=Buffer.from(c,f);s.push(d),a.update(d)}async function l({stype:c,object:f}){let d=x8[c],h=f.length,m=h>15?128:0,g=h&15;h=h>>>4;let v=(m|d|g).toString(16);for(o(v,"hex");m;)m=h>127?128:0,v=m|h&127,o($g(2,v),"hex"),h=h>>>7;o(Buffer.from(await _E(f)))}o("PACK"),o("00000002","hex"),o($g(8,i.length),"hex");for(let c of i){let{type:f,object:d}=await qe({fs:t,cache:e,gitdir:n,oid:c});await l({write:o,object:d,stype:f})}let u=a.digest();return s.push(u),s}async function S8({fs:t,cache:e,gitdir:r,oids:n,write:i}){let a=await xk({fs:t,cache:e,gitdir:r,oids:n}),s=Buffer.from(await Yf(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(O.join(r,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function Sk({fs:t,dir:e,gitdir:r=O.join(e,".git"),oids:n,write:i=!1,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oids",n),await S8({fs:new J(t),cache:a,gitdir:r,oids:n,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function Ek({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=O.join(o,".git"),ref:u,url:c,remote:f,remoteRef:d,prune:h=!1,pruneTags:m=!1,fastForward:g=!0,fastForwardOnly:v=!1,corsProxy:w,singleBranch:b,headers:E={},author:x,committer:k,signingKey:A,cache:y={}}){try{C("fs",t),C("gitdir",l);let S=new J(t),_=await da({fs:S,gitdir:l,author:x});if(!_)throw new zt("author");let T=await So({fs:S,gitdir:l,author:_,committer:k});if(!T)throw new zt("committer");return await YE({fs:S,cache:y,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:u,url:c,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:v,corsProxy:w,singleBranch:b,headers:E,author:_,committer:T,signingKey:A,prune:h,pruneTags:m})}catch(S){throw S.caller="git.pull",S}}async function E8({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),start:i,finish:a}){let s=await Qa.read({fs:t,gitdir:n}),o=new Set,l=new Set;for(let f of i)o.add(await z.resolve({fs:t,gitdir:n,ref:f}));for(let f of a)try{let d=await z.resolve({fs:t,gitdir:n,ref:f});l.add(d)}catch(d){}let u=new Set;async function c(f){u.add(f);let{type:d,object:h}=await qe({fs:t,cache:e,gitdir:n,oid:f});if(d==="tag"){let g=Fr.from(h).headers().object;return c(g)}if(d!=="commit")throw new rr(f,d,"commit");if(!s.has(f)){let g=mr.from(h).headers().parent;for(f of g)!l.has(f)&&!u.has(f)&&await c(f)}}for(let f of o)await c(f);return u}async function yg({fs:t,cache:e,dir:r,gitdir:n=O.join(r,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:u}=await qe({fs:t,cache:e,gitdir:n,oid:o});if(l==="tag"){let f=Fr.from(u).headers().object;await s(f)}else if(l==="commit"){let f=mr.from(u).headers().tree;await s(f)}else if(l==="tree"){let c=pr.from(u);for(let f of c)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function k8(t){let e={},r="",n=Qe.streamReader(t),i=await n();for(;i!==!0;)i!==null&&(r+=i.toString("utf8")+` `),i=await n();let a=r.toString("utf8").split(` -`);if(i=a.shift(),!i.startsWith("unpack "))throw new ua('unpack ok" or "unpack [error message]',i);t.ok=i==="unpack ok",t.ok||(t.error=i.slice(7)),t.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);t.refs[u]={ok:o==="ok",error:f}}return t}async function EI({capabilities:e=[],triplets:t=[]}){let r=[],n=`\0 ${e.join(" ")}`;for(let i of t)r.push(Ve.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n} -`)),n="";return r.push(Ve.flush()),r}async function AI({fs:e,cache:t,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:v,headers:y={}}){let b=u||await ha({fs:e,gitdir:c});if(typeof b=="undefined")throw new er("ref");let x=await We.get({fs:e,gitdir:c});d=d||await x.get(`branch.${b}.pushRemote`)||await x.get("remote.pushDefault")||await x.get(`branch.${b}.remote`)||"origin";let E=h||await x.get(`remote.${d}.pushurl`)||await x.get(`remote.${d}.url`);if(typeof E=="undefined")throw new er("remote OR url");let _=f||await x.get(`branch.${b}.merge`);if(typeof E=="undefined")throw new er("remoteRef");v===void 0&&(v=await x.get("http.corsProxy"));let k=await W.expand({fs:e,gitdir:c,ref:b}),w=m?"0000000000000000000000000000000000000000":await W.resolve({fs:e,gitdir:c,ref:k}),A=As.getRemoteHelperFor({url:E}),S=await A.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:E,headers:y,protocolVersion:1}),T=S.auth,P;if(!_)P=k;else try{P=await W.expandAgainstMap({ref:_,map:S.refs})}catch(Y){if(Y instanceof Le)P=_.startsWith("refs/")?_:`refs/heads/${_}`;else throw Y}let I=S.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:E,localRef:{ref:m?"(delete)":k,oid:w},remoteRef:{ref:P,oid:I}}))throw new ws;let N=!S.capabilities.has("no-thin"),L=new Set;if(!m){let Y=[...S.refs.values()],O=new Set;if(I!=="0000000000000000000000000000000000000000"){let he=await Pp({fs:e,cache:t,gitdir:c,oids:[w,I]});for(let Ge of he)Y.push(Ge);N&&(O=await fp({fs:e,cache:t,gitdir:c,oids:he}))}if(!Y.includes(w)){let he=await xI({fs:e,cache:t,gitdir:c,start:[w],finish:Y});L=await fp({fs:e,cache:t,gitdir:c,oids:he})}if(N){try{let he=await W.resolve({fs:e,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Ge}=await W.resolveAgainstMap({ref:he.replace(`refs/remotes/${d}/`,""),fullref:he,map:S.refs}),gt=[Ge];for(let Re of await fp({fs:e,cache:t,gitdir:c,oids:gt}))O.add(Re)}catch(he){}for(let he of O)L.delete(he)}if(w===I&&(p=!0),!p){if(k.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new ys("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await T2({fs:e,cache:t,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new ys("not-fast-forward")}}let ee=b2([...S.capabilities],["report-status","side-band-64k",`agent=${gu.agent}`]),fe=await EI({capabilities:ee,triplets:[{oldoid:I,oid:w,fullRef:P}]}),J=m?[]:await R2({fs:e,cache:t,gitdir:c,oids:[...L]}),Q=await A.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:E,auth:T,headers:y,body:[...fe,...J]}),{packfile:Pe,progress:ge}=await cu.demux(Q.body);if(i){let Y=_2(ge);_l(Y,async O=>{await i(O)})}let z=await SI(Pe);if(Q.headers&&(z.headers=Q.headers),d&&z.ok&&z.refs[P].ok&&!k.startsWith("refs/tags")){let Y=`refs/remotes/${d}/${P.replace("refs/heads","")}`;m?await W.deleteRef({fs:e,gitdir:c,ref:Y}):await W.writeRef({fs:e,gitdir:c,ref:Y,value:w})}if(z.ok&&Object.values(z.refs).every(Y=>Y.ok))return z;{let Y=Object.entries(z.refs).filter(([O,he])=>!he.ok).map(([O,he])=>` - - ${O}: ${he.error}`).join("");throw new ul(Y,z)}}async function kI({fs:e,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=$(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:v,headers:y={},cache:b={}}){try{return C("fs",e),C("http",t),C("gitdir",c),await AI({fs:new X(e),cache:b,http:t,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:v,headers:y})}catch(x){throw x.caller="git.push",x}}async function M2({fs:e,cache:t,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:e,cache:t,gitdir:r,oid:n});if(i==="tag")return n=pr.from(a).parse().object,M2({fs:e,cache:t,gitdir:r,oid:n});if(i!=="blob")throw new zt(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function O2({fs:e,cache:t,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await bl({fs:e,cache:t,gitdir:r,oid:n,filepath:i})),await M2({fs:e,cache:t,gitdir:r,oid:n})}async function xl({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,filepath:i,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await O2({fs:new X(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function TI({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await ou({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function CI({fs:e,cache:t,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await W.resolve({gitdir:r,fs:e,ref:n}),{blob:s}=await O2({fs:e,cache:t,gitdir:r,oid:a,filepath:i});return s}async function PI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("ref",n),C("oid",i),await CI({fs:new X(e),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function RI({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{C("fs",e),C("gitdir",r),C("oid",n);let l=new X(e);a!==void 0&&(n=await bl({fs:l,cache:o,gitdir:r,oid:n,filepath:a}));let u=await qe({fs:l,cache:o,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(u.oid=n,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=rr.from(u.object).parse();break;case"tree":u.object=tr.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=pr.from(u.object).parse();break;default:throw new zt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function MI({fs:e,cache:t,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:e,cache:t,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new zt(n,i,"tag");let s=pr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function OI({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,cache:i={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await MI({fs:new X(e),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function II({fs:e,dir:t,gitdir:r=$(t,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return C("fs",e),C("gitdir",r),C("oid",n),await ks({fs:new X(e),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function FI({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,cache:i={}}){try{C("fs",e),C("gitdir",r),C("filepath",n),await yt.acquire({fs:new X(e),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function $I({fs:e,cache:t,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await W.resolve({gitdir:n,fs:e,ref:i})}catch(p){if(!(p instanceof Le))throw p}let f=(await ks({fs:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let d=await kp({fs:e,gitdir:n,tree:f});return await mu({fs:e,cache:t,onSign:r,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' -`,author:s,committer:o,signingKey:l})}async function LI({fs:e,onSign:t,dir:r,gitdir:n=$(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{C("fs",e),C("gitdir",n),C("oid",a);let u=new X(e),f=await fa({fs:u,gitdir:n,author:s});if(!f)throw new Vt("author");let d=await Ss({fs:u,gitdir:n,author:f,committer:o});if(!d)throw new Vt("committer");return await $I({fs:u,cache:c,onSign:t,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function DI({fs:e,gitdir:t,oldref:r,ref:n,checkout:i=!1}){if(n!==Qr.default.clean(n))throw new Wn(n,Qr.default.clean(n));if(r!==Qr.default.clean(r))throw new Wn(r,Qr.default.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await W.exists({fs:e,gitdir:t,ref:s}))throw new en("branch",n,!1);let l=await W.resolve({fs:e,gitdir:t,ref:a,depth:1});await W.writeRef({fs:e,gitdir:t,ref:s,value:l}),await W.deleteRef({fs:e,gitdir:t,ref:a});let u=await ha({fs:e,gitdir:t,fullname:!0})===a;(i||u)&&await W.writeSymbolicRef({fs:e,gitdir:t,ref:"HEAD",value:s})}async function NI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,oldref:i,checkout:a=!1}){try{return C("fs",e),C("gitdir",r),C("ref",n),C("oldref",i),await DI({fs:new X(e),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function I2({gitdir:e,type:t,object:r}){return Vn(xi.wrap({type:t,object:r}))}async function BI({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,ref:i,cache:a={}}){try{C("fs",e),C("gitdir",r),C("filepath",n);let s=new X(e),o,l;try{o=await W.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await bl({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=t&&await s.read($(t,n));u&&(l=await I2({gitdir:r,type:"blob",object:u}),o===l&&(c=await s.lstat($(t,n)))),await yt.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function jI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,depth:i}){try{return C("fs",e),C("gitdir",r),C("ref",n),await W.resolve({fs:new X(e),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function HI({fs:e,dir:t,gitdir:r=$(t,".git"),path:n,value:i,append:a=!1}){try{C("fs",e),C("gitdir",r),C("path",n);let s=new X(e),o=await We.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await We.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function UI({fs:e,dir:t,gitdir:r=$(t,".git"),filepath:n,cache:i={}}){try{C("fs",e),C("gitdir",r),C("filepath",n);let a=new X(e);if(await xs.isIgnored({fs:a,gitdir:r,dir:t,filepath:n}))return"ignored";let o=await GI({fs:a,cache:i,gitdir:r}),l=await F2({fs:a,cache:i,gitdir:r,tree:o,path:n}),c=await yt.acquire({fs:a,gitdir:r,cache:i},async function(m){for(let v of m)if(v.path===n)return v;return null}),u=await a.lstat($(t,n)),f=l!==null,d=c!==null,h=u!==null,p=async()=>{if(d&&!eu(c,u))return c.oid;{let m=await a.read($(t,n)),v=await I2({gitdir:r,type:"blob",object:m});return d&&c.oid===v&&u.size!==-1&&yt.acquire({fs:a,gitdir:r,cache:i},async function(y){y.insert({filepath:n,stats:u,oid:v})}),v}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await p()===c.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===c.oid,"*deleted";if(f&&h&&!d)return await p()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let m=await p();return m===l?m===c.oid?"unmodified":"*unmodified":m===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function F2({fs:e,cache:t,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of n)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await qe({fs:e,cache:t,gitdir:r,oid:s.oid});if(o==="tree"){let c=tr.from(l);return F2({fs:e,cache:t,gitdir:r,tree:c,path:i})}if(o==="blob")throw new zt(s.oid,o,"blob",i.join("/"))}return null}async function GI({fs:e,cache:t,gitdir:r}){let n;try{n=await W.resolve({fs:e,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Le)return[]}let{tree:i}=await ks({fs:e,cache:t,gitdir:r,oid:n});return i}async function zI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{C("fs",e),C("gitdir",r),C("ref",n);let l=new X(e);return await _s({fs:l,cache:s,dir:t,gitdir:r,trees:[bi({ref:n}),pu(),hu()],map:async function(c,[u,f,d]){if(!u&&!d&&f&&!o&&await xs.isIgnored({fs:l,dir:t,filepath:c})||!i.some(k=>y2(c,k)))return null;if(a&&!a(c))return;let[h,p,m]=await Promise.all([u&&u.type(),f&&f.type(),d&&d.type()]),v=[h,p,m].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((p==="tree"||p==="special")&&!v)return;if(m==="commit")return null;if((m==="tree"||m==="special")&&!v)return;let y=h==="blob"?await u.oid():void 0,b=m==="blob"?await d.oid():void 0,x;h!=="blob"&&p==="blob"&&m!=="blob"?x="42":p==="blob"&&(x=await f.oid());let E=[void 0,y,x,b],_=E.map(k=>E.indexOf(k));return _.shift(),[c,..._]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function VI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,object:i,force:a=!1}){try{C("fs",e),C("gitdir",r),C("ref",n);let s=new X(e);if(n===void 0)throw new er("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await W.resolve({fs:s,gitdir:r,ref:i||"HEAD"});if(!a&&await W.exists({fs:s,gitdir:r,ref:n}))throw new en("tag",n);await W.writeRef({fs:s,gitdir:r,ref:n,value:o})}catch(s){throw s.caller="git.tag",s}}async function WI({fs:e,dir:t,gitdir:r=$(t,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{C("fs",e),C("gitdir",r),C("filepath",i);let u=new X(e);if(l)return await yt.acquire({fs:u,gitdir:r,cache:n},async function(d){let h;if(!c&&(h=await u.lstat($(t,i)),h)){if(h.isDirectory())throw new Si("directory");return}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await u.lstat($(t,i)),!f)throw new Le(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new Si("directory")}return await yt.acquire({fs:u,gitdir:r,cache:n},async function(d){if(!o&&!d.has({filepath:i}))throw new Le(`file at "${i}" in index and "add" not set`);let h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};if(!a){h=f;let p=h.isSymbolicLink()?await u.readlink($(t,i)):await u.read($(t,i));a=await mr({fs:u,gitdir:r,type:"blob",format:"content",object:p})}return d.insert({filepath:i,oid:a,stats:h}),a})}catch(u){throw u.caller="git.updateIndex",u}}function qI(){try{return gu.version}catch(e){throw e.caller="git.version",e}}async function YI({fs:e,dir:t,gitdir:r=$(t,".git"),trees:n,map:i,reduce:a,iterate:s,cache:o={}}){try{return C("fs",e),C("gitdir",r),C("trees",n),await _s({fs:new X(e),cache:o,dir:t,gitdir:r,trees:n,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function XI({fs:e,dir:t,gitdir:r=$(t,".git"),blob:n}){try{return C("fs",e),C("gitdir",r),C("blob",n),await mr({fs:new X(e),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function ZI({fs:e,gitdir:t,commit:r}){let n=rr.from(r).toObject();return await mr({fs:e,gitdir:t,type:"commit",object:n,format:"content"})}async function KI({fs:e,dir:t,gitdir:r=$(t,".git"),commit:n}){try{return C("fs",e),C("gitdir",r),C("commit",n),await ZI({fs:new X(e),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function JI({fs:e,dir:t,gitdir:r=$(t,".git"),type:n,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new X(e);if(a==="parsed"){switch(n){case"commit":i=rr.from(i).toObject();break;case"tree":i=tr.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=pr.from(i).toObject();break;default:throw new zt(s||"",n,"blob|commit|tag|tree")}a="content"}return s=await mr({fs:l,gitdir:r,type:n,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function QI({fs:e,dir:t,gitdir:r=$(t,".git"),ref:n,value:i,force:a=!1,symbolic:s=!1}){try{C("fs",e),C("gitdir",r),C("ref",n),C("value",i);let o=new X(e);if(n!==Qr.default.clean(n))throw new Wn(n,Qr.default.clean(n));if(!a&&await W.exists({fs:o,gitdir:r,ref:n}))throw new en("ref",n);s?await W.writeSymbolicRef({fs:o,gitdir:r,ref:n,value:i}):(i=await W.resolve({fs:o,gitdir:r,ref:i}),await W.writeRef({fs:o,gitdir:r,ref:n,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function e8({fs:e,gitdir:t,tag:r}){let n=pr.from(r).toObject();return await mr({fs:e,gitdir:t,type:"tag",object:n,format:"content"})}async function t8({fs:e,dir:t,gitdir:r=$(t,".git"),tag:n}){try{return C("fs",e),C("gitdir",r),C("tag",n),await e8({fs:new X(e),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function r8({fs:e,dir:t,gitdir:r=$(t,".git"),tree:n}){try{return C("fs",e),C("gitdir",r),C("tree",n),await kp({fs:new X(e),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var n8={Errors:wl,STAGE:hu,TREE:bi,WORKDIR:pu,add:rO,abortMerge:K6,addNote:iO,addRemote:aO,annotatedTag:oO,branch:cO,checkout:fO,clone:xO,commit:SO,getConfig:zO,getConfigAll:WO,setConfig:HI,currentBranch:EO,deleteBranch:kO,deleteRef:TO,deleteRemote:PO,deleteTag:MO,expandOid:$O,expandRef:LO,fastForward:jO,fetch:HO,findMergeBase:UO,findRoot:GO,getRemoteInfo:qO,getRemoteInfo2:YO,hashBlob:ZO,indexPack:JO,init:QO,isDescendent:eI,isIgnored:tI,listBranches:rI,listFiles:iI,listNotes:sI,listRemotes:lI,listServerRefs:fI,listTags:dI,log:gI,merge:vI,packObjects:bI,pull:_I,push:kI,readBlob:xl,readCommit:TI,readNote:PI,readObject:RI,readTag:OI,readTree:II,remove:FI,removeNote:LI,renameBranch:NI,resetIndex:BI,updateIndex:WI,resolveRef:jI,status:UI,statusMatrix:zI,tag:VI,version:qI,walk:YI,writeBlob:XI,writeCommit:KI,writeObject:JI,writeRef:QI,writeTag:t8,writeTree:r8},ie=n8;var xe=require("obsidian"),LP=ze(require("path"));g();var Aa=require("obsidian");g();var Yg=require("child_process"),xT=ze(wu()),_r=ze(require("fs/promises")),Jn=require("obsidian"),De=ze(require("path")),Yl=require("path");g();var Iu=ze(j2(),1),Pu=ze(wu(),1),d_=require("child_process"),X_=ze(Mp(),1),Ms=ze(Mp(),1),_x=require("node:events"),Mu=Object.defineProperty,x8=Object.defineProperties,S8=Object.getOwnPropertyDescriptor,E8=Object.getOwnPropertyDescriptors,Kp=Object.getOwnPropertyNames,H2=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,A8=Object.prototype.propertyIsEnumerable,U2=(e,t,r)=>t in e?Mu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$r=(e,t)=>{for(var r in t||(t={}))bb.call(t,r)&&U2(e,r,t[r]);if(H2)for(var r of H2(t))A8.call(t,r)&&U2(e,r,t[r]);return e},Al=(e,t)=>x8(e,E8(t)),V=(e,t)=>function(){return e&&(t=(0,e[Kp(e)[0]])(e=0)),t},k8=(e,t)=>function(){return t||(0,e[Kp(e)[0]])((t={exports:{}}).exports,t),t.exports},at=(e,t)=>{for(var r in t)Mu(e,r,{get:t[r],enumerable:!0})},T8=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kp(t))!bb.call(e,i)&&i!==r&&Mu(e,i,{get:()=>t[i],enumerable:!(n=S8(t,i))||n.enumerable});return e},Qe=e=>T8(Mu({},"__esModule",{value:!0}),e),El=(e,t,r)=>new Promise((n,i)=>{var a=l=>{try{o(r.next(l))}catch(c){i(c)}},s=l=>{try{o(r.throw(l))}catch(c){i(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(e,t)).next())});function C8(...e){let t=new String(e);return Ou.set(t,e),t}function Tu(e){return e instanceof String&&Ou.has(e)}function G2(e){return Ou.get(e)||[]}var Ou,Pl=V({"src/lib/args/pathspec.ts"(){"use strict";Ou=new WeakMap}}),wr,Ai=V({"src/lib/errors/git-error.ts"(){"use strict";wr=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),Rl,Is=V({"src/lib/errors/git-response-error.ts"(){"use strict";Ai(),Rl=class extends wr{constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),_b,xb=V({"src/lib/errors/task-configuration-error.ts"(){"use strict";Ai(),_b=class extends wr{constructor(e){super(void 0,e)}}}});function Sb(e){return typeof e=="function"?e:ya}function Eb(e){return typeof e=="function"&&e!==ya}function Ab(e,t){let r=e.indexOf(t);return r<=0?[e,""]:[e.substr(0,r),e.substr(r+1)]}function kb(e,t=0){return Tb(e)&&e.length>t?e[t]:void 0}function va(e,t=0){if(Tb(e)&&e.length>t)return e[e.length-1-t]}function Tb(e){return!!(e&&typeof e.length=="number")}function Ml(e="",t=!0,r=` -`){return e.split(r).reduce((n,i)=>{let a=t?i.trim():i;return a&&n.push(a),n},[])}function Jp(e,t){return Ml(e,!0).map(r=>t(r))}function Qp(e){return(0,Iu.exists)(e,Iu.FOLDER)}function Te(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function Cb(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function Fu(e,t){if(Array.isArray(e)){let r=e.indexOf(t);r>=0&&e.splice(r,1)}else e.delete(t);return t}function Sn(e){return Array.isArray(e)?e:[e]}function Pb(e){return e.replace(/[\s-]+(.)/g,(t,r)=>r.toUpperCase())}function Rb(e){return Sn(e).map(String)}function Fe(e,t=0){if(e==null)return t;let r=parseInt(e,10);return isNaN(r)?t:r}function kl(e,t){let r=[];for(let n=0,i=e.length;nr in e?{[r]:e[r]}:{}))}function Np(e=0){return new Promise(t=>setTimeout(t,e))}function Bp(e){if(e!==!1)return e}var Os,ya,Ol,$u=V({"src/lib/utils/util.ts"(){"use strict";Os="\0",ya=()=>{},Ol=Object.prototype.toString.call.bind(Object.prototype.toString)}});function En(e,t,r){return t(e)?e:arguments.length>2?r:void 0}function em(e,t){let r=Tu(e)?"string":typeof e;return/number|string|boolean/.test(r)&&(!t||!t.includes(r))}function tm(e){return!!e&&Ol(e)==="[object Object]"}function Ob(e){return typeof e=="function"}var Il,Mt,Ib,Cu,rm,Fb=V({"src/lib/utils/argument-filters.ts"(){"use strict";$u(),Pl(),Il=e=>Array.isArray(e),Mt=e=>typeof e=="string",Ib=e=>Array.isArray(e)&&e.every(Mt),Cu=e=>Mt(e)||Array.isArray(e)&&e.every(Mt),rm=e=>e==null||"number|boolean|function".includes(typeof e)?!1:Array.isArray(e)||typeof e=="string"||typeof e.length=="number"}}),jp,P8=V({"src/lib/utils/exit-codes.ts"(){"use strict";jp=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.NOT_FOUND=-2]="NOT_FOUND",e[e.UNCLEAN=128]="UNCLEAN",e))(jp||{})}}),Cl,R8=V({"src/lib/utils/git-output-streams.ts"(){"use strict";Cl=class{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new Cl(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),ce,Ei,M8=V({"src/lib/utils/line-parser.ts"(){"use strict";ce=class{constructor(e,t){this.matches=[],this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,r(a)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}useMatches(e,t){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,r){let n=r&&e.exec(r);return n&&this.pushMatch(t,n),!!n}pushMatch(e,t){this.matches.push(...t.slice(1))}},Ei=class extends ce{addMatch(e,t,r){return/^remote:\s/.test(String(r))&&super.addMatch(e,t,r)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function $b(...e){let t=process.cwd(),r=Object.assign($r({baseDir:t},Lb),...e.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||t,r.trimmed=r.trimmed===!0,r}var Lb,O8=V({"src/lib/utils/simple-git-options.ts"(){"use strict";Lb={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function nm(e,t=[]){return tm(e)?Object.keys(e).reduce((r,n)=>{let i=e[n];return Tu(i)?r.push(i):em(i,["boolean"])?r.push(n+"="+i):r.push(n),r},t):t}function nr(e,t=0,r=!1){let n=[];for(let i=0,a=t<0?e.length:t;i{for(let a=Ml(i,n),s=0,o=a.length;s{if(!(s+c>=o))return a[s+c]};t.some(({parse:c})=>c(l,e))}}),e}var $8=V({"src/lib/utils/task-parser.ts"(){"use strict";$u()}}),Db={};at(Db,{ExitCodes:()=>jp,GitOutputStreams:()=>Cl,LineParser:()=>ce,NOOP:()=>ya,NULL:()=>Os,RemoteLineParser:()=>Ei,append:()=>Te,appendTaskOptions:()=>nm,asArray:()=>Sn,asCamelCase:()=>Pb,asFunction:()=>Sb,asNumber:()=>Fe,asStringArray:()=>Rb,bufferToString:()=>Tl,callTaskParser:()=>Hp,createInstanceConfig:()=>$b,delay:()=>Np,filterArray:()=>Il,filterFunction:()=>Ob,filterHasLength:()=>rm,filterPlainObject:()=>tm,filterPrimitives:()=>em,filterString:()=>Mt,filterStringArray:()=>Ib,filterStringOrStringArray:()=>Cu,filterType:()=>En,first:()=>kb,folderExists:()=>Qp,forEachLineWithContent:()=>Jp,getTrailingOptions:()=>nr,including:()=>Cb,isUserFunction:()=>Eb,last:()=>va,objectToString:()=>Ol,orVoid:()=>Bp,parseStringResponse:()=>ar,pick:()=>Mb,prefixedArray:()=>kl,remove:()=>Fu,splitOn:()=>Ab,toLinesWithContent:()=>Ml,trailingFunctionArgument:()=>et,trailingOptionsArgument:()=>im});var oe=V({"src/lib/utils/index.ts"(){"use strict";Fb(),P8(),R8(),M8(),O8(),F8(),$8(),$u()}}),Nb={};at(Nb,{CheckRepoActions:()=>Up,checkIsBareRepoTask:()=>jb,checkIsRepoRootTask:()=>Bb,checkIsRepoTask:()=>L8});function L8(e){switch(e){case"bare":return jb();case"root":return Bb()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:Lu,parser:am}}function Bb(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:Lu,parser(t){return/^\.(git)?$/.test(t.trim())}}}function jb(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:Lu,parser:am}}function D8(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var Up,Lu,am,Hb=V({"src/lib/tasks/check-is-repo.ts"(){"use strict";oe(),Up=(e=>(e.BARE="bare",e.IN_TREE="tree",e.IS_REPO_ROOT="root",e))(Up||{}),Lu=({exitCode:e},t,r,n)=>{if(e===128&&D8(t))return r(Buffer.from("false"));n(t)},am=e=>e.trim()==="true"}});function N8(e,t){let r=new Ub(e),n=e?zb:Gb;return Ml(t).forEach(i=>{let a=i.replace(n,"");r.paths.push(a),(Vb.test(a)?r.folders:r.files).push(a)}),r}var Ub,Gb,zb,Vb,B8=V({"src/lib/responses/CleanSummary.ts"(){"use strict";oe(),Ub=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},Gb=/^[a-z]+\s*/i,zb=/^[a-z]+\s+[a-z]+\s*/i,Vb=/\/$/}}),Gp={};at(Gp,{EMPTY_COMMANDS:()=>Du,adhocExecTask:()=>Wb,configurationErrorTask:()=>ir,isBufferTask:()=>Yb,isEmptyTask:()=>Xb,straightThroughBufferTask:()=>qb,straightThroughStringTask:()=>Wt});function Wb(e){return{commands:Du,format:"empty",parser:e}}function ir(e){return{commands:Du,format:"empty",parser(){throw typeof e=="string"?new _b(e):e}}}function Wt(e,t=!1){return{commands:e,format:"utf-8",parser(r){return t?String(r).trim():r}}}function qb(e){return{commands:e,format:"buffer",parser(t){return t}}}function Yb(e){return e.format==="buffer"}function Xb(e){return e.format==="empty"||!e.commands.length}var Du,it=V({"src/lib/tasks/task.ts"(){"use strict";xb(),Du=[]}}),Zb={};at(Zb,{CONFIG_ERROR_INTERACTIVE_MODE:()=>sm,CONFIG_ERROR_MODE_REQUIRED:()=>om,CONFIG_ERROR_UNKNOWN_OPTION:()=>lm,CleanOptions:()=>Su,cleanTask:()=>Kb,cleanWithOptionsTask:()=>j8,isCleanOptionsArray:()=>H8});function j8(e,t){let{cleanMode:r,options:n,valid:i}=U8(e);return r?i.options?(n.push(...t),n.some(V8)?ir(sm):Kb(r,n)):ir(lm+JSON.stringify(e)):ir(om)}function Kb(e,t){return{commands:["clean",`-${e}`,...t],format:"utf-8",parser(n){return N8(e==="n",n)}}}function H8(e){return Array.isArray(e)&&e.every(t=>cm.has(t))}function U8(e){let t,r=[],n={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,"").split("").forEach(i=>{G8(i)?(t=i,n.cleanMode=!0):n.options=n.options&&z8(r[r.length]=`-${i}`)}),{cleanMode:t,options:r,valid:n}}function G8(e){return e==="f"||e==="n"}function z8(e){return/^-[a-z]$/i.test(e)&&cm.has(e.charAt(1))}function V8(e){return/^-[^\-]/.test(e)?e.indexOf("i")>0:e==="--interactive"}var sm,om,lm,Su,cm,Jb=V({"src/lib/tasks/clean.ts"(){"use strict";B8(),oe(),it(),sm="Git clean interactive mode is not supported",om='Git clean mode parameter ("n" or "f") is required',lm="Git clean unknown option found in: ",Su=(e=>(e.DRY_RUN="n",e.FORCE="f",e.IGNORED_INCLUDED="x",e.IGNORED_ONLY="X",e.EXCLUDING="e",e.QUIET="q",e.RECURSIVE="d",e))(Su||{}),cm=new Set(["i",...Rb(Object.values(Su))])}});function W8(e){let t=new e_;for(let r of Qb(e))t.addValue(r.file,String(r.key),r.value);return t}function q8(e,t){let r=null,n=[],i=new Map;for(let a of Qb(e,t))a.key===t&&(n.push(r=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(r));return{key:t,paths:Array.from(i.keys()),scopes:i,value:r,values:n}}function Y8(e){return e.replace(/^(file):/,"")}function*Qb(e,t=null){let r=e.split("\0");for(let n=0,i=r.length-1;nObject.assign(e,this.values[t]),{})),this._all}addFile(e){if(!(e in this.values)){let t=va(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,r){let n=this.addFile(e);n.hasOwnProperty(t)?Array.isArray(n[t])?n[t].push(r):n[t]=[n[t],r]:n[t]=r,this._all=void 0}}}});function Op(e,t){return typeof e=="string"&&zp.hasOwnProperty(e)?e:t}function Z8(e,t,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(e,t),{commands:i,format:"utf-8",parser(a){return a}}}function K8(e,t){let r=["config","--null","--show-origin","--get-all",e];return t&&r.splice(1,0,`--${t}`),{commands:r,format:"utf-8",parser(n){return q8(n,e)}}}function J8(e){let t=["config","--list","--show-origin","--null"];return e&&t.push(`--${e}`),{commands:t,format:"utf-8",parser(r){return W8(r)}}}function Q8(){return{addConfig(e,t,...r){return this._runTask(Z8(e,t,r[0]===!0,Op(r[1],"local")),et(arguments))},getConfig(e,t){return this._runTask(K8(e,Op(t,void 0)),et(arguments))},listConfig(...e){return this._runTask(J8(Op(e[0],void 0)),et(arguments))}}}var zp,t_=V({"src/lib/tasks/config.ts"(){"use strict";X8(),oe(),zp=(e=>(e.system="system",e.global="global",e.local="local",e.worktree="worktree",e))(zp||{})}});function eF(e){return r_.has(e)}var Ip,r_,n_=V({"src/lib/tasks/diff-name-status.ts"(){"use strict";Ip=(e=>(e.ADDED="A",e.COPIED="C",e.DELETED="D",e.MODIFIED="M",e.RENAMED="R",e.CHANGED="T",e.UNMERGED="U",e.UNKNOWN="X",e.BROKEN="B",e))(Ip||{}),r_=new Set(Object.values(Ip))}});function tF(...e){return new a_().param(...e)}function rF(e){let t=new Set,r={};return Jp(e,n=>{let[i,a,s]=n.split(Os);t.add(i),(r[i]=r[i]||[]).push({line:Fe(a),path:i,preview:s})}),{paths:t,results:r}}function nF(){return{grep(e){let t=et(arguments),r=nr(arguments);for(let i of i_)if(r.includes(i))return this._runTask(ir(`git.grep: use of "${i}" is not supported.`),t);typeof e=="string"&&(e=tF().param(e));let n=["grep","--null","-n","--full-name",...r,...e];return this._runTask({commands:n,format:"utf-8",parser(i){return rF(i)}},t)}}}var i_,Sl,z2,a_,s_=V({"src/lib/tasks/grep.ts"(){"use strict";oe(),it(),i_=["-h"],Sl=Symbol("grepQuery"),a_=class{constructor(){this[z2]=[]}*[(z2=Sl,Symbol.iterator)](){for(let e of this[Sl])yield e}and(...e){return e.length&&this[Sl].push("--and","(",...kl(e,"-e"),")"),this}param(...e){return this[Sl].push(...kl(e,"-e")),this}}}}),o_={};at(o_,{ResetMode:()=>Eu,getResetMode:()=>aF,resetTask:()=>iF});function iF(e,t){let r=["reset"];return l_(e)&&r.push(`--${e}`),r.push(...t),Wt(r)}function aF(e){if(l_(e))return e;switch(typeof e){case"string":case"undefined":return"soft"}}function l_(e){return c_.includes(e)}var Eu,c_,u_=V({"src/lib/tasks/reset.ts"(){"use strict";it(),Eu=(e=>(e.MIXED="mixed",e.SOFT="soft",e.HARD="hard",e.MERGE="merge",e.KEEP="keep",e))(Eu||{}),c_=Array.from(Object.values(Eu))}});function sF(){return(0,Pu.default)("simple-git")}function V2(e,t,r){return!t||!String(t).replace(/\s*/,"")?r?(n,...i)=>{e(n,...i),r(n,...i)}:e:(n,...i)=>{e(`%s ${n}`,t,...i),r&&r(n,...i)}}function oF(e,t,{namespace:r}){if(typeof e=="string")return e;let n=t&&t.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function um(e,t,r,n=sF()){let i=e&&`[${e}]`||"",a=[],s=typeof t=="string"?n.extend(t):t,o=oF(En(t,Mt),s,n);return c(r);function l(u,f){return Te(a,um(e,o.replace(/^[^:]+/,u),f,n))}function c(u){let f=u&&`[${u}]`||"",d=s&&V2(s,f)||ya,h=V2(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:e,sibling:l,info:h,step:c})}}var f_=V({"src/lib/git-logger.ts"(){"use strict";oe(),Pu.default.formatters.L=e=>String(rm(e)?e.length:"-"),Pu.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString("utf8"):Ol(e)}}),_u,Vp,lF=V({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";Ai(),f_(),_u=class{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let t=_u.getName(e.commands[0]),r=um(this.logLabel,t);return{task:e,logger:r,name:t}}push(e){let t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:r}]of Array.from(this._queue.entries()))t===e.task?(r.info("Failed %o",e),r("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):r.info("A fatal exception occurred in a previous task, the queue has been purged: %o",e.message),this.complete(t);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new wr(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++_u.counter}`}},Vp=_u,Vp.counter=0}});function ga(e,t){return{method:kb(e.commands)||"",commands:t}}function cF(e,t){return r=>{t("[ERROR] child process exception %o",r),e.push(Buffer.from(String(r.stack),"ascii"))}}function W2(e,t,r,n){return i=>{r("%s received %L bytes",t,i),n("%B",i),e.push(i)}}var Wp,uF=V({"src/lib/runners/git-executor-chain.ts"(){"use strict";Ai(),it(),oe(),lF(),Wp=class{constructor(e,t,r){this._executor=e,this._scheduler=t,this._plugins=r,this._chain=Promise.resolve(),this._queue=new Vp}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}attemptTask(e){return El(this,null,function*(){let t=yield this._scheduler.next(),r=()=>this._queue.complete(e);try{let{logger:n}=this._queue.attempt(e);return yield Xb(e)?this.attemptEmptyTask(e,n):this.attemptRemoteTask(e,n)}catch(n){throw this.onFatalException(e,n)}finally{r(),t()}})}onFatalException(e,t){let r=t instanceof wr?Object.assign(t,{task:e}):new wr(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(r),r}attemptRemoteTask(e,t){return El(this,null,function*(){let r=this._plugins.exec("spawn.binary","",ga(e,e.commands)),n=this._plugins.exec("spawn.args",[...e.commands],ga(e,e.commands)),i=yield this.gitResponse(e,r,n,this.outputHandler,t.step("SPAWN")),a=yield this.handleTaskData(e,n,i,t.step("HANDLE"));return t("passing response to task's parser as a %s",e.format),Yb(e)?Hp(e.parser,a):Hp(e.parser,a.asStrings())})}attemptEmptyTask(e,t){return El(this,null,function*(){return t("empty task bypassing child process to call to task's parser"),e.parser(this)})}handleTaskData(e,t,r,n){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=r;return new Promise((l,c)=>{n("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:a},$r($r({},ga(e,t)),r));if(u&&e.onError)return n.info("exitCode=%s handling with custom error handler"),e.onError(r,u,f=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Ol(f)),l(new Cl(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),c(u);n.info("retrieving task output complete"),l(new Cl(Buffer.concat(s),Buffer.concat(o)))})}gitResponse(e,t,r,n,i){return El(this,null,function*(){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},ga(e,e.commands));return new Promise(o=>{let l=[],c=[];i.info("%s %o",t,r),i("%O",s);let u=this._beforeSpawn(e,r);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,Al($r({},ga(e,r)),{kill(d){u=d||u}}));let f=(0,d_.spawn)(t,r,s);f.stdout.on("data",W2(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",W2(c,"stdErr",i,a.step("stdErr"))),f.on("error",cF(c,i)),n&&(i("Passing child process stdOut/stdErr to custom outputHandler"),n(t,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,Al($r({},ga(e,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(e,t){let r;return this._plugins.exec("spawn.before",void 0,Al($r({},ga(e,t)),{kill(n){r=n||r}})),r}}}}),h_={};at(h_,{GitExecutor:()=>p_});var p_,fF=V({"src/lib/runners/git-executor.ts"(){"use strict";uF(),p_=class{constructor(e,t,r){this.cwd=e,this._scheduler=t,this._plugins=r,this._chain=new Wp(this,this._scheduler,this._plugins)}chain(){return new Wp(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function dF(e,t,r=ya){let n=a=>{r(null,a)},i=a=>{(a==null?void 0:a.task)===e&&r(a instanceof Rl?hF(a):a,void 0)};t.then(n,i)}function hF(e){let t=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),t=ya};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(r,{}));function r(n,i){return i in e||(n[i]={enumerable:!1,configurable:!1,get(){return t(i),e.git[i]}}),n}}var pF=V({"src/lib/task-callback.ts"(){"use strict";Is(),oe()}});function q2(e,t){return Wb(r=>{if(!Qp(e))throw new Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||r).cwd=e})}var mF=V({"src/lib/tasks/change-working-directory.ts"(){"use strict";oe(),it()}});function Fp(e){let t=["checkout",...e];return t[1]==="-b"&&t.includes("-B")&&(t[1]=Fu(t,"-B")),Wt(t)}function gF(){return{checkout(){return this._runTask(Fp(nr(arguments,1)),et(arguments))},checkoutBranch(e,t){return this._runTask(Fp(["-b",e,t,...nr(arguments)]),et(arguments))},checkoutLocalBranch(e){return this._runTask(Fp(["-b",e,...nr(arguments)]),et(arguments))}}}var vF=V({"src/lib/tasks/checkout.ts"(){"use strict";oe(),it()}});function yF(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function wF(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(e){return ar(yF(),[m_],e)}})}}}var m_,bF=V({"src/lib/tasks/count-objects.ts"(){"use strict";oe(),m_=new ce(/([a-z-]+): (\d+)$/,(e,[t,r])=>{let n=Pb(t);e.hasOwnProperty(n)&&(e[n]=Fe(r))})}});function _F(e){return ar({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},g_,e)}var g_,xF=V({"src/lib/parsers/parse-commit.ts"(){"use strict";oe(),g_=[new ce(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,r,n])=>{e.branch=t,e.commit=n,e.root=!!r}),new ce(/\s*Author:\s(.+)/i,(e,[t])=>{let r=t.split("<"),n=r.pop();!n||!n.includes("@")||(e.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new ce(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,r,n])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(r,10)||0,e.summary.deletions=parseInt(n,10)||0}),new ce(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,r,n])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(r,10)||0;n==="-"?e.summary.deletions=i:n==="+"&&(e.summary.insertions=i)})]}});function SF(e,t,r){return{commands:["-c","core.abbrev=40","commit",...kl(e,"-m"),...t,...r],format:"utf-8",parser:_F}}function EF(){return{commit(t,...r){let n=et(arguments),i=e(t)||SF(Sn(t),Sn(En(r[0],Cu,[])),[...En(r[1],Il,[]),...nr(arguments,0,!0)]);return this._runTask(i,n)}};function e(t){return!Cu(t)&&ir("git.commit: requires the commit message to be supplied as a string/string[]")}}var AF=V({"src/lib/tasks/commit.ts"(){"use strict";xF(),oe(),it()}});function kF(){return{firstCommit(){return this._runTask(Wt(["rev-list","--max-parents=0","HEAD"],!0),et(arguments))}}}var TF=V({"src/lib/tasks/first-commit.ts"(){"use strict";oe(),it()}});function CF(e,t){let r=["hash-object",e];return t&&r.push("-w"),Wt(r,!0)}var PF=V({"src/lib/tasks/hash-object.ts"(){"use strict";it()}});function RF(e,t,r){let n=String(r).trim(),i;if(i=v_.exec(n))return new Au(e,t,!1,i[1]);if(i=y_.exec(n))return new Au(e,t,!0,i[1]);let a="",s=n.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new Au(e,t,/^re/i.test(n),a)}var Au,v_,y_,MF=V({"src/lib/responses/InitSummary.ts"(){"use strict";Au=class{constructor(e,t,r,n){this.bare=e,this.path=t,this.existing=r,this.gitDir=n}},v_=/^Init.+ repository in (.+)$/,y_=/^Rein.+ in (.+)$/}});function OF(e){return e.includes(fm)}function IF(e=!1,t,r){let n=["init",...r];return e&&!OF(n)&&n.splice(1,0,fm),{commands:n,format:"utf-8",parser(i){return RF(n.includes("--bare"),t,i)}}}var fm,FF=V({"src/lib/tasks/init.ts"(){"use strict";MF(),fm="--bare"}});function dm(e){for(let t=0;tar(new w_,t,r,!1)}var $p,Y2,X2,Z2,__,x_=V({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Fl(),LF(),n_(),oe(),$p=[new ce(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,r,n=""])=>{e.files.push({file:t.trim(),changes:Fe(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new ce(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,r,n])=>{e.files.push({file:t.trim(),before:Fe(r),after:Fe(n),binary:!0})}),new ce(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,r])=>{let n=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);e.changed=Fe(t),e.insertions=Fe(n==null?void 0:n[1]),e.deletions=Fe(i==null?void 0:i[1])})],Y2=[new ce(/(\d+)\t(\d+)\t(.+)$/,(e,[t,r,n])=>{let i=Fe(t),a=Fe(r);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:n,changes:i+a,insertions:i,deletions:a,binary:!1})}),new ce(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],X2=[new ce(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],Z2=[new ce(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,r,n,i,a])=>{e.changed++,e.files.push({file:a!=null?a:n,changes:0,insertions:0,deletions:0,binary:!1,status:Bp(eF(t)&&t),from:Bp(!!a&&n!==a&&n),similarity:Fe(r)})})],__={"":$p,"--stat":$p,"--numstat":Y2,"--name-status":Z2,"--name-only":X2}}});function DF(e,t){return t.reduce((r,n,i)=>(r[n]=e[i]||"",r),Object.create({diff:null}))}function S_(e=gm,t=E_,r=""){let n=b_(r);return function(i){let a=Ml(i.trim(),!1,pm).map(function(s){let o=s.split(mm),l=DF(o[0].split(e),t);return o.length>1&&o[1].trim()&&(l.diff=n(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var pm,mm,gm,E_,A_=V({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";oe(),x_(),Fl(),pm="\xF2\xF2\xF2\xF2\xF2\xF2 ",mm=" \xF2\xF2",gm=" \xF2 ",E_=["hash","date","message","refs","author_name","author_email"]}}),k_={};at(k_,{diffSummaryTask:()=>NF,validateLogFormatConfig:()=>Nu});function NF(e){let t=dm(e),r=["diff"];return t===""&&(t="--stat",r.push("--stat=4096")),r.push(...e),Nu(r)||{commands:r,format:"utf-8",parser:b_(t)}}function Nu(e){let t=e.filter($F);if(t.length>1)return ir(`Summary flags are mutually exclusive - pick one of ${t.join(",")}`);if(t.length&&e.includes("-z"))return ir(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var vm=V({"src/lib/tasks/diff.ts"(){"use strict";Fl(),x_(),it()}});function BF(e,t){let r=[],n=[];return Object.keys(e).forEach(i=>{r.push(i),n.push(String(e[i]))}),[r,n.join(t)]}function jF(e){return Object.keys(e).reduce((t,r)=>(r in qp||(t[r]=e[r]),t),{})}function T_(e={},t=[]){let r=En(e.splitter,Mt,gm),n=!em(e.format)&&e.format?e.format:{hash:"%H",date:e.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:e.multiLine?"%B":"%b",author_name:e.mailMap!==!1?"%aN":"%an",author_email:e.mailMap!==!1?"%aE":"%ae"},[i,a]=BF(n,r),s=[],o=[`--pretty=format:${pm}${a}${mm}`,...t],l=e.n||e["max-count"]||e.maxCount;if(l&&o.push(`--max-count=${l}`),e.from||e.to){let c=e.symmetric!==!1?"...":"..";s.push(`${e.from||""}${c}${e.to||""}`)}return Mt(e.file)&&o.push("--follow",C8(e.file)),nm(jF(e),o),{fields:i,splitter:r,commands:[...o,...s]}}function HF(e,t,r){let n=S_(e,t,dm(r));return{commands:["log",...r],format:"utf-8",parser:n}}function UF(){return{log(...r){let n=et(arguments),i=T_(im(arguments),En(arguments[0],Il)),a=t(...r)||Nu(i.commands)||e(i);return this._runTask(a,n)}};function e(r){return HF(r.splitter,r.fields,r.commands)}function t(r,n){return Mt(r)&&Mt(n)&&ir("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var qp,C_=V({"src/lib/tasks/log.ts"(){"use strict";Fl(),Pl(),A_(),oe(),it(),vm(),qp=(e=>(e[e["--pretty"]=0]="--pretty",e[e["max-count"]=1]="max-count",e[e.maxCount=2]="maxCount",e[e.n=3]="n",e[e.file=4]="file",e[e.format=5]="format",e[e.from=6]="from",e[e.to=7]="to",e[e.splitter=8]="splitter",e[e.symmetric=9]="symmetric",e[e.mailMap=10]="mailMap",e[e.multiLine=11]="multiLine",e[e.strictDate=12]="strictDate",e))(qp||{})}}),ku,P_,GF=V({"src/lib/responses/MergeSummary.ts"(){"use strict";ku=class{constructor(e,t=null,r){this.reason=e,this.file=t,this.meta=r}toString(){return`${this.file}:${this.reason}`}},P_=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"}}}}),Yp,R_,zF=V({"src/lib/responses/PullSummary.ts"(){"use strict";Yp=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},R_=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Lp(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function K2(e){let t=/^\s*(\d+)/.exec(e),r=/delta (\d+)/i.exec(e);return{count:Fe(t&&t[1]||"0"),delta:Fe(r&&r[1]||"0")}}var M_,VF=V({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";oe(),M_=[new Ei(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,r])=>{let n=t.toLowerCase(),i=Lp(e.remoteMessages);Object.assign(i,{[n]:Fe(r)})}),new Ei(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,r])=>{let n=t.toLowerCase(),i=Lp(e.remoteMessages);Object.assign(i,{[n]:Fe(r)})}),new Ei(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,r,n])=>{let i=Lp(e.remoteMessages);i.total=K2(t),i.reused=K2(r),i.packReused=Fe(n)})]}});function O_(e,t){return ar({remoteMessages:new F_},I_,t)}var I_,F_,$_=V({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";oe(),VF(),I_=[new Ei(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...M_,new Ei([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new Ei([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,r,n])=>{e.remoteMessages.vulnerabilities={count:Fe(t),summary:r,url:n}})],F_=class{constructor(){this.all=[]}}}});function WF(e,t){let r=ar(new R_,L_,[e,t]);return r.message&&r}var J2,Q2,eb,tb,L_,rb,ym,D_=V({"src/lib/parsers/parse-pull.ts"(){"use strict";zF(),oe(),$_(),J2=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Q2=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,eb=/^(create|delete) mode \d+ (.+)/,tb=[new ce(J2,(e,[t,r,n])=>{e.files.push(t),r&&(e.insertions[t]=r.length),n&&(e.deletions[t]=n.length)}),new ce(Q2,(e,[t,,r,,n])=>r!==void 0||n!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+r||0,e.summary.deletions=+n||0,!0):!1),new ce(eb,(e,[t,r])=>{Te(e.files,r),Te(t==="create"?e.created:e.deleted,r)})],L_=[new ce(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new ce(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new ce(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,r,n,i])=>{e.branch.local=n,e.hash.local=t,e.branch.remote=i,e.hash.remote=r})],rb=(e,t)=>ar(new Yp,tb,[e,t]),ym=(e,t)=>Object.assign(new Yp,rb(e,t),O_(e,t))}}),nb,N_,ib,qF=V({"src/lib/parsers/parse-merge.ts"(){"use strict";GF(),oe(),D_(),nb=[new ce(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new ce(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,r])=>{e.conflicts.push(new ku(t,r))}),new ce(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,r,n])=>{e.conflicts.push(new ku(t,r,{deleteRef:n}))}),new ce(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new ku(t,null))}),new ce(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],N_=(e,t)=>Object.assign(ib(e,t),ym(e,t)),ib=e=>ar(new P_,nb,e)}});function ab(e){return e.length?{commands:["merge",...e],format:"utf-8",parser(t,r){let n=N_(t,r);if(n.failed)throw new Rl(n);return n}}:ir("Git.merge requires at least one option")}var YF=V({"src/lib/tasks/merge.ts"(){"use strict";Is(),qF(),it()}});function XF(e,t,r){let n=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(e),a=!r.includes("new");return{deleted:n,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var sb,B_,ob,ZF=V({"src/lib/parsers/parse-push.ts"(){"use strict";oe(),$_(),sb=[new ce(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new ce(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref=Al($r({},e.ref||{}),{local:t})}),new ce(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,r,n])=>{e.pushed.push(XF(t,r,n))}),new ce(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,r,n])=>{e.branch=Al($r({},e.branch||{}),{local:t,remote:r,remoteName:n})}),new ce(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,r,n,i])=>{e.update={head:{local:t,remote:r},hash:{from:n,to:i}}})],B_=(e,t)=>{let r=ob(e,t),n=O_(e,t);return $r($r({},r),n)},ob=(e,t)=>ar({pushed:[]},sb,[e,t])}}),j_={};at(j_,{pushTagsTask:()=>KF,pushTask:()=>wm});function KF(e={},t){return Te(t,"--tags"),wm(e,t)}function wm(e={},t){let r=["push",...t];return e.branch&&r.splice(1,0,e.branch),e.remote&&r.splice(1,0,e.remote),Fu(r,"-v"),Te(r,"--verbose"),Te(r,"--porcelain"),{commands:r,format:"utf-8",parser:B_}}var H_=V({"src/lib/tasks/push.ts"(){"use strict";ZF(),oe()}});function JF(){return{showBuffer(){let e=["show",...nr(arguments,1)];return e.includes("--binary")||e.splice(1,0,"--binary"),this._runTask(qb(e),et(arguments))},show(){let e=["show",...nr(arguments,1)];return this._runTask(Wt(e),et(arguments))}}}var QF=V({"src/lib/tasks/show.ts"(){"use strict";oe(),it()}}),lb,U_,e4=V({"src/lib/responses/FileStatusSummary.ts"(){"use strict";lb=/^(.+)\0(.+)$/,U_=class{constructor(e,t,r){if(this.path=e,this.index=t,this.working_dir=r,t==="R"||r==="R"){let n=lb.exec(e)||[null,e,e];this.from=n[2]||"",this.path=n[1]||""}}}}});function cb(e){let[t,r]=e.split(Os);return{from:r||t,to:t}}function yr(e,t,r){return[`${e}${t}`,r]}function Dp(e,...t){return t.map(r=>yr(e,r,(n,i)=>Te(n.conflicted,i)))}function t4(e,t){let r=t.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return n(" ",r.charAt(0),r.substr(2));default:return}function n(i,a,s){let o=`${i}${a}`,l=G_.get(o);l&&l(e,s),o!=="##"&&o!=="!!"&&e.files.push(new U_(s,i,a))}}var ub,G_,z_,r4=V({"src/lib/responses/StatusSummary.ts"(){"use strict";oe(),e4(),ub=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}},G_=new Map([yr(" ","A",(e,t)=>Te(e.created,t)),yr(" ","D",(e,t)=>Te(e.deleted,t)),yr(" ","M",(e,t)=>Te(e.modified,t)),yr("A"," ",(e,t)=>Te(e.created,t)&&Te(e.staged,t)),yr("A","M",(e,t)=>Te(e.created,t)&&Te(e.staged,t)&&Te(e.modified,t)),yr("D"," ",(e,t)=>Te(e.deleted,t)&&Te(e.staged,t)),yr("M"," ",(e,t)=>Te(e.modified,t)&&Te(e.staged,t)),yr("M","M",(e,t)=>Te(e.modified,t)&&Te(e.staged,t)),yr("R"," ",(e,t)=>{Te(e.renamed,cb(t))}),yr("R","M",(e,t)=>{let r=cb(t);Te(e.renamed,r),Te(e.modified,r.to)}),yr("!","!",(e,t)=>{Te(e.ignored=e.ignored||[],t)}),yr("?","?",(e,t)=>Te(e.not_added,t)),...Dp("A","A","U"),...Dp("D","D","U"),...Dp("U","A","D","U"),["##",(e,t)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=r.exec(t),e.ahead=o&&+o[1]||0,o=n.exec(t),e.behind=o&&+o[1]||0,o=i.exec(t),e.current=o&&o[1],o=a.exec(t),e.tracking=o&&o[1],o=s.exec(t),e.current=o&&o[1]||e.current,e.detached=/\(no branch\)/.test(t)}]]),z_=function(e){let t=e.split(Os),r=new ub;for(let n=0,i=t.length;n!V_.includes(r))],parser(r){return z_(r)}}}var V_,i4=V({"src/lib/tasks/status.ts"(){"use strict";r4(),V_=["--null","-z"]}});function Ru(e=0,t=0,r=0,n="",i=!0){return Object.defineProperty({major:e,minor:t,patch:r,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function a4(){return Ru(0,0,0,"",!1)}function s4(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:o4,onError(e,t,r,n){if(e.exitCode===-2)return r(Buffer.from(bm));n(t)}})}}}function o4(e){return e===bm?a4():ar(Ru(0,0,0,e),W_,e)}var bm,W_,l4=V({"src/lib/tasks/version.ts"(){"use strict";oe(),bm="installed=false",W_=[new ce(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,r,n,i=""])=>{Object.assign(e,Ru(Fe(t),Fe(r),Fe(n),i))}),new ce(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,r,n,i=""])=>{Object.assign(e,Ru(Fe(t),Fe(r),n,i))})]}}),q_={};at(q_,{SimpleGitApi:()=>Xp});var Xp,c4=V({"src/lib/simple-git-api.ts"(){"use strict";pF(),mF(),vF(),bF(),AF(),t_(),TF(),s_(),PF(),FF(),C_(),YF(),H_(),QF(),i4(),it(),l4(),oe(),Xp=class{constructor(e){this._executor=e}_runTask(e,t){let r=this._executor.chain(),n=r.push(e);return t&&dF(e,n,t),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(e){return this._runTask(Wt(["add",...Sn(e)]),et(arguments))}cwd(e){let t=et(arguments);return typeof e=="string"?this._runTask(q2(e,this._executor),t):typeof(e==null?void 0:e.path)=="string"?this._runTask(q2(e.path,e.root&&this._executor||void 0),t):this._runTask(ir("Git.cwd: workingDirectory must be supplied as a string"),t)}hashObject(e,t){return this._runTask(CF(e,t===!0),et(arguments))}init(e){return this._runTask(IF(e===!0,this._executor.cwd,nr(arguments)),et(arguments))}merge(){return this._runTask(ab(nr(arguments)),et(arguments))}mergeFromTo(e,t){return Mt(e)&&Mt(t)?this._runTask(ab([e,t,...nr(arguments)]),et(arguments,!1)):this._runTask(ir("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=wm({remote:En(arguments[0],Mt),branch:En(arguments[1],Mt)},nr(arguments));return this._runTask(e,et(arguments))}stash(){return this._runTask(Wt(["stash",...nr(arguments)]),et(arguments))}status(){return this._runTask(n4(nr(arguments)),et(arguments))}},Object.assign(Xp.prototype,gF(),EF(),Q8(),wF(),kF(),nF(),UF(),JF(),s4())}}),Y_={};at(Y_,{Scheduler:()=>Z_});var fb,Z_,u4=V({"src/lib/runners/scheduler.ts"(){"use strict";oe(),f_(),fb=(()=>{let e=0;return()=>{e++;let{promise:t,done:r}=(0,X_.createDeferred)();return{promise:t,done:r,id:e}}})(),Z_=class{constructor(e=2){this.concurrency=e,this.logger=um("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",e)}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 e=Te(this.running,this.pending.shift());this.logger("Attempting id=%s",e.id),e.done(()=>{this.logger("Completing id=",e.id),Fu(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=Te(this.pending,fb());return this.logger("Scheduling id=%s",t),this.schedule(),e}}}}),K_={};at(K_,{applyPatchTask:()=>f4});function f4(e,t){return Wt(["apply",...t,...e])}var d4=V({"src/lib/tasks/apply-patch.ts"(){"use strict";it()}});function h4(e,t){return{branch:e,hash:t,success:!0}}function p4(e){return{branch:e,hash:null,success:!1}}var J_,m4=V({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";J_=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Q_(e,t){return t===1&&Zp.test(e)}var db,Zp,hb,Bu,g4=V({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";m4(),oe(),db=/(\S+)\s+\(\S+\s([^)]+)\)/,Zp=/^error[^']+'([^']+)'/m,hb=[new ce(db,(e,[t,r])=>{let n=h4(t,r);e.all.push(n),e.branches[t]=n}),new ce(Zp,(e,[t])=>{let r=p4(t);e.errors.push(r),e.all.push(r),e.branches[t]=r})],Bu=(e,t)=>ar(new J_,hb,[e,t])}}),ex,v4=V({"src/lib/responses/BranchSummary.ts"(){"use strict";ex=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(e,t,r,n,i){e==="*"&&(this.detached=t,this.current=r),this.all.push(r),this.branches[r]={current:e==="*",linkedWorkTree:e==="+",name:r,commit:n,label:i}}}}});function pb(e){return e?e.charAt(0):""}function tx(e){return ar(new ex,rx,e)}var rx,y4=V({"src/lib/parsers/parse-branch.ts"(){"use strict";v4(),oe(),rx=[new ce(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,r,n,i])=>{e.push(pb(t),!0,r,n,i)}),new ce(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),(e,[t,r,n,i])=>{e.push(pb(t),!1,r,n,i)})]}}),nx={};at(nx,{branchLocalTask:()=>b4,branchTask:()=>w4,containsDeleteBranchCommand:()=>ix,deleteBranchTask:()=>x4,deleteBranchesTask:()=>_4});function ix(e){let t=["-d","-D","--delete"];return e.some(r=>t.includes(r))}function w4(e){let t=ix(e),r=["branch",...e];return r.length===1&&r.push("-a"),r.includes("-v")||r.splice(1,0,"-v"),{format:"utf-8",commands:r,parser(n,i){return t?Bu(n,i).all[0]:tx(n)}}}function b4(){return{format:"utf-8",commands:["branch","-v"],parser:tx}}function _4(e,t=!1){return{format:"utf-8",commands:["branch","-v",t?"-D":"-d",...e],parser(r,n){return Bu(r,n)},onError({exitCode:r,stdOut:n},i,a,s){if(!Q_(String(i),r))return s(i);a(n)}}}function x4(e,t=!1){let r={format:"utf-8",commands:["branch","-v",t?"-D":"-d",e],parser(n,i){return Bu(n,i).branches[e]},onError({exitCode:n,stdErr:i,stdOut:a},s,o,l){if(!Q_(String(s),n))return l(s);throw new Rl(r.parser(Tl(a),Tl(i)),String(s))}};return r}var S4=V({"src/lib/tasks/branch.ts"(){"use strict";Is(),g4(),y4(),oe()}}),ax,E4=V({"src/lib/responses/CheckIgnore.ts"(){"use strict";ax=e=>e.split(/\n/g).map(t=>t.trim()).filter(t=>!!t)}}),sx={};at(sx,{checkIgnoreTask:()=>A4});function A4(e){return{commands:["check-ignore",...e],format:"utf-8",parser:ax}}var k4=V({"src/lib/tasks/check-ignore.ts"(){"use strict";E4()}}),ox={};at(ox,{cloneMirrorTask:()=>C4,cloneTask:()=>lx});function T4(e){return/^--upload-pack(=|$)/.test(e)}function lx(e,t,r){let n=["clone",...r];return Mt(e)&&n.push(e),Mt(t)&&n.push(t),n.find(T4)?ir("git.fetch: potential exploit argument blocked."):Wt(n)}function C4(e,t,r){return Te(r,"--mirror"),lx(e,t,r)}var P4=V({"src/lib/tasks/clone.ts"(){"use strict";it(),oe()}});function R4(e,t){return ar({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},cx,[e,t])}var cx,M4=V({"src/lib/parsers/parse-fetch.ts"(){"use strict";oe(),cx=[new ce(/From (.+)$/,(e,[t])=>{e.remote=t}),new ce(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,r])=>{e.branches.push({name:t,tracking:r})}),new ce(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,r])=>{e.tags.push({name:t,tracking:r})}),new ce(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new ce(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,r,n,i])=>{e.updated.push({name:n,tracking:i,to:r,from:t})})]}}),ux={};at(ux,{fetchTask:()=>I4});function O4(e){return/^--upload-pack(=|$)/.test(e)}function I4(e,t,r){let n=["fetch",...r];return e&&t&&n.push(e,t),n.find(O4)?ir("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:R4}}var F4=V({"src/lib/tasks/fetch.ts"(){"use strict";M4(),it()}});function $4(e){return ar({moves:[]},fx,e)}var fx,L4=V({"src/lib/parsers/parse-move.ts"(){"use strict";oe(),fx=[new ce(/^Renaming (.+) to (.+)$/,(e,[t,r])=>{e.moves.push({from:t,to:r})})]}}),dx={};at(dx,{moveTask:()=>D4});function D4(e,t){return{commands:["mv","-v",...Sn(e),t],format:"utf-8",parser:$4}}var N4=V({"src/lib/tasks/move.ts"(){"use strict";L4(),oe()}}),hx={};at(hx,{pullTask:()=>B4});function B4(e,t,r){let n=["pull",...r];return e&&t&&n.splice(1,0,e,t),{commands:n,format:"utf-8",parser(i,a){return ym(i,a)},onError(i,a,s,o){let l=WF(Tl(i.stdOut),Tl(i.stdErr));if(l)return o(new Rl(l));o(a)}}}var j4=V({"src/lib/tasks/pull.ts"(){"use strict";Is(),D_(),oe()}});function H4(e){let t={};return px(e,([r])=>t[r]={name:r}),Object.values(t)}function U4(e){let t={};return px(e,([r,n,i])=>{t.hasOwnProperty(r)||(t[r]={name:r,refs:{fetch:"",push:""}}),i&&n&&(t[r].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(t)}function px(e,t){Jp(e,r=>t(r.split(/\s+/)))}var G4=V({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";oe()}}),mx={};at(mx,{addRemoteTask:()=>z4,getRemotesTask:()=>V4,listRemotesTask:()=>W4,remoteTask:()=>q4,removeRemoteTask:()=>Y4});function z4(e,t,r){return Wt(["remote","add",...r,e,t])}function V4(e){let t=["remote"];return e&&t.push("-v"),{commands:t,format:"utf-8",parser:e?U4:H4}}function W4(e){let t=[...e];return t[0]!=="ls-remote"&&t.unshift("ls-remote"),Wt(t)}function q4(e){let t=[...e];return t[0]!=="remote"&&t.unshift("remote"),Wt(t)}function Y4(e){return Wt(["remote","remove",e])}var X4=V({"src/lib/tasks/remote.ts"(){"use strict";G4(),it()}}),gx={};at(gx,{stashListTask:()=>Z4});function Z4(e={},t){let r=T_(e),n=["stash","list",...r.commands,...t],i=S_(r.splitter,r.fields,dm(n));return Nu(n)||{commands:n,format:"utf-8",parser:i}}var K4=V({"src/lib/tasks/stash-list.ts"(){"use strict";Fl(),A_(),vm(),C_()}}),vx={};at(vx,{addSubModuleTask:()=>J4,initSubModuleTask:()=>Q4,subModuleTask:()=>ju,updateSubModuleTask:()=>e$});function J4(e,t){return ju(["add",e,t])}function Q4(e){return ju(["init",...e])}function ju(e){let t=[...e];return t[0]!=="submodule"&&t.unshift("submodule"),Wt(t)}function e$(e){return ju(["update",...e])}var t$=V({"src/lib/tasks/sub-module.ts"(){"use strict";it()}});function r$(e,t){let r=isNaN(e),n=isNaN(t);return r!==n?r?1:-1:r?yx(e,t):0}function yx(e,t){return e===t?0:e>t?1:-1}function n$(e){return e.trim()}function xu(e){return typeof e=="string"&&parseInt(e.replace(/^\D+/g,""),10)||0}var mb,wx,i$=V({"src/lib/responses/TagList.ts"(){"use strict";mb=class{constructor(e,t){this.all=e,this.latest=t}},wx=function(e,t=!1){let r=e.split(` -`).map(n$).filter(Boolean);t||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return r$(xu(s[0]),xu(o[0]));for(let l=0,c=Math.max(s.length,o.length);li.indexOf(".")>=0);return new mb(r,n)}}}),bx={};at(bx,{addAnnotatedTagTask:()=>o$,addTagTask:()=>s$,tagListTask:()=>a$});function a$(e=[]){let t=e.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...e],parser(r){return wx(r,t)}}}function s$(e){return{format:"utf-8",commands:["tag",e],parser(){return{name:e}}}}function o$(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser(){return{name:e}}}}var l$=V({"src/lib/tasks/tag.ts"(){"use strict";i$()}}),c$=k8({"src/git.js"(e,t){"use strict";var{GitExecutor:r}=(fF(),Qe(h_)),{SimpleGitApi:n}=(c4(),Qe(q_)),{Scheduler:i}=(u4(),Qe(Y_)),{configurationErrorTask:a}=(it(),Qe(Gp)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:p}=(oe(),Qe(Db)),{applyPatchTask:m}=(d4(),Qe(K_)),{branchTask:v,branchLocalTask:y,deleteBranchesTask:b,deleteBranchTask:x}=(S4(),Qe(nx)),{checkIgnoreTask:E}=(k4(),Qe(sx)),{checkIsRepoTask:_}=(Hb(),Qe(Nb)),{cloneTask:k,cloneMirrorTask:w}=(P4(),Qe(ox)),{cleanWithOptionsTask:A,isCleanOptionsArray:S}=(Jb(),Qe(Zb)),{diffSummaryTask:T}=(vm(),Qe(k_)),{fetchTask:P}=(F4(),Qe(ux)),{moveTask:I}=(N4(),Qe(dx)),{pullTask:N}=(j4(),Qe(hx)),{pushTagsTask:L}=(H_(),Qe(j_)),{addRemoteTask:ee,getRemotesTask:fe,listRemotesTask:J,remoteTask:Q,removeRemoteTask:Pe}=(X4(),Qe(mx)),{getResetMode:ge,resetTask:z}=(u_(),Qe(o_)),{stashListTask:Y}=(K4(),Qe(gx)),{addSubModuleTask:O,initSubModuleTask:he,subModuleTask:Ge,updateSubModuleTask:gt}=(t$(),Qe(vx)),{addAnnotatedTagTask:Re,addTagTask:ct,tagListTask:rt}=(l$(),Qe(bx)),{straightThroughBufferTask:Et,straightThroughStringTask:Ie}=(it(),Qe(Gp));function H(D,q){this._plugins=q,this._executor=new r(D.baseDir,new i(D.maxConcurrentProcesses),q),this._trimmed=D.trimmed}(H.prototype=Object.create(n.prototype)).constructor=H,H.prototype.customBinary=function(D){return this._plugins.reconfigure("binary",D),this},H.prototype.env=function(D,q){return arguments.length===1&&typeof D=="object"?this._executor.env=D:(this._executor.env=this._executor.env||{})[D]=q,this},H.prototype.stashList=function(D){return this._runTask(Y(p(arguments)||{},o(D)&&D||[]),h(arguments))};function Je(D,q,ve,Ne){return typeof ve!="string"?a(`git.${D}() requires a string 'repoPath'`):q(ve,f(Ne,c),d(arguments))}H.prototype.clone=function(){return this._runTask(Je("clone",k,...arguments),h(arguments))},H.prototype.mirror=function(){return this._runTask(Je("mirror",w,...arguments),h(arguments))},H.prototype.mv=function(D,q){return this._runTask(I(D,q),h(arguments))},H.prototype.checkoutLatestTag=function(D){var q=this;return this.pull(function(){q.tags(function(ve,Ne){q.checkout(Ne.latest,D)})})},H.prototype.pull=function(D,q,ve,Ne){return this._runTask(N(f(D,c),f(q,c),d(arguments)),h(arguments))},H.prototype.fetch=function(D,q){return this._runTask(P(f(D,c),f(q,c),d(arguments)),h(arguments))},H.prototype.silent=function(D){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},H.prototype.tags=function(D,q){return this._runTask(rt(d(arguments)),h(arguments))},H.prototype.rebase=function(){return this._runTask(Ie(["rebase",...d(arguments)]),h(arguments))},H.prototype.reset=function(D){return this._runTask(z(ge(D),d(arguments)),h(arguments))},H.prototype.revert=function(D){let q=h(arguments);return typeof D!="string"?this._runTask(a("Commit must be a string"),q):this._runTask(Ie(["revert",...d(arguments,0,!0),D]),q)},H.prototype.addTag=function(D){let q=typeof D=="string"?ct(D):a("Git.addTag requires a tag name");return this._runTask(q,h(arguments))},H.prototype.addAnnotatedTag=function(D,q){return this._runTask(Re(D,q),h(arguments))},H.prototype.deleteLocalBranch=function(D,q,ve){return this._runTask(x(D,typeof q=="boolean"?q:!1),h(arguments))},H.prototype.deleteLocalBranches=function(D,q,ve){return this._runTask(b(D,typeof q=="boolean"?q:!1),h(arguments))},H.prototype.branch=function(D,q){return this._runTask(v(d(arguments)),h(arguments))},H.prototype.branchLocal=function(D){return this._runTask(y(),h(arguments))},H.prototype.raw=function(D){let q=!Array.isArray(D),ve=[].slice.call(q?arguments:D,0);for(let bt=0;bte.removeEventListener("abort",a))}}]:void 0}function d$(e){return typeof e=="string"&&e.trim().toLowerCase()==="-c"}function h$(e,t){if(d$(e)&&/^\s*protocol(.[a-z]+)?.allow/.test(t))throw new qn(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function p$(e,t){if(/^\s*--(upload|receive)-pack/.test(e))throw new qn(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(t==="clone"&&/^\s*-u\b/.test(e))throw new qn(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(t==="push"&&/^\s*--exec\b/.test(e))throw new qn(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function m$({allowUnsafeProtocolOverride:e=!1,allowUnsafePack:t=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,a)=>{let s=aNp(i))).then(s.done)}return{type:"spawn.after",action(i,a){return El(this,arguments,function*(s,{spawned:o,close:l}){var c,u;let f=r(),d=!0,h=()=>void(d=!1);(c=o.stdout)==null||c.on("data",h),(u=o.stderr)==null||u.on("data",h),o.on("error",h),o.on("close",p=>f.close(p)),o.on("exit",p=>f.exit(p));try{yield f.result,d&&(yield Np(50)),l(f.exitCode)}catch(p){l(f.exitCode,p)}})}}}oe();var y$="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",vb="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function w$(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(e)}function yb(e,t){if(e.length<1||e.length>2)throw new qn(void 0,"binary",y$);if(e.some(w$))if(t)console.warn(vb);else throw new qn(void 0,"binary",vb);let[n,i]=e;return{binary:n,prefix:i}}function b$(e,t=["git"],r=!1){let n=yb(Sn(t),r);e.on("binary",i=>{n=yb(Sn(i),r)}),e.append("spawn.binary",()=>n.binary),e.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}Ai();function _$(e){return!!(e.exitCode&&e.stdErr.length)}function x$(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function S$(e=!1,t=_$,r=x$){return(n,i)=>!e&&n||!t(i)?n:r(i)}function wb(e){return{type:"task.error",action(t,r){let n=e(t.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new wr(void 0,n.toString("utf-8"))}:{error:n}}}}oe();var E$=class{constructor(){this.plugins=new Set,this.events=new _x.EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let r=Te(this.plugins,{type:e,action:t});return()=>this.plugins.delete(r)}add(e){let t=[];return Sn(e).forEach(r=>r&&this.plugins.add(Te(t,r))),()=>{t.forEach(r=>this.plugins.delete(r))}}exec(e,t,r){let n=t,i=Object.freeze(Object.create(r));for(let a of this.plugins)a.type===e&&(n=a.action(n,i));return n}};oe();function A$(e){let t="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return r.includes(s.method)?Cb(a,t):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(t)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&e({method:s.method,stage:k$(c[1]),progress:Fe(c[2]),processed:Fe(c[3]),total:Fe(c[4])})}))}}]}function k$(e){return String(e.toLowerCase().split(" ",1))||"unknown"}oe();function T$(e){let t=Mb(e,["uid","gid"]);return{type:"spawn.options",action(r){return $r($r({},t),r)}}}function C$({block:e,stdErr:t=!0,stdOut:r=!0}){if(e>0)return{type:"spawn.after",action(n,i){var a,s;let o;function l(){o&&clearTimeout(o),o=setTimeout(u,e)}function c(){var f,d;(f=i.spawned.stdout)==null||f.off("data",l),(d=i.spawned.stderr)==null||d.off("data",l),i.spawned.off("exit",c),i.spawned.off("close",c),o&&clearTimeout(o)}function u(){c(),i.kill(new qn(void 0,"timeout","block timeout reached"))}r&&((a=i.spawned.stdout)==null||a.on("data",l)),t&&((s=i.spawned.stderr)==null||s.on("data",l)),i.spawned.on("exit",c),i.spawned.on("close",c),l()}}}Pl();function P$(){return{type:"spawn.args",action(e){let t=[],r;function n(i){(r=r||[]).push(...i)}for(let i=0;iTu(s)&&G2(s)||s));break}t.push(a)}return r?[...t,"--",...r.map(String)]:t}}}oe();var R$=c$();function M$(e,t){var r;let n=new E$,i=$b(e&&(typeof e=="string"?{baseDir:e}:e)||{},t);if(!Qp(i.baseDir))throw new u$(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&n.add(g$(i.config)),n.add(m$(i.unsafe)),n.add(P$()),n.add(v$(i.completion)),i.abort&&n.add(f$(i.abort)),i.progress&&n.add(A$(i.progress)),i.timeout&&n.add(C$(i.timeout)),i.spawnOptions&&n.add(T$(i.spawnOptions)),n.add(wb(S$(!0))),i.errors&&n.add(wb(i.errors)),b$(n,i.binary,(r=i.unsafe)==null?void 0:r.allowUnsafeCustomBinary),new R$(i,n)}Is();var xx=M$;g();var Sx=require("obsidian"),Hu="YYYY-MM-DD",_m=`${Hu} HH:mm`,xm=`${Hu} HH:mm:ss`,Uu=40,Fs="conflict-files-obsidian-git.md",Ye={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitDateFormat:xm,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:Sx.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",lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:_m,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}},kt={type:"git-view",name:"Source Control",icon:"git-pull-request"},Lr={type:"git-history-view",name:"History",icon:"history"},ki={type:"split-diff-view",name:"Diff view",icon:"diff"},Ti={type:"diff-view",name:"Diff View",icon:"git-pull-request"},Gu="C:\\Program Files\\Git\\cmd\\git.exe",zu="git_credentials_input",wa="obsidian_askpass.sh",Ex=`#!/bin/sh +`);if(i=a.shift(),!i.startsWith("unpack "))throw new Ja('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),u=l.indexOf(" ");u===-1&&(u=l.length);let c=l.slice(0,u),f=l.slice(u+1);e.refs[c]={ok:o==="ok",error:f}}return e}async function A8({capabilities:t=[],triplets:e=[]}){let r=[],n=`\0 ${t.join(" ")}`;for(let i of e)r.push(Qe.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n} +`)),n="";return r.push(Qe.flush()),r}async function T8({fs:t,cache:e,http:r,onProgress:n,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={}}){let b=c||await pa({fs:t,gitdir:u});if(typeof b=="undefined")throw new hr("ref");let E=await nt.get({fs:t,gitdir:u});d=d||await E.get(`branch.${b}.pushRemote`)||await E.get("remote.pushDefault")||await E.get(`branch.${b}.remote`)||"origin";let x=h||await E.get(`remote.${d}.pushurl`)||await E.get(`remote.${d}.url`);if(typeof x=="undefined")throw new hr("remote OR url");let k=f||await E.get(`branch.${b}.merge`);if(typeof x=="undefined")throw new hr("remoteRef");v===void 0&&(v=await E.get("http.corsProxy"));let A=await z.expand({fs:t,gitdir:u,ref:b}),y=g?"0000000000000000000000000000000000000000":await z.resolve({fs:t,gitdir:u,ref:A}),S=Ao.getRemoteHelperFor({url:x}),_=await S.discover({http:r,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:v,service:"git-receive-pack",url:x,headers:w,protocolVersion:1}),T=_.auth,P;if(!k)P=A;else try{P=await z.expandAgainstMap({ref:k,map:_.refs})}catch(Z){if(Z instanceof Le)P=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw Z}let F=_.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:P,oid:F}}))throw new _o;let D=!_.capabilities.has("no-thin"),M=new Set;if(!g){let Z=[..._.refs.values()],H=new Set;if(F!=="0000000000000000000000000000000000000000"){let Oe=await Ng({fs:t,cache:e,gitdir:u,oids:[y,F]});for(let cr of Oe)Z.push(cr);D&&(H=await yg({fs:t,cache:e,gitdir:u,oids:Oe}))}if(!Z.includes(y)){let Oe=await E8({fs:t,cache:e,gitdir:u,start:[y],finish:Z});M=await yg({fs:t,cache:e,gitdir:u,oids:Oe})}if(D){try{let Oe=await z.resolve({fs:t,gitdir:u,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:cr}=await z.resolveAgainstMap({ref:Oe.replace(`refs/remotes/${d}/`,""),fullref:Oe,map:_.refs}),Gt=[cr];for(let Y of await yg({fs:t,cache:e,gitdir:u,oids:Gt}))H.add(Y)}catch(Oe){}for(let Oe of H)M.delete(Oe)}if(y===F&&(m=!0),!m){if(A.startsWith("refs/tags")&&F!=="0000000000000000000000000000000000000000")throw new bo("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&F!=="0000000000000000000000000000000000000000"&&!await lk({fs:t,cache:e,gitdir:u,oid:y,ancestor:F,depth:-1}))throw new bo("not-fast-forward")}}let re=ME([..._.capabilities],["report-status","side-band-64k",`agent=${td.agent}`]),ye=await A8({capabilities:re,triplets:[{oldoid:F,oid:y,fullRef:P}]}),me=g?[]:await xk({fs:t,cache:e,gitdir:u,oids:[...M]}),fe=await S.connect({http:r,onProgress:n,corsProxy:v,service:"git-receive-pack",url:x,auth:T,headers:w,body:[...ye,...me]}),{packfile:Ge,progress:oe}=await Xf.demux(fe.body);if(i){let Z=DE(oe);_c(Z,async H=>{await i(H)})}let B=await k8(Ge);if(fe.headers&&(B.headers=fe.headers),d&&B.ok&&B.refs[P].ok&&!A.startsWith("refs/tags")){let Z=`refs/remotes/${d}/${P.replace("refs/heads","")}`;g?await z.deleteRef({fs:t,gitdir:u,ref:Z}):await z.writeRef({fs:t,gitdir:u,ref:Z,value:y})}if(B.ok&&Object.values(B.refs).every(Z=>Z.ok))return B;{let Z=Object.entries(B.refs).filter(([H,Oe])=>!Oe.ok).map(([H,Oe])=>` + - ${H}: ${Oe.error}`).join("");throw new uc(Z,B)}}async function kk({fs:t,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:u=O.join(l,".git"),ref:c,remoteRef:f,remote:d="origin",url:h,force:m=!1,delete:g=!1,corsProxy:v,headers:w={},cache:b={}}){try{return C("fs",t),C("http",e),C("gitdir",u),await T8({fs:new J(t),cache:b,http:e,onProgress:r,onMessage:n,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:u,ref:c,remoteRef:f,remote:d,url:h,force:m,delete:g,corsProxy:v,headers:w})}catch(E){throw E.caller="git.push",E}}async function Ak({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n});if(i==="tag")return n=Fr.from(a).parse().object,Ak({fs:t,cache:e,gitdir:r,oid:n});if(i!=="blob")throw new rr(n,i,"blob");return{oid:n,blob:new Uint8Array(a)}}async function Tk({fs:t,cache:e,gitdir:r,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await yc({fs:t,cache:e,gitdir:r,oid:n,filepath:i})),await Ak({fs:t,cache:e,gitdir:r,oid:n})}async function Ck({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Tk({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function Bg({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Eo({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readCommit",a}}async function C8({fs:t,cache:e,gitdir:r,ref:n="refs/notes/commits",oid:i}){let a=await z.resolve({gitdir:r,fs:t,ref:n}),{blob:s}=await Tk({fs:t,cache:e,gitdir:r,oid:a,filepath:i});return s}async function Pk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="refs/notes/commits",oid:i,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oid",i),await C8({fs:new J(t),cache:a,gitdir:r,ref:n,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function Rk({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{C("fs",t),C("gitdir",r),C("oid",n);let l=new J(t);a!==void 0&&(n=await yc({fs:l,cache:o,gitdir:r,oid:n,filepath:a}));let c=await qe({fs:l,cache:o,gitdir:r,oid:n,format:i==="parsed"?"content":i});if(c.oid=n,i==="parsed")switch(c.format="parsed",c.type){case"commit":c.object=mr.from(c.object).parse();break;case"tree":c.object=pr.from(c.object).entries();break;case"blob":s?c.object=c.object.toString(s):(c.object=new Uint8Array(c.object),c.format="content");break;case"tag":c.object=Fr.from(c.object).parse();break;default:throw new rr(c.oid,c.type,"blob|commit|tag|tree")}else(c.format==="deflated"||c.format==="wrapped")&&(c.type=c.format);return c}catch(l){throw l.caller="git.readObject",l}}async function P8({fs:t,cache:e,gitdir:r,oid:n}){let{type:i,object:a}=await qe({fs:t,cache:e,gitdir:r,oid:n,format:"content"});if(i!=="tag")throw new rr(n,i,"tag");let s=Fr.from(a);return{oid:n,tag:s.parse(),payload:s.payload()}}async function Ik({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,cache:i={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await P8({fs:new J(t),cache:i,gitdir:r,oid:n})}catch(a){throw a.caller="git.readTag",a}}async function $k({fs:t,dir:e,gitdir:r=O.join(e,".git"),oid:n,filepath:i=void 0,cache:a={}}){try{return C("fs",t),C("gitdir",r),C("oid",n),await Po({fs:new J(t),cache:a,gitdir:r,oid:n,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function Fk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n),await ct.acquire({fs:new J(t),gitdir:r,cache:i},async function(a){a.delete({filepath:n})})}catch(a){throw a.caller="git.remove",a}}async function R8({fs:t,cache:e,onSign:r,gitdir:n,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let u;try{u=await z.resolve({gitdir:n,fs:t,ref:i})}catch(m){if(!(m instanceof Le))throw m}let f=(await Po({fs:t,gitdir:n,oid:u||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(m=>m.path!==a);let d=await bc({fs:t,gitdir:n,tree:f});return await Qf({fs:t,cache:e,onSign:r,gitdir:n,ref:i,tree:d,parent:u&&[u],message:`Note removed by 'isomorphic-git removeNote' +`,author:s,committer:o,signingKey:l})}async function Ok({fs:t,onSign:e,dir:r,gitdir:n=O.join(r,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:u={}}){try{C("fs",t),C("gitdir",n),C("oid",a);let c=new J(t),f=await da({fs:c,gitdir:n,author:s});if(!f)throw new zt("author");let d=await So({fs:c,gitdir:n,author:f,committer:o});if(!d)throw new zt("committer");return await R8({fs:c,cache:u,onSign:e,gitdir:n,ref:i,oid:a,author:f,committer:d,signingKey:l})}catch(c){throw c.caller="git.removeNote",c}}async function I8({fs:t,gitdir:e,oldref:r,ref:n,checkout:i=!1}){if(n!==Xn.clean(n))throw new wn(n,Xn.clean(n));if(r!==Xn.clean(r))throw new wn(r,Xn.clean(r));let a=`refs/heads/${r}`,s=`refs/heads/${n}`;if(await z.exists({fs:t,gitdir:e,ref:s}))throw new vn("branch",n,!1);let l=await z.resolve({fs:t,gitdir:e,ref:a,depth:1});await z.writeRef({fs:t,gitdir:e,ref:s,value:l}),await z.deleteRef({fs:t,gitdir:e,ref:a});let c=await pa({fs:t,gitdir:e,fullname:!0})===a;(i||c)&&await z.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function Mk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,oldref:i,checkout:a=!1}){try{return C("fs",t),C("gitdir",r),C("ref",n),C("oldref",i),await I8({fs:new J(t),gitdir:r,ref:n,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Dk({gitdir:t,type:e,object:r}){return ki(la.wrap({type:e,object:r}))}async function Lk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,ref:i,cache:a={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let s=new J(t),o,l;try{o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await yc({fs:s,cache:a,gitdir:r,oid:o,filepath:n})}catch(f){o=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},c=e&&await s.read(O.join(e,n));c&&(l=await Dk({gitdir:r,type:"blob",object:c}),o===l&&(u=await s.lstat(O.join(e,n)))),await ct.acquire({fs:s,gitdir:r,cache:a},async function(f){f.delete({filepath:n}),o&&f.insert({filepath:n,stats:u,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function Nk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,depth:i}){try{return C("fs",t),C("gitdir",r),C("ref",n),await z.resolve({fs:new J(t),gitdir:r,ref:n,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function Bk({fs:t,dir:e,gitdir:r=O.join(e,".git"),path:n,value:i,append:a=!1}){try{C("fs",t),C("gitdir",r),C("path",n);let s=new J(t),o=await nt.get({fs:s,gitdir:r});a?await o.append(n,i):await o.set(n,i),await nt.save({fs:s,gitdir:r,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function Hk({fs:t,gitdir:e,commit:r}){let n=mr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"commit",object:n,format:"content"})}var Zf=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,r,n){let i=e.name.replace(/\s/g,""),a="0000000000000000000000000000000000000000",s=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${a} ${r} ${i} ${e.email} ${s} ${o} ${n} +`}static getStashReflogEntry(e,r=!1){return e.split(` +`).filter(a=>a).reverse().map((a,s)=>r?`stash@{${s}}: ${a.split(" ")[1]}`:a)}},$8={stage:ts,workdir:Co},bg;async function To(t,e){return bg===void 0&&(bg=new tc),bg.acquire(t,e)}async function F8(t,e,r,n,i=null){let a=O.join(r,n),s=await t.lstat(a);if(!s)throw new Le(a);if(s.isDirectory())throw new de(`${a}: file expected, but found directory`);let o=i?await mE({fs:t,gitdir:e,oid:i}):void 0,l=o?i:void 0;return o||await To({fs:t,gitdir:e,currentFilepath:a},async()=>{let u=s.isSymbolicLink()?await t.readlink(a).then(xE):await t.read(a);if(u===null)throw new Le(a);l=await gr({fs:t,gitdir:e,type:"blob",object:u})}),l}async function O8({fs:t,dir:e,gitdir:r,entries:n}){async function i(a){if(a.type==="tree"){if(!a.oid){let s=await Promise.all(a.children.map(i));a.oid=await bc({fs:t,gitdir:r,tree:s}),a.mode=16384}}else a.type==="blob"&&(a.oid=await F8(t,r,e,a.path,a.oid),a.mode=33188);return a.path=a.path.split("/").pop(),a}return Promise.all(n.map(i))}async function lE({fs:t,dir:e,gitdir:r,treePair:n}){let i=n[1]==="stage",a=n.map(h=>typeof h=="string"?$8[h]():h),s=[],c=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:a,map:async(h,[m,g])=>{if(!(h==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!m||await m.oid()!==await g.oid()&&await g.oid()!==void 0)&&s.push([m,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,m)=>(m=m.filter(Boolean),h?(h.children=m,h):m.length>0?m:void 0),iterate:async(h,m)=>{let g=[];for(let v of m){let[w,b]=v;i?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(v):s.push([null,b])):w&&(b?g.push(v):s.push([w,null]))}return g.length?Promise.all(g.map(h)):[]}});if(s.length===0||c.length===0)return null;let d=(await O8({fs:t,dir:e,gitdir:r,entries:c})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return bc({fs:t,gitdir:r,tree:d})}async function M8({fs:t,dir:e,gitdir:r,stashCommit:n,parentCommit:i,wasStaged:a}){let s=[],o=[],l=await ua({fs:t,cache:{},dir:e,gitdir:r,trees:[$r({ref:i}),$r({ref:n})],map:async(u,[c,f])=>{if(u==="."||await fa.isIgnored({fs:t,dir:e,gitdir:r,filepath:u}))return;let d=f?await f.type():await c.type();if(d!=="tree"&&d!=="blob")return;if(!f&&c){let m=d==="tree"?"rmdir":"rm";return d==="tree"&&s.push(u),d==="blob"&&a&&o.push({filepath:u,oid:await c.oid()}),{method:m,filepath:u}}let h=await f.oid();if(!c||await c.oid()!==h)return d==="tree"?{method:"mkdir",filepath:u}:(a&&o.push({filepath:u,oid:h,stats:await t.lstat(O.join(e,u))}),{method:"write",filepath:u,oid:h})}});await To({fs:t,gitdir:r,dirRemoved:s,ops:l},async()=>{for(let u of l){let c=O.join(e,u.filepath);switch(u.method){case"rmdir":await t.rmdir(c);break;case"mkdir":await t.mkdir(c);break;case"rm":await t.rm(c);break;case"write":if(!s.some(f=>c.startsWith(f))){let{object:f}=await qe({fs:t,cache:{},gitdir:r,oid:u.oid});await t.exists(c)&&await t.rm(c),await t.write(c,f)}break}}}),await ct.acquire({fs:t,gitdir:r,cache:{}},async u=>{o.forEach(({filepath:c,stats:f,oid:d})=>{u.insert({filepath:c,stats:f,oid:d})})})}var es=class t{constructor({fs:e,dir:r,gitdir:n=O.join(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return O.join(this.gitdir,t.refStash)}get refLogsStashPath(){return O.join(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await da({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new zt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:n}){return Hk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new wn(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,r);return n?Eo({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return z.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let n=await this.getAuthor(),i=Zf.createStashReflogEntry(n,e,r),a=this.refLogsStashPath;await To({filepath:a,entry:i},async()=>{let s=await this.fs.exists(a)?await this.fs.read(a,"utf8"):"";await this.fs.write(a,s+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let n=(await this.fs.read(this.refLogsStashPath)).toString();return Zf.getStashReflogEntry(n,e)}};async function D8({fs:t,dir:e,gitdir:r,message:n=""}){let i=new es({fs:t,dir:e,gitdir:r});await i.getAuthor();let a=await pa({fs:t,gitdir:r,fullname:!1}),s=await z.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await Bg({fs:t,dir:e,gitdir:r,oid:s})).commit.message,u=[s],c=null,f=$r({ref:"HEAD"}),d=await lE({fs:t,dir:e,gitdir:r,treePair:[$r({ref:"HEAD"}),"stage"]});if(d){let v=await i.writeStashCommit({message:`stash-Index: WIP on ${a} - ${new Date().toISOString()}`,tree:d,parent:u});u.push(v),c=d,f=ts()}let h=await lE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${a} - ${new Date().toISOString()}`,tree:h,parent:[u[u.length-1]]});u.push(v),c=h}if(!c||!d&&!h)throw new Le("changes, nothing to stash");let m=(n.trim()||`WIP on ${a}`)+`: ${s.substring(0,7)} ${l}`,g=await i.writeStashCommit({message:m,tree:c,parent:u});return await i.writeStashRef(g),await i.writeStashReflogEntry({stashCommit:g,message:m}),await Dg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),g}async function Uk({fs:t,dir:e,gitdir:r,refIdx:n=0}){let a=await new es({fs:t,dir:e,gitdir:r}).readStashCommit(n),{parent:s=null}=a.commit?a.commit:{};if(!(!s||!Array.isArray(s)))for(let o=0;o{await t.exists(s)&&await t.rm(s)});let o=await i.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(n,1);let l=i.refLogsStashPath;await To({reflogEntries:o,stashReflogPath:l,stashMgr:i},async()=>{if(o.length){await t.write(l,o.join(` +`),"utf8");let u=o[o.length-1].split(" ")[1];await i.writeStashRef(u)}else await t.rm(l)})}async function L8({fs:t,dir:e,gitdir:r}){return new es({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function N8({fs:t,dir:e,gitdir:r}){let n=new es({fs:t,dir:e,gitdir:r}),i=[n.refStashPath,n.refLogsStashPath];await To(i,async()=>{await Promise.all(i.map(async a=>{if(await t.exists(a))return t.rm(a)}))})}async function B8({fs:t,dir:e,gitdir:r,refIdx:n=0}){await Uk({fs:t,dir:e,gitdir:r,refIdx:n}),await jk({fs:t,dir:e,gitdir:r,refIdx:n})}async function Gk({fs:t,dir:e,gitdir:r=O.join(e,".git"),op:n="push",message:i="",refIdx:a=0}){C("fs",t),C("dir",e),C("gitdir",r),C("op",n);let s={push:D8,apply:Uk,drop:jk,list:L8,clear:N8,pop:B8},o=["apply","drop","pop"];try{let l=new J(t);["refs","logs","logs/refs"].map(f=>O.join(r,f)).forEach(async f=>{await l.exists(f)||await l.mkdir(f)});let c=s[n];if(c){if(o.includes(n)&&a<0)throw new wn(`stash@${a}`,"number that is in range of [0, num of stash pushed]");return await c({fs:l,dir:e,gitdir:r,message:i,refIdx:a})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function qk({fs:t,dir:e,gitdir:r=O.join(e,".git"),filepath:n,cache:i={}}){try{C("fs",t),C("gitdir",r),C("filepath",n);let a=new J(t);if(await fa.isIgnored({fs:a,gitdir:r,dir:e,filepath:n}))return"ignored";let o=await H8({fs:a,cache:i,gitdir:r}),l=await zk({fs:a,cache:i,gitdir:r,tree:o,path:n}),u=await ct.acquire({fs:a,gitdir:r,cache:i},async function(g){for(let v of g)if(v.path===n)return v;return null}),c=await a.lstat(O.join(e,n)),f=l!==null,d=u!==null,h=c!==null,m=async()=>{if(d&&!Uf(u,c))return u.oid;{let g=await a.read(O.join(e,n)),v=await Dk({gitdir:r,type:"blob",object:g});return d&&u.oid===v&&c.size!==-1&&ct.acquire({fs:a,gitdir:r,cache:i},async function(w){w.insert({filepath:n,stats:c,oid:v})}),v}};if(!f&&!h&&!d)return"absent";if(!f&&!h&&d)return"*absent";if(!f&&h&&!d)return"*added";if(!f&&h&&d)return await m()===u.oid?"added":"*added";if(f&&!h&&!d)return"deleted";if(f&&!h&&d)return l===u.oid,"*deleted";if(f&&h&&!d)return await m()===l?"*undeleted":"*undeletemodified";if(f&&h&&d){let g=await m();return g===l?g===u.oid?"unmodified":"*unmodified":g===u.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function zk({fs:t,cache:e,gitdir:r,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of n)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await qe({fs:t,cache:e,gitdir:r,oid:s.oid});if(o==="tree"){let u=pr.from(l);return zk({fs:t,cache:e,gitdir:r,tree:u,path:i})}if(o==="blob")throw new rr(s.oid,o,"blob",i.join("/"))}return null}async function H8({fs:t,cache:e,gitdir:r}){let n;try{n=await z.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(a){if(a instanceof Le)return[]}let{tree:i}=await Po({fs:t,cache:e,gitdir:r,oid:n});return i}async function Vk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let l=new J(t);return await ua({fs:l,cache:s,dir:e,gitdir:r,trees:[$r({ref:n}),Co(),ts()],map:async function(u,[c,f,d]){if(!c&&!d&&f&&!o&&await fa.isIgnored({fs:l,dir:e,filepath:u})||!i.some(A=>FE(u,A)))return null;if(a&&!a(u))return;let[h,m,g]=await Promise.all([c&&c.type(),f&&f.type(),d&&d.type()]),v=[h,m,g].includes("blob");if((h==="tree"||h==="special")&&!v)return;if(h==="commit")return null;if((m==="tree"||m==="special")&&!v)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!v)return;let w=h==="blob"?await c.oid():void 0,b=g==="blob"?await d.oid():void 0,E;h!=="blob"&&m==="blob"&&g!=="blob"?E="42":m==="blob"&&(E=await f.oid());let x=[void 0,w,E,b],k=x.map(A=>x.indexOf(A));return k.shift(),[u,...k]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Wk({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,object:i,force:a=!1}){try{C("fs",t),C("gitdir",r),C("ref",n);let s=new J(t);if(n===void 0)throw new hr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let o=await z.resolve({fs:s,gitdir:r,ref:i||"HEAD"});if(!a&&await z.exists({fs:s,gitdir:r,ref:n}))throw new vn("tag",n);await z.writeRef({fs:s,gitdir:r,ref:n,value:o})}catch(s){throw s.caller="git.tag",s}}async function Yk({fs:t,dir:e,gitdir:r=O.join(e,".git"),cache:n={},filepath:i,oid:a,mode:s,add:o,remove:l,force:u}){try{C("fs",t),C("gitdir",r),C("filepath",i);let c=new J(t);if(l)return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!u){let h=await c.lstat(O.join(e,i));if(h){if(h.isDirectory())throw new ca("directory");return}}d.has({filepath:i})&&d.delete({filepath:i})});let f;if(!a){if(f=await c.lstat(O.join(e,i)),!f)throw new Le(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new ca("directory")}return await ct.acquire({fs:c,gitdir:r,cache:n},async function(d){if(!o&&!d.has({filepath:i}))throw new Le(`file at "${i}" in index and "add" not set`);let h;if(a)h={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};else{h=f;let m=h.isSymbolicLink()?await c.readlink(O.join(e,i)):await c.read(O.join(e,i));a=await gr({fs:c,gitdir:r,type:"blob",format:"content",object:m})}return d.insert({filepath:i,oid:a,stats:h}),a})}catch(c){throw c.caller="git.updateIndex",c}}function Xk(){try{return td.version}catch(t){throw t.caller="git.version",t}}async function Zk({fs:t,dir:e,gitdir:r=O.join(e,".git"),trees:n,map:i,reduce:a,iterate:s,cache:o={}}){try{return C("fs",t),C("gitdir",r),C("trees",n),await ua({fs:new J(t),cache:o,dir:e,gitdir:r,trees:n,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function Kk({fs:t,dir:e,gitdir:r=O.join(e,".git"),blob:n}){try{return C("fs",t),C("gitdir",r),C("blob",n),await gr({fs:new J(t),gitdir:r,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function Jk({fs:t,dir:e,gitdir:r=O.join(e,".git"),commit:n}){try{return C("fs",t),C("gitdir",r),C("commit",n),await Hk({fs:new J(t),gitdir:r,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function Qk({fs:t,dir:e,gitdir:r=O.join(e,".git"),type:n,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new J(t);if(a==="parsed"){switch(n){case"commit":i=mr.from(i).toObject();break;case"tree":i=pr.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Fr.from(i).toObject();break;default:throw new rr(s||"",n,"blob|commit|tag|tree")}a="content"}return s=await gr({fs:l,gitdir:r,type:n,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function eA({fs:t,dir:e,gitdir:r=O.join(e,".git"),ref:n,value:i,force:a=!1,symbolic:s=!1}){try{C("fs",t),C("gitdir",r),C("ref",n),C("value",i);let o=new J(t);if(n!==Xn.clean(n))throw new wn(n,Xn.clean(n));if(!a&&await z.exists({fs:o,gitdir:r,ref:n}))throw new vn("ref",n);s?await z.writeSymbolicRef({fs:o,gitdir:r,ref:n,value:i}):(i=await z.resolve({fs:o,gitdir:r,ref:i}),await z.writeRef({fs:o,gitdir:r,ref:n,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function U8({fs:t,gitdir:e,tag:r}){let n=Fr.from(r).toObject();return await gr({fs:t,gitdir:e,type:"tag",object:n,format:"content"})}async function tA({fs:t,dir:e,gitdir:r=O.join(e,".git"),tag:n}){try{return C("fs",t),C("gitdir",r),C("tag",n),await U8({fs:new J(t),gitdir:r,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function rA({fs:t,dir:e,gitdir:r=O.join(e,".git"),tree:n}){try{return C("fs",t),C("gitdir",r),C("tree",n),await bc({fs:new J(t),gitdir:r,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var j8={Errors:wE,STAGE:ts,TREE:$r,WORKDIR:Co,add:SE,abortMerge:bE,addNote:CE,addRemote:RE,annotatedTag:IE,branch:$E,checkout:Dg,clone:NE,commit:BE,getConfig:ek,getConfigAll:tk,setConfig:Bk,currentBranch:HE,deleteBranch:UE,deleteRef:jE,deleteRemote:GE,deleteTag:qE,expandOid:zE,expandRef:VE,fastForward:XE,fetch:ZE,findMergeBase:KE,findRoot:QE,getRemoteInfo:rk,getRemoteInfo2:ik,hashBlob:ak,indexPack:sk,init:ok,isDescendent:ck,isIgnored:uk,listBranches:fk,listFiles:hk,listNotes:pk,listRefs:mk,listRemotes:gk,listServerRefs:vk,listTags:wk,log:bk,merge:_k,packObjects:Sk,pull:Ek,push:kk,readBlob:Ck,readCommit:Bg,readNote:Pk,readObject:Rk,readTag:Ik,readTree:$k,remove:Fk,removeNote:Ok,renameBranch:Mk,resetIndex:Lk,updateIndex:Yk,resolveRef:Nk,status:qk,statusMatrix:Vk,tag:Wk,version:Xk,walk:Zk,writeBlob:Kk,writeCommit:Jk,writeObject:Qk,writeRef:eA,writeTag:tA,writeTree:rA,stash:Gk};W.Errors=wE;W.STAGE=ts;W.TREE=$r;W.WORKDIR=Co;W.abortMerge=bE;W.add=SE;W.addNote=CE;W.addRemote=RE;W.annotatedTag=IE;W.branch=$E;W.checkout=Dg;W.clone=NE;W.commit=BE;W.currentBranch=HE;W.default=j8;W.deleteBranch=UE;W.deleteRef=jE;W.deleteRemote=GE;W.deleteTag=qE;W.expandOid=zE;W.expandRef=VE;W.fastForward=XE;W.fetch=ZE;W.findMergeBase=KE;W.findRoot=QE;W.getConfig=ek;W.getConfigAll=tk;W.getRemoteInfo=rk;W.getRemoteInfo2=ik;W.hashBlob=ak;W.indexPack=sk;W.init=ok;W.isDescendent=ck;W.isIgnored=uk;W.listBranches=fk;W.listFiles=hk;W.listNotes=pk;W.listRefs=mk;W.listRemotes=gk;W.listServerRefs=vk;W.listTags=wk;W.log=bk;W.merge=_k;W.packObjects=Sk;W.pull=Ek;W.push=kk;W.readBlob=Ck;W.readCommit=Bg;W.readNote=Pk;W.readObject=Rk;W.readTag=Ik;W.readTree=$k;W.remove=Fk;W.removeNote=Ok;W.renameBranch=Mk;W.resetIndex=Lk;W.resolveRef=Nk;W.setConfig=Bk;W.stash=Gk;W.status=qk;W.statusMatrix=Vk;W.tag=Wk;W.updateIndex=Yk;W.version=Xk;W.walk=Zk;W.writeBlob=Kk;W.writeCommit=Jk;W.writeObject=Qk;W.writeRef=eA;W.writeTag=tA;W.writeTree=rA});var uA=I((nZ,cA)=>{"use strict";p();cA.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 dA=I((aZ,fA)=>{p();var Vg={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}};fA.exports=function(t,e,r,n){if(!Vg.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!Vg[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var i=Vg[r][e]*t;return n!==!1?(n=Math.pow(10,parseInt(n)||5),Math.round(i*n)/n):i}});var AA=I(Ai=>{"use strict";p();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.fromRgba=$o;Ai.fromRgb=Wg;Ai.fromHsla=ld;Ai.fromHsl=EA;Ai.fromString=kA;Ai.default=void 0;var hA=gA(uA()),W8=gA(dA());function gA(t){return t&&t.__esModule?t:{default:t}}function Y8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pA(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r-1}function e6(t,e,r){var n=t/255,i=e/255,a=r/255,s=Math.max(n,i,a),o=Math.min(n,i,a),l=s-o,u=(s+o)/2;if(l===0)return[0,0,u*100];var c=l/(1-Math.abs(2*u-1)),f=function(){switch(s){case n:return(i-a)/l%6;case i:return(a-n)/l+2;default:return(n-i)/l+4}}();return[f*60,c*100,u*100]}function t6(t,e,r){var n=t/60,i=e/100,a=r/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(n%2-1)),l=a-s/2,u=function(){return n<1?[s,o,0]:n<2?[o,s,0]:n<3?[0,s,o]:n<4?[0,o,s]:n<5?[o,0,s]:[s,0,o]}(),c=nr(u,3),f=c[0],d=c[1],h=c[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var r6=function(){function t(e){var r=nr(e,4),n=r[0],i=r[1],a=r[2],s=r[3];Y8(this,t),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return X8(t,[{key:"toRgbString",value:function(){var r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return s===1?"rgb(".concat(n,", ").concat(i,", ").concat(a,")"):"rgba(".concat(n,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),n=nr(r,4),i=n[0],a=n[1],s=n[2],o=n[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(n).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=nr(this.values,4),n=r[0],i=r[1],a=r[2],s=r[3],o=e6(n,i,a),l=nr(o,3),u=l[0],c=l[1],f=l[2];return[u,c,f,s]}}]),t}();function $o(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3];return new r6([r,n,i,a])}function Wg(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return $o([r,n,i,1])}function ld(t){var e=nr(t,4),r=e[0],n=e[1],i=e[2],a=e[3],s=t6(r,n,i),o=nr(s,3),l=o[0],u=o[1],c=o[2];return $o([l,u,c,a])}function EA(t){var e=nr(t,3),r=e[0],n=e[1],i=e[2];return ld([r,n,i,1])}function n6(t){var e=vA.exec(t)||wA.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,$o([n,i,a,s])}function i6(t){var e=yA.exec(t)||_A.exec(t)||bA.exec(t)||xA.exec(t),r=nr(e,5),n=r[1],i=r[2],a=r[3],s=r[4];return n=Ec(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ec(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Ec(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Ec(s,"%")?100:1),$o([n,i,a,s])}function a6(t){var e=SA.exec(t),r=nr(e,6),n=r[1],i=r[2],a=r[3],s=r[4],o=r[5];return i=i||"deg",n=(0,W8.default)(parseFloat(n),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Ec(o,"%")?100:1),ld([n,a,s,o])}function kA(t){return hA.default[t]?Wg(hA.default[t]):vA.test(t)||wA.test(t)?n6(t):yA.test(t)||_A.test(t)||bA.test(t)||xA.test(t)?i6(t):SA.test(t)?a6(t):null}var s6={fromString:kA,fromRgb:Wg,fromRgba:$o,fromHsl:EA,fromHsla:ld};Ai.default=s6});var Yg=I((cZ,CA)=>{"use strict";p();var TA=Object.prototype.toString;CA.exports=function(e){var r=TA.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&TA.call(e.callee)==="[object Function]"),n}});var LA=I((fZ,DA)=>{"use strict";p();var MA;Object.keys||(kc=Object.prototype.hasOwnProperty,Xg=Object.prototype.toString,PA=Yg(),Zg=Object.prototype.propertyIsEnumerable,RA=!Zg.call({toString:null},"toString"),IA=Zg.call(function(){},"prototype"),Ac=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],cd=function(t){var e=t.constructor;return e&&e.prototype===t},$A={$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},FA=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!$A["$"+t]&&kc.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{cd(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),OA=function(t){if(typeof window=="undefined"||!FA)return cd(t);try{return cd(t)}catch(e){return!1}},MA=function(e){var r=e!==null&&typeof e=="object",n=Xg.call(e)==="[object Function]",i=PA(e),a=r&&Xg.call(e)==="[object String]",s=[];if(!r&&!n&&!i)throw new TypeError("Object.keys called on a non-object");var o=IA&&n;if(a&&e.length>0&&!kc.call(e,0))for(var l=0;l0)for(var u=0;u{"use strict";p();var o6=Array.prototype.slice,l6=Yg(),NA=Object.keys,ud=NA?function(e){return NA(e)}:LA(),BA=Object.keys;ud.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(n){return l6(n)?BA(o6.call(n)):BA(n)})}else Object.keys=ud;return Object.keys||ud};HA.exports=ud});var va=I((mZ,qA)=>{"use strict";p();var c6=fd(),u6=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",f6=Object.prototype.toString,d6=Array.prototype.concat,UA=pf(),h6=function(t){return typeof t=="function"&&f6.call(t)==="[object Function]"},jA=mf()(),p6=function(t,e,r,n){if(e in t){if(n===!0){if(t[e]===r)return}else if(!h6(n)||!n())return}jA?UA(t,e,r,!0):UA(t,e,r)},GA=function(t,e){var r=arguments.length>2?arguments[2]:{},n=c6(e);u6&&(n=d6.call(n,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";p();var m6=fd(),VA=Fl()(),WA=St(),dd=Qu(),g6=WA("Array.prototype.push"),zA=WA("Object.prototype.propertyIsEnumerable"),v6=VA?dd.getOwnPropertySymbols:null;YA.exports=function(e,r){if(e==null)throw new TypeError("target must be an object");var n=dd(e);if(arguments.length===1)return n;for(var i=1;i{"use strict";p();var Jg=Kg(),w6=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n{"use strict";p();var b6=va(),_6=Qg();ZA.exports=function(){var e=_6();return b6(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var tT=I((SZ,eT)=>{"use strict";p();var x6=va(),S6=Ua(),E6=Kg(),JA=Qg(),k6=KA(),A6=S6.apply(JA()),QA=function(e,r){return A6(Object,arguments)};x6(QA,{getPolyfill:JA,implementation:E6,shim:k6});eT.exports=QA});var ev=I((kZ,iT)=>{"use strict";p();var rT=Bn(),nT=Ua(),T6=nT(rT("String.prototype.indexOf"));iT.exports=function(e,r){var n=rT(e,!!r);return typeof n=="function"&&T6(e,".prototype.")>-1?nT(n):n}});var sT=I((TZ,aT)=>{"use strict";p();var Cc=function(){return typeof function(){}.name=="string"},Tc=Object.getOwnPropertyDescriptor;if(Tc)try{Tc([],"length")}catch(t){Tc=null}Cc.functionsHaveConfigurableNames=function(){if(!Cc()||!Tc)return!1;var e=Tc(function(){},"name");return!!e&&!!e.configurable};var C6=Function.prototype.bind;Cc.boundFunctionsHaveNames=function(){return Cc()&&typeof C6=="function"&&function(){}.bind().name!==""};aT.exports=Cc});var cT=I((PZ,lT)=>{"use strict";p();var oT=pf(),P6=mf()(),R6=sT().functionsHaveConfigurableNames(),I6=fr();lT.exports=function(e,r){if(typeof e!="function")throw new I6("`fn` is not a function");var n=arguments.length>2&&!!arguments[2];return(!n||R6)&&(P6?oT(e,"name",r,!0,!0):oT(e,"name",r)),e}});var tv=I((IZ,uT)=>{"use strict";p();var $6=cT(),F6=fr(),O6=Object;uT.exports=$6(function(){if(this==null||this!==O6(this))throw new F6("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 rv=I((FZ,fT)=>{"use strict";p();var M6=tv(),D6=va().supportsDescriptors,L6=Object.getOwnPropertyDescriptor;fT.exports=function(){if(D6&&/a/mig.flags==="gim"){var e=L6(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(n,"sticky",{get:function(){r+="y"}}),e.get.call(n),r==="dy")return e.get}}return M6}});var pT=I((MZ,hT)=>{"use strict";p();var N6=va().supportsDescriptors,B6=rv(),H6=Ki(),U6=Object.defineProperty,j6=im(),dT=lf(),G6=/a/;hT.exports=function(){if(!N6||!dT)throw new j6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=B6(),r=dT(G6),n=H6(r,"flags");return(!n||n.get!==e)&&U6(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var wT=I((LZ,vT)=>{"use strict";p();var q6=va(),z6=Ua(),V6=tv(),mT=rv(),W6=pT(),gT=z6(mT());q6(gT,{getPolyfill:mT,implementation:V6,shim:W6});vT.exports=gT});var iv=I((BZ,bT)=>{"use strict";p();var Y6=Ji()(),X6=St(),nv=X6("Object.prototype.toString"),hd=function(e){return Y6&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:nv(e)==="[object Arguments]"},yT=function(e){return hd(e)?!0:e!==null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&nv(e)!=="[object Array]"&&"callee"in e&&nv(e.callee)==="[object Function]"},Z6=function(){return hd(arguments)}();hd.isLegacyArguments=yT;bT.exports=Z6?hd:yT});var _T=I(()=>{p()});var Fc=I((qZ,UT)=>{p();var pv=typeof Map=="function"&&Map.prototype,av=Object.getOwnPropertyDescriptor&&pv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,md=pv&&av&&typeof av.get=="function"?av.get:null,xT=pv&&Map.prototype.forEach,mv=typeof Set=="function"&&Set.prototype,sv=Object.getOwnPropertyDescriptor&&mv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,gd=mv&&sv&&typeof sv.get=="function"?sv.get:null,ST=mv&&Set.prototype.forEach,K6=typeof WeakMap=="function"&&WeakMap.prototype,Rc=K6?WeakMap.prototype.has:null,J6=typeof WeakSet=="function"&&WeakSet.prototype,Ic=J6?WeakSet.prototype.has:null,Q6=typeof WeakRef=="function"&&WeakRef.prototype,ET=Q6?WeakRef.prototype.deref:null,e4=Boolean.prototype.valueOf,t4=Object.prototype.toString,r4=Function.prototype.toString,n4=String.prototype.match,gv=String.prototype.slice,wa=String.prototype.replace,i4=String.prototype.toUpperCase,kT=String.prototype.toLowerCase,OT=RegExp.prototype.test,AT=Array.prototype.concat,Kn=Array.prototype.join,a4=Array.prototype.slice,TT=Math.floor,cv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ov=Object.getOwnPropertySymbols,uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Fo=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$c=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Fo||!0)?Symbol.toStringTag:null,MT=Object.prototype.propertyIsEnumerable,CT=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function PT(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||OT.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-TT(-t):TT(t);if(n!==t){var i=String(n),a=gv.call(e,i.length+1);return wa.call(i,r,"$&_")+"."+wa.call(wa.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return wa.call(e,r,"$&_")}var fv=_T(),RT=fv.custom,IT=NT(RT)?RT:null,DT={__proto__:null,double:'"',single:"'"},s4={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};UT.exports=function t(e,r,n,i){var a=r||{};if(Ti(a,"quoteStyle")&&!Ti(DT,a.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ti(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=Ti(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ti(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ti(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.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 HT(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?PT(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return o?PT(e,u):u}var c=typeof a.depth=="undefined"?5:a.depth;if(typeof n=="undefined"&&(n=0),n>=c&&c>0&&typeof e=="object")return dv(e)?"[Array]":"[Object]";var f=E4(a,n);if(typeof i=="undefined")i=[];else if(BT(i,e)>=0)return"[Circular]";function d(D,M,re){if(M&&(i=a4.call(i),i.push(M)),re){var ye={depth:a.depth};return Ti(a,"quoteStyle")&&(ye.quoteStyle=a.quoteStyle),t(D,ye,n+1,i)}return t(D,a,n+1,i)}if(typeof e=="function"&&!$T(e)){var h=m4(e),m=pd(e,d);return"[Function"+(h?": "+h:" (anonymous)")+"]"+(m.length>0?" { "+Kn.call(m,", ")+" }":"")}if(NT(e)){var g=Fo?wa.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):uv.call(e);return typeof e=="object"&&!Fo?Pc(g):g}if(_4(e)){for(var v="<"+kT.call(String(e.nodeName)),w=e.attributes||[],b=0;b",v}if(dv(e)){if(e.length===0)return"[]";var E=pd(e,d);return f&&!S4(E)?"["+hv(E,f)+"]":"[ "+Kn.call(E,", ")+" ]"}if(c4(e)){var x=pd(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!MT.call(e,"cause")?"{ ["+String(e)+"] "+Kn.call(AT.call("[cause]: "+d(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Kn.call(x,", ")+" }"}if(typeof e=="object"&&s){if(IT&&typeof e[IT]=="function"&&fv)return fv(e,{depth:c-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(g4(e)){var k=[];return xT&&xT.call(e,function(D,M){k.push(d(M,e,!0)+" => "+d(D,e))}),FT("Map",md.call(e),k,f)}if(y4(e)){var A=[];return ST&&ST.call(e,function(D){A.push(d(D,e))}),FT("Set",gd.call(e),A,f)}if(v4(e))return lv("WeakMap");if(b4(e))return lv("WeakSet");if(w4(e))return lv("WeakRef");if(f4(e))return Pc(d(Number(e)));if(h4(e))return Pc(d(cv.call(e)));if(d4(e))return Pc(e4.call(e));if(u4(e))return Pc(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(!l4(e)&&!$T(e)){var y=pd(e,d),S=CT?CT(e)===Object.prototype:e instanceof Object||e.constructor===Object,_=e instanceof Object?"":"null prototype",T=!S&&$c&&Object(e)===e&&$c in e?gv.call(ya(e),8,-1):_?"Object":"",P=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",F=P+(T||_?"["+Kn.call(AT.call([],T||[],_||[]),": ")+"] ":"");return y.length===0?F+"{}":f?F+"{"+hv(y,f)+"}":F+"{ "+Kn.call(y,", ")+" }"}return String(e)};function LT(t,e,r){var n=r.quoteStyle||e,i=DT[n];return i+t+i}function o4(t){return wa.call(String(t),/"/g,""")}function ns(t){return!$c||!(typeof t=="object"&&($c in t||typeof t[$c]!="undefined"))}function dv(t){return ya(t)==="[object Array]"&&ns(t)}function l4(t){return ya(t)==="[object Date]"&&ns(t)}function $T(t){return ya(t)==="[object RegExp]"&&ns(t)}function c4(t){return ya(t)==="[object Error]"&&ns(t)}function u4(t){return ya(t)==="[object String]"&&ns(t)}function f4(t){return ya(t)==="[object Number]"&&ns(t)}function d4(t){return ya(t)==="[object Boolean]"&&ns(t)}function NT(t){if(Fo)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!uv)return!1;try{return uv.call(t),!0}catch(e){}return!1}function h4(t){if(!t||typeof t!="object"||!cv)return!1;try{return cv.call(t),!0}catch(e){}return!1}var p4=Object.prototype.hasOwnProperty||function(t){return t in this};function Ti(t,e){return p4.call(t,e)}function ya(t){return t4.call(t)}function m4(t){if(t.name)return t.name;var e=n4.call(r4.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function BT(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return HT(gv.call(t,0,e.maxStringLength),e)+n}var i=s4[e.quoteStyle||"single"];i.lastIndex=0;var a=wa.call(wa.call(t,i,"\\$1"),/[\x00-\x1f]/g,x4);return LT(a,"single",e)}function x4(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":"")+i4.call(e.toString(16))}function Pc(t){return"Object("+t+")"}function lv(t){return t+" { ? }"}function FT(t,e,r,n){var i=n?hv(r,n):Kn.call(r,", ");return t+" ("+e+") {"+i+"}"}function S4(t){for(var e=0;e=0)return!1;return!0}function E4(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Kn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Kn.call(Array(e+1),r)}}function hv(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Kn.call(t,","+r)+` +`+e.prev}function pd(t,e){var r=dv(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";p();var k4=Fc(),A4=fr(),vd=function(t,e,r){for(var n=t,i;(i=n.next)!=null;n=i)if(i.key===e)return n.next=i.next,r||(i.next=t.next,t.next=i),i},T4=function(t,e){if(t){var r=vd(t,e);return r&&r.value}},C4=function(t,e,r){var n=vd(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},P4=function(t,e){return t?!!vd(t,e):!1},R4=function(t,e){if(t)return vd(t,e,!0)};jT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new A4("Side channel does not contain "+k4(n))},delete:function(n){var i=e&&e.next,a=R4(e,n);return a&&i&&i===a&&(e=void 0),!!a},get:function(n){return T4(e,n)},has:function(n){return P4(e,n)},set:function(n,i){e||(e={next:void 0}),C4(e,n,i)}};return r}});var vv=I((YZ,zT)=>{"use strict";p();var I4=Bn(),Oc=St(),$4=Fc(),F4=fr(),qT=I4("%Map%",!0),O4=Oc("Map.prototype.get",!0),M4=Oc("Map.prototype.set",!0),D4=Oc("Map.prototype.has",!0),L4=Oc("Map.prototype.delete",!0),N4=Oc("Map.prototype.size",!0);zT.exports=!!qT&&function(){var e,r={assert:function(n){if(!r.has(n))throw new F4("Side channel does not contain "+$4(n))},delete:function(n){if(e){var i=L4(e,n);return N4(e)===0&&(e=void 0),i}return!1},get:function(n){if(e)return O4(e,n)},has:function(n){return e?D4(e,n):!1},set:function(n,i){e||(e=new qT),M4(e,n,i)}};return r}});var WT=I((ZZ,VT)=>{"use strict";p();var B4=Bn(),yd=St(),H4=Fc(),wd=vv(),U4=fr(),Oo=B4("%WeakMap%",!0),j4=yd("WeakMap.prototype.get",!0),G4=yd("WeakMap.prototype.set",!0),q4=yd("WeakMap.prototype.has",!0),z4=yd("WeakMap.prototype.delete",!0);VT.exports=Oo?function(){var e,r,n={assert:function(i){if(!n.has(i))throw new U4("Side channel does not contain "+H4(i))},delete:function(i){if(Oo&&i&&(typeof i=="object"||typeof i=="function")){if(e)return z4(e,i)}else if(wd&&r)return r.delete(i);return!1},get:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?j4(e,i):r&&r.get(i)},has:function(i){return Oo&&i&&(typeof i=="object"||typeof i=="function")&&e?q4(e,i):!!r&&r.has(i)},set:function(i,a){Oo&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Oo),G4(e,i,a)):wd&&(r||(r=wd()),r.set(i,a))}};return n}:wd});var wv=I((JZ,YT)=>{"use strict";p();var V4=fr(),W4=Fc(),Y4=GT(),X4=vv(),Z4=WT(),K4=Z4||X4||Y4;YT.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new V4("Side channel does not contain "+W4(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,i){e||(e=K4()),e.set(n,i)}};return r}});var ZT=I((eK,XT)=>{"use strict";p();var J4=cf(),Mc=wv()(),Ci=fr(),yv={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");if(Mc.assert(t),!yv.has(t,e))throw new Ci("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var r=Mc.get(t);return!!r&&J4(r,"$"+e)},set:function(t,e,r){if(!t||typeof t!="object"&&typeof t!="function")throw new Ci("`O` is not an object");if(typeof e!="string")throw new Ci("`slot` must be a string");var n=Mc.get(t);n||(n={},Mc.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(yv);XT.exports=yv});var QT=I((rK,JT)=>{"use strict";p();var Dc=ZT(),Q4=ef(),KT=typeof StopIteration=="object"?StopIteration:null;JT.exports=function(e){if(!KT)throw new Q4("this environment lacks StopIteration");Dc.set(e,"[[Done]]",!1);var r={next:function(){var i=Dc.get(this,"[[Iterator]]"),a=!!Dc.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Dc.set(i,"[[Done]]",!0),s!==KT)throw s;return{done:!0,value:void 0}}}};return Dc.set(r,"[[Iterator]]",e),r}});var bv=I((iK,tC)=>{"use strict";p();var eC=St(),e5=eC("String.prototype.valueOf"),t5=function(e){try{return e5(e),!0}catch(r){return!1}},r5=eC("Object.prototype.toString"),n5="[object String]",i5=Ji()();tC.exports=function(e){return typeof e=="string"?!0:!e||typeof e!="object"?!1:i5?t5(e):r5(e)===n5}});var xv=I((sK,iC)=>{"use strict";p();var _v=typeof Map=="function"&&Map.prototype?Map:null,a5=typeof Set=="function"&&Set.prototype?Set:null,bd;_v||(bd=function(e){return!1});var nC=_v?Map.prototype.has:null,rC=a5?Set.prototype.has:null;!bd&&!nC&&(bd=function(e){return!1});iC.exports=bd||function(e){if(!e||typeof e!="object")return!1;try{if(nC.call(e),rC)try{rC.call(e)}catch(r){return!0}return e instanceof _v}catch(r){}return!1}});var Ev=I((lK,oC)=>{"use strict";p();var s5=typeof Map=="function"&&Map.prototype?Map:null,Sv=typeof Set=="function"&&Set.prototype?Set:null,_d;Sv||(_d=function(e){return!1});var aC=s5?Map.prototype.has:null,sC=Sv?Set.prototype.has:null;!_d&&!sC&&(_d=function(e){return!1});oC.exports=_d||function(e){if(!e||typeof e!="object")return!1;try{if(sC.call(e),aC)try{aC.call(e)}catch(r){return!0}return e instanceof Sv}catch(r){}return!1}});var yC=I((uK,Ed)=>{"use strict";p();var lC=iv(),cC=QT();nf()()||Fl()()?(xd=Symbol.iterator,Ed.exports=function(e){if(e!=null&&typeof e[xd]!="undefined")return e[xd]();if(lC(e))return Array.prototype[xd].call(e)}):(uC=Ju(),fC=bv(),kv=Bn(),dC=kv("%Map%",!0),hC=kv("%Set%",!0),en=ev(),Av=en("Array.prototype.push"),Tv=en("String.prototype.charCodeAt"),pC=en("String.prototype.slice"),mC=function(e,r){var n=e.length;if(r+1>=n)return r+1;var i=Tv(e,r);if(i<55296||i>56319)return r+1;var a=Tv(e,r+1);return a<56320||a>57343?r+1:r+2},Sd=function(e){var r=0;return{next:function(){var i=r>=e.length,a;return i||(a=e[r],r+=1),{done:i,value:a}}}},Cv=function(e,r){if(uC(e)||lC(e))return Sd(e);if(fC(e)){var n=0;return{next:function(){var a=mC(e,n),s=pC(e,n,a);return n=a,{done:a>e.length,value:s}}}}if(r&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!dC&&!hC?Ed.exports=function(e){if(e!=null)return Cv(e,!0)}:(gC=xv(),vC=Ev(),Pv=en("Map.prototype.forEach",!0),Rv=en("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(Iv=en("Map.prototype.iterator",!0),$v=en("Set.prototype.iterator",!0)),Fv=en("Map.prototype.@@iterator",!0)||en("Map.prototype._es6-shim iterator_",!0),Ov=en("Set.prototype.@@iterator",!0)||en("Set.prototype._es6-shim iterator_",!0),wC=function(e){if(gC(e)){if(Iv)return cC(Iv(e));if(Fv)return Fv(e);if(Pv){var r=[];return Pv(e,function(i,a){Av(r,[a,i])}),Sd(r)}}if(vC(e)){if($v)return cC($v(e));if(Ov)return Ov(e);if(Rv){var n=[];return Rv(e,function(i){Av(n,i)}),Sd(n)}}},Ed.exports=function(e){return wC(e)||Cv(e)}));var xd,uC,fC,kv,dC,hC,en,Av,Tv,pC,mC,Sd,Cv,gC,vC,Pv,Rv,Iv,$v,Fv,Ov,wC});var Mv=I((dK,_C)=>{"use strict";p();var bC=function(t){return t!==t};_C.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||bC(e)&&bC(r))}});var Dv=I((pK,xC)=>{"use strict";p();var o5=Mv();xC.exports=function(){return typeof Object.is=="function"?Object.is:o5}});var EC=I((gK,SC)=>{"use strict";p();var l5=Dv(),c5=va();SC.exports=function(){var e=l5();return c5(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var CC=I((wK,TC)=>{"use strict";p();var u5=va(),f5=Ua(),d5=Mv(),kC=Dv(),h5=EC(),AC=f5(kC(),Object);u5(AC,{getPolyfill:kC,implementation:d5,shim:h5});TC.exports=AC});var Nv=I((bK,$C)=>{"use strict";p();var p5=Ua(),IC=St(),m5=Bn(),Lv=m5("%ArrayBuffer%",!0),kd=IC("ArrayBuffer.prototype.byteLength",!0),g5=IC("Object.prototype.toString"),PC=!!Lv&&!kd&&new Lv(0).slice,RC=!!PC&&p5(PC);$C.exports=kd||RC?function(e){if(!e||typeof e!="object")return!1;try{return kd?kd(e):RC(e,0),!0}catch(r){return!1}}:Lv?function(e){return g5(e)==="[object ArrayBuffer]"}:function(e){return!1}});var MC=I((xK,OC)=>{"use strict";p();var FC=St(),v5=FC("Date.prototype.getDay"),w5=function(e){try{return v5(e),!0}catch(r){return!1}},y5=FC("Object.prototype.toString"),b5="[object Date]",_5=Ji()();OC.exports=function(e){return typeof e!="object"||e===null?!1:_5?w5(e):y5(e)===b5}});var jv=I((EK,HC)=>{"use strict";p();var DC=St(),x5=Ji()(),S5=cf(),E5=Ki(),Uv;x5?(LC=DC("RegExp.prototype.exec"),Bv={},Ad=function(){throw Bv},Hv={toString:Ad,valueOf:Ad},typeof Symbol.toPrimitive=="symbol"&&(Hv[Symbol.toPrimitive]=Ad),Uv=function(e){if(!e||typeof e!="object")return!1;var r=E5(e,"lastIndex"),n=r&&S5(r,"value");if(!n)return!1;try{LC(e,Hv)}catch(i){return i===Bv}}):(NC=DC("Object.prototype.toString"),BC="[object RegExp]",Uv=function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:NC(e)===BC});var LC,Bv,Ad,Hv,NC,BC;HC.exports=Uv});var GC=I((AK,jC)=>{"use strict";p();var k5=St(),UC=k5("SharedArrayBuffer.prototype.byteLength",!0);jC.exports=UC?function(e){if(!e||typeof e!="object")return!1;try{return UC(e),!0}catch(r){return!1}}:function(e){return!1}});var VC=I((CK,zC)=>{"use strict";p();var qC=St(),A5=qC("Number.prototype.toString"),T5=function(e){try{return A5(e),!0}catch(r){return!1}},C5=qC("Object.prototype.toString"),P5="[object Number]",R5=Ji()();zC.exports=function(e){return typeof e=="number"?!0:!e||typeof e!="object"?!1:R5?T5(e):C5(e)===P5}});var XC=I((RK,YC)=>{"use strict";p();var WC=St(),I5=WC("Boolean.prototype.toString"),$5=WC("Object.prototype.toString"),F5=function(e){try{return I5(e),!0}catch(r){return!1}},O5="[object Boolean]",M5=Ji()();YC.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:M5?F5(e):$5(e)===O5}});var KC=I(($K,ZC)=>{"use strict";p();var D5=St(),L5=jv(),N5=D5("RegExp.prototype.exec"),B5=fr();ZC.exports=function(e){if(!L5(e))throw new B5("`regex` must be a RegExp");return function(n){return N5(e,n)!==null}}});var r2=I((OK,Gv)=>{"use strict";p();var t2=St(),H5=t2("Object.prototype.toString"),U5=nf()(),j5=KC();U5?(JC=t2("Symbol.prototype.toString"),QC=j5(/^Symbol\(.*\)$/),e2=function(e){return typeof e.valueOf()!="symbol"?!1:QC(JC(e))},Gv.exports=function(e){if(typeof e=="symbol")return!0;if(!e||typeof e!="object"||H5(e)!=="[object Symbol]")return!1;try{return e2(e)}catch(r){return!1}}):Gv.exports=function(e){return!1};var JC,QC,e2});var a2=I((DK,i2)=>{"use strict";p();var n2=typeof BigInt!="undefined"&&BigInt;i2.exports=function(){return typeof n2=="function"&&typeof BigInt=="function"&&typeof n2(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var l2=I((NK,qv)=>{"use strict";p();var G5=a2()();G5?(s2=BigInt.prototype.valueOf,o2=function(e){try{return s2.call(e),!0}catch(r){}return!1},qv.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:o2(e)}):qv.exports=function(e){return!1};var s2,o2});var u2=I((HK,c2)=>{"use strict";p();var q5=bv(),z5=VC(),V5=XC(),W5=r2(),Y5=l2();c2.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(q5(e))return"String";if(z5(e))return"Number";if(V5(e))return"Boolean";if(W5(e))return"Symbol";if(Y5(e))return"BigInt"}});var h2=I((jK,d2)=>{"use strict";p();var Td=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,f2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Cd;Td||(Cd=function(e){return!1});var Vv=Td?Td.prototype.has:null,zv=f2?f2.prototype.has:null;!Cd&&!Vv&&(Cd=function(e){return!1});d2.exports=Cd||function(e){if(!e||typeof e!="object")return!1;try{if(Vv.call(e,Vv),zv)try{zv.call(e,zv)}catch(r){return!0}return e instanceof Td}catch(r){}return!1}});var m2=I((qK,Yv)=>{"use strict";p();var X5=Bn(),p2=St(),Z5=X5("%WeakSet%",!0),Wv=p2("WeakSet.prototype.has",!0);Wv?(Pd=p2("WeakMap.prototype.has",!0),Yv.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Wv(e,Wv),Pd)try{Pd(e,Pd)}catch(r){return!0}return e instanceof Z5}catch(r){}return!1}):Yv.exports=function(e){return!1};var Pd});var v2=I((VK,g2)=>{"use strict";p();var K5=xv(),J5=Ev(),Q5=h2(),eU=m2();g2.exports=function(e){if(e&&typeof e=="object"){if(K5(e))return"Map";if(J5(e))return"Set";if(Q5(e))return"WeakMap";if(eU(e))return"WeakSet"}return!1}});var b2=I((YK,y2)=>{"use strict";p();var tU=St(),w2=tU("ArrayBuffer.prototype.byteLength",!0),rU=Nv();y2.exports=function(e){return rU(e)?w2?w2(e):e.byteLength:NaN}});var z2=I((ZK,q2)=>{"use strict";p();var U2=tT(),Jn=ev(),_2=wT(),nU=Bn(),Mo=yC(),iU=wv(),x2=CC(),S2=iv(),E2=Ju(),k2=Nv(),A2=MC(),T2=jv(),C2=GC(),P2=fd(),R2=u2(),I2=v2(),$2=bm(),F2=b2(),O2=Jn("SharedArrayBuffer.prototype.byteLength",!0),M2=Jn("Date.prototype.getTime"),Xv=Object.getPrototypeOf,D2=Jn("Object.prototype.toString"),Id=nU("%Set%",!0),Zv=Jn("Map.prototype.has",!0),$d=Jn("Map.prototype.get",!0),L2=Jn("Map.prototype.size",!0),Fd=Jn("Set.prototype.add",!0),j2=Jn("Set.prototype.delete",!0),Od=Jn("Set.prototype.has",!0),Rd=Jn("Set.prototype.size",!0);function N2(t,e,r,n){for(var i=Mo(t),a;(a=i.next())&&!a.done;)if(yn(e,a.value,r,n))return j2(t,a.value),!0;return!1}function G2(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 aU(t,e,r,n,i,a){var s=G2(r);if(s!=null)return s;var o=$d(e,s),l=U2({},i,{strict:!1});return typeof o=="undefined"&&!Zv(e,s)||!yn(n,o,l,a)?!1:!Zv(t,s)&&yn(n,o,l,a)}function sU(t,e,r){var n=G2(r);return n!=null?n:Od(e,n)&&!Od(t,n)}function B2(t,e,r,n,i,a){for(var s=Mo(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,yn(r,l,i,a)&&yn(n,$d(e,l),i,a))return j2(t,l),!0;return!1}function yn(t,e,r,n){var i=r||{};if(i.strict?x2(t,e):t===e)return!0;var a=R2(t),s=R2(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?x2(t,e):t==e;var o=n.has(t),l=n.has(e),u;if(o&&l){if(n.get(t)===n.get(e))return!0}else u={};return o||n.set(t,u),l||n.set(e,u),cU(t,e,i,n)}function H2(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 oU(t,e,r,n){if(Rd(t)!==Rd(e))return!1;for(var i=Mo(t),a=Mo(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new Id),Fd(l,s.value);else if(!Od(e,s.value)){if(r.strict||!sU(t,e,s.value))return!1;l||(l=new Id),Fd(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!N2(l,o.value,r.strict,n))return!1}else if(!r.strict&&!Od(t,o.value)&&!N2(l,o.value,r.strict,n))return!1;return Rd(l)===0}return!0}function lU(t,e,r,n){if(L2(t)!==L2(e))return!1;for(var i=Mo(t),a=Mo(e),s,o,l,u,c,f;(s=i.next())&&!s.done;)if(u=s.value[0],c=s.value[1],u&&typeof u=="object")l||(l=new Id),Fd(l,u);else if(f=$d(e,u),typeof f=="undefined"&&!Zv(e,u)||!yn(c,f,r,n)){if(r.strict||!aU(t,e,u,c,r,n))return!1;l||(l=new Id),Fd(l,u)}if(l){for(;(o=a.next())&&!o.done;)if(u=o.value[0],f=o.value[1],u&&typeof u=="object"){if(!B2(l,t,u,f,r,n))return!1}else if(!r.strict&&(!t.has(u)||!yn($d(t,u),f,r,n))&&!B2(l,t,u,f,U2({},r,{strict:!1}),n))return!1;return Rd(l)===0}return!0}function cU(t,e,r,n){var i,a;if(typeof t!=typeof e||t==null||e==null||D2(t)!==D2(e)||S2(t)!==S2(e))return!1;var s=E2(t),o=E2(e);if(s!==o)return!1;var l=t instanceof Error,u=e instanceof Error;if(l!==u||(l||u)&&(t.name!==e.name||t.message!==e.message))return!1;var c=T2(t),f=T2(e);if(c!==f||(c||f)&&(t.source!==e.source||_2(t)!==_2(e)))return!1;var d=A2(t),h=A2(e);if(d!==h||(d||h)&&M2(t)!==M2(e)||r.strict&&Xv&&Xv(t)!==Xv(e))return!1;var m=$2(t),g=$2(e);if(m!==g)return!1;if(m||g){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(A[i]!=y[i])return!1;for(i=A.length-1;i>=0;i--)if(a=A[i],!yn(t[a],e[a],r,n))return!1;var S=I2(t),_=I2(e);return S!==_?!1:S==="Set"||_==="Set"?oU(t,e,r,n):S==="Map"?lU(t,e,r,n):!0}q2.exports=function(e,r,n){return yn(e,r,n,iU())}});var aP=I((aJ,iP)=>{p();iP.exports=function(t,e){var r=t,n=e,i=r.length,a=n.length,s=!1,o=i+1,l=[],u=[],c,f,d=function(){i>=a&&(c=r,f=i,r=n,n=c,i=a,a=f,s=!0,o=i+1)},h=function(g,v,w,b,E){return{startX:g,startY:v,endX:w,endY:b,r:E}},m=function(g,v,w){var b,E,x,k,A;for(v>w?b=l[g-1+o]:b=l[g+1+o],A=x=Math.max(v,w),k=E=x-g;E=g+1;--k)w[k+o]=m(k,w[k-1+o]+1,w[k+1+o]);w[g+o]=m(g,w[g-1+o]+1,w[g+1+o])}while(w[g+o]!==a);for(ed=g+2*b,E=l[g+o],A=i,y=a,S=[];E!==-1;){let _=u[E];(i!=_.endX||a!=_.endY)&&S.push({file1:[s?_.endY:_.endX,s?y-_.endY:A-_.endX],file2:[s?_.endX:_.endY,s?A-_.endX:y-_.endY]}),A=_.startX,y=_.startY,E=u[E].r}return(A!=0||y!=0)&&S.push({file1:[0,s?y:A],file2:[0,s?A:y]}),S.reverse(),S}}}});var lP=I((oJ,oP)=>{p();var sP=aP();function fU(t,e,r){var n,i=new sP(e,t).compose(),a=new sP(e,r).compose(),s=[];function o(D,M){s.push([D.file1[0],M,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;nu&&(l.push([1,u,D-u]),u=D)}for(var f=0;fg)break;g=Math.max(g,w+v[2]),f++}if(c(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(n=d;n<=f;n++){h=s[n];var E=h[1],x=b[E],k=h[0],A=k+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(k,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]),F=b[2][1]+(g-b[2][3]);l.push([-1,_,T-_,m,g-m,P,F-P])}u=g}return c(e.length),l}function dU(t,e,r){var n=[],i=[t,e,r],a=fU(t,e,r),s=[];function o(){s.length&&n.push({ok:s}),s=[]}function l(h){for(var m=0;m{p();var Ho=1e3,Uo=Ho*60,jo=Uo*60,as=jo*24,mU=as*7,gU=as*365.25;uP.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return vU(t);if(r==="number"&&isFinite(t))return e.long?yU(t):wU(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function vU(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]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*gU;case"weeks":case"week":case"w":return r*mU;case"days":case"day":case"d":return r*as;case"hours":case"hour":case"hrs":case"hr":case"h":return r*jo;case"minutes":case"minute":case"mins":case"min":case"m":return r*Uo;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ho;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function wU(t){var e=Math.abs(t);return e>=as?Math.round(t/as)+"d":e>=jo?Math.round(t/jo)+"h":e>=Uo?Math.round(t/Uo)+"m":e>=Ho?Math.round(t/Ho)+"s":t+"ms"}function yU(t){var e=Math.abs(t);return e>=as?Ld(t,e,as,"day"):e>=jo?Ld(t,e,jo,"hour"):e>=Uo?Ld(t,e,Uo,"minute"):e>=Ho?Ld(t,e,Ho,"second"):t+" ms"}function Ld(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var hP=I((yJ,dP)=>{p();function bU(t){r.debug=r,r.default=r,r.coerce=l,r.disable=s,r.enable=i,r.enabled=o,r.humanize=fP(),r.destroy=u,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){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=c,g.useColors=r.useColors(),g.color=r.selectColor(c),g.extend=n,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(c)),m),set:v=>{d=v}}),typeof r.init=="function"&&r.init(g),g}function n(c,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+c);return d.log=this.log,d}function i(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let f=(typeof c=="string"?c:"").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 a(c,f){let d=0,h=0,m=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),c}function o(c){for(let f of r.skips)if(a(c,f))return!1;for(let f of r.names)if(a(c,f))return!0;return!1}function l(c){return c instanceof Error?c.stack||c.message:c}function u(){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}dP.exports=bU});var Bd=I((vr,Nd)=>{p();vr.formatArgs=xU;vr.save=SU;vr.load=EU;vr.useColors=_U;vr.storage=kU();vr.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`."))}})();vr.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 _U(){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 xU(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nd.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}vr.log=console.debug||console.log||(()=>{});function SU(t){try{t?vr.storage.setItem("debug",t):vr.storage.removeItem("debug")}catch(e){}}function EU(){let t;try{t=vr.storage.getItem("debug")||vr.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function kU(){try{return localStorage}catch(t){}}Nd.exports=hP()(vr);var{formatters:AU}=Nd.exports;AU.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var pP=I(Or=>{"use strict";p();var TU=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});var CU=require("fs"),PU=TU(Bd()),Go=PU.default("@kwsites/file-exists");function RU(t,e,r){Go("checking %s",t);try{let n=CU.statSync(t);return n.isFile()&&e?(Go("[OK] path represents a file"),!0):n.isDirectory()&&r?(Go("[OK] path represents a directory"),!0):(Go("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return Go("[FAIL] path is not accessible: %o",n),!1;throw Go("[FATAL] %o",n),n}}function IU(t,e=Or.READABLE){return RU(t,(e&Or.FILE)>0,(e&Or.FOLDER)>0)}Or.exists=IU;Or.FILE=1;Or.FOLDER=2;Or.READABLE=Or.FILE+Or.FOLDER});var mP=I(Hd=>{"use strict";p();function $U(t){for(var e in t)Hd.hasOwnProperty(e)||(Hd[e]=t[e])}Object.defineProperty(Hd,"__esModule",{value:!0});$U(pP())});var nw=I(ss=>{"use strict";p();Object.defineProperty(ss,"__esModule",{value:!0});ss.createDeferred=ss.deferred=void 0;function rw(){let t,e,r="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){r==="pending"&&(r="resolved",t(i))},fail(i){r==="pending"&&(r="rejected",e(i))},get fulfilled(){return r!=="pending"},get status(){return r}}}ss.deferred=rw;ss.createDeferred=rw;ss.default=rw});var Yw=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(i){return e.create().update(i)};for(var r=0;r>2]|=t[i]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|n&63)<=57344?(o[a>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|n&63)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|n&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}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,n=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,u,c,f,d,h,m,g,v,w,b,E;for(u=16;u<64;++u)h=l[u-15],c=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[u-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[u]=l[u-16]+c+l[u-7]+f<<0;for(E=e&r,u=0;u<64;u+=4)this.first?(this.is224?(v=300032,h=l[0]-1413257819,o=h-150054599<<0,n=h+24177077<<0):(v=704751109,h=l[0]-210244248,o=h-1521486534<<0,n=h+143694565<<0),this.first=!1):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),v=t&e,d=v^t&r^E,g=i&a^~i&s,h=o+f+g+K[u]+l[u],m=c+d,o=n+h<<0,n=h+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=n&t,d=w^n&e^v,g=o&i^~o&a,h=s+f+g+K[u+1]+l[u+1],m=c+d,s=r+h<<0,r=h+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=r&n,d=b^r&t^w,g=s&o^~s&i,h=a+f+g+K[u+2]+l[u+2],m=c+d,a=e+h<<0,e=h+m<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),E=e&r,d=E^e&n^b,g=a&s^~a&o,h=i+f+g+K[u+3]+l[u+3],m=c+d,i=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+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,s=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[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[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[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]+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];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,n=this.h3,i=this.h4,a=this.h5,s=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,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&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 n,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(n=0;n>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++n)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);t=a}else if(i==="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 u=[],c=[];for(n=0;n<64;++n){var f=t[n]||0;u[n]=92^f,c[n]=54^f}Sha256.call(this,e,r),this.update(c),this.oKeyPad=u,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 NF=I(F0=>{p();(function(t){var e=/\S/,r=/\"/g,n=/\n/g,i=/\r/g,a=/\\/g,s=/\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,F=1,D=2,M=P,re=null,ye=null,me="",fe=[],Ge=!1,oe=0,B=0,Z="{{",H="}}";function Oe(){me.length>0&&(fe.push({tag:"_t",text:new String(me)}),me="")}function cr(){for(var Ie=!0,Me=B;Me"&&(De.indent=fe[It].text.toString()),fe.splice(It,1));else Me||fe.push({tag:` +`});Ge=!1,B=fe.length}function Y(Ie,Me){var It="="+H,De=Ie.indexOf(It,Me),G=u(Ie.substring(Ie.indexOf("=",Me)+1,De)).split(" ");return Z=G[0],H=G[G.length-1],De+It.length-1}for(_&&(_=_.split(" "),Z=_[0],H=_[1]),oe=0;oe0;){if(M=y.shift(),D&&D.tag=="<"&&!(M.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[M.tag]<=t.tags.$||h(M,T))_.push(M),M.nodes=d(y,M.tag,_,T);else if(M.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+M.n);if(F=_.pop(),M.n!=F.n&&!m(M.n,F.n,T))throw new Error("Nesting error: "+F.n+" vs. "+M.n);return F.end=M.i,P}else M.tag==` +`&&(M.last=y.length==0||y[0].tag==` +`);P.push(M)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return P}function h(y,S){for(var _=0,T=S.length;_":x,"<":function(y,S){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var T=S.partials[x(y,S)];T.subs=_.subs,T.partials=_.partials},$:function(y,S){var _={subs:{},code:"",partials:S.partials,prefix:y.n};t.walk(y.nodes,_),S.subs[y.n]=_.code,S.inPartial||(S.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,S){S.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,S){S.code+="t.b(t.v(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,S){S.code+=A('"'+b(y.text)+'"')},"{":k,"&":k};function k(y,S){S.code+="t.b(t.t(t."+E(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,S){for(var _,T=0,P=y.length;T{p();var eV={};(function(t){t.Template=function(d,h,m,g){d=d||{},this.r=d.code||this.r,this.c=m,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,m){return""},v:c,t:u,render:function(h,m,g){return this.ri([h],m||{},g)},ri:function(d,h,m){return this.r(d,h,m)},ep:function(d,h){var m=this.partials[d],g=h[m.name];if(m.instance&&m.base==g)return m.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,m.subs){h.stackText||(h.stackText={});for(key in m.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,m.subs,m.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,m,g){var v=this.ep(d,m);return v?v.ri(h,m,g):""},rs:function(d,h,m){var g=d[d.length-1];if(!f(g)){m(d,h,this);return}for(var v=0;v=0;x--)if(w=h[x],v=e(d,w,E),v!==void 0){b=!0;break}return b?(!g&&typeof v=="function"&&(v=this.mv(v,h,m)),v):g?!1:""},ls:function(d,h,m,g,v){var w=this.options.delimiters;return this.options.delimiters=v,this.b(this.ct(u(d.call(h,g)),h,m)),this.options.delimiters=w,!1},ct:function(d,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 E,x=h[h.length-1],k=d.call(x);return typeof k=="function"?g?!0:(E=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(k,x,m,E.substring(v,w),b)):k},mv:function(d,h,m){var g=h[h.length-1],v=d.call(g);return typeof v=="function"?this.ct(u(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 E(){}E.prototype=d.subs;var x,k=new b;k.subs=new E,k.subsText={},k.buf="",g=g||{},k.stackSubs=g,k.subsText=w;for(x in h)g[x]||(g[x]=h[x]);for(x in g)k.subs[x]=g[x];v=v||{},k.stackPartials=v;for(x in m)v[x]||(v[x]=m[x]);for(x in v)k.partials[x]=v[x];return k}var n=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function u(d){return String(d==null?"":d)}function c(d){return d=u(d),l.test(d)?d.replace(n,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof O0!="undefined"?O0:eV)});var M0=I((Mte,HF)=>{p();var Hh=NF();Hh.Template=BF().Template;Hh.template=Hh.Template;HF.exports=Hh});var GF=I(nn=>{"use strict";p();Object.defineProperty(nn,"__esModule",{value:!0});nn.ColorSchemeType=nn.DiffStyleType=nn.LineMatchingType=nn.OutputFormatType=nn.LineType=void 0;var UF;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(UF||(nn.LineType=UF={}));nn.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};nn.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};nn.DiffStyleType={WORD:"word",CHAR:"char"};var jF;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(jF||(nn.ColorSchemeType=jF={}))});var A9={};JM(A9,{default:()=>Up});module.exports=QM(A9);p();var $M=bt(Hg()),we=require("obsidian"),FM=bt(require("path"));p();var Zn={};p();var rd=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 nA=require("obsidian"),nd="YYYY-MM-DD",Ug=`${nd} HH:mm`,jg=`${nd} HH:mm:ss`,id=40,Ro="conflict-files-obsidian-git.md",Xe={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:jg,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:nA.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:Ug,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}},Dt={type:"git-view",name:"Source Control",icon:"git-pull-request"},Qr={type:"git-history-view",name:"History",icon:"history"},ma={type:"split-diff-view",name:"Diff view",icon:"diff"},ga={type:"diff-view",name:"Diff View",icon:"git-pull-request"},ad="C:\\Program Files\\Git\\cmd\\git.exe",sd="git_credentials_input",rs="obsidian_askpass.sh",iA=`#!/bin/sh PROMPT="$1" TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" @@ -124,47 +123,50 @@ done RESPONSE=$(cat "$TEMP_FILE.response") echo "$RESPONSE" -`,Ax=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];g();var kx=require("obsidian"),O$={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},$e=class extends kx.SuggestModal{constructor(t,r){if(super(t.app),this.config={...O$,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(t=>{this.resolve=t,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(t=>setTimeout(t,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(t){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[t.length>0?t:" ",...this.config.options]:[t.length>0?t:"...",...this.config.options]}renderSuggestion(t,r){this.config.obscure?r.hide():r.setText(t)}onChooseSuggestion(t,r){if(this.resolve){let n;this.config.allowEmpty&&t===" "?n="":t==="..."?n=void 0:n=t,this.resolve(n)}}};g();function Tx(e,t){let r=Object.assign({},e.lineAuthor,t.lineAuthor);return Object.assign({},e,t,{lineAuthor:r})}var $s=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};g();var cT=ze(Vx()),uT=ze(lT()),Kn=require("obsidian");var Gg=(e,t)=>e==="."||t==null||t.length===0||t==="."?!0:t.length>=e.length?t.startsWith(e):e.startsWith(t);function nn(e,t){let r;if(t){if(t.button===0||t.button===1){let n=Kn.Keymap.isModEvent(t);r=e.workspace.getLeaf(n)}}else r=e.workspace.getLeaf(!1);return r}function Tn(e,t,r,n,i){if(t.button==2){let a=e.vault.getAbstractFileByPath(r);if(a!=null){let s=new Kn.Menu;e.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:t.pageX,y:t.pageY})}else{let s=new Kn.Menu;e.workspace.trigger("obsidian-git:menu",s,r,i,n),s.showAtPosition({x:t.pageX,y:t.pageY})}}}function Ii(e){throw new Error("Impossible branch: "+e)}function zg(e){return`rgb(${e.r},${e.g},${e.b})`}function fT(e){var a;let t=(a=cT.fromString(e))==null?void 0:a.toRgbaArray();if(t===void 0)return;let[r,n,i]=t;return{r,g:n,b:i}}function dT(e){return e.diff(Kn.moment.unix(0),"seconds")}function hT(e){if(e.length!==0)return e.slice().sort()[Math.floor(e.length/2)]}function pT(e,t){return(0,uT.default)(e,t,{strict:!0})}function ql(e,t){return new Proxy(e,{get(r,n){return n==="length"?Math.min(t,r.length):r[n]}})}function mT(e,t,r){return e.length<=t?new Array(t-e.length).fill(r).join("")+e:e.substring(e.length-t)}function gT(e,t){if(t<=0)return e;let r=new Array(t).fill(" ").join(""),n=e.substring(t,e.length);return r+n}function Vg(e,t,r){return e<=t&&t<=r}function Fi(e){let[t,...r]=e.split("/");return[t,r.length===0?void 0:r.join("/")]}function Cn(e){return e.endsWith("/")?e:e.split("/").last().replace(/\.md$/,"")}function vT(e){return e===1?"1 minute":`${e} minutes`}function FB(e){let t=e.lastIndexOf(".");return e.substring(t+1)}function Ws(e){if(e.endsWith(".md"))return!1;let t=FB(e);return Ax.includes(t)}function Wg(e){return(e.startsWith("https://github.com/")||e.startsWith("https://gitlab.com/"))&&(e.endsWith(".git")||(e=e+".git")),e}function qs(e,t){let r=t.vault.getAbstractFileByPath(e);if(!(r instanceof Kn.TFile))return!1;try{return!!t.viewRegistry.getTypeByExtension(r.extension)}catch(n){return!0}}function yT({isFolder:e,gitRelativePath:t}){let r="/";return r+=t,e&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}g();var wT=require("obsidian"),Ys=class{constructor(t){this.plugin=t,this.app=t.app}getRelativeVaultPath(t){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+t:t}getRelativeRepoPath(t,r=!0){return r&&this.plugin.settings.basePath.length>0?t.substring(this.plugin.settings.basePath.length+1):t}unload(){}_getTreeStructure(t,r=0){let n=[];for(t=[...t];t.length>0;){let i=t.first(),a=i.path.substring(r);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=t.filter(c=>c.path.substring(r).startsWith(s+"/"));o.forEach(c=>t.remove(c));let l=i.path.substring(0,a.indexOf("/")+r);n.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+s.length:s.length)+1)})}else n.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),t.remove(i)}return n}simplify(t){var r,n,i,a;for(let s of t){for(;;){let o=((r=s.children)==null?void 0:r.length)==1,l=((i=(n=s.children)==null?void 0:n.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let c=s.children.first();s.title+="/"+c.title,s.data=c.data,s.path=c.path,s.vaultPath=c.vaultPath,s.children=c.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.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 t.sort((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.title.localeCompare(o.title)})}getTreeStructure(t){let r=this._getTreeStructure(t);return this.simplify(r)}async formatCommitMessage(t){let r;if(t.includes("{{numFiles}}")){r=await this.status();let n=r.staged.length;t=t.replace("{{numFiles}}",String(n))}if(t.includes("{{hostname}}")){let n=this.plugin.localStorage.getHostname()||"";t=t.replace("{{hostname}}",n)}if(t.includes("{{files}}")){r=r!=null?r:await this.status();let n={},i="";if(r.staged.length<100){r.staged.forEach(s=>{s.index in n?n[s.index].push(s.path):n[s.index]=[s.path]});let a=[];for(let[s,o]of Object.entries(n))a.push(s+" "+o.join(" "));i=a.join(", ")}else i="Too many files to list";t=t.replace("{{files}}",i)}if(t=t.replace("{{date}}",(0,wT.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let n=r!=null?r:await this.status(),i="";n.staged.length<100?i=n.staged.map(a=>a.path).join(` -`):i="Too many files to list",t=t+` +`,aA=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];p();p();p();var xc=class{diff(e,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let a=this.castInput(e,n),s=this.castInput(r,n),o=this.removeEmpty(this.tokenize(a,n)),l=this.removeEmpty(this.tokenize(s,n));return this.diffWithOptionsObj(o,l,n,i)}diffWithOptionsObj(e,r,n,i){var a;let s=b=>{if(b=this.postProcess(b,n),i){setTimeout(function(){i(b)},0);return}else return b},o=r.length,l=e.length,u=1,c=o+l;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let f=(a=n.timeout)!==null&&a!==void 0?a:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,e,0,n);if(h[0].oldPos+1>=l&&m+1>=o)return s(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,w=()=>{for(let b=Math.max(g,-u);b<=Math.min(v,u);b+=2){let E,x=h[b-1],k=h[b+1];x&&(h[b-1]=void 0);let A=!1;if(k){let S=k.oldPos-b;A=k&&0<=S&&S=l&&m+1>=o)return s(this.buildValues(E.lastComponent,r,e))||!0;h[b]=E,E.oldPos+1>=l&&(v=Math.min(v,b-1)),m+1>=o&&(g=Math.max(g,b+1))}u++};if(i)(function b(){setTimeout(function(){if(u>c||Date.now()>d)return i(void 0);w()||b()},0)})();else for(;u<=c&&Date.now()<=d;){let b=w();if(b)return b}}addToPath(e,r,n,i,a){let s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}}extractCommon(e,r,n,i,a){let s=r.length,o=n.length,l=e.oldPos,u=l-i,c=0;for(;u+1d.length?m:d}),c.value=this.join(f)}else c.value=this.join(r.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}};p();var Gg=class extends xc{constructor(){super(...arguments),this.tokenize=q8}equals(e,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(` +`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),r.endsWith(` +`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}},G8=new Gg;function qg(t,e,r){return G8.diff(t,e,r)}function q8(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));let r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i{let d=u(f);c(d)}}))}else return u(qg(r,n,o));function u(c){if(!c)return;c.push({value:"",lines:[]});function f(b){return b.map(function(E){return" "+E})}let d=[],h=0,m=0,g=[],v=1,w=1;for(let b=0;b0?f(k.lines.slice(-l)):[],h-=g.length,m-=g.length)}for(let k of x)g.push((E.added?"+":"-")+k);E.added?w+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&b{o(l?od(l):void 0)}}))}else{let o=zg(t,e,r,n,i,a,s);return o?od(o):void 0}}function Sc(t,e,r,n,i,a){return sA(t,t,e,r,n,i,a)}function z8(t){let e=t.endsWith(` +`),r=t.split(` +`).map(n=>n+` +`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var te=bt(Hg()),is=require("obsidian");p();function oA(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var Io=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};p();var lA=require("obsidian"),V8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},ze=class extends lA.SuggestModal{constructor(e,r){if(super(e.app),this.config={...V8,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button"});i.style.marginRight="32px",i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};p();var V2=bt(AA()),W2=require("child_process"),Y2=bt(z2()),Pi=require("obsidian");function Md(t){throw new Error(`Unexpected object: ${t}`)}function Lc(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var Kv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function bn(t,e){let r;if(e){if(e.button===0||e.button===1){let n=Pi.Keymap.isModEvent(e);r=t.workspace.getLeaf(n)}}else r=t.workspace.getLeaf(!1);return r}function Qn(t,e,r,n,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(r);if(a!=null){let s=new Pi.Menu;t.workspace.trigger("file-menu",s,a,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}else{let s=new Pi.Menu;t.workspace.trigger("obsidian-git:menu",s,r,i,n),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function ba(t){throw new Error("Impossible branch: "+t)}function Jv(t){return`rgb(${t.r},${t.g},${t.b})`}function X2(t){var a;let e=(a=V2.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[r,n,i]=e;return{r,g:n,b:i}}function Z2(t){return t.diff(Pi.moment.unix(0),"seconds")}function K2(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function J2(t,e){return(0,Y2.default)(t,e,{strict:!0})}function Nc(t,e){return new Proxy(t,{get(r,n){return n==="length"?Math.min(e,r.length):r[n]}})}function Q2(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function eP(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),n=t.substring(e,t.length);return r+n}function Qv(t,e,r){return t<=e&&e<=r}function Ri(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function ei(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function tP(t){return t===1?"1 minute":`${t} minutes`}function uU(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function Do(t){if(t.endsWith(".md"))return!1;let e=uU(t);return aA.includes(e)}function ew(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function Lo(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof Pi.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(n){return!0}}function rP({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function No(t,e,r,n){let i=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:i,linktext:n})}function Bc(t,e,r={}){return new Promise((n,i)=>{let a=(0,W2.spawn)(t,e,r),s="",o="";a.stdout.on("data",l=>{s+=l.toString()}),a.stderr.on("data",l=>{o+=l.toString()}),a.on("error",l=>{n({error:new Error(l.message),stdout:s,stderr:s,code:1})}),a.on("close",l=>{n({stdout:s,stderr:o,code:l!=null?l:1,error:void 0})})})}p();var nP=require("obsidian"),Bo=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let n=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(r);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(u=>u.path.substring(r).startsWith(s+"/"));o.forEach(u=>e.remove(u));let l=i.path.substring(0,a.indexOf("/")+r);n.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+s.length:s.length)+1)})}else n.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return n}simplify(e){var r,n,i,a;for(let s of e){for(;;){let o=((r=s.children)==null?void 0:r.length)==1,l=((i=(n=s.children)==null?void 0:n.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let u=s.children.first();s.title+="/"+u.title,s.data=u.data,s.path=u.path,s.vaultPath=u.vaultPath,s.children=u.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.sort((o,l)=>{let u=(l.data==null?1:0)-(o.data==null?1:0);return u!=0?u:o.title.localeCompare(l.title)})}return e.sort((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.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 n=r.staged.length;e=e.replace("{{numFiles}}",String(n))}if(e.includes("{{hostname}}")){let n=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",n)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let n={},i="";if(r.staged.length<100){r.staged.forEach(s=>{s.index in n?n[s.index].push(s.path):n[s.index]=[s.path]});let a=[];for(let[s,o]of Object.entries(n))a.push(s+" "+o.join(" "));i=a.join(", ")}else i="Too many files to list";e=e.replace("{{files}}",i)}if(e=e.replace("{{date}}",(0,nP.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let n=r!=null?r:await this.status(),i="";n.staged.length<100?i=n.staged.map(a=>a.path).join(` +`):i="Too many files to list",e=e+` Affected files: -`+i}return t}};var Ce=class extends Ys{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var n;if(this.isGitInstalled()){let i=this.app.vault.adapter,a=i.getBasePath(),s=a;this.plugin.settings.basePath&&(await i.exists((0,Jn.normalizePath)(this.plugin.settings.basePath))?s=De.join(a,this.plugin.settings.basePath):r||new Jn.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=s,this.git=xx({baseDir:s,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Gu: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=process.env.PATH+":"+o.join(":");process.env.PATH=v}c&&(process.env.GIT_DIR=c);for(let v of l){let[y,b]=v.split("=");process.env[y]=b}let u="simple-git",f=",",h=((n=localStorage.debug)!=null?n:"").split(f);if(!h.includes(u)&&!h.includes(`-${u}`)&&(h.push(u),xT.default.enable(h.join(f))),await this.git.checkIsRepo()){let v=await this.git.revparse("--show-cdup"),y=(0,Yl.resolve)(s+Yl.sep+v);this.absoluteRepoPath=y,await this.git.cwd(y)}let p=De.join(a,this.app.vault.configDir,"plugins","obsidian-git"),m=De.join(p,wa);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=m),process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=De.join(p,zu),process.env.SSH_ASKPASS==m&&this.askpass().catch(v=>this.plugin.displayError(v))}}getRelativeVaultPath(r){let i=this.app.vault.adapter.getBasePath(),a=De.join(this.absoluteRepoPath,r),s=De.relative(i,a);return Jn.Platform.isWin&&(s=s.replace(/\\/g,"/")),s}getRelativeRepoPath(r,n=!0){if(n){let a=this.plugin.app.vault.adapter.getBasePath(),s=this.absoluteRepoPath,o=De.join(a,r),l=De.relative(s,o);return Jn.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}async askpass(){let r=this.app.vault.adapter,n=r.getBasePath(),i=De.join(n,this.app.vault.configDir,"plugins","obsidian-git"),a=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await _r.writeFile(De.join(i,wa),Ex),await _r.chmod(De.join(i,wa),493),this.watchAbortController=new AbortController;let{signal:s}=this.watchAbortController;try{let o=_r.watch(i,{signal:s});for await(let l of o){if(l.filename!=zu)continue;let c=a+zu;if(!await r.exists(c))continue;let u=await r.read(c),f;u.length>60&&(f=new Jn.Notice(u,999999));let d=await new $e(this.plugin,{allowEmpty:!0,obscure:!0,placeholder:u.length>60?"Enter a response to the message.":u}).openAndGetResult();f==null||f.hide(),await r.exists(c)&&await r.write(`${c}.response`,d!=null?d:"")}}catch(o){this.plugin.displayError(o),await _r.rm(De.join(i,wa),{force:!0}),await _r.rm(De.join(i,`${wa}.response`),{force:!0}),await new Promise(l=>setTimeout(l,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=De.join(this.app.vault.configDir,"plugins","obsidian-git",wa),i=this.getRelativeRepoPath(n,!0);(await _r.readFile(r,"utf-8")).split(` -`).some(l=>l.contains(i))||await _r.appendFile(r,i+` -`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(){this.plugin.setPluginState({gitAction:1});let r=await this.git.status();this.plugin.setPluginState({gitAction:0});let n=r.files.map(i=>{let a=this.formatPath(i);return{path:a.path,from:a.from,index:i.index==="?"?"U":i.index,workingDir:i.working_dir==="?"?"U":i.working_dir,vaultPath:this.getRelativeVaultPath(a.path)}});return{all:n,changed:n.filter(i=>i.workingDir!==" "),staged:n.filter(i=>i.index!==" "&&i.index!="U"),conflicted:r.conflicted.map(i=>this.formatPath({path:i}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",De.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),s}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",c=>{o+=c.toString("utf8")}),i.on("end",()=>{let u=o.split(` -`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Yl.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r,n=!1){function i(a){if(a!=null)return a.startsWith('"')&&a.endsWith('"')?a.substring(1,a.length-1):a}return n?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,n,i){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let a=await this.getSubmoduleOfFile(r),s=a?["-C",a.submodule]:[],o=a?a.relativeFilepath:r;s.push("blame","--porcelain"),i&&s.push("-w");let l=`-C${Uu}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",l);break;case"all-commits":s.push("-C","-C",l);break;default:Ii(n)}s.push("--",o);let c=await this.git.raw(s);return $B(c)}async isTracked(r){let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("ls-files","--",a),this.git.raw(i).then(s=>s.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let i=await this.getSubmodulePaths();for(let a of i)await this.git.cwd({path:a,root:!1}).add("-A"),await this.git.cwd({path:a,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:r,amend:n}){this.plugin.setPluginState({gitAction:4});let i=(await this.git.commit(await this.formatCommitMessage(r),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),i}async stage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)?await this.git.checkout(["--",r]):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(r),!0),this.plugin.setPluginState({gitAction:0})}async hashObject(r){r=this.getRelativeRepoPath(r);let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("hash-object","--",a),this.git.raw(i)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),n=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let i=await this.git.revparse([r.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([r.tracking]);break;case"rebase":await this.git.rebase([r.tracking])}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,i]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let a=await this.git.revparse([r.current]);return(await this.git.diff([`${n}..${a}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let s=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(s)}let r=await this.git.status(),n=r.tracking,i=r.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let a=(await this.git.diffSummary([i,n,"--"])).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),a}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),n=r.tracking,i=r.current;return n==null||i==null?0:(await this.git.diffSummary([i,n,"--"])).changed}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),n=r.tracking,i=r.current;return n?(await this.git.diffSummary([i,n,"--"])).changed!==0:!1}async checkRequirements(){return this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),n=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:n.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(n){if(String(n).contains(r))return;throw n}}async log(r,n=!0,i,a){let s;r&&(s=this.getRelativeRepoPath(r,n));let o={file:s,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return a&&(o[a]=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(p=>p.length>0),diff:{...c.diff,files:(f=(u=c.diff)==null?void 0:u.files.map(p=>({...p,status:p.status,path:p.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(p.file),fromPath:p.from,fromVaultPath:p.from!=null?this.getRelativeVaultPath(p.from):void 0,binary:p.binary})))!=null?f:[]},fileName:(h=(d=c.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(r,n,i=!0){let a=this.getRelativeRepoPath(n,i);return this.git.show([r+":"+a])}async checkout(r,n){if(n&&(r=`${n}/${r}`),await this.git.checkout(r),this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let a of i){let s=await this.git.cwd({path:a,root:!1}).branch();Object.keys(s.branches).includes(r)&&await this.git.cwd({path:a,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,n){await this.git.branch([n?"-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,n,i){await this.git.clone(r,De.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[])}async setConfig(r,n){n==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,n)}async getConfig(r){let i=(await this.git.listConfig("local")).all[r];if(typeof i=="string"||i==null)return i;throw new Error("Config value is not a string")}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,n){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,n]):await this.git.remote(["add",r,n])}async getRemoteBranches(r){let n=await this.git.branch(["-r","--list",`${r}*`]),i=[];for(let a in n.branches)i.push(n.branches[a].name);return i}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(n){try{await this.git.branch(["--set-upstream",r])}catch(i){await this.git.push(["--set-upstream",...Fi(r)])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,n=!1,i){return n?await this.git.diff(["--cached","--",r]):i?await this.git.show([`${i}`,"--",r]):await this.git.diff(["--",r])}async diff(r,n,i){return await this.git.diff([`${n}..${i}`,"--",r])}async rawCommand(r){let n=r.split(" ");return await this.git.raw(n[0],...n.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(De.dirname(r)))return;let n=await this.git.raw(["-C",De.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",De.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let s=this.app.vault.adapter.getFullPath(De.normalize(r)),o=De.relative(n,s);return{submodule:n,relativeFilepath:o}}async getLastCommitTime(){let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),n=(0,Yg.spawnSync)(r||"git",["--version"],{stdio:"ignore"});if(n.error)if(Jn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Gu}) of Git for Windows.`);let i=(0,Yg.spawnSync)(Gu,["--version"],{stdio:"ignore"});if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof wr){let n=String(r.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new $s(n)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);return this.plugin.displayError(`Error checking LFS status: ${i}`),!1}}},ST={hash:"000000",isZeroCommit:!0,summary:""};function $B(e){let r=e.replace(`\r -`,` -`).split(` -`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&r.groupSizePerStartingLine.set(t,parseInt(e[3])),parseInt(e[2])!==t)throw Error(`git-blame output is out of order: ${t} vs ${e[2]}`);return n}function DB(e,t,r){let n=e[0],i=e.slice(1).join(" "),a=t.hashPerLine[r],s=t.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(n){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=_T(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=_T(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}t.commits.set(a,s)}function NB(e){if(e.summary===void 0)throw Error(`Summary not provided for commit: ${e.hash}`);qg(e.author)&&(e.author=void 0),qg(e.committer)&&(e.committer=void 0),qg(e.previous)&&(e.previous=void 0),e.isZeroCommit=!!e.hash.match(/^0*$/)}function qg(e){return!e||Object.keys(e).length===0}function bT(e){return e.length>0&&e[0].trim()===e[0]}function _T(e){let t=e.startsWith("<")?e.substring(1):e;return t.endsWith(">")?t.substring(0,t.length-1):t}g();var iC=require("@codemirror/state");g();var DT=require("@codemirror/state"),qf=require("obsidian");g();var Xg=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(t,r){if(t)return this.ensureInitialized(t),r(this.eventsPerFilepath.get(t))}forEachSubscriber(t){this.eventsPerFilepath.forEach(r=>r.forEach(t))}ensureInitialized(t){this.eventsPerFilepath.get(t)||this.eventsPerFilepath.set(t,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(t=>t==null?void 0:t.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Xs=new Xg;g();var zf=require("@codemirror/state"),OT=ze(Zg());g();var U=require("obsidian");g();g();function an(){}an.prototype={diff:function(t,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(E){return E=s.postProcess(E,i),a?(setTimeout(function(){a(E)},0),!0):E}t=this.castInput(t,i),r=this.castInput(r,i),t=this.removeEmpty(this.tokenize(t,i)),r=this.removeEmpty(this.tokenize(r,i));var l=r.length,c=t.length,u=1,f=l+c;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var d=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+d,p=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(p[0],r,t,0,i);if(p[0].oldPos+1>=c&&m+1>=l)return o(ET(s,p[0].lastComponent,r,t,s.useLongestToken));var v=-1/0,y=1/0;function b(){for(var E=Math.max(v,-u);E<=Math.min(y,u);E+=2){var _=void 0,k=p[E-1],w=p[E+1];k&&(p[E-1]=void 0);var A=!1;if(w){var S=w.oldPos-E;A=w&&0<=S&&S=c&&m+1>=l)return o(ET(s,_.lastComponent,r,t,s.useLongestToken));p[E]=_,_.oldPos+1>=c&&(y=Math.min(y,E-1)),m+1>=l&&(v=Math.max(v,E+1))}u++}if(a)(function E(){setTimeout(function(){if(u>f||Date.now()>h)return a();b()||E()},0)})();else for(;u<=f&&Date.now()<=h;){var x=b();if(x)return x}},addToPath:function(t,r,n,i,a){var s=t.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}},extractCommon:function(t,r,n,i,a){for(var s=r.length,o=n.length,l=t.oldPos,c=l-i,u=0;c+1h.length?m:h}),f.value=e.join(d)}else f.value=e.join(r.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}return a}var tq=new an;function AT(e,t){var r;for(r=0;rt.length&&(r=e.length-t.length);var n=t.length;e.length0&&t[s]!=t[a];)a=i[a];t[s]==t[a]&&a++}a=0;for(var o=r;o0&&e[o]!=t[a];)a=i[a];e[o]==t[a]&&a++}return a}var Lf="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",jB=new RegExp("[".concat(Lf,"]+|\\s+|[^").concat(Lf,"]"),"ug"),Nf=new an;Nf.equals=function(e,t,r){return r.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()};Nf.tokenize=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(t.intlSegmenter){if(t.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(t.intlSegmenter.segment(e),function(a){return a.segment})}else r=e.match(jB)||[];var n=[],i=null;return r.forEach(function(a){/\s/.test(a)?i==null?n.push(a):n.push(n.pop()+a):/\s/.test(i)?n[n.length-1]==i?n.push(n.pop()+a):n.push(i+a):n.push(a),i=a}),n};Nf.join=function(e){return e.map(function(t,r){return r==0?t:t.replace(/^\s+/,"")}).join("")};Nf.postProcess=function(e,t){if(!e||t.oneChangePerToken)return e;var r=null,n=null,i=null;return e.forEach(function(a){a.added?n=a:a.removed?i=a:((n||i)&&CT(r,i,n,a),r=a,n=null,i=null)}),(n||i)&&CT(r,i,n,null),e};function CT(e,t,r,n){if(t&&r){var i=t.value.match(/^\s*/)[0],a=t.value.match(/\s*$/)[0],s=r.value.match(/^\s*/)[0],o=r.value.match(/\s*$/)[0];if(e){var l=AT(i,s);e.value=Qg(e.value,s,l),t.value=Xl(t.value,l),r.value=Xl(r.value,l)}if(n){var c=kT(a,o);n.value=Jg(n.value,o,c),t.value=$f(t.value,c),r.value=$f(r.value,c)}}else if(r)e&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(e&&n){var u=n.value.match(/^\s*/)[0],f=t.value.match(/^\s*/)[0],d=t.value.match(/\s*$/)[0],h=AT(u,f);t.value=Xl(t.value,h);var p=kT(Xl(u,h),d);t.value=$f(t.value,p),n.value=Jg(n.value,u,p),e.value=Qg(e.value,u,u.slice(0,u.length-p.length))}else if(n){var m=n.value.match(/^\s*/)[0],v=t.value.match(/\s*$/)[0],y=TT(v,m);t.value=$f(t.value,y)}else if(e){var b=e.value.match(/\s*$/)[0],x=t.value.match(/^\s*/)[0],E=TT(b,x);t.value=Xl(t.value,E)}}var HB=new an;HB.tokenize=function(e){var t=new RegExp("(\\r?\\n)|[".concat(Lf,"]+|[^\\S\\n\\r]+|[^").concat(Lf,"]"),"ug");return e.match(t)||[]};var Bf=new an;Bf.tokenize=function(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,` -`));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;ie.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?f(I.lines.slice(-s.context)):[],h-=m.length,p-=m.length)}(P=m).push.apply(P,Kg(T.map(function(J){return(S.added?"+":"-")+J}))),S.added?y+=T.length:v+=T.length}else{if(h)if(T.length<=s.context*2&&x(0,$i.normalizePath)(a.substring(t.length))):i=n,i}async mkdir(t){return this.adapter.mkdir(t)}async rmdir(t,r){var n,i;return this.adapter.rmdir(t,(i=(n=r==null?void 0:r.options)==null?void 0:n.recursive)!=null?i:!1)}async stat(t){if(t.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(t);if(n==null)throw{code:"ENOENT"};return this.indexctime=n.ctime,this.indexmtime=n.mtime,{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}t==="."&&(t="/");let r=this.vault.getAbstractFileByPath(t);if(this.maybeLog("Stat: "+t),r instanceof $i.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(t);if(n)return{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(t){return this.adapter.remove(t)}async lstat(t){return this.stat(t)}async readlink(t){throw new Error(`readlink of (${t}) is not implemented.`)}async symlink(t){throw new Error(`symlink of (${t}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(t){}};var sn=class extends Ys{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 Hf(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,n;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(n=this.plugin.localStorage.getPassword())!=null?n:void 0}},onAuthFailure:async()=>{new Sa.Notice("Authentication failed. Please try with different credentials");let r=await new $e(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new $e(this.plugin,{placeholder:"Specify your password/personal access token"}).openAndGetResult();if(n)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(n),{username:r,password:n}}return{cancel:!0}},http:{async request({url:r,method:n,headers:i,body:a}){let s;a&&(s=(await rj(a)).buffer);let o=await(0,Sa.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:[new Uint8Array(o.arrayBuffer)],statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let n=await r;return await this.fs.saveAndClear(),n}catch(n){throw await this.fs.saveAndClear(),n}}async status(){let r,n=window.setTimeout(()=>{r=new Sa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let i=(await this.wrapFS(ie.statusMatrix({...this.getRepo()}))).map(l=>this.getFileStatusResult(l)),a=i.filter(l=>l.workingDir!==" "),s=i.filter(l=>l.index!==" "&&l.index!=="U"),o=[];return window.clearTimeout(n),r==null||r.hide(),{all:i,changed:a,staged:s,conflicted:o}}catch(i){throw window.clearTimeout(n),r==null||r.hide(),this.plugin.displayError(i),i}}async commitAll({message:r,status:n,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:n,unstagedFiles:i}),this.commit({message:r})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let n=await this.formatCommitMessage(r),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(ie.commit({...this.getRepo(),message:n,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(n){throw this.plugin.displayError(n),n}}async stage(r,n){let i=this.getRelativeRepoPath(r,n),a;n?a=r:a=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(a)?await this.wrapFS(ie.add({...this.getRepo(),filepath:i})):await this.wrapFS(ie.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:r,status:n,unstagedFiles:i}){try{if(n)await Promise.all(n.changed.map(a=>a.workingDir!=="D"?this.wrapFS(ie.add({...this.getRepo(),filepath:a.path})):ie.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(a.map(({path:s,deleted:o})=>o?ie.remove({...this.getRepo(),filepath:s}):this.wrapFS(ie.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(r,n){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.wrapFS(ie.resetIndex({...this.getRepo(),filepath:r}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:r,status:n}){try{let i;n?i=n.staged.map(a=>a.path):i=(await this.getStagedFiles(r!=null?r:".")).map(({path:s})=>s),await this.wrapFS(Promise.all(i.map(a=>ie.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async discardAll({dir:r,status:n}){let i=[];n?r!=null?i=n.changed.filter(a=>a.path.startsWith(r)).map(a=>a.path):i=n.changed.map(a=>a.path):i=(await this.getUnstagedFiles(r)).map(({path:a})=>a);try{await this.wrapFS(ie.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}getProgressText(r,n){let i=`${r} progress:`;return n.phase&&(i=`${i} ${n.phase}:`),n.loaded&&(i=`${i} ${n.loaded}`,n.total&&(i=`${i} of ${n.total}`)),i}resolveRef(r){return this.wrapFS(ie.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let n=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(ie.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1}))).alreadyMerged||await this.wrapFS(ie.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),r==null||r.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(n,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(n){throw r==null||r.hide(),n instanceof wl.MergeConflictError&&await this.plugin.handleConflict(n.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(n),n}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let n=await this.branchInfo(),i=n.tracking,a=n.current,s=(await this.getFileChangesCount(a,i)).length;return this.plugin.setPluginState({gitAction:5}),await this.wrapFS(ie.push({...this.getRepo(),onProgress:o=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Pushing",o))}})),r==null||r.hide(),s}catch(n){throw r==null||r.hide(),this.plugin.displayError(n),n}}async getUnpushedCommits(){let r=await this.branchInfo(),n=r.tracking,i=r.current;if(n==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(n);return(await this.getFileChangesCount(a,s)).length}async canPush(){let r=await this.branchInfo(),n=r.tracking,i=r.current,a=await this.resolveRef(i),s=await this.resolveRef(n);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,n;try{let i=await ie.currentBranch(this.getRepo())||"",a=await ie.listBranches(this.getRepo()),s=(r=await this.getConfig(`branch.${i}.remote`))!=null?r:"origin",o=(n=await this.getConfig(`branch.${i}.merge`))==null?void 0:n.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let r=await ie.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${r}.remote`))!=null?i:"origin"}async checkout(r,n){try{return this.wrapFS(ie.checkout({...this.getRepo(),ref:r,force:!!n,remote:n}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(r){try{await this.wrapFS(ie.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(n){throw this.plugin.displayError(n),n}}async deleteBranch(r){try{await this.wrapFS(ie.deleteBranch({...this.getRepo(),ref:r}))}catch(n){throw this.plugin.displayError(n),n}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(ie.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,n,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(ie.clone({...this.getRepo(),dir:n,url:r,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(r,n){try{return this.wrapFS(ie.setConfig({...this.getRepo(),path:r,value:n}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(r){try{return this.wrapFS(ie.getConfig({...this.getRepo(),path:r}))}catch(n){throw this.plugin.displayError(n),n}}async fetch(r){let n=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(ie.fetch(i)),n==null||n.hide()}catch(i){throw this.plugin.displayError(i),n==null||n.hide(),i}}async setRemote(r,n){try{await this.wrapFS(ie.addRemote({...this.getRepo(),remote:r,url:n,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(r){let n=[];return n.push(...await this.wrapFS(ie.listBranches({...this.getRepo(),remote:r}))),n.remove("HEAD"),n=n.map(i=>`${r}/${i}`),n}async getRemotes(){return(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(ie.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var n;return(n=(await this.wrapFS(ie.listRemotes({...this.getRepo()}))).filter(i=>i.remote==r)[0])==null?void 0:n.url}async log(r,n=!0,i,a){let s=await this.wrapFS(ie.log({...this.getRepo(),depth:i,ref:a}));return Promise.all(s.map(async o=>{let l=o.commit.message.split(` +`+i}return e}};p();var _a=require("obsidian"),Dd=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var n;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof _a.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modify(n,r):this.adapter.write(e,r)}else if(e.endsWith(this.gitDir+"/index"))this.index=r,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof _a.TFile?this.vault.modifyBinary(n,r):this.adapter.writeBinary(e,r)}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),n=[...r.files,...r.folders],i;return e!=="/"?i=n.map(a=>(0,_a.normalizePath)(a.substring(e.length))):i=n,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var n,i;return this.adapter.rmdir(e,(i=(n=r==null?void 0:r.options)==null?void 0:n.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);if(n==null)throw{code:"ENOENT"};return this.indexctime=n.ctime,this.indexmtime=n.mtime,{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof _a.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(e);if(n)return{ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var cP=bt(lP()),_n=class extends Bo{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Dd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,n;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(n=this.plugin.localStorage.getPassword())!=null?n:void 0}},onAuthFailure:async()=>{new is.Notice("Authentication failed. Please try with different credentials");let r=await new ze(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let n=await new ze(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(n)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(n),{username:r,password:n}}return{cancel:!0}},http:{async request({url:r,method:n,headers:i,body:a}){let s;a&&(s=await pU(a));let o=await(0,is.requestUrl)({url:r,method:n,headers:i,body:s,throw:!1});return{url:r,method:n,headers:o.headers,body:hU(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let n=await r;return await this.fs.saveAndClear(),n}catch(n){throw await this.fs.saveAndClear(),n}}async status(r){let n,i=window.setTimeout(()=>{n=new is.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let a={...this.getRepo()};(r==null?void 0:r.path)!=null&&(a.filepaths=[`${r.path}/`]);let s=(await this.wrapFS(te.default.statusMatrix(a))).map(f=>this.getFileStatusResult(f)),o=[],l=[],u=[];for(let f of s)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&u.push(f);let c=[];return window.clearTimeout(i),n==null||n.hide(),{all:u,changed:o,staged:l,conflicted:c}}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async commitAll({message:r,status:n,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:n,unstagedFiles:i}),this.commit({message:r})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let n=await this.formatCommitMessage(r),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(te.default.commit({...this.getRepo(),message:n,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(n){throw this.plugin.displayError(n),n}}async stage(r,n){let i=this.getRelativeRepoPath(r,n),a;n?a=r:a=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(a)?await this.wrapFS(te.default.add({...this.getRepo(),filepath:i})):await this.wrapFS(te.default.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:r,status:n,unstagedFiles:i}){try{if(n)await Promise.all(n.changed.map(a=>a.workingDir!=="D"?this.wrapFS(te.default.add({...this.getRepo(),filepath:a.path})):te.default.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(a.map(({path:s,type:o})=>o=="D"?te.default.remove({...this.getRepo(),filepath:s}):this.wrapFS(te.default.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(r,n){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.wrapFS(te.default.resetIndex({...this.getRepo(),filepath:r}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:r,status:n}){try{let i;n?i=n.staged.map(a=>a.path):i=(await this.getStagedFiles(r!=null?r:".")).map(({path:s})=>s),await this.wrapFS(Promise.all(i.map(a=>te.default.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(te.default.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async discardAll({dir:r,status:n}){let i=[];n?r!=null?i=n.changed.filter(a=>a.workingDir!="U"&&a.path.startsWith(r)).map(a=>a.path):i=n.changed.filter(a=>a.workingDir!="U").map(a=>a.path):i=(await this.getUnstagedFiles(r)).filter(a=>a.type!="A").map(({path:a})=>a);try{await this.wrapFS(te.default.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}async getUntrackedPaths(r){let n=[];if(r.status)for(let i of r.status.changed)i.index=="U"&&i.workingDir==="U"&&i.path.startsWith(r.path!=null?`${r.path}/`:"")&&n.push(i.path);else{let i=await this.status({path:r==null?void 0:r.path});for(let a of i.changed)a.index==="U"&&a.workingDir==="U"&&n.push(a.path)}return n}getProgressText(r,n){let i=`${r} progress:`;return n.phase&&(i=`${i} ${n.phase}:`),n.loaded&&(i=`${i} ${n.loaded}`,n.total&&(i=`${i} of ${n.total}`)),i}resolveRef(r){return this.wrapFS(te.default.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let n=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(te.default.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var b,E,x;let u=l[0],c=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(b=c.match(d))!=null?b:[],m=(E=u.match(d))!=null?E:[],g=(x=f.match(d))!=null?x:[],v=(0,cP.default)(h,m,g),w="";for(let k of v)k.ok&&(w+=k.ok.join("")),k.conflict&&(w+=this.plugin.settings.mergeStrategy==="ours"?k.conflict.a.join(""):k.conflict.b.join(""));return{cleanMerge:!0,mergedText:w}}:void 0}))).alreadyMerged||await this.wrapFS(te.default.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),r==null||r.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(n,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(n){throw r==null||r.hide(),n instanceof te.Errors.MergeConflictError&&await this.plugin.handleConflict(n.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(n),n}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let n=await this.branchInfo(),i=n.tracking,a=n.current,s=(await this.getFileChangesCount(a,i)).length;this.plugin.setPluginState({gitAction:5});let o=await this.getCurrentRemote();return await this.wrapFS(te.default.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Pushing",l))}})),r==null||r.hide(),s}catch(n){throw r==null||r.hide(),this.plugin.displayError(n),n}}async getUnpushedCommits(){let r=await this.branchInfo(),n=r.tracking,i=r.current;if(n==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(n);return(await this.getFileChangesCount(a,s)).length}async canPush(){let r=await this.branchInfo(),n=r.tracking,i=r.current,a=await this.resolveRef(i),s=await this.resolveRef(n);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,n;try{let i=await te.default.currentBranch(this.getRepo())||"",a=await te.default.listBranches(this.getRepo()),s=(r=await this.getConfig(`branch.${i}.remote`))!=null?r:"origin",o=(n=await this.getConfig(`branch.${i}.merge`))==null?void 0:n.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let r=await te.default.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${r}.remote`))!=null?i:"origin"}async checkout(r,n){try{return this.wrapFS(te.default.checkout({...this.getRepo(),ref:r,force:!!n,remote:n}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(r){try{await this.wrapFS(te.default.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(n){throw this.plugin.displayError(n),n}}async deleteBranch(r){try{await this.wrapFS(te.default.deleteBranch({...this.getRepo(),ref:r}))}catch(n){throw this.plugin.displayError(n),n}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(te.default.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,n,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(te.default.clone({...this.getRepo(),dir:n,url:r,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(r,n){try{return this.wrapFS(te.default.setConfig({...this.getRepo(),path:r,value:n}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(r){try{return this.wrapFS(te.default.getConfig({...this.getRepo(),path:r}))}catch(n){throw this.plugin.displayError(n),n}}async fetch(r){let n=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(te.default.fetch(i)),n==null||n.hide()}catch(i){throw this.plugin.displayError(i),n==null||n.hide(),i}}async setRemote(r,n){try{await this.wrapFS(te.default.addRemote({...this.getRepo(),remote:r,url:n,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(r){let n=[];return n.push(...await this.wrapFS(te.default.listBranches({...this.getRepo(),remote:r}))),n.remove("HEAD"),n=n.map(i=>`${r}/${i}`),n}async getRemotes(){return(await this.wrapFS(te.default.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(te.default.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var n;return(n=(await this.wrapFS(te.default.listRemotes({...this.getRepo()}))).filter(i=>i.remote==r)[0])==null?void 0:n.url}async log(r,n=!0,i,a){let s=await this.wrapFS(te.default.log({...this.getRepo(),depth:i,ref:a}));return Promise.all(s.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[n,i]=Fi(r),a=await this.branchInfo();await this.wrapFS(ie.push({...this.getRepo(),remote:n,remoteRef:i})),await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,n){return this.walkDifference({walkers:[ie.TREE({ref:r}),ie.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(ie.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!Gg(a,n))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[ie.TREE({ref:"HEAD"}),ie.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new Sa.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ie.walk({...a,trees:[ie.WORKDIR(),ie.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ie.isIgnored({...a,filepath:o})||!Gg(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?p!==h?{path:o,deleted:!1}:null:{path:o,deleted:!0}}}));return window.clearTimeout(i),n==null||n.hide(),s}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async getDiffString(r,n=!1,i){let a=this.getRelativeVaultPath(r),s=async(c,[u])=>{if(r==c){let f=await u.oid();return(await ie.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await xl({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h}),u=await ie.readCommit({...this.getRepo(),oid:i}),f=await xl({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof ie.Errors.NotFoundError))throw h});return jf(a,f!=null?f:"",c!=null?c:"")}let o=(await ie.walk({...this.getRepo(),trees:[ie.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(n){let c=await this.resolveRef("HEAD").then(f=>xl({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ie.Errors.NotFoundError))throw f});return jf(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",jf(a,l,c)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await ie.readCommit({...r,oid:n})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(r){let n=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:n[0]=="?"?"U":n[0],workingDir:n[1]=="?"?"U":n[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!r||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,n=!0){if(!this.plugin.settings.disablePopups)return new Sa.Notice(r,n?this.noticeLength:void 0)}};function QB(e){let t=[e];return{next(){return Promise.resolve({done:t.length===0,value:t.pop()})},return(){return t=[],{}},[Symbol.asyncIterator](){return this}}}function ej(e){return e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e[Symbol.iterator]?e[Symbol.iterator]():e.next?e:QB(e)}async function tj(e,t){let r=ej(e);for(;;){let{value:n,done:i}=await r.next();if(n&&await t(n),i)break}r.return&&r.return()}async function rj(e){let t=0,r=[];await tj(e,a=>{r.push(a),t+=a.byteLength});let n=new Uint8Array(t),i=0;for(let a of r)n.set(a,i),i+=a.byteLength;return n}var nj="https://momentjs.com/docs/#/parsing/string-format/",ij="https://publish.obsidian.md/git-doc/Line+Authoring",Uf=class extends U.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,n=this.plugin,i;n.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=n.gitReady;r.empty(),a||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let s;if(a){new 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(u=>u.setValue(n.settings.differentIntervalCommitAndPush).onChange(async f=>{n.settings.differentIntervalCommitAndPush=f,await n.saveSettings(),n.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new U.Setting(r).setName(`Auto ${i} interval (minutes)`).setDesc(`${n.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"autoSaveInterval"}),u.setPlaceholder(String(Ye.autoSaveInterval)),u.onChange(async f=>{f!==""?n.settings.autoSaveInterval=Number(f):n.settings.autoSaveInterval=Ye.autoSaveInterval,await n.saveSettings(),n.automaticsManager.reload("commit")})}),s=new U.Setting(r).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. - If turned on, do auto ${i} every ${vT(n.settings.autoSaveInterval)} after stopping file edits. - This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(n.settings.autoBackupAfterFileChange).onChange(async f=>{n.settings.autoBackupAfterFileChange=f,this.refreshDisplayWithDelay(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new U.Setting(r).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(n.settings.setLastSaveToLastCommit).onChange(async f=>{n.settings.setLastSaveToLastCommit=f,await n.saveSettings(),n.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"autoPushInterval"}),u.setPlaceholder(String(Ye.autoPushInterval)),u.onChange(async f=>{f!==""?n.settings.autoPushInterval=Number(f):n.settings.autoPushInterval=Ye.autoPushInterval,await n.saveSettings(),n.automaticsManager.reload("push")})}),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"autoPullInterval"}),u.setPlaceholder(String(Ye.autoPullInterval)),u.onChange(async f=>{f!==""?n.settings.autoPullInterval=Number(f):n.settings.autoPullInterval=Ye.autoPullInterval,await n.saveSettings(),n.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(n.settings.customMessageOnAutoBackup).onChange(async f=>{n.settings.customMessageOnAutoBackup=f,await n.saveSettings(),this.refreshDisplayWithDelay()})),s=new U.Setting(r).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>{u.setPlaceholder(Ye.autoCommitMessage).onChange(async f=>{f===""?n.settings.autoCommitMessage=Ye.autoCommitMessage:n.settings.autoCommitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:u,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading(),new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>{u.setPlaceholder(Ye.commitMessage).onChange(async f=>{f===""?n.settings.commitMessage=Ye.commitMessage:n.settings.commitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:u,settingsProperty:"commitMessage"})});let c=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(n.settings.commitDateFormat).setValue(n.settings.commitDateFormat).onChange(async f=>{n.settings.commitDateFormat=f,await n.saveSettings()}));c.descEl.innerHTML=` - Specify custom date format. E.g. "${xm}. See Moment.js for more formats.`,new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=n.localStorage.getHostname())!=null?f:"").onChange(d=>{n.localStorage.setHostname(d)})}),new U.Setting(r).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new U.Notice(`${f}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(n.settings.listChangedFilesInMessageBody).onChange(async f=>{n.settings.listChangedFilesInMessageBody=f,await n.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof Ce&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(n.settings.syncMethod),u.onChange(async d=>{n.settings.syncMethod=d,await n.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(n.settings.autoPullOnBoot).onChange(async f=>{n.settings.autoPullOnBoot=f,await n.saveSettings()})),new U.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new U.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${n.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(u=>u.setValue(!n.settings.disablePush).onChange(async f=>{n.settings.disablePush=!f,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${n.settings.disablePush?"":"and push "}only.`).addToggle(u=>u.setValue(n.settings.pullBeforePush).onChange(async f=>{n.settings.pullBeforePush=f,this.refreshDisplayWithDelay(),await n.saveSettings()})),n.gitManager instanceof Ce&&(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(n.settings.authorInHistoryView),c.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new U.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(n.settings.dateInHistoryView).onChange(async u=>{n.settings.dateInHistoryView=u,await n.saveSettings(),await n.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(n.settings.refreshSourceControl).onChange(async u=>{n.settings.refreshSourceControl=u,await n.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(Ye.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?n.settings.refreshSourceControlTimer=Math.max(Number(f),500):n.settings.refreshSourceControlTimer=Ye.refreshSourceControlTimer,await n.saveSettings(),n.setRefreshDebouncer()})}),new U.Setting(r).setName("Miscellaneous").setHeading(),n.gitManager instanceof Ce&&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(n.settings.diffStyle),c.onChange(async f=>{n.settings.diffStyle=f,await n.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(n.settings.disablePopups).onChange(async u=>{n.settings.disablePopups=u,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.Setting(r).setName("Disable error notifications").setDesc("Disable errror notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(!n.settings.showErrorNotices).onChange(async u=>{n.settings.showErrorNotices=!u,await n.saveSettings()})),n.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(n.settings.disablePopupsForNoChanges).onChange(async u=>{n.settings.disablePopupsForNoChanges=u,await n.saveSettings()})),new U.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(n.settings.showStatusBar).onChange(async u=>{n.settings.showStatusBar=u,await n.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(n.settings.showFileMenu).onChange(async u=>{n.settings.showFileMenu=u,await n.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(n.settings.showBranchStatusBar).onChange(async u=>{n.settings.showBranchStatusBar=u,await n.saveSettings()})),new U.Setting(r).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(n.settings.changedFilesInStatusBar).onChange(async u=>{n.settings.changedFilesInStatusBar=u,await n.saveSettings()})),n.gitManager instanceof sn?new U.Setting(r).setName("Authentication/commit author").setHeading():new U.Setting(r).setName("Commit author").setHeading(),n.gitManager instanceof sn&&new U.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=n.localStorage.getUsername())!=null?u:""),c.onChange(f=>{n.localStorage.setUsername(f)})}),n.gitManager instanceof sn&&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=>{n.localStorage.setPassword(u)})}),n.gitReady&&new U.Setting(r).setName("Author name for commit").addText(async c=>{var u;c.setValue((u=await n.gitManager.getConfig("user.name"))!=null?u:""),c.onChange(async f=>{await n.gitManager.setConfig("user.name",f==""?void 0:f)})}),n.gitReady&&new U.Setting(r).setName("Author email for commit").addText(async c=>{var u;c.setValue((u=await n.gitManager.getConfig("user.email"))!=null?u:""),c.onChange(async f=>{await n.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 requried for special setups.").setHeading(),n.gitManager instanceof Ce&&(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(n.settings.updateSubmodules).onChange(async u=>{n.settings.updateSubmodules=u,await n.saveSettings()})),n.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(n.settings.submoduleRecurseCheckout).onChange(async u=>{n.settings.submoduleRecurseCheckout=u,await n.saveSettings()}))),n.gitManager instanceof Ce&&new U.Setting(r).setName("Custom Git binary path").addText(c=>{var u;c.setValue((u=n.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{n.localStorage.setGitPath(f),n.gitManager.updateGitPath(f||"git").catch(d=>n.displayError(d))})}),n.gitManager instanceof Ce&&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(n.localStorage.getEnvVars().join(` -`)),c.onChange(u=>{n.localStorage.setEnvVars(u.split(` -`))})}),n.gitManager instanceof Ce&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(n.localStorage.getPATHPaths().join(` -`)),c.onChange(u=>{n.localStorage.setPATHPaths(u.split(` -`))})}),n.gitManager instanceof Ce&&new 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 n.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(` +`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[n,i]=Ri(r),a=await this.branchInfo();await this.wrapFS(te.default.push({...this.getRepo(),remote:n,remoteRef:i})),await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,n){return this.walkDifference({walkers:[te.default.TREE({ref:r}),te.default.TREE({ref:n})]})}async walkDifference({walkers:r,dir:n}){return await this.wrapFS(te.default.walk({...this.getRepo(),trees:r,map:async function(a,[s,o]){if(!Kv(a,n))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),u=await(o==null?void 0:o.oid()),c="equal";if(l!==u&&(c="M"),l===void 0&&(c="A"),u===void 0&&(c="D"),l===void 0&&u===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),c!=="equal")return{path:a,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[te.default.TREE({ref:"HEAD"}),te.default.STAGE()],dir:r})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path}))}async getUnstagedFiles(r="."){let n,i=window.setTimeout(()=>{n=new is.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(te.default.walk({...a,trees:[te.default.WORKDIR(),te.default.STAGE()],map:async function(o,[l,u]){if(!u&&l&&await te.default.isIgnored({...a,filepath:o})||!Kv(o,r))return null;let[c,f]=await Promise.all([l&&l.type(),u&&u.type()]),d=[c,f].includes("blob");if((c==="tree"||c==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await u.oid():void 0,m;return c==="blob"&&f!=="blob"?m="42":c==="blob"&&(m=await l.oid()),m?h?m!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(i),n==null||n.hide(),s}catch(a){throw window.clearTimeout(i),n==null||n.hide(),this.plugin.displayError(a),a}}async getDiffString(r,n=!1,i){let a=this.getRelativeVaultPath(r),s=async(u,[c])=>{if(r==u){let f=await c.oid();return(await te.default.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let u=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:i}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h}),c=await te.default.readCommit({...this.getRepo(),oid:i}),f=await(0,te.readBlob)({...this.getRepo(),filepath:r,oid:c.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof te.default.Errors.NotFoundError))throw h});return Sc(a,f!=null?f:"",u!=null?u:"")}let o=(await te.default.walk({...this.getRepo(),trees:[te.default.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(n){let u=await this.resolveRef("HEAD").then(f=>(0,te.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof te.default.Errors.NotFoundError))throw f});return Sc(a,u!=null?u:"",l)}else{let u;return await this.app.vault.adapter.exists(a)?u=await this.app.vault.adapter.read(a):u="",Sc(a,l,u)}}async getLastCommitTime(){let r=this.getRepo(),n=await this.resolveRef("HEAD"),a=(await te.default.readCommit({...r,oid:n})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(r){let n=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:n[0]=="?"?"U":n[0],workingDir:n[1]=="?"?"U":n[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!r||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,n=!0){if(!this.plugin.settings.disablePopups)return new is.Notice(r,n?this.noticeLength:void 0)}};async function*hU(t){yield new Uint8Array(t)}async function pU(t){let e=new ReadableStream({async start(n){for await(let i of t)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}p();var QI=bt(Bd()),Dr=bt(require("fs/promises")),$i=require("obsidian"),He=bt(require("path")),Xc=require("path");p();var Kd=bt(mP(),1),Yd=bt(Bd(),1),HR=require("child_process"),SI=bt(nw(),1),qo=bt(nw(),1),XI=require("node:events"),Sw=Object.defineProperty,FU=Object.getOwnPropertyDescriptor,Ew=Object.getOwnPropertyNames,OU=Object.prototype.hasOwnProperty,V=(t,e)=>function(){return t&&(e=(0,t[Ew(t)[0]])(t=0)),e},MU=(t,e)=>function(){return e||(0,t[Ew(t)[0]])((e={exports:{}}).exports,e),e.exports},ft=(t,e)=>{for(var r in e)Sw(t,r,{get:e[r],enumerable:!0})},DU=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ew(e))!OU.call(t,i)&&i!==r&&Sw(t,i,{get:()=>e[i],enumerable:!(n=FU(e,i))||n.enumerable});return t},it=t=>DU(Sw({},"__esModule",{value:!0}),t);function LU(...t){let e=new String(t);return Zd.set(e,t),e}function zd(t){return t instanceof String&&Zd.has(t)}function gP(t){return Zd.get(t)||[]}var Zd,Gc=V({"src/lib/args/pathspec.ts"(){"use strict";Zd=new WeakMap}}),br,Sa=V({"src/lib/errors/git-error.ts"(){"use strict";br=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),qc,Vo=V({"src/lib/errors/git-response-error.ts"(){"use strict";Sa(),qc=class extends br{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),WP,YP=V({"src/lib/errors/task-configuration-error.ts"(){"use strict";Sa(),WP=class extends br{constructor(t){super(void 0,t)}}}});function XP(t){return typeof t!="function"?us:t}function ZP(t){return typeof t=="function"&&t!==us}function KP(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function JP(t,e=0){return QP(t)&&t.length>e?t[e]:void 0}function cs(t,e=0){if(QP(t)&&t.length>e)return t[t.length-1-e]}function QP(t){return!!(t&&typeof t.length=="number")}function zc(t="",e=!0,r=` +`){return t.split(r).reduce((n,i)=>{let a=e?i.trim():i;return a&&n.push(a),n},[])}function kw(t,e){return zc(t,!0).map(r=>e(r))}function Aw(t){return(0,Kd.exists)(t,Kd.FOLDER)}function Re(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function eR(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Jd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function ti(t){return Array.isArray(t)?t:[t]}function tR(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function rR(t){return ti(t).map(String)}function Ue(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function Uc(t,e){let r=[];for(let n=0,i=t.length;nr in t?{[r]:t[r]}:{}))}function uw(t=0){return new Promise(e=>setTimeout(e,t))}function fw(t){if(t!==!1)return t}var zo,us,Vc,Qd=V({"src/lib/utils/util.ts"(){"use strict";zo="\0",us=()=>{},Vc=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ri(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function dw(t,e){let r=zd(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function eh(t){return!!t&&Vc(t)==="[object Object]"}function iR(t){return typeof t=="function"}var Wc,Vt,aR,Vd,Tw,sR=V({"src/lib/utils/argument-filters.ts"(){"use strict";Qd(),Gc(),Wc=t=>Array.isArray(t),Vt=t=>typeof t=="string",aR=t=>Array.isArray(t)&&t.every(Vt),Vd=t=>Vt(t)||Array.isArray(t)&&t.every(Vt),Tw=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),hw,NU=V({"src/lib/utils/exit-codes.ts"(){"use strict";hw=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(hw||{})}}),Wd,BU=V({"src/lib/utils/git-output-streams.ts"(){"use strict";Wd=class oR{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new oR(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),he,xa,HU=V({"src/lib/utils/line-parser.ts"(){"use strict";he=class{constructor(t,e){this.matches=[],this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,r(a)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},xa=class extends he{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function lR(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...cR},...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var cR,UU=V({"src/lib/utils/simple-git-options.ts"(){"use strict";cR={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Cw(t,e=[]){return eh(t)?Object.keys(t).reduce((r,n)=>{let i=t[n];if(zd(i))r.push(i);else if(dw(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let a of i)dw(a,["string","number"])||r.push(n+"="+a);else r.push(n);return r},e):e}function wr(t,e=0,r=!1){let n=[];for(let i=0,a=e<0?t.length:e;i{for(let a=zc(i,n),s=0,o=a.length;s{if(!(s+u>=o))return a[s+u]};e.some(({parse:u})=>u(l,t))}}),t}var qU=V({"src/lib/utils/task-parser.ts"(){"use strict";Qd()}}),uR={};ft(uR,{ExitCodes:()=>hw,GitOutputStreams:()=>Wd,LineParser:()=>he,NOOP:()=>us,NULL:()=>zo,RemoteLineParser:()=>xa,append:()=>Re,appendTaskOptions:()=>Cw,asArray:()=>ti,asCamelCase:()=>tR,asFunction:()=>XP,asNumber:()=>Ue,asStringArray:()=>rR,bufferToString:()=>jc,callTaskParser:()=>pw,createInstanceConfig:()=>lR,delay:()=>uw,filterArray:()=>Wc,filterFunction:()=>iR,filterHasLength:()=>Tw,filterPlainObject:()=>eh,filterPrimitives:()=>dw,filterString:()=>Vt,filterStringArray:()=>aR,filterStringOrStringArray:()=>Vd,filterType:()=>ri,first:()=>JP,folderExists:()=>Aw,forEachLineWithContent:()=>kw,getTrailingOptions:()=>wr,including:()=>eR,isUserFunction:()=>ZP,last:()=>cs,objectToString:()=>Vc,orVoid:()=>fw,parseStringResponse:()=>_r,pick:()=>nR,prefixedArray:()=>Uc,remove:()=>Jd,splitOn:()=>KP,toLinesWithContent:()=>zc,trailingFunctionArgument:()=>at,trailingOptionsArgument:()=>Pw});var ue=V({"src/lib/utils/index.ts"(){"use strict";sR(),NU(),BU(),HU(),UU(),GU(),qU(),Qd()}}),fR={};ft(fR,{CheckRepoActions:()=>mw,checkIsBareRepoTask:()=>hR,checkIsRepoRootTask:()=>dR,checkIsRepoTask:()=>zU});function zU(t){switch(t){case"bare":return hR();case"root":return dR()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:th,parser:Rw}}function dR(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:th,parser(e){return/^\.(git)?$/.test(e.trim())}}}function hR(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:th,parser:Rw}}function VU(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var mw,th,Rw,pR=V({"src/lib/tasks/check-is-repo.ts"(){"use strict";ue(),mw=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(mw||{}),th=({exitCode:t},e,r,n)=>{if(t===128&&VU(e))return r(Buffer.from("false"));n(e)},Rw=t=>t.trim()==="true"}});function WU(t,e){let r=new mR(t),n=t?vR:gR;return zc(e).forEach(i=>{let a=i.replace(n,"");r.paths.push(a),(wR.test(a)?r.folders:r.files).push(a)}),r}var mR,gR,vR,wR,YU=V({"src/lib/responses/CleanSummary.ts"(){"use strict";ue(),mR=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},gR=/^[a-z]+\s*/i,vR=/^[a-z]+\s+[a-z]+\s*/i,wR=/\/$/}}),gw={};ft(gw,{EMPTY_COMMANDS:()=>rh,adhocExecTask:()=>yR,configurationErrorTask:()=>yr,isBufferTask:()=>_R,isEmptyTask:()=>xR,straightThroughBufferTask:()=>bR,straightThroughStringTask:()=>ir});function yR(t){return{commands:rh,format:"empty",parser:t}}function yr(t){return{commands:rh,format:"empty",parser(){throw typeof t=="string"?new WP(t):t}}}function ir(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function bR(t){return{commands:t,format:"buffer",parser(e){return e}}}function _R(t){return t.format==="buffer"}function xR(t){return t.format==="empty"||!t.commands.length}var rh,ut=V({"src/lib/tasks/task.ts"(){"use strict";YP(),rh=[]}}),SR={};ft(SR,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Iw,CONFIG_ERROR_MODE_REQUIRED:()=>$w,CONFIG_ERROR_UNKNOWN_OPTION:()=>Fw,CleanOptions:()=>ls,cleanTask:()=>ER,cleanWithOptionsTask:()=>XU,isCleanOptionsArray:()=>ZU});function XU(t,e){let{cleanMode:r,options:n,valid:i}=KU(t);return r?i.options?(n.push(...e),n.some(ej)?yr(Iw):ER(r,n)):yr(Fw+JSON.stringify(t)):yr($w)}function ER(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return WU(t==="n",n)}}}function ZU(t){return Array.isArray(t)&&t.every(e=>Ow.has(e))}function KU(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{JU(i)?(e=i,n.cleanMode=!0):n.options=n.options&&QU(r[r.length]=`-${i}`)}),{cleanMode:e,options:r,valid:n}}function JU(t){return t==="f"||t==="n"}function QU(t){return/^-[a-z]$/i.test(t)&&Ow.has(t.charAt(1))}function ej(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var Iw,$w,Fw,ls,Ow,kR=V({"src/lib/tasks/clean.ts"(){"use strict";YU(),ue(),ut(),Iw="Git clean interactive mode is not supported",$w='Git clean mode parameter ("n" or "f") is required',Fw="Git clean unknown option found in: ",ls=(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))(ls||{}),Ow=new Set(["i",...rR(Object.values(ls))])}});function tj(t){let e=new TR;for(let r of AR(t))e.addValue(r.file,String(r.key),r.value);return e}function rj(t,e){let r=null,n=[],i=new Map;for(let a of AR(t,e))a.key===e&&(n.push(r=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(r));return{key:e,paths:Array.from(i.keys()),scopes:i,value:r,values:n}}function nj(t){return t.replace(/^(file):/,"")}function*AR(t,e=null){let r=t.split("\0");for(let n=0,i=r.length-1;nObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=cs(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);n.hasOwnProperty(e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function iw(t,e){return typeof t=="string"&&vw.hasOwnProperty(t)?t:e}function aj(t,e,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function sj(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return rj(n,t)}}}function oj(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return tj(r)}}}function lj(){return{addConfig(t,e,...r){return this._runTask(aj(t,e,r[0]===!0,iw(r[1],"local")),at(arguments))},getConfig(t,e){return this._runTask(sj(t,iw(e,void 0)),at(arguments))},listConfig(...t){return this._runTask(oj(iw(t[0],void 0)),at(arguments))}}}var vw,CR=V({"src/lib/tasks/config.ts"(){"use strict";ij(),ue(),vw=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(vw||{})}});function cj(t){return PR.has(t)}var aw,PR,RR=V({"src/lib/tasks/diff-name-status.ts"(){"use strict";aw=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(aw||{}),PR=new Set(Object.values(aw))}});function uj(...t){return new $R().param(...t)}function fj(t){let e=new Set,r={};return kw(t,n=>{let[i,a,s]=n.split(zo);e.add(i),(r[i]=r[i]||[]).push({line:Ue(a),path:i,preview:s})}),{paths:e,results:r}}function dj(){return{grep(t){let e=at(arguments),r=wr(arguments);for(let i of IR)if(r.includes(i))return this._runTask(yr(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=uj().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(i){return fj(i)}},e)}}}var IR,Hc,vP,$R,FR=V({"src/lib/tasks/grep.ts"(){"use strict";ue(),ut(),IR=["-h"],Hc=Symbol("grepQuery"),$R=class{constructor(){this[vP]=[]}*[(vP=Hc,Symbol.iterator)](){for(let t of this[Hc])yield t}and(...t){return t.length&&this[Hc].push("--and","(",...Uc(t,"-e"),")"),this}param(...t){return this[Hc].push(...Uc(t,"-e")),this}}}}),OR={};ft(OR,{ResetMode:()=>jd,getResetMode:()=>pj,resetTask:()=>hj});function hj(t,e){let r=["reset"];return MR(t)&&r.push(`--${t}`),r.push(...e),ir(r)}function pj(t){if(MR(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function MR(t){return DR.includes(t)}var jd,DR,LR=V({"src/lib/tasks/reset.ts"(){"use strict";ut(),jd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(jd||{}),DR=Array.from(Object.values(jd))}});function mj(){return(0,Yd.default)("simple-git")}function wP(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...i)=>{t(n,...i),r(n,...i)}:t:(n,...i)=>{t(`%s ${n}`,e,...i),r&&r(n,...i)}}function gj(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function Mw(t,e,r,n=mj()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?n.extend(e):e,o=gj(ri(e,Vt),s,n);return u(r);function l(c,f){return Re(a,Mw(t,o.replace(/^[^:]+/,c),f,n))}function u(c){let f=c&&`[${c}]`||"",d=s&&wP(s,f)||us,h=wP(n,`${i} ${f}`,d);return Object.assign(s?d:h,{label:t,sibling:l,info:h,step:u})}}var NR=V({"src/lib/git-logger.ts"(){"use strict";ue(),Yd.default.formatters.L=t=>String(Tw(t)?t.length:"-"),Yd.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Vc(t)}}),BR,vj=V({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Sa(),NR(),BR=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let n=t.getName(r.commands[0]),i=Mw(this.logLabel,n);return{task:r,logger:i,name:n}}push(r){let n=this.createProgress(r);return n.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,n),n}fatal(r){for(let[n,{logger:i}]of Array.from(this._queue.entries()))n===r.task?(i.info("Failed %o",r),i("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):i.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(n);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let n=this.withProgress(r);if(!n)throw new br(void 0,"TasksPendingQueue: attempt called for an unknown task");return n.logger("Starting task"),n}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function os(t,e){return{method:JP(t.commands)||"",commands:e}}function wj(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function yP(t,e,r,n){return i=>{r("%s received %L bytes",e,i),n("%B",i),t.push(i)}}var ww,yj=V({"src/lib/runners/git-executor-chain.ts"(){"use strict";Sa(),ut(),ue(),vj(),ww=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new BR}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:n}=this._queue.attempt(t);return await(xR(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n))}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof br?Object.assign(e,{task:t}):new br(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","",os(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],os(t,t.commands)),i=await this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),a=await this.handleTaskData(t,n,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),_R(t)?pw(t.parser,a):pw(t.parser,a.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,n){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=r;return new Promise((l,u)=>{n("Preparing to handle process response exitCode=%d stdOut=",i);let{error:c}=this._plugins.exec("task.error",{error:a},{...os(t,e),...r});if(c&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,c,f=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Vc(f)),l(new Wd(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},u);if(c)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),u(c);n.info("retrieving task output complete"),l(new Wd(Buffer.concat(s),Buffer.concat(o)))})}async gitResponse(t,e,r,n,i){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},os(t,t.commands));return new Promise(o=>{let l=[],u=[];i.info("%s %o",e,r),i("%O",s);let c=this._beforeSpawn(t,r);if(c)return o({stdOut:l,stdErr:u,exitCode:9901,rejection:c});this._plugins.exec("spawn.before",void 0,{...os(t,r),kill(d){c=d||c}});let f=(0,HR.spawn)(e,r,s);f.stdout.on("data",yP(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",yP(u,"stdErr",i,a.step("stdErr"))),f.on("error",wj(u,i)),n&&(i("Passing child process stdOut/stdErr to custom outputHandler"),n(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...os(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:u,exitCode:d,rejection:c||h})},kill(d){f.killed||(c=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...os(t,e),kill(n){r=n||r}}),r}}}}),UR={};ft(UR,{GitExecutor:()=>jR});var jR,bj=V({"src/lib/runners/git-executor.ts"(){"use strict";yj(),jR=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new ww(this,this._scheduler,this._plugins)}chain(){return new ww(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function _j(t,e,r=us){let n=a=>{r(null,a)},i=a=>{(a==null?void 0:a.task)===t&&r(a instanceof qc?xj(a):a,void 0)};e.then(n,i)}function xj(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=us};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,i){return i in t||(n[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),n}}var Sj=V({"src/lib/task-callback.ts"(){"use strict";Vo(),ue()}});function bP(t,e){return yR(r=>{if(!Aw(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var Ej=V({"src/lib/tasks/change-working-directory.ts"(){"use strict";ue(),ut()}});function sw(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Jd(e,"-B")),ir(e)}function kj(){return{checkout(){return this._runTask(sw(wr(arguments,1)),at(arguments))},checkoutBranch(t,e){return this._runTask(sw(["-b",t,e,...wr(arguments)]),at(arguments))},checkoutLocalBranch(t){return this._runTask(sw(["-b",t,...wr(arguments)]),at(arguments))}}}var Aj=V({"src/lib/tasks/checkout.ts"(){"use strict";ue(),ut()}});function Tj(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function Cj(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return _r(Tj(),[GR],t)}})}}}var GR,Pj=V({"src/lib/tasks/count-objects.ts"(){"use strict";ue(),GR=new he(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=tR(e);t.hasOwnProperty(n)&&(t[n]=Ue(r))})}});function Rj(t){return _r({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},qR,t)}var qR,Ij=V({"src/lib/parsers/parse-commit.ts"(){"use strict";ue(),qR=[new he(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new he(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new he(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new he(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(r,10)||0;n==="-"?t.summary.deletions=i:n==="+"&&(t.summary.insertions=i)})]}});function $j(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Uc(t,"-m"),...e,...r],format:"utf-8",parser:Rj}}function Fj(){return{commit(e,...r){let n=at(arguments),i=t(e)||$j(ti(e),ti(ri(r[0],Vd,[])),[...ri(r[1],Wc,[]),...wr(arguments,0,!0)]);return this._runTask(i,n)}};function t(e){return!Vd(e)&&yr("git.commit: requires the commit message to be supplied as a string/string[]")}}var Oj=V({"src/lib/tasks/commit.ts"(){"use strict";Ij(),ue(),ut()}});function Mj(){return{firstCommit(){return this._runTask(ir(["rev-list","--max-parents=0","HEAD"],!0),at(arguments))}}}var Dj=V({"src/lib/tasks/first-commit.ts"(){"use strict";ue(),ut()}});function Lj(t,e){let r=["hash-object",t];return e&&r.push("-w"),ir(r,!0)}var Nj=V({"src/lib/tasks/hash-object.ts"(){"use strict";ut()}});function Bj(t,e,r){let n=String(r).trim(),i;if(i=zR.exec(n))return new Gd(t,e,!1,i[1]);if(i=VR.exec(n))return new Gd(t,e,!0,i[1]);let a="",s=n.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new Gd(t,e,/^re/i.test(n),a)}var Gd,zR,VR,Hj=V({"src/lib/responses/InitSummary.ts"(){"use strict";Gd=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},zR=/^Init.+ repository in (.+)$/,VR=/^Rein.+ in (.+)$/}});function Uj(t){return t.includes(Dw)}function jj(t=!1,e,r){let n=["init",...r];return t&&!Uj(n)&&n.splice(1,0,Dw),{commands:n,format:"utf-8",parser(i){return Bj(n.includes("--bare"),e,i)}}}var Dw,Gj=V({"src/lib/tasks/init.ts"(){"use strict";Hj(),Dw="--bare"}});function Lw(t){for(let e=0;e_r(new WR,e,r,!1)}var ow,_P,xP,SP,XR,ZR=V({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Yc(),zj(),RR(),ue(),ow=[new he(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:Ue(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new he(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:Ue(r),after:Ue(n),binary:!0})}),new he(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);t.changed=Ue(e),t.insertions=Ue(n==null?void 0:n[1]),t.deletions=Ue(i==null?void 0:i[1])})],_P=[new he(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let i=Ue(e),a=Ue(r);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:n,changes:i+a,insertions:i,deletions:a,binary:!1})}),new he(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],xP=[new he(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],SP=[new he(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,i,a])=>{t.changed++,t.files.push({file:a!=null?a:n,changes:0,insertions:0,deletions:0,binary:!1,status:fw(cj(e)&&e),from:fw(!!a&&n!==a&&n),similarity:Ue(r)})})],XR={"":ow,"--stat":ow,"--numstat":_P,"--name-status":SP,"--name-only":xP}}});function Vj(t,e){return e.reduce((r,n,i)=>(r[n]=t[i]||"",r),Object.create({diff:null}))}function KR(t=Uw,e=JR,r=""){let n=YR(r);return function(i){let a=zc(i.trim(),!1,Bw).map(function(s){let o=s.split(Hw),l=Vj(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=n(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var Bw,Hw,Uw,JR,QR=V({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";ue(),ZR(),Yc(),Bw="\xF2\xF2\xF2\xF2\xF2\xF2 ",Hw=" \xF2\xF2",Uw=" \xF2 ",JR=["hash","date","message","refs","author_name","author_email"]}}),eI={};ft(eI,{diffSummaryTask:()=>Wj,validateLogFormatConfig:()=>nh});function Wj(t){let e=Lw(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),nh(r)||{commands:r,format:"utf-8",parser:YR(e)}}function nh(t){let e=t.filter(qj);if(e.length>1)return yr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return yr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var jw=V({"src/lib/tasks/diff.ts"(){"use strict";Yc(),ZR(),ut()}});function Yj(t,e){let r=[],n=[];return Object.keys(t).forEach(i=>{r.push(i),n.push(String(t[i]))}),[r,n.join(e)]}function Xj(t){return Object.keys(t).reduce((e,r)=>(r in yw||(e[r]=t[r]),e),{})}function tI(t={},e=[]){let r=ri(t.splitter,Vt,Uw),n=eh(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"},[i,a]=Yj(n,r),s=[],o=[`--pretty=format:${Bw}${a}${Hw}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let u=t.symmetric!==!1?"...":"..";s.push(`${t.from||""}${u}${t.to||""}`)}return Vt(t.file)&&o.push("--follow",LU(t.file)),Cw(Xj(t),o),{fields:i,splitter:r,commands:[...o,...s]}}function Zj(t,e,r){let n=KR(t,e,Lw(r));return{commands:["log",...r],format:"utf-8",parser:n}}function Kj(){return{log(...r){let n=at(arguments),i=tI(Pw(arguments),ri(arguments[0],Wc)),a=e(...r)||nh(i.commands)||t(i);return this._runTask(a,n)}};function t(r){return Zj(r.splitter,r.fields,r.commands)}function e(r,n){return Vt(r)&&Vt(n)&&yr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var yw,rI=V({"src/lib/tasks/log.ts"(){"use strict";Yc(),Gc(),QR(),ue(),ut(),jw(),yw=(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))(yw||{})}}),qd,nI,Jj=V({"src/lib/responses/MergeSummary.ts"(){"use strict";qd=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},nI=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"}}}}),bw,iI,Qj=V({"src/lib/responses/PullSummary.ts"(){"use strict";bw=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},iI=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function lw(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 EP(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Ue(e&&e[1]||"0"),delta:Ue(r&&r[1]||"0")}}var aI,eG=V({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";ue(),aI=[new xa(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=lw(t.remoteMessages);Object.assign(i,{[n]:Ue(r)})}),new xa(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),i=lw(t.remoteMessages);Object.assign(i,{[n]:Ue(r)})}),new xa(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let i=lw(t.remoteMessages);i.total=EP(e),i.reused=EP(r),i.packReused=Ue(n)})]}});function sI(t,e){return _r({remoteMessages:new lI},oI,e)}var oI,lI,cI=V({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";ue(),eG(),oI=[new xa(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...aI,new xa([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new xa([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:Ue(e),summary:r,url:n}})],lI=class{constructor(){this.all=[]}}}});function tG(t,e){let r=_r(new iI,uI,[t,e]);return r.message&&r}var kP,AP,TP,CP,uI,PP,Gw,fI=V({"src/lib/parsers/parse-pull.ts"(){"use strict";Qj(),ue(),cI(),kP=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,AP=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,TP=/^(create|delete) mode \d+ (.+)/,CP=[new he(kP,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new he(AP,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new he(TP,(t,[e,r])=>{Re(t.files,r),Re(e==="create"?t.created:t.deleted,r)})],uI=[new he(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new he(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new he(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,i])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=i,t.hash.remote=r})],PP=(t,e)=>_r(new bw,CP,[t,e]),Gw=(t,e)=>Object.assign(new bw,PP(t,e),sI(t,e))}}),RP,dI,IP,rG=V({"src/lib/parsers/parse-merge.ts"(){"use strict";Jj(),ue(),fI(),RP=[new he(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new he(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new qd(e,r))}),new he(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new qd(e,r,{deleteRef:n}))}),new he(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new qd(e,null))}),new he(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],dI=(t,e)=>Object.assign(IP(t,e),Gw(t,e)),IP=t=>_r(new nI,RP,t)}});function $P(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=dI(e,r);if(n.failed)throw new qc(n);return n}}:yr("Git.merge requires at least one option")}var nG=V({"src/lib/tasks/merge.ts"(){"use strict";Vo(),rG(),ut()}});function iG(t,e,r){let n=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(t),a=!r.includes("new");return{deleted:n,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var FP,hI,OP,aG=V({"src/lib/parsers/parse-push.ts"(){"use strict";ue(),cI(),FP=[new he(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new he(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new he(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push(iG(e,r,n))}),new he(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:n}}),new he(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,i])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:i}}})],hI=(t,e)=>{let r=OP(t,e),n=sI(t,e);return{...r,...n}},OP=(t,e)=>_r({pushed:[]},FP,[t,e])}}),pI={};ft(pI,{pushTagsTask:()=>sG,pushTask:()=>qw});function sG(t={},e){return Re(e,"--tags"),qw(t,e)}function qw(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Jd(r,"-v"),Re(r,"--verbose"),Re(r,"--porcelain"),{commands:r,format:"utf-8",parser:hI}}var mI=V({"src/lib/tasks/push.ts"(){"use strict";aG(),ue()}});function oG(){return{showBuffer(){let t=["show",...wr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(bR(t),at(arguments))},show(){let t=["show",...wr(arguments,1)];return this._runTask(ir(t),at(arguments))}}}var lG=V({"src/lib/tasks/show.ts"(){"use strict";ue(),ut()}}),MP,gI,cG=V({"src/lib/responses/FileStatusSummary.ts"(){"use strict";MP=/^(.+)\0(.+)$/,gI=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=MP.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function DP(t){let[e,r]=t.split(zo);return{from:r||e,to:e}}function Mr(t,e,r){return[`${t}${e}`,r]}function cw(t,...e){return e.map(r=>Mr(t,r,(n,i)=>Re(n.conflicted,i)))}function uG(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return n(" ",r.charAt(0),r.substr(2));default:return}function n(i,a,s){let o=`${i}${a}`,l=vI.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new gI(s,i,a))}}var LP,vI,wI,fG=V({"src/lib/responses/StatusSummary.ts"(){"use strict";ue(),cG(),LP=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}},vI=new Map([Mr(" ","A",(t,e)=>Re(t.created,e)),Mr(" ","D",(t,e)=>Re(t.deleted,e)),Mr(" ","M",(t,e)=>Re(t.modified,e)),Mr("A"," ",(t,e)=>Re(t.created,e)&&Re(t.staged,e)),Mr("A","M",(t,e)=>Re(t.created,e)&&Re(t.staged,e)&&Re(t.modified,e)),Mr("D"," ",(t,e)=>Re(t.deleted,e)&&Re(t.staged,e)),Mr("M"," ",(t,e)=>Re(t.modified,e)&&Re(t.staged,e)),Mr("M","M",(t,e)=>Re(t.modified,e)&&Re(t.staged,e)),Mr("R"," ",(t,e)=>{Re(t.renamed,DP(e))}),Mr("R","M",(t,e)=>{let r=DP(e);Re(t.renamed,r),Re(t.modified,r.to)}),Mr("!","!",(t,e)=>{Re(t.ignored=t.ignored||[],e)}),Mr("?","?",(t,e)=>Re(t.not_added,e)),...cw("A","A","U"),...cw("D","D","U"),...cw("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=r.exec(e),t.ahead=o&&+o[1]||0,o=n.exec(e),t.behind=o&&+o[1]||0,o=i.exec(e),t.current=o&&o[1],o=a.exec(e),t.tracking=o&&o[1],o=s.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),wI=function(t){let e=t.split(zo),r=new LP;for(let n=0,i=e.length;n!yI.includes(r))],parser(r){return wI(r)}}}var yI,hG=V({"src/lib/tasks/status.ts"(){"use strict";fG(),yI=["--null","-z"]}});function Xd(t=0,e=0,r=0,n="",i=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function pG(){return Xd(0,0,0,"",!1)}function mG(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:gG,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(zw));n(e)}})}}}function gG(t){return t===zw?pG():_r(Xd(0,0,0,t),bI,t)}var zw,bI,vG=V({"src/lib/tasks/version.ts"(){"use strict";ue(),zw="installed=false",bI=[new he(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,i=""])=>{Object.assign(t,Xd(Ue(e),Ue(r),Ue(n),i))}),new he(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,i=""])=>{Object.assign(t,Xd(Ue(e),Ue(r),n,i))})]}}),_I={};ft(_I,{SimpleGitApi:()=>_w});var _w,wG=V({"src/lib/simple-git-api.ts"(){"use strict";Sj(),Ej(),Aj(),Pj(),Oj(),CR(),Dj(),FR(),Nj(),Gj(),rI(),nG(),mI(),lG(),hG(),ut(),vG(),ue(),_w=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&_j(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask(ir(["add",...ti(t)]),at(arguments))}cwd(t){let e=at(arguments);return typeof t=="string"?this._runTask(bP(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(bP(t.path,t.root&&this._executor||void 0),e):this._runTask(yr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Lj(t,e===!0),at(arguments))}init(t){return this._runTask(jj(t===!0,this._executor.cwd,wr(arguments)),at(arguments))}merge(){return this._runTask($P(wr(arguments)),at(arguments))}mergeFromTo(t,e){return Vt(t)&&Vt(e)?this._runTask($P([t,e,...wr(arguments)]),at(arguments,!1)):this._runTask(yr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=qw({remote:ri(arguments[0],Vt),branch:ri(arguments[1],Vt)},wr(arguments));return this._runTask(t,at(arguments))}stash(){return this._runTask(ir(["stash",...wr(arguments)]),at(arguments))}status(){return this._runTask(dG(wr(arguments)),at(arguments))}},Object.assign(_w.prototype,kj(),Fj(),lj(),Cj(),Mj(),dj(),Kj(),oG(),mG())}}),xI={};ft(xI,{Scheduler:()=>EI});var NP,EI,yG=V({"src/lib/runners/scheduler.ts"(){"use strict";ue(),NR(),NP=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,SI.createDeferred)();return{promise:e,done:r,id:t}}})(),EI=class{constructor(t=2){this.concurrency=t,this.logger=Mw("","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=Re(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Jd(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Re(this.pending,NP());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),kI={};ft(kI,{applyPatchTask:()=>bG});function bG(t,e){return ir(["apply",...e,...t])}var _G=V({"src/lib/tasks/apply-patch.ts"(){"use strict";ut()}});function xG(t,e){return{branch:t,hash:e,success:!0}}function SG(t){return{branch:t,hash:null,success:!1}}var AI,EG=V({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";AI=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function TI(t,e){return e===1&&xw.test(t)}var BP,xw,HP,ih,kG=V({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";EG(),ue(),BP=/(\S+)\s+\(\S+\s([^)]+)\)/,xw=/^error[^']+'([^']+)'/m,HP=[new he(BP,(t,[e,r])=>{let n=xG(e,r);t.all.push(n),t.branches[e]=n}),new he(xw,(t,[e])=>{let r=SG(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ih=(t,e)=>_r(new AI,HP,[t,e])}}),CI,AG=V({"src/lib/responses/BranchSummary.ts"(){"use strict";CI=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,i){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:i}}}}});function UP(t){return t?t.charAt(0):""}function PI(t){return _r(new CI,RI,t)}var RI,TG=V({"src/lib/parsers/parse-branch.ts"(){"use strict";AG(),ue(),RI=[new he(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,i])=>{t.push(UP(e),!0,r,n,i)}),new he(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,n,i])=>{t.push(UP(e),!1,r,n,i)})]}}),II={};ft(II,{branchLocalTask:()=>PG,branchTask:()=>CG,containsDeleteBranchCommand:()=>$I,deleteBranchTask:()=>IG,deleteBranchesTask:()=>RG});function $I(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function CG(t){let e=$I(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(n,i){return e?ih(n,i).all[0]:PI(n)}}}function PG(){return{format:"utf-8",commands:["branch","-v"],parser:PI}}function RG(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return ih(r,n)},onError({exitCode:r,stdOut:n},i,a,s){if(!TI(String(i),r))return s(i);a(n)}}}function IG(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,i){return ih(n,i).branches[t]},onError({exitCode:n,stdErr:i,stdOut:a},s,o,l){if(!TI(String(s),n))return l(s);throw new qc(r.parser(jc(a),jc(i)),String(s))}};return r}var $G=V({"src/lib/tasks/branch.ts"(){"use strict";Vo(),kG(),TG(),ue()}}),FI,FG=V({"src/lib/responses/CheckIgnore.ts"(){"use strict";FI=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),OI={};ft(OI,{checkIgnoreTask:()=>OG});function OG(t){return{commands:["check-ignore",...t],format:"utf-8",parser:FI}}var MG=V({"src/lib/tasks/check-ignore.ts"(){"use strict";FG()}}),MI={};ft(MI,{cloneMirrorTask:()=>LG,cloneTask:()=>DI});function DG(t){return/^--upload-pack(=|$)/.test(t)}function DI(t,e,r){let n=["clone",...r];return Vt(t)&&n.push(t),Vt(e)&&n.push(e),n.find(DG)?yr("git.fetch: potential exploit argument blocked."):ir(n)}function LG(t,e,r){return Re(r,"--mirror"),DI(t,e,r)}var NG=V({"src/lib/tasks/clone.ts"(){"use strict";ut(),ue()}});function BG(t,e){return _r({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},LI,[t,e])}var LI,HG=V({"src/lib/parsers/parse-fetch.ts"(){"use strict";ue(),LI=[new he(/From (.+)$/,(t,[e])=>{t.remote=e}),new he(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new he(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new he(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new he(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,i])=>{t.updated.push({name:n,tracking:i,to:r,from:e})})]}}),NI={};ft(NI,{fetchTask:()=>jG});function UG(t){return/^--upload-pack(=|$)/.test(t)}function jG(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(UG)?yr("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:BG}}var GG=V({"src/lib/tasks/fetch.ts"(){"use strict";HG(),ut()}});function qG(t){return _r({moves:[]},BI,t)}var BI,zG=V({"src/lib/parsers/parse-move.ts"(){"use strict";ue(),BI=[new he(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),HI={};ft(HI,{moveTask:()=>VG});function VG(t,e){return{commands:["mv","-v",...ti(t),e],format:"utf-8",parser:qG}}var WG=V({"src/lib/tasks/move.ts"(){"use strict";zG(),ue()}}),UI={};ft(UI,{pullTask:()=>YG});function YG(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(i,a){return Gw(i,a)},onError(i,a,s,o){let l=tG(jc(i.stdOut),jc(i.stdErr));if(l)return o(new qc(l));o(a)}}}var XG=V({"src/lib/tasks/pull.ts"(){"use strict";Vo(),fI(),ue()}});function ZG(t){let e={};return jI(t,([r])=>e[r]={name:r}),Object.values(e)}function KG(t){let e={};return jI(t,([r,n,i])=>{e.hasOwnProperty(r)||(e[r]={name:r,refs:{fetch:"",push:""}}),i&&n&&(e[r].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function jI(t,e){kw(t,r=>e(r.split(/\s+/)))}var JG=V({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";ue()}}),GI={};ft(GI,{addRemoteTask:()=>QG,getRemotesTask:()=>eq,listRemotesTask:()=>tq,remoteTask:()=>rq,removeRemoteTask:()=>nq});function QG(t,e,r){return ir(["remote","add",...r,t,e])}function eq(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?KG:ZG}}function tq(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),ir(e)}function rq(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),ir(e)}function nq(t){return ir(["remote","remove",t])}var iq=V({"src/lib/tasks/remote.ts"(){"use strict";JG(),ut()}}),qI={};ft(qI,{stashListTask:()=>aq});function aq(t={},e){let r=tI(t),n=["stash","list",...r.commands,...e],i=KR(r.splitter,r.fields,Lw(n));return nh(n)||{commands:n,format:"utf-8",parser:i}}var sq=V({"src/lib/tasks/stash-list.ts"(){"use strict";Yc(),QR(),jw(),rI()}}),zI={};ft(zI,{addSubModuleTask:()=>oq,initSubModuleTask:()=>lq,subModuleTask:()=>ah,updateSubModuleTask:()=>cq});function oq(t,e){return ah(["add",t,e])}function lq(t){return ah(["init",...t])}function ah(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),ir(e)}function cq(t){return ah(["update",...t])}var uq=V({"src/lib/tasks/sub-module.ts"(){"use strict";ut()}});function fq(t,e){let r=isNaN(t),n=isNaN(e);return r!==n?r?1:-1:r?VI(t,e):0}function VI(t,e){return t===e?0:t>e?1:-1}function dq(t){return t.trim()}function Ud(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var jP,WI,hq=V({"src/lib/responses/TagList.ts"(){"use strict";jP=class{constructor(t,e){this.all=t,this.latest=e}},WI=function(t,e=!1){let r=t.split(` +`).map(dq).filter(Boolean);e||r.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return fq(Ud(s[0]),Ud(o[0]));for(let l=0,u=Math.max(s.length,o.length);li.indexOf(".")>=0);return new jP(r,n)}}}),YI={};ft(YI,{addAnnotatedTagTask:()=>gq,addTagTask:()=>mq,tagListTask:()=>pq});function pq(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return WI(r,e)}}}function mq(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function gq(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var vq=V({"src/lib/tasks/tag.ts"(){"use strict";hq()}}),wq=MU({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(bj(),it(UR)),{SimpleGitApi:n}=(wG(),it(_I)),{Scheduler:i}=(yG(),it(xI)),{configurationErrorTask:a}=(ut(),it(gw)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:u,filterStringOrStringArray:c,filterType:f,getTrailingOptions:d,trailingFunctionArgument:h,trailingOptionsArgument:m}=(ue(),it(uR)),{applyPatchTask:g}=(_G(),it(kI)),{branchTask:v,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:E}=($G(),it(II)),{checkIgnoreTask:x}=(MG(),it(OI)),{checkIsRepoTask:k}=(pR(),it(fR)),{cloneTask:A,cloneMirrorTask:y}=(NG(),it(MI)),{cleanWithOptionsTask:S,isCleanOptionsArray:_}=(kR(),it(SR)),{diffSummaryTask:T}=(jw(),it(eI)),{fetchTask:P}=(GG(),it(NI)),{moveTask:F}=(WG(),it(HI)),{pullTask:D}=(XG(),it(UI)),{pushTagsTask:M}=(mI(),it(pI)),{addRemoteTask:re,getRemotesTask:ye,listRemotesTask:me,remoteTask:fe,removeRemoteTask:Ge}=(iq(),it(GI)),{getResetMode:oe,resetTask:B}=(LR(),it(OR)),{stashListTask:Z}=(sq(),it(qI)),{addSubModuleTask:H,initSubModuleTask:Oe,subModuleTask:cr,updateSubModuleTask:Gt}=(uq(),it(zI)),{addAnnotatedTagTask:Y,addTagTask:Ie,tagListTask:Me}=(vq(),it(YI)),{straightThroughBufferTask:It,straightThroughStringTask:De}=(ut(),it(gw));function G(N,X){this._plugins=X,this._executor=new r(N.baseDir,new i(N.maxConcurrentProcesses),X),this._trimmed=N.trimmed}(G.prototype=Object.create(n.prototype)).constructor=G,G.prototype.customBinary=function(N){return this._plugins.reconfigure("binary",N),this},G.prototype.env=function(N,X){return arguments.length===1&&typeof N=="object"?this._executor.env=N:(this._executor.env=this._executor.env||{})[N]=X,this},G.prototype.stashList=function(N){return this._runTask(Z(m(arguments)||{},o(N)&&N||[]),h(arguments))};function Je(N,X,Ee,We){return typeof Ee!="string"?a(`git.${N}() requires a string 'repoPath'`):X(Ee,f(We,u),d(arguments))}G.prototype.clone=function(){return this._runTask(Je("clone",A,...arguments),h(arguments))},G.prototype.mirror=function(){return this._runTask(Je("mirror",y,...arguments),h(arguments))},G.prototype.mv=function(N,X){return this._runTask(F(N,X),h(arguments))},G.prototype.checkoutLatestTag=function(N){var X=this;return this.pull(function(){X.tags(function(Ee,We){X.checkout(We.latest,N)})})},G.prototype.pull=function(N,X,Ee,We){return this._runTask(D(f(N,u),f(X,u),d(arguments)),h(arguments))},G.prototype.fetch=function(N,X){return this._runTask(P(f(N,u),f(X,u),d(arguments)),h(arguments))},G.prototype.silent=function(N){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},G.prototype.tags=function(N,X){return this._runTask(Me(d(arguments)),h(arguments))},G.prototype.rebase=function(){return this._runTask(De(["rebase",...d(arguments)]),h(arguments))},G.prototype.reset=function(N){return this._runTask(B(oe(N),d(arguments)),h(arguments))},G.prototype.revert=function(N){let X=h(arguments);return typeof N!="string"?this._runTask(a("Commit must be a string"),X):this._runTask(De(["revert",...d(arguments,0,!0),N]),X)},G.prototype.addTag=function(N){let X=typeof N=="string"?Ie(N):a("Git.addTag requires a tag name");return this._runTask(X,h(arguments))},G.prototype.addAnnotatedTag=function(N,X){return this._runTask(Y(N,X),h(arguments))},G.prototype.deleteLocalBranch=function(N,X,Ee){return this._runTask(E(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.deleteLocalBranches=function(N,X,Ee){return this._runTask(b(N,typeof X=="boolean"?X:!1),h(arguments))},G.prototype.branch=function(N,X){return this._runTask(v(d(arguments)),h(arguments))},G.prototype.branchLocal=function(N){return this._runTask(w(),h(arguments))},G.prototype.raw=function(N){let X=!Array.isArray(N),Ee=[].slice.call(X?arguments:N,0);for(let $t=0;$tt.removeEventListener("abort",a))}}]:void 0}function _q(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function xq(t,e){if(_q(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Ii(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function Sq(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Ii(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 Ii(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 Ii(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function Eq({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,a)=>{let s=auw(i))).then(s.done)}return{type:"spawn.after",async action(i,{spawned:a,close:s}){var c,f;let o=r(),l=!0,u=()=>void(l=!1);(c=a.stdout)==null||c.on("data",u),(f=a.stderr)==null||f.on("data",u),a.on("error",u),a.on("close",d=>o.close(d)),a.on("exit",d=>o.exit(d));try{await o.result,l&&await uw(50),s(o.exitCode)}catch(d){s(o.exitCode,d)}}}}ue();var Tq="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",qP="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function Cq(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function zP(t,e){if(t.length<1||t.length>2)throw new Ii(void 0,"binary",Tq);if(t.some(Cq))if(e)console.warn(qP);else throw new Ii(void 0,"binary",qP);let[n,i]=t;return{binary:n,prefix:i}}function Pq(t,e=["git"],r=!1){let n=zP(ti(e),r);t.on("binary",i=>{n=zP(ti(i),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}Sa();function Rq(t){return!!(t.exitCode&&t.stdErr.length)}function Iq(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function $q(t=!1,e=Rq,r=Iq){return(n,i)=>!t&&n||!e(i)?n:r(i)}function VP(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new br(void 0,n.toString("utf-8"))}:{error:n}}}}ue();var Fq=class{constructor(){this.plugins=new Set,this.events=new XI.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Re(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return ti(t).forEach(r=>r&&this.plugins.add(Re(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,i=Object.freeze(Object.create(r));for(let a of this.plugins)a.type===t&&(n=a.action(n,i));return n}};ue();function Oq(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return r.includes(s.method)?eR(a,e):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(e)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let u=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));u&&t({method:s.method,stage:Mq(u[1]),progress:Ue(u[2]),processed:Ue(u[3]),total:Ue(u[4])})}))}}]}function Mq(t){return String(t.toLowerCase().split(" ",1))||"unknown"}ue();function Dq(t){let e=nR(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function Lq({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,i){var u,c;let a;function s(){a&&clearTimeout(a),a=setTimeout(l,t)}function o(){var f,d;(f=i.spawned.stdout)==null||f.off("data",s),(d=i.spawned.stderr)==null||d.off("data",s),i.spawned.off("exit",o),i.spawned.off("close",o),a&&clearTimeout(a)}function l(){o(),i.kill(new Ii(void 0,"timeout","block timeout reached"))}r&&((u=i.spawned.stdout)==null||u.on("data",s)),e&&((c=i.spawned.stderr)==null||c.on("data",s)),i.spawned.on("exit",o),i.spawned.on("close",o),s()}}}Gc();function Nq(){return{type:"spawn.args",action(t){let e=[],r;function n(i){(r=r||[]).push(...i)}for(let i=0;izd(s)&&gP(s)||s));break}e.push(a)}return r?[...e,"--",...r.map(String)]:e}}}ue();var Bq=wq();function Hq(t,e){var i;let r=new Fq,n=lR(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Aw(n.baseDir))throw new yq(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(kq(n.config)),r.add(Eq(n.unsafe)),r.add(Nq()),r.add(Aq(n.completion)),n.abort&&r.add(bq(n.abort)),n.progress&&r.add(Oq(n.progress)),n.timeout&&r.add(Lq(n.timeout)),n.spawnOptions&&r.add(Dq(n.spawnOptions)),r.add(VP($q(!0))),n.errors&&r.add(VP(n.errors)),Pq(r,n.binary,(i=n.unsafe)==null?void 0:i.allowUnsafeCustomBinary),new Bq(n,r)}Vo();var ZI=Hq;var _e=class extends Bo{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var n;if(await this.isGitInstalled()){let i=this.app.vault.adapter,a=i.getBasePath(),s=a;this.plugin.settings.basePath&&(await i.exists((0,$i.normalizePath)(this.plugin.settings.basePath))?s=He.join(a,this.plugin.settings.basePath):r||new $i.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=s,this.git=ZI({baseDir:s,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?ad:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),u=this.plugin.settings.gitDir;if(o.length>0){let v=o.join(":")+":"+process.env.PATH;process.env.PATH=v}u&&(process.env.GIT_DIR=u);for(let v of l){let[w,b]=v.split("=");process.env[w]=b}let c="simple-git",f=",",h=((n=localStorage.debug)!=null?n:"").split(f);if(!h.includes(c)&&!h.includes(`-${c}`)&&(h.push(c),QI.default.enable(h.join(f))),await this.git.checkIsRepo()){let v=await this.git.revparse("--show-cdup"),w=(0,Xc.resolve)(s+Xc.sep+v);this.absoluteRepoPath=w,await this.git.cwd(w)}let m=He.join(a,this.app.vault.configDir,"plugins","obsidian-git"),g=He.join(m,rs);process.env.SSH_ASKPASS==null&&(process.env.SSH_ASKPASS=g),process.env.OBSIDIAN_GIT_CREDENTIALS_INPUT=He.join(m,sd),process.env.SSH_ASKPASS==g&&this.askpass().catch(v=>this.plugin.displayError(v))}}getRelativeVaultPath(r){let i=this.app.vault.adapter.getBasePath(),a=He.join(this.absoluteRepoPath,r),s=He.relative(i,a);return $i.Platform.isWin&&(s=s.replace(/\\/g,"/")),s}getRelativeRepoPath(r,n=!0){if(n){let a=this.plugin.app.vault.adapter.getBasePath(),s=this.absoluteRepoPath,o=He.join(a,r),l=He.relative(s,o);return $i.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let n=this.app.vault.adapter.getBasePath();return He.join(n,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return He.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,n=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await Dr.writeFile(He.join(this.absPluginConfigPath,rs),iA),await Dr.chmod(He.join(this.absPluginConfigPath,rs),493),this.watchAbortController=new AbortController;let{signal:i}=this.watchAbortController;try{let a=Dr.watch(this.absPluginConfigPath,{signal:i});for await(let s of a){if(s.filename!=sd)continue;let o=n+sd;if(!await r.exists(o))continue;let l=await r.read(o),u;l.length>60&&(u=new $i.Notice(l,999999));let c=await new ze(this.plugin,{allowEmpty:!0,obscure:!0,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();u==null||u.hide(),await r.exists(o)&&await r.write(`${o}.response`,c!=null?c:"")}}catch(a){this.plugin.displayError(a),await Dr.rm(He.join(this.absPluginConfigPath,rs),{force:!0}),await Dr.rm(He.join(this.absPluginConfigPath,`${rs}.response`),{force:!0}),await new Promise(s=>setTimeout(s,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=He.join(this.app.vault.configDir,"plugins","obsidian-git",rs),i=this.getRelativeRepoPath(n,!0);(await Dr.readFile(r,"utf-8")).split(` +`).some(l=>l.contains(i))||await Dr.appendFile(r,i+` +`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=await this.git.status(n!=null?["--",n]:[]);this.plugin.setPluginState({gitAction:0});let a=i.files.map(s=>{let o=this.formatPath(s);return{path:o.path,from:o.from,index:s.index==="?"?"U":s.index,workingDir:s.working_dir==="?"?"U":s.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:a,changed:a.filter(s=>s.workingDir!==" "),staged:a.filter(s=>s.index!==" "&&s.index!="U"),conflicted:i.conflicted.map(s=>this.formatPath({path:s}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let n=this.getRelativeRepoPath(r),a=["-C",He.dirname(n),"rev-parse","HEAD"],s=this.git.raw(a);return s.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await s).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((n,i,a,s)=>{if(!(s.contains("submodule")&&s.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");i.on("data",u=>{o+=u.toString("utf8")}),i.on("end",()=>{let c=o.split(` +`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Xc.sep}).filter(f=>!!f);c.reverse(),r(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(r){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return r.from!=null?{from:n(r.from),path:n(r.path)}:{path:n(r.path)}}async blame(r,n,i){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let a=await this.getSubmoduleOfFile(r),s=a?["-C",a.submodule]:[],o=a?a.relativeFilepath:r;s.push("blame","--porcelain"),i&&s.push("-w");let l=`-C${id}`;switch(n){case"inactive":break;case"same-commit":s.push("-C",l);break;case"all-commits":s.push("-C","-C",l);break;default:ba(n)}s.push("--",o);let u=await this.git.raw(s);return Uq(u)}async isTracked(r){let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("ls-files","--",a),this.git.raw(i).then(s=>s.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let i=await this.getSubmodulePaths();for(let a of i)await this.git.cwd({path:a,root:!1}).add("-A"),await this.git.cwd({path:a,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:r,amend:n}){this.plugin.setPluginState({gitAction:4});let i=(await this.git.commit(await this.formatCommitMessage(r),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),i}async stage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,n){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,n),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let n=He.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,r),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(r){let n=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let i=[];n!=null&&i.push("--",n);let a=await this.git.clean(ls.RECURSIVE+ls.DRY_RUN,i);return this.plugin.setPluginState({gitAction:0}),a.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let n=await this.getSubmoduleOfFile(r),i=n?["-C",n.submodule]:[],a=n?n.relativeFilepath:r;return i.push("hash-object","--",a),this.git.raw(i)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),n=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let i=await this.git.revparse([r.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,i]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let a=await this.git.revparse([r.current]);return(await this.git.diff([`${n}..${a}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let s=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(s)}let r=await this.git.status(),n=r.tracking,i=r.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let a=(await this.git.diffSummary([i,n,"--"])).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),a}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),n=r.tracking,i=r.current;if(n==null||i==null)return 0;let[a,s]=Ri(n);return(await this.getRemoteBranches(a)).includes(n)?(await this.git.diffSummary([i,n,"--"])).changed:(this.plugin.log(`Tracking branch ${n} does not exist on remote ${a}.`),0)}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),n=r.tracking,i=r.current;return n?(await this.git.diffSummary([i,n,"--"])).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(),n=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:n.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(n){if(String(n).contains(r))return;throw n}}async log(r,n=!0,i,a){let s;r&&(s=this.getRelativeRepoPath(r,n));let o={file:s,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return a&&(o[a]=null),(await this.git.log(o)).all.map(u=>{var c,f,d,h;return{...u,author:{name:u.author_name,email:u.author_email},refs:u.refs.split(", ").filter(m=>m.length>0),diff:{...u.diff,files:(f=(c=u.diff)==null?void 0:c.files.map(m=>({...m,status:m.status,path:m.file,hash:u.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=u.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(r,n,i=!0){let a=this.getRelativeRepoPath(n,i);return this.git.show([r+":"+a])}async checkout(r,n){if(n&&(r=`${n}/${r}`),await this.git.checkout(r),this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let a of i){let s=await this.git.cwd({path:a,root:!1}).branch();Object.keys(s.branches).includes(r)&&await this.git.cwd({path:a,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,n){await this.git.branch([n?"-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,n,i){await this.git.clone(r,He.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[])}async setConfig(r,n){n==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,n)}async getConfig(r){let i=(await this.git.listConfig("local")).all[r];if(typeof i=="string"||i==null)return i;throw new Error("Config value is not a string")}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,n){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,n]):await this.git.remote(["add",r,n])}async getRemoteBranches(r){let n=await this.git.branch(["-r","--list",`${r}*`]),i=[];for(let a in n.branches)i.push(n.branches[a].name);return i}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(n){try{await this.git.branch(["--set-upstream",r])}catch(i){let[a,s]=Ri(r),o=await this.branchInfo();await this.git.push(["--set-upstream",a,`${o.current}:${s}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,n=!1,i){return n?await this.git.diff(["--cached","--",r]):i?await this.git.show([`${i}`,"--",r]):await this.git.diff(["--",r])}async diff(r,n,i){return await this.git.diff([`${n}..${i}`,"--",r])}async rawCommand(r){let n=r.split(" ");return await this.git.raw(n[0],...n.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(He.dirname(r)))return;let n=await this.git.raw(["-C",He.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",He.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let s=this.app.vault.adapter.getFullPath(He.normalize(r)),o=He.relative(n,s);return{submodule:n,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof br){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),n=await Bc(r||"git",["--version"],{});if(n.error)if($i.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${ad}) of Git for Windows.`);let i=await Bc(ad,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof br){let n=String(r.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Io(n)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);return this.plugin.displayError(`Error checking LFS status: ${i}`),!1}}},e$={hash:"000000",isZeroCommit:!0,summary:""};function Uq(t){let r=t.replace(`\r +`,` +`).split(` +`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return n}function Gq(t,e,r){let n=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[r],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(n){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=JI(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=JI(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function qq(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);Vw(t.author)&&(t.author=void 0),Vw(t.committer)&&(t.committer=void 0),Vw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function Vw(t){return!t||Object.keys(t).length===0}function KI(t){return t.length>0&&t[0].trim()===t[0]}function JI(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}p();var k$=require("@codemirror/state");p();var Ww=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},Fi=new Ww;p();var oh=require("@codemirror/state"),t$=bt(Yw());function r$(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var n$=oh.StateEffect.define();function i$(t,e,r){return r.update({effects:n$.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Wo=oh.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(n$))return r.value;return zq(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function lh(t){var a;let e=t$.sha256.create();if(!t)return e;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=t;e.update(r==="untracked"?"t":"f"),e.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var tn={get:void 0,save:void 0};function a$(t,e){tn.get=t,tn.save=e}function ch(t){var e,r;return(r=(e=sh(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:sh(Xe.lineAuthor.coloringMaxAge).asDays()}function zq(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,n,i,a)=>{var m;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(r).number,u=s.lineAt(n).number,c=o.lineAt(i).number,f=o.lineAt(a).number,d=u-l+1,h=f-c+1;for(let g=c;g<=f;g++){let v=(m=e.lineOffsetsFromUnsavedChanges.get(g))!=null?m:0,w=f===g,b=h-d;w&&(v+=b),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}p();function s$(){Yo=void 0,Xw=[],uh=0,dh.clear(),hh.clear(),Xo.clear()}var Yo,fh=()=>Yo;function o$(t,e){var i;let r=e.length;if(r<((i=Yo==null?void 0:Yo.length)!=null?i:0))return;Yo={gutter:t,length:r,text:e};let n=tn.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,tn.save(n))}var Xw=[],Vq=15,uh=0;function l$(t){Xw[uh]=t,uh=(uh+1)%Vq}function c$(){return K2(Xw)}var dh=new Map,hh=new Map,Xo=new Set;p();var x$=require("@codemirror/state"),S$=require("@codemirror/view");p();var Qw=require("@codemirror/view"),w$=bt(Yw()),vh=require("obsidian");p();p();var ph={x:-10,y:-10};function u$(){ph.x===-10&&window.addEventListener("mousedown",t=>{ph.x=t.clientX,ph.y=t.clientY})}function f$(){for(let t of Xo)if(Wq(t,ph))return t}function Wq(t,e){let{x:r,y:n,width:i,height:a}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+i&&n<=e.y&&e.y<=n+a}var d$="data-commit";function h$(t,e,r){if(e.hasFocus())return;let n=f$();if(!n)return;let i=Xq(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&Yq(i,t),Zw("showCommitHash",t),Zw("authorDisplay",t),Zw("dateTimeFormatOptions",t))}function Yq(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(t.hash)))}function Zw(t,e){var l,u;let r,n,i=Zn.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Xe.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",n=a;else if(t==="authorDisplay"){let c=(l=i.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(s?a:c),n=s?"hide":c}else if(t==="dateTimeFormatOptions"){let c=(u=i.lastShownDateTimeFormatOptions)!=null?u:o;r="Show "+(s?a:c),r+=r.contains("date")?"":" date",n=s?"hide":c}else ba(t);e.addItem(c=>c.setTitle(r).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=Zn.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,n)}))}function p$(t,e,r){r.setAttr(d$,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function Xq(t){let e=t.getAttr(d$);return e?JSON.parse(e):void 0}p();function gh(t,e){return t==="oldest"?mh(0,!1,e).color:mh(void 0,!0,e).color}function mh(t,e,r){let n=ch(r),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/n,0,1),1/2.3),u=Zq(),c=r.colorNew,f=r.colorOld,d=u?.4:1,h=Kw(c.r,f.r,l)*d,m=Kw(c.g,f.g,l)*d,g=Kw(c.b,f.b,l)*d;return{color:`rgba(${h},${m},${g},${u?.75:.25})`,daysSinceCommit:o}}function Kw(t,e,r){return t+(e-t)*r}function Zq(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function m$(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}p();function g$(t,e,r){let n;for(let i=e;i<=r;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!n||s.isZeroCommit||Kq(s,n))&&(n=s)}return n}function Kq(t,e){var i,a,s,o;let r=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,n=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return r>n}var v$="-",Jq="+",Qq=3,ez="*",tz=/\S/g,rz="%",Zo=class t extends Qw.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){}},Jw=class extends Qw.GutterMarker{constructor(r,n,i,a,s,o){super();this.lineAuthoring=r;this.startLine=n;this.endLine=i;this.key=a;this.settings=s;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)||Xo.delete(r))}computeDom(){let r=g$(this.lineAuthoring,this.startLine,this.endLine),n=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?o$(this,n):n=this.adaptTextForFakeCommit(r,n,this.options),this.createHtmlNode(r,n,this.options==="waiting-for-result")}createHtmlNode(r,n,i){var u;let a=window.createDiv();a.innerText=n;let{color:s,daysSinceCommit:o}=mh((u=r==null?void 0:r.author)==null?void 0:u.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);a.style.backgroundColor=s,p$(r,i,a);function l(){let c=a.cloneNode(!0);return Xo.add(c),i||l$(o),c}return l}renderNonZeroCommit(r){let n=this.settings.showCommitHash?this.renderHash(r):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[n,i,a].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,n){var o,l,u,c;let i=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(n){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(u=a.first())!=null?u:v$;break;case"last name":s=(c=a.last())!=null?c:v$;break;case"full":s=i;break;default:return ba(n)}return J2(r==null?void 0:r.author,r==null?void 0:r.committer)||(s=s+ez),s}renderAuthoringDate(r,n,i,a){var u;let s="?";if(((u=r==null?void 0:r.author)==null?void 0:u.epochSeconds)===void 0)return s;let o;switch(n){case"date":o=nd;break;case"datetime":o=Ug;break;case"custom":o=i;break;case"natural language":o=c=>{let f=c.diff((0,vh.moment)());return vh.moment.duration(f).humanize(!0)};break;default:return ba(n)}let l=vh.moment.unix(r.author.epochSeconds);switch(a){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 ba(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,n,i){var l,u,c,f;let a=(u=(l=fh())==null?void 0:l.text)!=null?u:n,s=i!=="waiting-for-result"&&r.isZeroCommit?Jq:rz;n=a.replace(tz,s);let o=(f=(c=tn.get())==null?void 0:c.gutterSpacingFallbackLength)!=null?f:n.length;if(n=Q2(n,o,s),i!=="waiting-for-result"&&r.isZeroCommit){let d=Math.min(o,Qq);n=eP(n,o-d)}return n}};function fs(t,e,r,n,i,a){let s=w$.sha256.create();s.update(JSON.stringify(i)),s.update(`s${e}-e${r}-k${n}-o${a}`);let o=s.hex(),l=dh.get(o);if(l)return l;let u=new Jw(t,e,r,n,i,a);return dh.set(o,u),u}p();var y$=require("obsidian");function e0(){var e,r;let t=(r=(e=tn.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?r:Xe.lineAuthor.gutterSpacingFallbackLength;return new Zo(Array(t).fill("-").join(""))}function t0(t){let{lineAuthoring:e,ageForInitialRender:r}=nz(t);return fs(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function nz(t){var a;let e=(a=c$())!=null?a:ch(t)*.25,r=(0,y$.moment)().add(-e,"days"),n={name:"",epochSeconds:Z2(r),tz:"+0000"},i={hash:"waiting-for-result",author:n,committer:n,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}p();function b$(t,e){return fs({hashPerLine:[void 0,"000000"],commits:new Map([["000000",e$]])},1,1,t,e)}var r0=new Zo(""),E$=(0,S$.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(Wo,!1);return iz(t,e)},lineMarkerChange(t){let e=lh(t.state.field(Wo));return lh(t.startState.field(Wo))!==e},renderEmptyElements:!0,initialSpacer:t=>(_$(t),e0()),updateSpacer:(t,e)=>{var r,n;return _$(e.view),(n=(r=fh())==null?void 0:r.gutter)!=null?n:e0()}});function iz(t,e){let r=lh(e),n=t.state.doc,i=new Map;for(let c=1;c<=n.lines;c++){let f=n.line(c).from,d=t.lineBlockAt(f).to;i.set(c,[f,d]),r.update([f,d,0])}let a=tn.get();r.update("s"+Object.values(tn).join(","));let s=r.hex(),o=hh.get(s);if(o)return o;let{result:l,allowCache:u}=az(n,i,a,e);return u&&hh.set(s,l),l}function az(t,e,r,n){let i=!0,a=t.lines,s=[];function o(f,d,h){return s.push(h.range(f,d))}let l=sz(a,n),u=t.length===0,c=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[d,h]=e.get(f),m=t.lineAt(h).number;if(u){o(d,h,r0);continue}if(f===a&&c){o(d,h,r0);continue}if(n===void 0){o(d,h,t0(r)),i=!1;continue}let{key:g,la:v}=n;if(v==="untracked"){o(d,h,b$(v,r));continue}let w=v.hashPerLine.length-1,b=l[f],E=l[m];if(E&&E>w&&o(d,h,r0),b!==void 0&&Qv(1,b,w)&&E!==void 0&&Qv(1,E,w)){o(d,h,fs(v,b,E,g,r));continue}if(w<1){o(d,h,t0(r)),i=!1;continue}let x=Math.clamp(b!=null?b:f,1,w),k=Math.clamp(E!=null?E:m,1,w);o(d,h,fs(v,x,k,g+"computing",r,"waiting-for-result"))}return{result:x$.RangeSet.of(s,!0),allowCache:i}}function sz(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let r=[void 0],n=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);n+=a!=null?a:0,r[i]=a===void 0?i-n:void 0}return r}function _$(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var wh=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(),s$()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,n=await r.submoduleAwareHeadRevisonInContainingDirectory(e),i=await r.hashObject(e),a=r$(n,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,r){Fi.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},A$=k$.Prec.high([Wo,E$]);var oz="https://momentjs.com/docs/#/parsing/string-format/",lz="https://publish.obsidian.md/git-doc/Line+Authoring",yh=class extends U.PluginSettingTab{constructor(r,n){super(r,n);this.plugin=n;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,n=this.plugin,i;n.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=n.gitReady;r.empty(),a||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let s;if(a){new 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(c=>c.setValue(n.settings.differentIntervalCommitAndPush).onChange(async f=>{n.settings.differentIntervalCommitAndPush=f,await n.saveSettings(),n.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new U.Setting(r).setName(`Auto ${i} interval (minutes)`).setDesc(`${n.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoSaveInterval"}),c.setPlaceholder(String(Xe.autoSaveInterval)),c.onChange(async f=>{f!==""?n.settings.autoSaveInterval=Number(f):n.settings.autoSaveInterval=Xe.autoSaveInterval,await n.saveSettings(),n.automaticsManager.reload("commit")})}),s=new U.Setting(r).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. + If turned on, do auto ${i} every ${tP(n.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(c=>c.setValue(n.settings.autoBackupAfterFileChange).onChange(async f=>{n.settings.autoBackupAfterFileChange=f,this.refreshDisplayWithDelay(),await n.saveSettings(),n.automaticsManager.reload("commit")})),this.mayDisableSetting(s,n.settings.setLastSaveToLastCommit),s=new U.Setting(r).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(c=>c.setValue(n.settings.setLastSaveToLastCommit).onChange(async f=>{n.settings.setLastSaveToLastCommit=f,await n.saveSettings(),n.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(s,n.settings.autoBackupAfterFileChange),s=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPushInterval"}),c.setPlaceholder(String(Xe.autoPushInterval)),c.onChange(async f=>{f!==""?n.settings.autoPushInterval=Number(f):n.settings.autoPushInterval=Xe.autoPushInterval,await n.saveSettings(),n.automaticsManager.reload("push")})}),this.mayDisableSetting(s,!n.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"autoPullInterval"}),c.setPlaceholder(String(Xe.autoPullInterval)),c.onChange(async f=>{f!==""?n.settings.autoPullInterval=Number(f):n.settings.autoPullInterval=Xe.autoPullInterval,await n.saveSettings(),n.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${i} only staged files`).setDesc(`If turned on, only staged files are committed on ${i}. If turned off, all changed files are committed.`).addToggle(c=>c.setValue(n.settings.autoCommitOnlyStaged).onChange(async f=>{n.settings.autoCommitOnlyStaged=f,await n.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(c=>c.setValue(n.settings.customMessageOnAutoBackup).onChange(async f=>{n.settings.customMessageOnAutoBackup=f,await n.saveSettings(),this.refreshDisplayWithDelay()})),s=new U.Setting(r).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(c=>{c.setPlaceholder(Xe.autoCommitMessage).onChange(async f=>{f===""?n.settings.autoCommitMessage=Xe.autoCommitMessage:n.settings.autoCommitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(s,n.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit message").setHeading(),new U.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(c=>{c.setPlaceholder(Xe.commitMessage).onChange(async f=>{f===""?n.settings.commitMessage=Xe.commitMessage:n.settings.commitMessage=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessage"})}),new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(c=>{c.onChange(async f=>{f===""?n.settings.commitMessageScript=Xe.commitMessageScript:n.settings.commitMessageScript=f,await n.saveSettings()}),this.setNonDefaultValue({text:c,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(c=>c.setDefaultFormat(n.settings.commitDateFormat).setValue(n.settings.commitDateFormat).onChange(async f=>{n.settings.commitDateFormat=f,await n.saveSettings()}));u.descEl.innerHTML=` + Specify custom date format. E.g. "${jg}. See Moment.js for more formats.`,new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(c=>{var f;return c.setValue((f=n.localStorage.getHostname())!=null?f:"").onChange(d=>{n.localStorage.setHostname(d)})}),new U.Setting(r).setName("Preview commit message").addButton(c=>c.setButtonText("Preview").onClick(async()=>{let f=await n.gitManager.formatCommitMessage(n.settings.commitMessage);new U.Notice(`${f}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(c=>c.setValue(n.settings.listChangedFilesInMessageBody).onChange(async f=>{n.settings.listChangedFilesInMessageBody=f,await n.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),n.gitManager instanceof _e&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(c=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};c.addOptions(f),c.setValue(n.settings.syncMethod),c.onChange(async d=>{n.settings.syncMethod=d,await n.saveSettings()})}),new U.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(c=>{let f={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};c.addOptions(f),c.setValue(n.settings.mergeStrategy),c.onChange(async d=>{n.settings.mergeStrategy=d,await n.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(c=>c.setValue(n.settings.autoPullOnBoot).onChange(async f=>{n.settings.autoPullOnBoot=f,await n.saveSettings()})),new U.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new U.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${n.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(c=>c.setValue(!n.settings.disablePush).onChange(async f=>{n.settings.disablePush=!f,this.refreshDisplayWithDelay(),await n.saveSettings()})),new U.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${n.settings.disablePush?"":"and push "}only.`).addToggle(c=>c.setValue(n.settings.pullBeforePush).onChange(async f=>{n.settings.pullBeforePush=f,this.refreshDisplayWithDelay(),await n.saveSettings()})),n.gitManager instanceof _e&&(new U.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new U.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(c=>c.setValue(n.settings.hunks.showSigns).onChange(async f=>{n.settings.hunks.showSigns=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(c=>c.setValue(n.settings.hunks.hunkCommands).onChange(async f=>{n.settings.hunks.hunkCommands=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Status bar with summary of line changes").addDropdown(c=>c.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(n.settings.hunks.statusBar).onChange(async f=>{n.settings.hunks.statusBar=f,await n.saveSettings(),n.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new U.Setting(r).setName("History view").setHeading(),new U.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(u=>{let c={hide:"Hide",full:"Full",initials:"Initials"};u.addOptions(c),u.setValue(n.settings.authorInHistoryView),u.onChange(async f=>{n.settings.authorInHistoryView=f,await n.saveSettings(),await n.refresh()})}),new U.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(u=>u.setValue(n.settings.dateInHistoryView).onChange(async c=>{n.settings.dateInHistoryView=c,await n.saveSettings(),await n.refresh()})),new U.Setting(r).setName("Source control view").setHeading(),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(u=>u.setValue(n.settings.refreshSourceControl).onChange(async c=>{n.settings.refreshSourceControl=c,await n.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(u=>{u.inputEl.type="number",this.setNonDefaultValue({text:u,settingsProperty:"refreshSourceControlTimer"}),u.setPlaceholder(String(Xe.refreshSourceControlTimer)),u.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?n.settings.refreshSourceControlTimer=Math.max(Number(f),500):n.settings.refreshSourceControlTimer=Xe.refreshSourceControlTimer,await n.saveSettings(),n.setRefreshDebouncer()})}),new U.Setting(r).setName("Miscellaneous").setHeading(),n.gitManager instanceof _e&&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(u=>{let c={split:"Split",git_unified:"Unified"};u.addOptions(c),u.setValue(n.settings.diffStyle),u.onChange(async f=>{n.settings.diffStyle=f,await n.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(u=>u.setValue(n.settings.disablePopups).onChange(async c=>{n.settings.disablePopups=c,this.refreshDisplayWithDelay(),await n.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(u=>u.setValue(!n.settings.showErrorNotices).onChange(async c=>{n.settings.showErrorNotices=!c,await n.saveSettings()})),n.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(u=>u.setValue(n.settings.disablePopupsForNoChanges).onChange(async c=>{n.settings.disablePopupsForNoChanges=c,await n.saveSettings()})),new U.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(u=>u.setValue(n.settings.showStatusBar).onChange(async c=>{n.settings.showStatusBar=c,await n.saveSettings()})),new U.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(u=>u.setValue(n.settings.showFileMenu).onChange(async c=>{n.settings.showFileMenu=c,await n.saveSettings()})),new U.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(u=>u.setValue(n.settings.showBranchStatusBar).onChange(async c=>{n.settings.showBranchStatusBar=c,await n.saveSettings()})),new U.Setting(r).setName("Show the count of modified files in the status bar").addToggle(u=>u.setValue(n.settings.changedFilesInStatusBar).onChange(async c=>{n.settings.changedFilesInStatusBar=c,await n.saveSettings()})),n.gitManager instanceof _n?new U.Setting(r).setName("Authentication/commit author").setHeading():new U.Setting(r).setName("Commit author").setHeading(),n.gitManager instanceof _n&&new U.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(u=>{var c;u.setValue((c=n.localStorage.getUsername())!=null?c:""),u.onChange(f=>{n.localStorage.setUsername(f)})}),n.gitManager instanceof _n&&new U.Setting(r).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(u=>{u.inputEl.autocapitalize="off",u.inputEl.autocomplete="off",u.inputEl.spellcheck=!1,u.onChange(c=>{n.localStorage.setPassword(c)})}),n.gitReady&&new U.Setting(r).setName("Author name for commit").addText(async u=>{var c;u.setValue((c=await n.gitManager.getConfig("user.name"))!=null?c:""),u.onChange(async f=>{await n.gitManager.setConfig("user.name",f==""?void 0:f)})}),n.gitReady&&new U.Setting(r).setName("Author email for commit").addText(async u=>{var c;u.setValue((c=await n.gitManager.getConfig("user.email"))!=null?c:""),u.onChange(async f=>{await n.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(),n.gitManager instanceof _e&&(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(u=>u.setValue(n.settings.updateSubmodules).onChange(async c=>{n.settings.updateSubmodules=c,await n.saveSettings()})),n.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(u=>u.setValue(n.settings.submoduleRecurseCheckout).onChange(async c=>{n.settings.submoduleRecurseCheckout=c,await n.saveSettings()}))),n.gitManager instanceof _e&&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(u=>{var c;u.setValue((c=n.localStorage.getGitPath())!=null?c:""),u.setPlaceholder("git"),u.onChange(f=>{n.localStorage.setGitPath(f),n.gitManager.updateGitPath(f||"git").catch(d=>n.displayError(d))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(u=>{u.setPlaceholder("GIT_DIR=/path/to/git/dir"),u.setValue(n.localStorage.getEnvVars().join(` +`)),u.onChange(c=>{n.localStorage.setEnvVars(c.split(` +`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(u=>{u.setValue(n.localStorage.getPATHPaths().join(` +`)),u.onChange(c=>{n.localStorage.setPATHPaths(c.split(` +`))})}),n.gitManager instanceof _e&&new U.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(u=>{u.setButtonText("Reload"),u.setCta(),u.onClick(async()=>{await n.gitManager.setGitInstance()})}),new U.Setting(r).setName("Custom base path (Git repository path)").setDesc(` Sets the relative path to the vault from which the Git binary should be executed. Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. - `).addText(c=>{c.setValue(n.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{n.settings.basePath=u,await n.saveSettings(),n.gitManager.updateBasePath(u||"").catch(f=>n.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(n.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{n.settings.gitDir=u,await n.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(n.localStorage.getPluginDisabled()).onChange(u=>{n.localStorage.setPluginDisabled(u),u?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new 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,n){n&&(r.setDisabled(n),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}async lineAuthorSettingHandler(r,n){this.settings.lineAuthor[r]=n,await this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.innerHTML=` - Feature guide and quick examples
+ `).addText(u=>{u.setValue(n.settings.basePath),u.setPlaceholder("directory/directory-with-git-repo"),u.onChange(async c=>{n.settings.basePath=c,await n.saveSettings(),n.gitManager.updateBasePath(c||"").catch(f=>n.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(u=>{u.setValue(n.settings.gitDir),u.setPlaceholder(".git"),u.onChange(async c=>{n.settings.gitDir=c,await n.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(u=>u.setValue(n.localStorage.getPluginDisabled()).onChange(c=>{n.localStorage.setPluginDisabled(c),c?n.unloadPlugin():n.init({fromReload:!0}).catch(f=>n.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(u=>{u.buttonEl.outerHTML="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 u=r.createDiv();u.setAttr("align","center"),u.setText(`Debugging and logging: +You can always see the logs of this and every other plugin by opening the console with`);let c=r.createDiv();c.setAttr("align","center"),c.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?c.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):c.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,n){n&&(r.setDisabled(n),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,n){this.settings.lineAuthor[r]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.innerHTML=` + 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(n=>n.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let n=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(n.descEl.innerHTML=` By default (deactivated), each line only shows the newest commit where it was changed.
@@ -173,7 +175,7 @@ You can always see the logs of this and every other plugin by opening the consol With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected.
It uses git-blame and - for matches (at least ${Uu} 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(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new U.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` + for matches (at least ${id} 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(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new U.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` The time-zone in which the authoring date should be shown. Either your local time-zone (default), the author's time-zone during commit creation or @@ -181,7 +183,7 @@ You can always see the logs of this and every other plugin by opening the consol `;let i=new U.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(async s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new U.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(async s=>{await this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=` The CSS color of the gutter text.
- It is higly recommended to use + It is highly recommended to use CSS variables defined by themes @@ -203,107 +205,122 @@ You can always see the logs of this and every other plugin by opening the consol If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection. - `}}createColorSetting(r){let n=new U.Setting(this.containerEl).setName("").addText(i=>{let a=a0(r,this.settings.lineAuthor),s=a0(r,Ye.lineAuthor);i.setPlaceholder(zg(s)),i.setValue(zg(a)),i.onChange(async o=>{let l=fT(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,a0(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let n=this.lineAuthorColorSettings.get(r);if(n){let i=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(r,n){let i=this.lineAuthorColorSettings.get(r);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(r,this.settings.lineAuthor,n!==void 0))}colorSettingPreviewDescHtml(r,n,i){let a=i?s0(r,n):"rgba(127,127,127,0.3)",s=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and + `}}createColorSetting(r){let n=new U.Setting(this.containerEl).setName("").addText(i=>{let a=n0(r,this.settings.lineAuthor),s=n0(r,Xe.lineAuthor);i.setPlaceholder(Jv(s)),i.setValue(Jv(a)),i.onChange(async o=>{let l=X2(o);if(l!==void 0){let u=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,n),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,n0(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let n=this.lineAuthorColorSettings.get(r);if(n){let i=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(r,n){let i=this.lineAuthorColorSettings.get(r);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(r,this.settings.lineAuthor,n!==void 0))}colorSettingPreviewDescHtml(r,n,i){let a=i?gh(r,n):"rgba(127,127,127,0.3)",s=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: ${`
${o}
`}`}previewCustomDateTimeDescriptionHtml(r){let n=(0,U.moment)().format(r);return`Format string to display the authoring date.
Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=Gf(r);return[`The oldest age in the line author coloring. Everything older will have the same color. -
Smallest valid age is "1d". Currently: ${n!==void 0?`${n.asDays()} days`:"invalid!"}`,n]}setNonDefaultValue({settingsProperty:r,text:n}){let i=this.plugin.settings[r];Ye[r]!==i&&n.setValue(String(i))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function a0(e,t){return e==="oldest"?t.colorOld:t.colorNew}function Gf(e){let t=U.moment.duration("P"+e.toUpperCase());return t.isValid()&&t.asDays()&&t.asDays()>=1?t:void 0}function IT(e,t,r){if(!(e===void 0||t===void 0||r===void 0))return`head${e}-obj${t}-path${r}`}var FT=zf.Annotation.define();function $T(e,t,r){return r.update({annotations:FT.of({key:e,la:t,lineOffsetsFromUnsavedChanges:new Map})})}function aj(e){return e.annotation(FT)}var Zs=zf.StateField.define({create:e=>{},update:(e,t)=>{var r;return(r=aj(t))!=null?r:sj(t,e)},compare:(e,t)=>(e==null?void 0:e.key)===(t==null?void 0:t.key)});function Vf(e){var a;let t=OT.sha256.create();if(!e)return t;let{la:r,key:n,lineOffsetsFromUnsavedChanges:i}=e;t.update(r==="untracked"?"t":"f"),t.update(n);for(let[s,o]of(a=i.entries())!=null?a:[])t.update([s,o]);return t}var Nr={get:void 0,save:void 0};function LT(e,t){Nr.get=e,Nr.save=t}function Wf(e){var t,r;return(r=(t=Gf(e.coloringMaxAge))==null?void 0:t.asDays())!=null?r:Gf(Ye.lineAuthor.coloringMaxAge).asDays()}function sj(e,t){if(t)return e.changes.empty||e.changes.iterChanges((r,n,i,a)=>{var p;let s=e.startState.doc,{newDoc:o}=e,l=s.lineAt(r).number,c=s.lineAt(n).number,u=o.lineAt(i).number,f=o.lineAt(a).number,d=c-l+1,h=f-u+1;for(let m=u;m<=f;m++){let v=(p=t.lineOffsetsFromUnsavedChanges.get(m))!=null?p:0,y=f===m,b=h-d;y&&(v+=b),t.lineOffsetsFromUnsavedChanges.set(m,v)}}),t}var o0=class{constructor(t){this.state=t;this.subscribeMe()}notifyLineAuthoring(t,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${t}`);return}let n=this.view.state,i=$T(t,r,n);this.view.dispatch(i)}updateToNewState(t){let r=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=t,r&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(Xs.ifFilepathDefinedTransformSubscribers(this.filepath,t=>t.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(t){Xs.ifFilepathDefinedTransformSubscribers(t,r=>r.delete(this))}get filepath(){var t,r;return(r=(t=this.state.field(qf.editorInfoField))==null?void 0:t.file)==null?void 0:r.path}get view(){return this.state.field(qf.editorEditorField)}},NT=DT.StateField.define({create:e=>new o0(e),update:(e,t)=>e.updateToNewState(t.state),compare:(e,t)=>e===t});g();function BT(){Ks=void 0,l0=[],Yf=0,Zf.clear(),Kf.clear(),Js.clear()}var Ks,Xf=()=>Ks;function jT(e,t){var i;let r=t.length;if(r<((i=Ks==null?void 0:Ks.length)!=null?i:0))return;Ks={gutter:e,length:r,text:t};let n=Nr.get();r!==n.gutterSpacingFallbackLength&&(n.gutterSpacingFallbackLength=r,Nr.save(n))}var l0=[],oj=15,Yf=0;function HT(e){l0[Yf]=e,Yf=(Yf+1)%oj}function UT(){return hT(l0)}var Zf=new Map,Kf=new Map,Js=new Set;g();var tC=require("@codemirror/state"),rC=require("@codemirror/view");g();var d0=require("@codemirror/view"),KT=ze(Zg()),ed=require("obsidian");g();g();var Jf={x:-10,y:-10};function GT(){Jf.x===-10&&window.addEventListener("mousedown",e=>{Jf.x=e.clientX,Jf.y=e.clientY})}function zT(){for(let e of Js)if(lj(e,Jf))return e}function lj(e,t){let{x:r,y:n,width:i,height:a}=e.getBoundingClientRect();return r<=t.x&&t.x<=r+i&&n<=t.y&&t.y<=n+a}g();var Kl={};var VT="data-commit";function WT(e,t,r){if(t.hasFocus())return;let n=zT();if(!n)return;let i=uj(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&cj(i,e),c0("showCommitHash",e),c0("authorDisplay",e),c0("dateTimeFormatOptions",e))}function cj(e,t){t.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(e.hash)))}function c0(e,t){var l,c;let r,n,i=Kl.plugin.settings.lineAuthor,a=i[e],s=typeof a=="boolean"?a:a!=="hide",o=Ye.lineAuthor[e];if(e==="showCommitHash")r="Show commit hash",n=a;else if(e==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(s?a:u),n=s?"hide":u}else if(e==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(s?a:u),r+=r.contains("date")?"":" date",n=s?"hide":u}else Ii(e);t.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var d,h;return(h=(d=Kl.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(e,n)}))}function qT(e,t,r){r.setAttr(VT,JSON.stringify({hash:e.hash,isZeroCommit:e.isZeroCommit,isWaitingGutter:t}))}function uj(e){let t=e.getAttr(VT);return t?JSON.parse(t):void 0}g();function s0(e,t){return e==="oldest"?Qf(0,!1,t).color:Qf(void 0,!0,t).color}function Qf(e,t,r){let n=Wf(r),i=Date.now()/1e3,a=e!=null?e:0,o=(t?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/n,0,1),1/2.3),c=fj(),u=r.colorNew,f=r.colorOld,d=c?.4:1,h=u0(u.r,f.r,l)*d,p=u0(u.g,f.g,l)*d,m=u0(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${m},${c?.75:.25})`,daysSinceCommit:o}}function u0(e,t,r){return e+(t-e)*r}function fj(){var e;return((e=window.app)==null?void 0:e.getTheme())==="obsidian"}function YT(e){document.body.style.setProperty("--obs-git-gutter-text",e.textColorCss)}g();function XT(e,t,r){let n;for(let i=t;i<=r;i++){let a=e.hashPerLine[i],s=e.commits.get(a);(!n||s.isZeroCommit||dj(s,n))&&(n=s)}return n}function dj(e,t){var i,a,s,o;let r=(a=(i=e.author)==null?void 0:i.epochSeconds)!=null?a:0,n=(o=(s=t.author)==null?void 0:s.epochSeconds)!=null?o:0;return r>n}var ZT="-",hj="+",pj=3,mj="*",gj=/\S/g,vj="%",Qs=class e extends d0.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof e&&this.text===r.text}toDOM(){return document.createTextNode(this.text)}destroy(r){r&&(document.body.contains(r)||r.remove())}},f0=class extends d0.GutterMarker{constructor(r,n,i,a,s,o){super();this.lineAuthoring=r;this.startLine=n;this.endLine=i;this.key=a;this.settings=s;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)||(Js.delete(r),r.remove()))}computeDom(){let r=XT(this.lineAuthoring,this.startLine,this.endLine),n=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?jT(this,n):n=this.adaptTextForFakeCommit(r,n,this.options),this.createHtmlNode(r,n,this.options==="waiting-for-result")}createHtmlNode(r,n,i){var c;let a=window.createDiv();a.innerText=n;let{color:s,daysSinceCommit:o}=Qf((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);a.style.backgroundColor=s,qT(r,i,a);function l(){let u=a.cloneNode(!0);return Js.add(u),i||HT(o),u}return l}renderNonZeroCommit(r){let n=this.settings.showCommitHash?this.renderHash(r):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[n,i,a].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,n){var o,l,c,u;let i=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(n){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(c=a.first())!=null?c:ZT;break;case"last name":s=(u=a.last())!=null?u:ZT;break;case"full":s=i;break;default:return Ii(n)}return pT(r==null?void 0:r.author,r==null?void 0:r.committer)||(s=s+mj),s}renderAuthoringDate(r,n,i,a){var c;let s="?";if(((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds)===void 0)return s;let o;switch(n){case"date":o=Hu;break;case"datetime":o=_m;break;case"custom":o=i;break;case"natural language":o=u=>{let f=u.diff((0,ed.moment)());return ed.moment.duration(f).humanize(!0)};break;default:return Ii(n)}let l=ed.moment.unix(r.author.epochSeconds);switch(a){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 Ii(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,n,i){var l,c,u,f;let a=(c=(l=Xf())==null?void 0:l.text)!=null?c:n,s=i!=="waiting-for-result"&&r.isZeroCommit?hj:vj;n=a.replace(gj,s);let o=(f=(u=Nr.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:n.length;if(n=mT(n,o,s),i!=="waiting-for-result"&&r.isZeroCommit){let d=Math.min(o,pj);n=gT(n,o-d)}return n}};function Ea(e,t,r,n,i,a){let s=KT.sha256.create();s.update(Object.values(i).join(",")),s.update(`s${t}-e${r}-k${n}-o${a}`);let o=s.hex(),l=Zf.get(o);if(l)return l;let c=new f0(e,t,r,n,i,a);return Zf.set(o,c),c}g();var JT=require("obsidian");function h0(){var t,r;let e=(r=(t=Nr.get())==null?void 0:t.gutterSpacingFallbackLength)!=null?r:Ye.lineAuthor.gutterSpacingFallbackLength;return new Qs(Array(e).fill("-").join(""))}function p0(e){let{lineAuthoring:t,ageForInitialRender:r}=yj(e);return Ea(t,1,1,"initialGutter"+r,e,"waiting-for-result")}function yj(e){var a;let t=(a=UT())!=null?a:Wf(e)*.25,r=(0,JT.moment)().add(-t,"days"),n={name:"",epochSeconds:dT(r),tz:"+0000"},i={hash:"waiting-for-result",author:n,committer:n,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:t}}g();function QT(e,t){return Ea({hashPerLine:[void 0,"000000"],commits:new Map([["000000",ST]])},1,1,e,t)}var m0=new Qs(""),nC=(0,rC.gutter)({class:"line-author-gutter-container",markers(e){let t=e.state.field(Zs,!1);return wj(e,t)},lineMarkerChange(e){let t=Vf(e.state.field(Zs));return Vf(e.startState.field(Zs))!==t},renderEmptyElements:!0,initialSpacer:e=>(eC(e),h0()),updateSpacer:(e,t)=>{var r,n;return eC(t.view),(n=(r=Xf())==null?void 0:r.gutter)!=null?n:h0()}});function wj(e,t){let r=Vf(t),n=e.state.doc,i=new Map;for(let u=1;u<=n.lines;u++){let f=n.line(u).from,d=e.lineBlockAt(f).to;i.set(u,[f,d]),r.update([f,d,0])}let a=Nr.get();r.update("s"+Object.values(Nr).join(","));let s=r.hex(),o=Kf.get(s);if(o)return o;let{result:l,allowCache:c}=bj(n,i,a,t);return c&&Kf.set(s,l),l}function bj(e,t,r,n){let i=!0,a=e.lines,s=[];function o(f,d,h){return s.push(h.range(f,d))}let l=_j(a,n),c=e.length===0,u=e.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[d,h]=t.get(f),p=e.lineAt(h).number;if(c){o(d,h,m0);continue}if(f===a&&u){o(d,h,m0);continue}if(n===void 0){o(d,h,p0(r)),i=!1;continue}let{key:m,la:v}=n;if(v==="untracked"){o(d,h,QT(v,r));continue}let y=v.hashPerLine.length-1,b=l[f],x=l[p];if(x&&x>y&&o(d,h,m0),b!==void 0&&Vg(1,b,y)&&x!==void 0&&Vg(1,x,y)){o(d,h,Ea(v,b,x,m,r));continue}if(y<1){o(d,h,p0(r)),i=!1;continue}let E=Math.clamp(b!=null?b:f,1,y),_=Math.clamp(x!=null?x:p,1,y);o(d,h,Ea(v,E,_,m+"computing",r,"waiting-for-result"))}return{result:tC.RangeSet.of(s,!0),allowCache:i}}function _j(e,t){if(!(t!=null&&t.lineOffsetsFromUnsavedChanges))return Array.from(new Array(e+1),i=>i);let r=[void 0],n=0;for(let i=1;i<=e;i++){let a=t.lineOffsetsFromUnsavedChanges.get(i);n+=a!=null?a:0,r[i]=a===void 0?i-n:void 0}return r}function eC(e){e.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var td=class{constructor(t){this.plugin=t;this.lineAuthorings=new Map}async trackChanged(t){return this.trackChangedHelper(t).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(t){if(t){if(t.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeLineAuthorInfo(t.path)}}destroy(){this.lineAuthorings.clear(),Xs.clear(),BT()}async computeLineAuthorInfo(t){let r=this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,n=await r.submoduleAwareHeadRevisonInContainingDirectory(t),i=await r.hashObject(t),a=IT(n,i,t);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await r.blame(t,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(t,a)}}notifyComputationResultToSubscribers(t,r){Xs.ifFilepathDefinedTransformSubscribers(t,n=>n.forEach(i=>i.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},aC=iC.Prec.high([NT,Zs,nC]);var rd=class{constructor(t){this.plg=t;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=t=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=t==null?void 0:t.view;!(r instanceof Aa.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),LT(()=>this.plg.settings.lineAuthor,t=>{this.plg.settings.lineAuthor=t,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;YT(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new td(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(t){console.warn("Git: Error while loading line authoring feature.",t),this.deactivateFeature()}}deactivateFeature(){var t;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(t=this.lineAuthorInfoProvider)==null||t.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&Aa.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ce?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(aC),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let t of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(t);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),GT(),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.fileRenameEvent)}destroyEventHandlers(){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.fileRenameEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",t=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(t).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(t,r)=>{var n;return t instanceof Aa.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(t))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",t=>{var r;return t instanceof Aa.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(t))})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",WT)}};g();var nd=class{constructor(t){this.plugin=t;this.tasks=[]}addTask(t,r){this.tasks.push({task:t,onFinished:r!=null?r:()=>{}}),this.tasks.length===1&&this.handleTask()}handleTask(){if(this.tasks.length>0){let t=this.tasks[0];t.task().then(r=>{t.onFinished(r),this.tasks.shift(),this.handleTask()},r=>{this.plugin.displayError(r),t.onFinished(void 0),this.tasks.shift(),this.handleTask()})}}clear(){this.tasks=[]}};g();var Br=require("obsidian");var id=class{constructor(t,r){this.statusBarEl=t;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(t,r){this.messages.push({message:`Git: ${t.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.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,Br.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.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Br.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Br.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Br.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Br.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Br.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Br.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let t=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(t){let i=(0,Br.moment)(t).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=` -(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Br.setIcon)(this.iconEl,"globe"):(0,Br.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};g();var sd=require("obsidian"),ad=class extends sd.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let n=(0,sd.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${n}: ${r}`,`${r}: ${n}`]}renderSuggestion(r,n){n.innerText=r}onChooseSuggestion(r,n){this.resolve&&this.resolve(r)}};g();var sC=require("obsidian"),Jl=class{constructor(t){this.plugin=t}saveLastAuto(t,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(t.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(t.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(t.toString())}loadLastAuto(){var t,r,n;return{backup:new Date((t=this.plugin.localStorage.getLastAutoBackup())!=null?t:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let t=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,t.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,t.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...t){t.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),t.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),t.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let t=await this.plugin.gitManager.getLastCommitTime();t&&this.saveLastAuto(t,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let t=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,t.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(t){let r=(t!=null?t:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?t===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,sC.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 t=await this.plugin.gitManager.getLastCommitTime();if(t){this.saveLastAuto(t,"backup");let r=this.diff(this.plugin.settings.autoSaveInterval,t);if(r>0)return this.startAutoCommitAndSync(r),!1}}return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0}):await this.plugin.commitAndSync({fromAutoBackup:!0}),!0},t=>{t!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(t){let r=(t!=null?t:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(t){let r=(t!=null?t: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 t=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,t=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.cancel(),this.plugin.autoCommitDebouncer=void 0,t=!0),t}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}diff(t,r){let i=t-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,i)}};g();var ka=require("obsidian");g();var Ql=require("obsidian");async function oC(e,t,r){let n=await cC(t,r);if(n.result==="failure"){new Ql.Notice(n.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=n;if(i){let c=e.getCursor("from").line+1,u=e.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}-L${u}`)}else new Ql.Notice("It seems like you are not using GitHub")}async function lC(e,t){let r=await cC(e,t);if(r.result==="failure"){new Ql.Notice(r.reason);return}let{isGitHub:n,branch:i,repo:a,user:s,filePath:o}=r;n?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new Ql.Notice("It seems like you are not using GitHub")}async function cC(e,t){let r=await t.branchInfo(),n=r.tracking,i=r.current,a,s=t.getRelativeRepoPath(e.path);if(t instanceof Ce){let l=await t.getSubmoduleOfFile(t.getRelativeRepoPath(e.path));if(l){s=l.relativeFilepath;let c=await t.git.cwd({path:l.submodule,root:!1}).status();if(n=c.tracking||void 0,i=c.current||void 0,n){let u=n.substring(0,n.indexOf("/")),f=await t.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(n==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=n.substring(0,n.indexOf("/"));if(a=await t.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.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:i,filePath:s}}}g();var uC=require("obsidian"),od=class extends uC.FuzzySuggestModal{constructor(t,r){super(t.app),this.plugin=t,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(t){if(t.index=="U"&&t.workingDir=="U")return`Untracked | ${t.vaultPath}`;let r="",n="";return t.workingDir!=" "&&(r=`Working Dir: ${t.workingDir} `),t.index!=" "&&(n=`Index: ${t.index}`),`${r}${n} | ${t.vaultPath}`}onChooseItem(t,r){this.plugin.app.metadataCache.getFirstLinkpathDest(t.vaultPath,"")==null?this.app.openWithDefaultApp(t.vaultPath):this.plugin.app.workspace.openLinkText(t.vaultPath,"/")}};g();var fC=require("obsidian"),ld=class extends fC.Modal{constructor(r,n){super(r);this.content=n;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:n}=this;n.setText("Edit .gitignore");let i=r.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};function dC(e){let t=e.app;e.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=e.gitManager.getRelativeVaultPath(".gitignore");await t.vault.adapter.exists(r)||await t.vault.adapter.write(r,"");let n=await t.vault.adapter.read(r),a=await new ld(t,n).openAndGetReslt();a!==void 0&&(await t.vault.adapter.write(r,a),await e.refresh())}}),e.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let r=t.workspace.getLeavesOfType(kt.type),n;r.length===0?(n=(i=t.workspace.getRightLeaf(!1))!=null?i:t.workspace.getLeaf(),await n.setViewState({type:kt.type})):n=r.first(),await t.workspace.revealLeaf(n),t.workspace.trigger("obsidian-git:refresh")}}),e.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let r=t.workspace.getLeavesOfType(Lr.type),n;r.length===0?(n=(i=t.workspace.getRightLeaf(!1))!=null?i:t.workspace.getLeaf(),await n.setViewState({type:Lr.type})):n=r.first(),await t.workspace.revealLeaf(n),t.workspace.trigger("obsidian-git:refresh")}}),e.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let n=t.workspace.getActiveFile();if(r)return n!==null;{let i=e.gitManager.getRelativeRepoPath(n.path,!0);e.tools.openDiff({aFile:i,aRef:""})}}}),e.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:n})=>{if(n)return oC(r,n,e.gitManager)}}),e.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:n})=>{if(n)return lC(n,e.gitManager)}}),e.addCommand({id:"pull",name:"Pull",callback:()=>e.promiseQueue.addTask(()=>e.pullChangesFromRemote())}),e.addCommand({id:"fetch",name:"Fetch",callback:()=>e.promiseQueue.addTask(()=>e.fetch())}),e.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>e.promiseQueue.addTask(()=>e.switchRemoteBranch())}),e.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let n=t.workspace.getActiveFile();if(r)return n!==null;e.addFileToGitignore(n.path,n instanceof ka.TFolder).catch(i=>e.displayError(i))}}),e.addCommand({id:"push",name:"Commit-and-sync",callback:()=>e.promiseQueue.addTask(()=>e.commitAndSync({fromAutoBackup:!1}))}),e.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>e.promiseQueue.addTask(async()=>{await e.commitAndSync({fromAutoBackup:!1}),window.close()})}),e.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>e.promiseQueue.addTask(()=>e.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),e.addCommand({id:"commit",name:"Commit all changes",callback:()=>e.promiseQueue.addTask(()=>e.commit({fromAuto:!1}))}),e.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>e.promiseQueue.addTask(()=>e.commit({fromAuto:!1,requestCustomMessage:!0}))}),e.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>e.promiseQueue.addTask(()=>e.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:!0}))}),ka.Platform.isDesktopApp&&e.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>e.promiseQueue.addTask(()=>e.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),e.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>e.promiseQueue.addTask(()=>e.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}),e.addCommand({id:"push2",name:"Push",callback:()=>e.promiseQueue.addTask(()=>e.push())}),e.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let n=t.workspace.getActiveFile();if(r)return n!==null;e.promiseQueue.addTask(()=>e.stageFile(n))}}),e.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let n=t.workspace.getActiveFile();if(r)return n!==null;e.promiseQueue.addTask(()=>e.unstageFile(n))}}),e.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>e.editRemotes().catch(r=>e.displayError(r))}),e.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>e.removeRemote().catch(r=>e.displayError(r))}),e.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>e.setUpstreamBranch().catch(r=>e.displayError(r))}),e.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await t.vault.adapter.exists(`${e.settings.basePath}/.git`)?await new $e(e,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&(await t.vault.adapter.rmdir(`${e.settings.basePath}/.git`,!0),new ka.Notice("Successfully deleted repository. Reloading plugin..."),e.unloadPlugin(),await e.init({fromReload:!0})):new ka.Notice("No repository found")}}),e.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>e.createNewRepo().catch(r=>e.displayError(r))}),e.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>e.cloneNewRepo().catch(r=>e.displayError(r))}),e.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await e.isAllInitialized())try{let r=await e.updateCachedStatus();if(r.changed.length+r.staged.length>500){e.displayError("Too many changes to display");return}new od(e,r.all).open()}catch(r){e.displayError(r)}}}),e.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{e.switchBranch().catch(r=>e.displayError(r))}}),e.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{e.createBranch().catch(r=>e.displayError(r))}}),e.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{e.deleteBranch().catch(r=>e.displayError(r))}}),e.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{if(!await e.isAllInitialized())return!1;await new $e(e,{options:["NO","YES"],placeholder:"Do you want to discard all changes to tracked files? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&e.promiseQueue.addTask(()=>e.discardAll())}}),e.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let n=e.gitManager;if(r)return n instanceof Ce;e.tools.runRawCommand().catch(i=>e.displayError(i))}}),e.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=e.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!e.settings.lineAuthor.show)}})}g();var cd=class{constructor(t){this.plugin=t;this.prefix=this.plugin.manifest.id+":",this.app=t.app}migrate(){let t=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let r of t){let n=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&n!=null&&n!=null&&(this.app.saveLocalStorage(this.prefix+r,n),localStorage.removeItem(this.prefix+r))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(t){return this.app.saveLocalStorage(this.prefix+"password",t)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(t){return this.app.saveLocalStorage(this.prefix+"username",t)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(t){return this.app.saveLocalStorage(this.prefix+"hostname",t)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(t){return this.app.saveLocalStorage(this.prefix+"conflict",`${t}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(t){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",t)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(t){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",t)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(t){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",t)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(t){return this.app.saveLocalStorage(this.prefix+"gitPath",t)}getPATHPaths(){var t,r;return(r=(t=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:t.split(":"))!=null?r:[]}setPATHPaths(t){return this.app.saveLocalStorage(this.prefix+"PATHPaths",t.join(":"))}getEnvVars(){var t;return JSON.parse((t=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?t:"[]")}setEnvVars(t){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(t))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(t){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${t}`)}};g();var eo=require("obsidian");var ec=class{constructor(t){this.plugin=t}async hasTooBigFiles(t){let r=await this.plugin.gitManager.branchInfo(),n=r.tracking?Fi(r.tracking)[0]:null;if(!n)return!1;let i=await this.plugin.gitManager.getRemoteUrl(n);if(i!=null&&i.includes("github.com")){let a=[],s=this.plugin.gitManager;for(let o of t){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),c=!1;if(l instanceof eo.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;s instanceof Ce&&(u=await s.isFileTrackedByLFS(o.path)),u||a.push(o)}}if(a.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: -- ${a.map(o=>o.vaultPath).join(` -- `)} -Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(t){t!==void 0&&await this.plugin.app.vault.adapter.write(Fs,t);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&Fs.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(Fs,"/",!0)}openDiff({aFile:t,bFile:r,aRef:n,bRef:i,event:a}){var l,c;let s=this.plugin.settings.diffStyle;eo.Platform.isMobileApp&&(s="git_unified");let o={aFile:t,bFile:r!=null?r:t,aRef:n,bRef:i};s=="split"?(l=nn(this.plugin.app,a))==null||l.setViewState({type:ki.type,active:!0,state:o}):s=="git_unified"&&((c=nn(this.plugin.app,a))==null||c.setViewState({type:Ti.type,active:!0,state:o}))}async runRawCommand(){let t=this.plugin.gitManager;if(!(t instanceof Ce))return;let n=await new $e(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new eo.Notice(`Running '${n}'...`,999999);try{let a=await t.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};g();g();g();g();var je;(function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"})(je||(je={}));var hC={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},pC={LINES:"lines",WORDS:"words",NONE:"none"},mC={WORD:"word",CHAR:"char"},Ta;(function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"})(Ta||(Ta={}));g();var xj=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Sj=RegExp("["+xj.join("\\")+"]","g");function gC(e){return e.replace(Sj,"\\$&")}function g0(e){return e&&e.replace(/\\/g,"/")}function vC(e){let t,r,n,i=0;for(t=0,n=e.length;t1?r[r.length-1]:t}function wC(e,t){return t.reduce((r,n)=>r||e.startsWith(n),!1)}var bC=["a/","b/","i/","w/","c/","o/"];function Li(e,t,r){let n=r!==void 0?[...bC,r]:bC,i=t?new RegExp(`^${gC(t)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(e)||[],s=n.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Ej(e,t){return Li(e,"---",t)}function Aj(e,t){return Li(e,"+++",t)}function _C(e,t={}){let r=[],n=null,i=null,a=null,s=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,x=/^rename from "?(.+)"?/,E=/^rename to "?(.+)"?/,_=/^similarity index (\d+)%/,k=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,A=/^Binary files (.*) and (.*) differ/,S=/^GIT binary patch/,T=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,L=e.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` + >${o}`}`}previewCustomDateTimeDescriptionHtml(r){let n=(0,U.moment)().format(r);return`Format string to display the authoring date.
Currently: ${n}`}previewOldestAgeDescriptionHtml(r){let n=sh(r);return[`The oldest age in the line author coloring. Everything older will have the same color. +
Smallest valid age is "1d". Currently: ${n!==void 0?`${n.asDays()} days`:"invalid!"}`,n]}setNonDefaultValue({settingsProperty:r,text:n}){let i=this.plugin.settings[r];Xe[r]!==i&&(typeof i=="string"||typeof i=="number"||typeof i=="boolean"?n.setValue(String(i)):n.setValue(JSON.stringify(i)))}refreshDisplayWithDelay(r=80){setTimeout(()=>this.display(),r)}};function n0(t,e){return t==="oldest"?e.colorOld:e.colorNew}function sh(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}p();var Lr=require("obsidian");var bh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,Lr.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,Lr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,Lr.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,Lr.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,Lr.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,Lr.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,Lr.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var n;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let i=(0,Lr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${i}`,(n=this.unPushedCommits)!=null&&n&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,Lr.setIcon)(this.iconEl,"globe"):(0,Lr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};p();var xh=require("obsidian"),_h=class extends xh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let n=(0,xh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${n}: ${r}`,`${r}: ${n}`]}renderSuggestion(r,n){n.innerText=r}onChooseSuggestion(r,n){this.resolve&&this.resolve(r)}};p();var T$=require("obsidian"),Zc=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,T$.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let n=this.diff(this.plugin.settings.autoSaveInterval,r);if(n>0)return this.startAutoCommitAndSync(n),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.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 i=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,i)}};p();var kn=require("obsidian");p();var Kc=require("obsidian");async function C$(t,e,r){let n=await R$(e,r);if(n.result==="failure"){new Kc.Notice(n.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=n;if(i){let u=t.getCursor("from").line+1,c=t.getCursor("to").line+1;u===c?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${u}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${u}-L${c}`)}else new Kc.Notice("It seems like you are not using GitHub")}async function P$(t,e){let r=await R$(t,e);if(r.result==="failure"){new Kc.Notice(r.reason);return}let{isGitHub:n,branch:i,repo:a,user:s,filePath:o}=r;n?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new Kc.Notice("It seems like you are not using GitHub")}async function R$(t,e){let r=await e.branchInfo(),n=r.tracking,i=r.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof _e){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let u=await e.git.cwd({path:l.submodule,root:!1}).status();if(n=u.tracking||void 0,i=u.current||void 0,n){let c=n.substring(0,n.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${c}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(n==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=n.substring(0,n.indexOf("/"));if(a=await e.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.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,u,c,f,d]=o;return{result:"success",isGitHub:!!l,repo:c||d,user:u||f,branch:i,filePath:s}}}p();var I$=require("obsidian"),Sh=class extends I$.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="",n="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(n=`Index: ${e.index}`),`${r}${n} | ${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 $$=require("obsidian"),Eh=class extends $$.Modal{constructor(r,n){super(r);this.content=n;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:n}=this;n.setText("Edit .gitignore");let i=r.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};p();var cu=require("@codemirror/state"),jh=require("@codemirror/view");p();var Qo=require("@codemirror/state");p();var Et=class t{static createHunk(e,r,n,i){return{removed:{start:e,count:r,lines:[]},added:{start:n,count:i,lines:[]},head:`@@ -${e}${r>0?`,${r}`:""} +${n}${i>0?`,${i}`:""} @@`,vend:n+Math.max(i-1,0),type:i===0?"delete":r===0?"add":"change"}}static createPartialHunk(e,r,n){let i=r,a=n-r+1,s=0;for(let o of e){let l=o.added.count-o.removed.count,u=0;if(o.added.start>=r&&o.vend<=n)u=l;else{let c=Math.max(0,n+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<=n?u=c:o.vend>=r&&o.vend<=n?(u=l-f,i=i-f):o.added.start<=r&&o.vend>=n?(u=c-f,i=i-f):s++,r>o.vend&&(i=i-l)}a=a-u}if(s!==e.length)return a===0&&(i=i-1),this.createHunk(i,a,r,n-r+1)}patchLines(e,r=!1){let n=[];for(let i of e.removed.lines)n.push("-"+i);for(let i of e.added.lines)n.push("+"+i);return r?n.map(i=>i.replace(/\r$/,"")):n}static parseDiffLine(e){let i=e.split("@@")[1].trim().split(" "),a=i[0].substring(1).split(","),s=i[1].substring(1).split(","),o=this.createHunk(parseInt(a[0]),parseInt(a[1]||"1"),parseInt(s[0]),parseInt(s[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,n,i=1,a=1/0,s){if(s&&r.type!=="add")return console.error(`Invalid hunk with untracked=${s} hunk="${r.head}"`),[];i=Math.max(1,i);let{start:o,added:l,removed:u}={start:r.added.start,added:r.added.count,removed:r.removed.count},c=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!n||n.added.start!==o+1);f&&i===1&&(i=0);let d=[];for(let h=Math.max(o,i);h<=Math.min(c,a);h++){let m=r.type==="change"&&(u>l&&h===c||e&&e.added.start===0);d.push({type:f?"topdelete":m?"changedelete":s?"untracked":r.type,count:h===o?r.type==="add"?l:u:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>u&&r.vend>=i&&c<=a)for(let h=Math.max(c,i);h<=Math.min(r.vend,a);h++)d.push({type:"add",count:h===r.vend?l-u:void 0,lnum:h});return d}static createPatch(e,r,n,i=!1){let a=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${n}`,`--- a/${e}`,`+++ b/${e}`],s=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,u=o.removed.count,c=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;i&&([u,c]=[c,u],[f,d]=[d,f]),a.push(`@@ -${l},${u} +${l+s},${c} @@`);for(let h of f)a.push("-"+h);(i?o.added:o.removed).no_nl_at_eof&&a.push("\\ No newline at end of file");for(let h of d)a.push("+"+h);(i?o.removed:o.added).no_nl_at_eof&&a.push("\\ No newline at end of file"),o.removed.start=l+s,s=s+(c-u)}return a}getSummary(e){let r={added:0,changed:0,removed:0};for(let n of e)if(n.type==="add")r.added+=n.added.count;else if(n.type==="delete")r.removed+=n.removed.count;else if(n.type==="change"){let i=n.added.count,a=n.removed.count,s=Math.min(i,a);r.changed+=s,r.added+=i-s,r.removed+=a-s}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let n=0;n=e)return[i,n]}return[void 0,void 0]}static findNearestHunk(e,r,n,i){if(r.length!==0){if(n==="first")return 0;if(n==="last")return r.length-1;if(n==="next"){if(r[0].added.start>e)return 0;for(let a=r.length-1;a>=0;a--)if(r[a].added.start<=e){if(a+1e)return a+1;if(i)return 0}}else if(n==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[a-1].vend,1)l.added.start?i++:o.added.starts.replace(/\r$/,"")),a=a.map(s=>s.replace(/\r$/,"")));for(let s of[{sym:"-",lines:i,hl:"GitSignsDeletePreview"},{sym:"+",lines:a,hl:"GitSignsAddPreview"}])for(let o of s.lines){let l={start_row:0,hl_group:s.hl,end_row:1};n.push([[s.sym+o,[l]]])}return n}};p();p();var $e=require("@codemirror/view"),Te=require("@codemirror/state");p();var i0="\u037C",F$=typeof Symbol=="undefined"?"__"+i0:Symbol.for(i0),a0=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),O$=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},kh=class{constructor(e,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,o,l,u){let c=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&o==null)return l.push(s[0]+";");for(let h in o){let m=o[h];if(/&/.test(h))a(h.split(/,\s*/).map(g=>s.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.");a(i(h),m,c,d)}else m!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+m+";")}(c.length||d)&&l.push((n&&!f&&!u?s.map(n):s).join(", ")+" {"+c.join(" ")+"}")}for(let s in e)a(i(s),e[s],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=O$[F$]||1;return O$[F$]=e+1,i0+e.toString(36)}static mount(e,r,n){let i=e[a0],a=n&&n.nonce;i?a&&i.setNonce(a):i=new s0(e,a),i.mount(Array.isArray(r)?r:[r],e)}},M$=new Map,s0=class{constructor(e,r){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let a=M$.get(n);if(a)return e[a0]=a;this.sheet=new i.CSSStyleSheet,M$.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[a0]=this}mount(e,r){let n=this.sheet,i=0,a=0;for(let s=0;s-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,o),n)for(let u=0;uu){let f=t.slice(e,r).indexOf(n.slice(i,a));if(f>-1)return[new ht(e,e+f,i,i),new ht(e+f+u,r,a,a)]}else if(u>l){let f=n.slice(i,a).indexOf(t.slice(e,r));if(f>-1)return[new ht(e,e,i,i+f),new ht(r,r,i+f+l,a)]}if(l==1||u==1)return[new ht(e,r,i,a)];let c=tF(t,e,r,n,i,a);if(c){let[f,d,h]=c;return hs(t,e,f,n,i,d).concat(hs(t,f+h,r,n,d+h,a))}return uz(t,e,r,n,i,a)}var Jc=1e9,Qc=0,h0=!1;function uz(t,e,r,n,i,a){let s=r-e,o=a-i;if(Jc<1e9&&Math.min(s,o)>Jc*16||Qc>0&&Date.now()>Qc)return Math.min(s,o)>Jc*64?[new ht(e,r,i,a)]:D$(t,e,r,n,i,a);let l=Math.ceil((s+o)/2);o0.reset(l),l0.reset(l);let u=(h,m)=>t.charCodeAt(e+h)==n.charCodeAt(i+m),c=(h,m)=>t.charCodeAt(r-h-1)==n.charCodeAt(a-m-1),f=(s-o)%2!=0?l0:null,d=f?null:o0;for(let h=0;hJc||Qc>0&&!(h&63)&&Date.now()>Qc)return D$(t,e,r,n,i,a);let m=o0.advance(h,s,o,l,f,!1,u)||l0.advance(h,s,o,l,d,!0,c);if(m)return fz(t,e,r,e+m[0],n,i,a,i+m[1])}return[new ht(e,r,i,a)]}var Rh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-l;if(d>=0&&d=r-c)return[h,i+h-d]}else{let h=r-a.vec[d];if(c>=h)return[c,f]}}}return null}},o0=new Rh,l0=new Rh;function fz(t,e,r,n,i,a,s,o){let l=!1;return!Jo(t,n)&&++n==r&&(l=!0),!Jo(i,o)&&++o==s&&(l=!0),l?[new ht(e,r,a,s)]:hs(t,e,n,i,a,o).concat(hs(t,n,r,i,o,s))}function eF(t,e){let r=1,n=Math.min(t,e);for(;rr||c>a||t.slice(o,u)!=n.slice(l,c)){if(s==1)return o-e-(Jo(t,o)?0:1);s=s>>1}else{if(u==r||c==a)return u-e;o=u,l=c}}}function m0(t,e,r,n,i,a){if(e==r||i==a||t.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=eF(r-e,a-i);for(let o=r,l=a;;){let u=o-s,c=l-s;if(u>1}else{if(u==e||c==i)return r-u;o=u,l=c}}}function c0(t,e,r,n,i,a,s,o){let l=n.slice(i,a),u=null;for(;;){if(u||s=r)break;let d=t.slice(c,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let m=p0(t,f,r,n,i+h+d.length,a),g=m0(t,e,c,n,i,i+h),v=d.length+m+g;(!u||u[2]>1}}function tF(t,e,r,n,i,a){let s=r-e,o=a-i;if(si.fromA-e&&n.toB>i.fromB-e&&(t[r-1]=new ht(n.fromA,i.toA,n.fromB,i.toB),t.splice(r--,1))}}function dz(t,e,r){for(;;){rF(r,1);let n=!1;for(let i=0;i3||o>3){let l=i==t.length-1?e.length:t[i+1].fromA,u=a.fromA-n,c=l-a.toA,f=N$(e,a.fromA,u),d=L$(e,a.toA,c),h=a.fromA-f,m=d-a.toA;if((!s||!o)&&h&&m){let g=Math.max(s,o),[v,w,b]=s?[e,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&e.slice(f,a.fromA)==v.slice(b-h,b)?(a=t[i]=new ht(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=L$(e,a.toA,l-a.toA)):g>m&&e.slice(a.toA,d)==v.slice(w,w+m)&&(a=t[i]=new ht(d-s,d,a.fromB+m,a.toB+m),d=a.toA,f=N$(e,a.fromA,a.fromA-n)),h=a.fromA-f,m=d-a.toA}if(h||m)a=t[i]=new ht(a.fromA-h,a.toA+m,a.fromB-h,a.toB+m);else if(s){if(!o){let g=H$(e,a.fromA,a.toA),v,w=g<0?-1:B$(e,a.toA,a.fromA);g>-1&&(v=g-a.fromA)<=c&&e.slice(a.fromA,g)==e.slice(a.toA,a.toA+v)?a=t[i]=a.offset(v):w>-1&&(v=a.toA-w)<=u&&e.slice(a.fromA-v,a.fromA)==e.slice(w,a.toA)&&(a=t[i]=a.offset(-v))}}else{let g=H$(r,a.fromB,a.toB),v,w=g<0?-1:B$(r,a.toB,a.fromB);g>-1&&(v=g-a.fromB)<=c&&r.slice(a.fromB,g)==r.slice(a.toB,a.toB+v)?a=t[i]=a.offset(v):w>-1&&(v=a.toB-w)<=u&&r.slice(a.fromB-v,a.fromB)==r.slice(w,a.toB)&&(a=t[i]=a.offset(-v))}}n=a.toA}return rF(t,3),t}var ds;try{ds=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function nF(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function iF(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?nF(r)?1:0:ds?!oF(r)||e==t.length-1?ds.test(String.fromCharCode(r))?1:0:ds.test(t.slice(e,e+2))?2:0:0}function aF(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?nF(r)?1:0:ds?!lF(r)||e==1?ds.test(String.fromCharCode(r))?1:0:ds.test(t.slice(e-2,e))?2:0:0}var sF=8;function L$(t,e,r){if(e==t.length||!aF(t,e))return e;for(let n=e,i=e+r,a=0;ai)return n;n+=s}return e}function N$(t,e,r){if(!e||!iF(t,e))return e;for(let n=e,i=e-r,a=0;at>=55296&&t<=56319,lF=t=>t>=56320&&t<=57343;function Jo(t,e){return!e||e==t.length||!oF(t.charCodeAt(e-1))||!lF(t.charCodeAt(e))}function pz(t,e,r){var n;return Jc=((n=r==null?void 0:r.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Qc=r!=null&&r.timeout?Date.now()+r.timeout:0,h0=!1,dz(t,e,hs(t,0,t.length,e,0,e.length))}function cF(){return!h0}function uF(t,e,r){return hz(pz(t,e,r),t,e)}var xn=Te.Facet.define({combine:t=>t[0]}),u0=Te.StateEffect.define(),mz=Te.Facet.define(),ps=Te.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is(u0)&&(t=r.value);for(let r of e.state.facet(mz))t=r(t,e);return t}});function g0(t){let e=t.field(ps,!1);if(!e)return null;let r=t.facet(xn);return{chunks:e,side:r?r.side:null}}var Oi=class t{constructor(e,r,n,i,a,s=!0){this.changes=e,this.fromA=r,this.toA=n,this.fromB=i,this.toB=a,this.precise=s}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,n){let i=uF(e.toString(),r.toString(),n);return fF(i,e,r,0,0,cF())}static updateA(e,r,n,i,a){return z$(q$(e,i,!0,n.length),e,r,n,a)}static updateB(e,r,n,i,a){return z$(q$(e,i,!1,r.length),e,r,n,a)}};function U$(t,e,r,n){let i=r.lineAt(t),a=n.lineAt(e);return i.to==t&&a.to==e&&tf+1&&v>d+1)break;h.push(m.offset(-u+n,-c+i)),[f,d]=j$(m.toA+n,m.toB+i,e,r),o++}s.push(new Oi(h,u,Math.max(u,f),c,Math.max(c,d),a))}return s}var Ah=1e3;function G$(t,e,r,n){let i=0,a=t.length;for(;;){if(i==a){let c=0,f=0;i&&({toA:c,toB:f}=t[i-1]);let d=e-(r?c:f);return[c+d,f+d]}let s=i+a>>1,o=t[s],[l,u]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)a=s;else if(u<=e)i=s+1;else return n?[o.fromA,o.fromB]:[o.toA,o.toB]}}function q$(t,e,r,n){let i=[];return e.iterChangedRanges((a,s,o,l)=>{let u=0,c=r?e.length:n,f=0,d=r?n:e.length;a>Ah&&([u,f]=G$(t,a-Ah,r,!0)),s=u?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:c,toB:d,diffA:m.diffA+g,diffB:m.diffB+v}:i.push({fromA:u,toA:c,fromB:f,toB:d,diffA:g,diffB:v})}),i}function z$(t,e,r,n,i){if(!t.length)return e;let a=[];for(let s=0,o=0,l=0,u=0;;s++){let c=s==t.length?null:t[s],f=c?c.fromA+o:r.length,d=c?c.fromB+l:n.length;for(;uf||Math.min(n.length,v.toB+l)>d)break;a.push(v.offset(o,l)),u++}if(!c)break;let h=c.toA+o+c.diffA,m=c.toB+l+c.diffB,g=uF(r.sliceString(f,h),n.sliceString(d,m),i);for(let v of fF(g,r,n,f,d,cF()))a.push(v);for(o+=c.diffA,l+=c.diffB;uh&&v.fromB+l>m)break;u++}}return a}var gz={scanLimit:500},dF=$e.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Y$(t))}update(t){(t.docChanged||t.viewportChanged||vz(t.startState,t.state)||wz(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Y$(t.view))}},{decorations:t=>t.deco}),Th=Te.Prec.low((0,$e.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(dF))===null||e===void 0?void 0:e.gutter)||Te.RangeSet.empty}}));function vz(t,e){return t.field(ps,!1)!=e.field(ps,!1)}function wz(t,e){return t.facet(xn)!=e.facet(xn)}var V$=$e.Decoration.line({class:"cm-changedLine"}),yz=$e.Decoration.mark({class:"cm-changedText"}),bz=$e.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),_z=$e.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),W$=new class extends $e.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function xz(t,e,r,n,i,a){let s=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(s!=o){i.add(s,s,V$),i.add(s,o,r?_z:bz),a&&a.add(s,s,W$);for(let u=e.iterRange(s,o-1),c=s;!u.next().done;){if(u.lineBreak){c++,i.add(c,c,V$),a&&a.add(c,c,W$);continue}let f=c+u.value.length;if(n)for(;l=c)break;(s?f.toA:f.toB)>u&&(!a||!a(t.state,f,o,l))&&xz(f,t.state.doc,s,n,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var Ko=class extends $e.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}},Ih=Te.StateEffect.define({map:(t,e)=>t.map(e)}),eu=Te.StateField.define({create:()=>$e.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(Ih))return r.value;return t.map(e.changes)},provide:t=>$e.EditorView.decorations.from(t)}),Ch=.01;function X$(t,e){if(t.size!=e.size)return!1;let r=t.iter(),n=e.iter();for(;r.value;){if(r.from!=n.from||Math.abs(r.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;r.next(),n.next()}return!0}function Sz(t,e,r){let n=new Te.RangeSetBuilder,i=new Te.RangeSetBuilder,a=t.state.field(eu).iter(),s=e.state.field(eu).iter(),o=0,l=0,u=0,c=0,f=t.viewport,d=e.viewport;for(let v=0;;v++){let w=vCh&&(c+=A,i.add(l,l,$e.Decoration.widget({widget:new Ko(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(;a.value&&a.fromCh&&i.add(e.state.doc.length,e.state.doc.length,$e.Decoration.widget({widget:new Ko(h),block:!0,side:1}));let m=n.finish(),g=i.finish();X$(m,t.state.field(eu))||t.dispatch({effects:Ih.of(m)}),X$(g,e.state.field(eu))||e.dispatch({effects:Ih.of(g)})}var f0=Te.StateEffect.define({map:(t,e)=>e.mapPos(t)});var d0=class extends $e.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",n=>{let i=e.posAtDOM(n.target);e.dispatch({effects:f0.of(i)});let{side:a,sibling:s}=e.state.facet(xn);s&&s().dispatch({effects:f0.of(Ez(i,e.state.field(ps),a=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function Ez(t,e,r){let n=0,i=0;for(let a=0;;a++){let s=a=t)return i+(t-n);[n,i]=r?[s.toA,s.toB]:[s.toB,s.toA]}}var kz=Te.StateField.define({create(t){return $e.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(f0)&&(t=t.update({filter:n=>n!=r.value}));return t},provide:t=>$e.EditorView.decorations.from(t)});function Z$({margin:t=3,minSize:e=4}){return kz.init(r=>Az(r,t,e))}function Az(t,e,r){let n=new Te.RangeSetBuilder,i=t.facet(xn).side=="a",a=t.field(ps),s=1;for(let o=0;;o++){let l=o=r&&n.add(t.doc.line(u).from,t.doc.line(c).to,$e.Decoration.replace({widget:new d0(f),block:!0})),!l)break;s=t.doc.lineAt(Math.min(t.doc.length,i?l.toA:l.toB)).number}return n.finish()}var Tz=$e.EditorView.styleModule.of(new kh({".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"}})),Cz=$e.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"}}),K$=new Te.Compartment,Ph=new Te.Compartment,$h=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||gz;let r=[Te.Prec.low(dF),Cz,Tz,eu,$e.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Ih)))&&this.measure()})],n=[xn.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Th);let i=Te.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],$e.EditorView.editorAttributes.of({class:"cm-merge-a"}),Ph.of(n),r]}),a=[xn.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&a.push(Th);let s=Te.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],$e.EditorView.editorAttributes.of({class:"cm-merge-b"}),Ph.of(a),r]});this.chunks=Oi.build(i.doc,s.doc,this.diffConf);let o=[ps.init(()=>this.chunks),K$.of(e.collapseUnchanged?Z$(e.collapseUnchanged):[])];i=i.update({effects:Te.StateEffect.appendConfig.of(o)}).state,s=s.update({effects:Te.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",u=document.createElement("div");u.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?u:c),this.editorDOM.appendChild(l=="a-b"?c:u),this.a=new $e.EditorView({state:i,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new $e.EditorView({state:s,parent:c,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(n=>n.docChanged)){let n=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Te.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?Oi.updateA(this.chunks,n.newDoc,this.b.state.doc,i,this.diffConf):Oi.updateB(this.chunks,this.a.state.doc,n.newDoc,i,this.diffConf),r.update([...e,n.state.update({effects:u0.of(this.chunks)})]);let a=r==this.a?this.b:this.a;a.update([a.state.update({effects:u0.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let a=e.orientation!="b-a";if(a!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(a?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(a?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let a=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(a=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(a,s,o)}let r="highlightChanges"in e,n="gutter"in e,i="collapseUnchanged"in e;if(r||n||i){let a=[],s=[];if(r||n){let o=this.a.state.facet(xn),l=n?e.gutter!==!1:o.markGutter,u=r?e.highlightChanges!==!1:o.highlightChanges;a.push(Ph.reconfigure([xn.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?Th:[]])),s.push(Ph.reconfigure([xn.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?Th:[]]))}if(i){let o=K$.reconfigure(e.collapseUnchanged?Z$(e.collapseUnchanged):[]);a.push(o),s.push(o)}this.a.dispatch({effects:a}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,r,n){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",i=>this.revertClicked(i)),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(){Sz(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,n=this.a.viewport,i=this.b.viewport;for(let a=0;an.to||s.fromB>i.to)break;if(s.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function J$(t){let e=t.nextSibling;return t.remove(),e}var v0=require("@codemirror/state");function w0(t,e,r){let n=[],i=t.split(` +`),a=e.split(` +`);for(let s of r){let{oldStart:o,oldLines:l,newStart:u,newLines:c}=s,f=Et.createHunk(o,l,u,c);if(s.oldLines>0){for(let d=o;di.length&&i.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(s.newLines>0){for(let d=u;da.length&&a.last()!=""&&(f.added.no_nl_at_eof=!0)}n.push(f)}return n}function y0(t,e,r){let n=e.lineAt(t.fromA).number,i=t.fromA==t.toA?0:Fh(e,t.endA)-n+1,a=r.lineAt(t.fromB).number,s=t.fromB==t.toB?0:Fh(r,t.endB)-a+1,o={oldStart:n,oldLines:i,newStart:a,newLines:s};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var hF={scanLimit:1e3,timeout:200};function Pz(t,e,r,n){let i=v0.Text.of(t.split(` +`)),a=v0.Text.of(e.split(` +`)),s=r&&n?Oi.updateB(r,i,a,n,hF):Oi.build(i,a,hF),o=[];for(let l=0;lh.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));u.added.lines=c.compareText.split(` +`).slice(f-1,d),c.compareTextHead?u.removed.lines=c.compareTextHead.split(` +`).slice(u.removed.start-1,u.removed.start-1+u.removed.count):u.removed.lines=[]}else u.added.lines=e.doc.toString().split(` +`).slice(s-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(` +`)&&(u.added.no_nl_at_eof=!0),u.removed.lines=c.compareText.split(` +`).slice(u.removed.start-1,u.removed.start-1+u.removed.count),u.removed.start+u.removed.count-1===c.compareText.split(` +`).length&&!c.compareText.endsWith(` +`)&&(u.removed.no_nl_at_eof=!0);return u}},xr=Qo.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let i of e.effects)i.is(tl)&&(r.compareText=i.value.compareText,r.compareTextHead=i.value.compareTextHead,n=(t==null?void 0:t.compareText)!==i.value.compareText,n&&(r.chunks=void 0)),i.is(tu)&&mF(r,i.value,e.state);if(r.compareText!==void 0){if(n||e.docChanged){r.isDirty=!0;let i=Rz(e,r.compareText,r.chunks,r.maxDiffTimeMs);i&&mF(r,i,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function mF(t,e,r){var i,a;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let n=r.field(el.editorInfoField).file;(a=(i=Zn.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,n)}var b0=Qo.StateField.define({create:()=>({debouncer:(0,el.debounce)(t=>{let{state:e,compareText:r,previousChunks:n,changeDesc:i}=t,a=gF(e,r,n,i);e.field(el.editorEditorField).dispatch({effects:tu.of(a)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let n of e.effects)if(n.is(tu))return t.changeDesc=void 0,t;return!t.changeDesc&&e.changes?t.changeDesc=e.changes:t.changeDesc=(r=t.changeDesc)==null?void 0:r.composeDesc(e.changes),t}});function gF(t,e,r,n){let i=t.doc.toString(),a=performance.now(),{hunks:s,chunks:o}=pF(e,i,r,n),l=performance.now()-a;return{hunks:s,chunks:o,diffDuration:l}}function Rz(t,e,r,n){let i=t.state,a=Math.abs(t.changes.length-t.changes.newLength),s=i.field(b0);if(a>1e3||n>16)s.debouncer({state:i,compareText:e,previousChunks:r,changeDesc:s.changeDesc});else return s.changeDesc=void 0,gF(i,e,r,t.changes)}var tl=Qo.StateEffect.define(),tu=Qo.StateEffect.define();function vF(t,e){return e.update({effects:tl.of(t)})}p();p();p();var Ze;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(Ze||(Ze={}));var wF={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},yF={LINES:"lines",WORDS:"words",NONE:"none"},bF={WORD:"word",CHAR:"char"},ms;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ms||(ms={}));p();var Iz=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],$z=RegExp("["+Iz.join("\\")+"]","g");function _F(t){return t.replace($z,"\\$&")}function _0(t){return t&&t.replace(/\\/g,"/")}function xF(t){let e,r,n,i=0;for(e=0,n=t.length;e1?r[r.length-1]:e}function EF(t,e){return e.reduce((r,n)=>r||t.startsWith(n),!1)}var kF=["a/","b/","i/","w/","c/","o/"];function Ea(t,e,r){let n=r!==void 0?[...kF,r]:kF,i=e?new RegExp(`^${_F(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=n.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Fz(t,e){return Ea(t,"---",e)}function Oz(t,e){return Ea(t,"+++",e)}function AF(t,e={}){let r=[],n=null,i=null,a=null,s=null,o=null,l=null,u=null,c="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,m=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,E=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,k=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,T=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,P=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,F=/^new file mode (\d{6})/,D=/^deleted file mode (\d{6}),(\d{6})/,M=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` `).split(` -`);function ee(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function fe(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&c!==null&&(n.newName=c),n.newName&&(r.push(n),n=null)),l=null,c=null}function J(){ee(),fe(),n={blocks:[],deletedLines:0,addedLines:0}}function Q(z){ee();let Y;n!==null&&((Y=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(n.isCombined=!1,a=parseInt(Y[1],10),o=parseInt(Y[2],10)):(Y=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(n.isCombined=!0,a=parseInt(Y[1],10),s=parseInt(Y[2],10),o=parseInt(Y[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,n.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:z}}function Pe(z){if(n===null||i===null||a===null||o===null)return;let Y={content:z},O=n.isCombined?["+ "," +","++"]:["+"],he=n.isCombined?["- "," -","--"]:["-"];wC(z,O)?(n.addedLines++,Y.type=je.INSERT,Y.oldNumber=void 0,Y.newNumber=o++):wC(z,he)?(n.deletedLines++,Y.type=je.DELETE,Y.oldNumber=a++,Y.newNumber=void 0):(Y.type=je.CONTEXT,Y.oldNumber=a++,Y.newNumber=o++),i.lines.push(Y)}function ge(z,Y){let O=Y;for(;O{if(!z||z.startsWith("*"))return;let O,he=L[Y-1],Ge=L[Y+1],gt=L[Y+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(J(),(O=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Li(O[1],void 0,t.dstPrefix),c=Li(O[2],void 0,t.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(J(),(O=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Li(O[1],void 0,t.dstPrefix),c=Li(O[2],void 0,t.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&z.startsWith(u)&&Ge.startsWith(f)&>.startsWith(d))&&J(),n!=null&&n.isTooBig)return;if(n&&(typeof t.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>t.diffMaxChanges||typeof t.diffMaxLineLength=="number"&&z.length>t.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let ct=typeof t.diffTooBigMessage=="function"?t.diffTooBigMessage(r.length):"Diff too big to be displayed";Q(ct);return}if(z.startsWith(u)&&Ge.startsWith(f)||z.startsWith(f)&&he.startsWith(u)){if(n&&!n.oldName&&z.startsWith("--- ")&&(O=Ej(z,t.srcPrefix))){n.oldName=O,n.language=yC(n.oldName,n.language);return}if(n&&!n.newName&&z.startsWith("+++ ")&&(O=Aj(z,t.dstPrefix))){n.newName=O,n.language=yC(n.newName,n.language);return}}if(n&&(z.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){Q(z);return}if(i&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){Pe(z);return}let Re=!ge(z,Y);if(n===null)throw new Error("Where is my file !!!");(O=h.exec(z))?n.oldMode=O[1]:(O=p.exec(z))?n.newMode=O[1]:(O=m.exec(z))?(n.deletedFileMode=O[1],n.isDeleted=!0):(O=v.exec(z))?(n.newFileMode=O[1],n.isNew=!0):(O=y.exec(z))?(Re&&(n.oldName=O[1]),n.isCopy=!0):(O=b.exec(z))?(Re&&(n.newName=O[1]),n.isCopy=!0):(O=x.exec(z))?(Re&&(n.oldName=O[1]),n.isRename=!0):(O=E.exec(z))?(Re&&(n.newName=O[1]),n.isRename=!0):(O=A.exec(z))?(n.isBinary=!0,n.oldName=Li(O[1],void 0,t.srcPrefix),n.newName=Li(O[2],void 0,t.dstPrefix),Q("Binary file")):S.test(z)?(n.isBinary=!0,Q(z)):(O=_.exec(z))?n.unchangedPercentage=parseInt(O[1],10):(O=k.exec(z))?n.changedPercentage=parseInt(O[1],10):(O=w.exec(z))?(n.checksumBefore=O[1],n.checksumAfter=O[2],O[3]&&(n.mode=O[3])):(O=T.exec(z))?(n.checksumBefore=[O[2],O[3]],n.checksumAfter=O[1]):(O=P.exec(z))?(n.oldMode=[O[2],O[3]],n.newMode=O[1]):(O=I.exec(z))?(n.newFileMode=O[1],n.isNew=!0):(O=N.exec(z))&&(n.deletedFileMode=O[1],n.isDeleted=!0)}),ee(),fe(),r}g();g();g();function Qn(){}Qn.prototype={diff:function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.callback;typeof n=="function"&&(i=n,n={}),this.options=n;var a=this;function s(m){return i?(setTimeout(function(){i(void 0,m)},0),!0):m}t=this.castInput(t),r=this.castInput(r),t=this.removeEmpty(this.tokenize(t)),r=this.removeEmpty(this.tokenize(r));var o=r.length,l=t.length,c=1,u=o+l;n.maxEditLength&&(u=Math.min(u,n.maxEditLength));var f=[{newPos:-1,components:[]}],d=this.extractCommon(f[0],r,t,0);if(f[0].newPos+1>=o&&d+1>=l)return s([{value:this.join(r),count:r.length}]);function h(){for(var m=-1*c;m<=c;m+=2){var v=void 0,y=f[m-1],b=f[m+1],x=(b?b.newPos:0)-m;y&&(f[m-1]=void 0);var E=y&&y.newPos+1=o&&x+1>=l)return s(Tj(a,v.components,r,t,a.useLongestToken));f[m]=v}c++}if(i)(function m(){setTimeout(function(){if(c>u)return i();h()||m()},0)})();else for(;c<=u;){var p=h();if(p)return p}},pushComponent:function(t,r,n){var i=t[t.length-1];i&&i.added===r&&i.removed===n?t[t.length-1]={count:i.count+1,added:r,removed:n}:t.push({count:1,added:r,removed:n})},extractCommon:function(t,r,n,i){for(var a=r.length,s=n.length,o=t.newPos,l=o-i,c=0;o+1h.length?m:h}),c.value=e.join(u)}else c.value=e.join(r.slice(o,o+c.count));o+=c.count,c.added||(l+=c.count)}}var d=t[s-1];return s>1&&typeof d.value=="string"&&(d.added||d.removed)&&e.equals("",d.value)&&(t[s-2].value+=d.value,t.pop()),t}function Cj(e){return{newPos:e.newPos,components:e.components.slice(0)}}var Pj=new Qn;function EC(e,t,r){return Pj.diff(e,t,r)}var xC=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,SC=/\S/,w0=new Qn;w0.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!SC.test(e)&&!SC.test(t)};w0.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r{let n=e(t).trim(),i=e(r).trim();return Fj(n,i)/(n.length+i.length)}}function ro(e){function t(n,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(x=v.concat(x)),(n.length>d||i.length>h)&&(x=x.concat(b)),x}return r}var Tt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},Ca={matching:pC.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:mC.WORD,colorScheme:Ta.LIGHT},Pn="/",TC=to(e=>e.value),$j=ro(TC);function _0(e){return e.indexOf("dev/null")!==-1}function Lj(e){return e.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function Dj(e){return e.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function no(e){switch(e){case je.CONTEXT:return Tt.CONTEXT;case je.INSERT:return Tt.INSERTS;case je.DELETE:return Tt.DELETES}}function io(e){switch(e){case Ta.DARK:return"d2h-dark-color-scheme";case Ta.AUTO:return"d2h-auto-color-scheme";case Ta.LIGHT:default:return"d2h-light-color-scheme"}}function Nj(e){return e?2:1}function Di(e){return e.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function jr(e,t,r=!0){let n=Nj(t);return{prefix:e.substring(0,n),content:r?Di(e.substring(n)):e.substring(n)}}function Pa(e){let t=g0(e.oldName),r=g0(e.newName);if(t!==r&&!_0(t)&&!_0(r)){let n=[],i=[],a=t.split(Pn),s=r.split(Pn),o=a.length,l=s.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&a[u]===s[f];)i.unshift(s[f]),u-=1,f-=1;let d=n.join(Pn),h=i.join(Pn),p=a.slice(c,u+1).join(Pn),m=s.slice(c,f+1).join(Pn);return d.length&&h.length?d+Pn+"{"+p+" \u2192 "+m+"}"+Pn+h:d.length?d+Pn+"{"+p+" \u2192 "+m+"}":h.length?"{"+p+" \u2192 "+m+"}"+Pn+h:t+" \u2192 "+r}else return _0(r)?t:r}function ao(e){return`d2h-${vC(Pa(e)).toString().slice(-6)}`}function so(e){let t="file-changed";return e.isRename||e.isCopy?t="file-renamed":e.isNew?t="file-added":e.isDeleted?t="file-deleted":e.newName!==e.oldName&&(t="file-renamed"),t}function fd(e,t,r,n={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},Ca),n),l=jr(e,r,!1),c=jr(t,r,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:Di(l.content)},newLine:{prefix:c.prefix,content:Di(c.content)}};let u=o==="char"?EC(l.content,c.content):AC(l.content,c.content),f=[];if(o==="word"&&i==="words"){let h=u.filter(v=>v.removed),p=u.filter(v=>v.added);$j(p,h).forEach(v=>{v[0].length===1&&v[1].length===1&&TC(v[0][0],v[1][0]){let m=p.added?"ins":p.removed?"del":null,v=f.indexOf(p)>-1?' class="d2h-change"':"",y=Di(p.value);return m!==null?`${h}<${m}${v}>${y}`:`${h}${y}`},"");return{oldLine:{prefix:l.prefix,content:Lj(d)},newLine:{prefix:c.prefix,content:Dj(d)}}}var CC="file-summary",Bj="icon",jj={colorScheme:Ca.colorScheme},dd=class{constructor(t,r={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},jj),r)}render(t){let r=t.map(n=>this.hoganUtils.render(CC,"line",{fileHtmlId:ao(n),oldName:n.oldName,newName:n.newName,fileName:Pa(n),deletedLines:"-"+n.deletedLines,addedLines:"+"+n.addedLines},{fileIcon:this.hoganUtils.template(Bj,so(n))})).join(` -`);return this.hoganUtils.render(CC,"wrapper",{colorScheme:io(this.config.colorScheme),filesNumber:t.length,files:r})}};g();var S0=Object.assign(Object.assign({},Ca),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),rc="generic",PC="line-by-line",Hj="icon",Uj="tag",nc=class{constructor(t,r={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},S0),r)}render(t){let r=t.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` -`);return this.hoganUtils.render(rc,"wrapper",{colorScheme:io(this.config.colorScheme),content:r})}makeFileDiffHtml(t,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";let n=this.hoganUtils.template(PC,"file-diff"),i=this.hoganUtils.template(rc,"file-path"),a=this.hoganUtils.template(Hj,"file"),s=this.hoganUtils.template(Uj,so(t));return n.render({file:t,fileHtmlId:ao(t),diffs:r,filePath:i.render({fileDiffName:Pa(t)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(rc,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Tt})}generateFileHtml(t){let r=ro(to(n=>jr(n.content,t.isCombined).content));return t.blocks.map(n=>{let i=this.hoganUtils.render(rc,"block-header",{CSSLineClass:Tt,blockHeader:t.isTooBig?n.header:Di(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(t,t.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=jr(l.content,t.isCombined);i+=this.generateSingleLineHtml(t,{type:Tt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(t,t.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` -`)}applyLineGroupping(t){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===je.CONTEXT?r.push([[s],[],[]]):s.type===je.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===je.INSERT&&n.length>0?i.push(s):s.type===je.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(t,r,n){let i=t.length*r.length,a=Math.max.apply(null,[0].concat(t.concat(r).map(o=>o.content.length)));return i{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` -`);return this.hoganUtils.render(ic,"wrapper",{colorScheme:io(this.config.colorScheme),content:r})}makeFileDiffHtml(t,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";let n=this.hoganUtils.template(Gj,"file-diff"),i=this.hoganUtils.template(ic,"file-path"),a=this.hoganUtils.template(zj,"file"),s=this.hoganUtils.template(Vj,so(t));return n.render({file:t,fileHtmlId:ao(t),diffs:r,filePath:i.render({fileDiffName:Pa(t)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(ic,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Tt})}}generateFileHtml(t){let r=ro(to(n=>jr(n.content,t.isCombined).content));return t.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,t),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(t.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=jr(l.content,t.isCombined),{left:f,right:d}=this.generateLineHtml({type:Tt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Tt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(t.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(t){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===je.CONTEXT?r.push([[s],[],[]]):s.type===je.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===je.INSERT&&n.length>0?i.push(s):s.type===je.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(t,r,n){let i=t.length*r.length,a=Math.max.apply(null,[0].concat(t.concat(r).map(o=>o.content.length)));return i'),n.b(` +`);function re(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function ye(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&u!==null&&(n.newName=u),n.newName&&(r.push(n),n=null)),l=null,u=null}function me(){re(),ye(),n={blocks:[],deletedLines:0,addedLines:0}}function fe(B){re();let Z;n!==null&&((Z=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(B))?(n.isCombined=!1,a=parseInt(Z[1],10),o=parseInt(Z[2],10)):(Z=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(B))?(n.isCombined=!0,a=parseInt(Z[1],10),s=parseInt(Z[2],10),o=parseInt(Z[3],10)):(B.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,n.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:B}}function Ge(B){if(n===null||i===null||a===null||o===null)return;let Z={content:B},H=n.isCombined?["+ "," +","++"]:["+"],Oe=n.isCombined?["- "," -","--"]:["-"];EF(B,H)?(n.addedLines++,Z.type=Ze.INSERT,Z.oldNumber=void 0,Z.newNumber=o++):EF(B,Oe)?(n.deletedLines++,Z.type=Ze.DELETE,Z.oldNumber=a++,Z.newNumber=void 0):(Z.type=Ze.CONTEXT,Z.oldNumber=a++,Z.newNumber=o++),i.lines.push(Z)}function oe(B,Z){let H=Z;for(;H{if(!B||B.startsWith("*"))return;let H,Oe=M[Z-1],cr=M[Z+1],Gt=M[Z+2];if(B.startsWith("diff --git")||B.startsWith("diff --combined")){if(me(),(H=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(B.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(me(),(H=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(B))&&(l=Ea(H[1],void 0,e.dstPrefix),u=Ea(H[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&B.startsWith(c)&&cr.startsWith(f)&&Gt.startsWith(d))&&me(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&B.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let Ie=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";fe(Ie);return}if(B.startsWith(c)&&cr.startsWith(f)||B.startsWith(f)&&Oe.startsWith(c)){if(n&&!n.oldName&&B.startsWith("--- ")&&(H=Fz(B,e.srcPrefix))){n.oldName=H,n.language=SF(n.oldName,n.language);return}if(n&&!n.newName&&B.startsWith("+++ ")&&(H=Oz(B,e.dstPrefix))){n.newName=H,n.language=SF(n.newName,n.language);return}}if(n&&(B.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){fe(B);return}if(i&&(B.startsWith("+")||B.startsWith("-")||B.startsWith(" "))){Ge(B);return}let Y=!oe(B,Z);if(n===null)throw new Error("Where is my file !!!");(H=h.exec(B))?n.oldMode=H[1]:(H=m.exec(B))?n.newMode=H[1]:(H=g.exec(B))?(n.deletedFileMode=H[1],n.isDeleted=!0):(H=v.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=w.exec(B))?(Y&&(n.oldName=H[1]),n.isCopy=!0):(H=b.exec(B))?(Y&&(n.newName=H[1]),n.isCopy=!0):(H=E.exec(B))?(Y&&(n.oldName=H[1]),n.isRename=!0):(H=x.exec(B))?(Y&&(n.newName=H[1]),n.isRename=!0):(H=S.exec(B))?(n.isBinary=!0,n.oldName=Ea(H[1],void 0,e.srcPrefix),n.newName=Ea(H[2],void 0,e.dstPrefix),fe("Binary file")):_.test(B)?(n.isBinary=!0,fe(B)):(H=k.exec(B))?n.unchangedPercentage=parseInt(H[1],10):(H=A.exec(B))?n.changedPercentage=parseInt(H[1],10):(H=y.exec(B))?(n.checksumBefore=H[1],n.checksumAfter=H[2],H[3]&&(n.mode=H[3])):(H=T.exec(B))?(n.checksumBefore=[H[2],H[3]],n.checksumAfter=H[1]):(H=P.exec(B))?(n.oldMode=[H[2],H[3]],n.newMode=H[1]):(H=F.exec(B))?(n.newFileMode=H[1],n.isNew=!0):(H=D.exec(B))&&(n.deletedFileMode=H[1],n.isDeleted=!0)}),re(),ye(),r}p();p();p();function En(){}En.prototype={diff:function(e,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(x){return x=s.postProcess(x,i),a?(setTimeout(function(){a(x)},0),!0):x}e=this.castInput(e,i),r=this.castInput(r,i),e=this.removeEmpty(this.tokenize(e,i)),r=this.removeEmpty(this.tokenize(r,i));var l=r.length,u=e.length,c=1,f=l+u;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var d=(n=i.timeout)!==null&&n!==void 0?n:1/0,h=Date.now()+d,m=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(m[0],r,e,0,i);if(m[0].oldPos+1>=u&&g+1>=l)return o(TF(s,m[0].lastComponent,r,e,s.useLongestToken));var v=-1/0,w=1/0;function b(){for(var x=Math.max(v,-c);x<=Math.min(w,c);x+=2){var k=void 0,A=m[x-1],y=m[x+1];A&&(m[x-1]=void 0);var S=!1;if(y){var _=y.oldPos-x;S=y&&0<=_&&_=u&&g+1>=l)return o(TF(s,k.lastComponent,r,e,s.useLongestToken));m[x]=k,k.oldPos+1>=u&&(w=Math.min(w,x-1)),g+1>=l&&(v=Math.max(v,x+1))}c++}if(a)(function x(){setTimeout(function(){if(c>f||Date.now()>h)return a();b()||x()},0)})();else for(;c<=f&&Date.now()<=h;){var E=b();if(E)return E}},addToPath:function(e,r,n,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===r&&s.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:r,removed:n,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:s}}},extractCommon:function(e,r,n,i,a){for(var s=r.length,o=n.length,l=e.oldPos,u=l-i,c=0;u+1h.length?g:h}),f.value=t.join(d)}else f.value=t.join(r.slice(u,u+f.count));u+=f.count,f.added||(c+=f.count)}}return a}var Dz=new En;function $F(t,e,r){return Dz.diff(t,e,r)}function CF(t,e){var r;for(r=0;re.length&&(r=t.length-e.length);var n=e.length;t.length0&&e[s]!=e[a];)a=i[a];e[s]==e[a]&&a++}a=0;for(var o=r;o0&&t[o]!=e[a];)a=i[a];t[o]==e[a]&&a++}return a}var Dh="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Nz=new RegExp("[".concat(Dh,"]+|\\s+|[^").concat(Dh,"]"),"ug"),Lh=new En;Lh.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};Lh.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(e.intlSegmenter.segment(t),function(a){return a.segment})}else r=t.match(Nz)||[];var n=[],i=null;return r.forEach(function(a){/\s/.test(a)?i==null?n.push(a):n.push(n.pop()+a):/\s/.test(i)?n[n.length-1]==i?n.push(n.pop()+a):n.push(i+a):n.push(a),i=a}),n};Lh.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};Lh.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var r=null,n=null,i=null;return t.forEach(function(a){a.added?n=a:a.removed?i=a:((n||i)&&IF(r,i,n,a),r=a,n=null,i=null)}),(n||i)&&IF(r,i,n,null),t};function IF(t,e,r,n){if(e&&r){var i=e.value.match(/^\s*/)[0],a=e.value.match(/\s*$/)[0],s=r.value.match(/^\s*/)[0],o=r.value.match(/\s*$/)[0];if(t){var l=CF(i,s);t.value=S0(t.value,s,l),e.value=ru(e.value,l),r.value=ru(r.value,l)}if(n){var u=PF(a,o);n.value=x0(n.value,o,u),e.value=Mh(e.value,u),r.value=Mh(r.value,u)}}else if(r)t&&(r.value=r.value.replace(/^\s*/,"")),n&&(n.value=n.value.replace(/^\s*/,""));else if(t&&n){var c=n.value.match(/^\s*/)[0],f=e.value.match(/^\s*/)[0],d=e.value.match(/\s*$/)[0],h=CF(c,f);e.value=ru(e.value,h);var m=PF(ru(c,h),d);e.value=Mh(e.value,m),n.value=x0(n.value,c,m),t.value=S0(t.value,c,c.slice(0,c.length-m.length))}else if(n){var g=n.value.match(/^\s*/)[0],v=e.value.match(/\s*$/)[0],w=RF(v,g);e.value=Mh(e.value,w)}else if(t){var b=t.value.match(/\s*$/)[0],E=e.value.match(/^\s*/)[0],x=RF(b,E);e.value=ru(e.value,x)}}var FF=new En;FF.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(Dh,"]+|[^\\S\\n\\r]+|[^").concat(Dh,"]"),"ug");return t.match(e)||[]};function OF(t,e,r){return FF.diff(t,e,r)}var T0=new En;T0.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));var r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var i=0;i{let n=t(e).trim(),i=t(r).trim();return jz(n,i)/(n.length+i.length)}}function nl(t){function e(n,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(E=v.concat(E)),(n.length>d||i.length>h)&&(E=E.concat(b)),E}return r}var Lt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},gs={matching:yF.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:bF.WORD,colorScheme:ms.LIGHT},ni="/",MF=rl(t=>t.value),Gz=nl(MF);function P0(t){return t.indexOf("dev/null")!==-1}function qz(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function zz(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function il(t){switch(t){case Ze.CONTEXT:return Lt.CONTEXT;case Ze.INSERT:return Lt.INSERTS;case Ze.DELETE:return Lt.DELETES}}function al(t){switch(t){case ms.DARK:return"d2h-dark-color-scheme";case ms.AUTO:return"d2h-auto-color-scheme";case ms.LIGHT:default:return"d2h-light-color-scheme"}}function Vz(t){return t?2:1}function ka(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function rn(t,e,r=!0){let n=Vz(e);return{prefix:t.substring(0,n),content:r?ka(t.substring(n)):t.substring(n)}}function vs(t){let e=_0(t.oldName),r=_0(t.newName);if(e!==r&&!P0(e)&&!P0(r)){let n=[],i=[],a=e.split(ni),s=r.split(ni),o=a.length,l=s.length,u=0,c=o-1,f=l-1;for(;uu&&f>u&&a[c]===s[f];)i.unshift(s[f]),c-=1,f-=1;let d=n.join(ni),h=i.join(ni),m=a.slice(u,c+1).join(ni),g=s.slice(u,f+1).join(ni);return d.length&&h.length?d+ni+"{"+m+" \u2192 "+g+"}"+ni+h:d.length?d+ni+"{"+m+" \u2192 "+g+"}":h.length?"{"+m+" \u2192 "+g+"}"+ni+h:e+" \u2192 "+r}else return P0(r)?e:r}function sl(t){return`d2h-${xF(vs(t)).toString().slice(-6)}`}function ol(t){let e="file-changed";return t.isRename||t.isCopy?e="file-renamed":t.isNew?e="file-added":t.isDeleted?e="file-deleted":t.newName!==t.oldName&&(e="file-renamed"),e}function Nh(t,e,r,n={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},gs),n),l=rn(t,r,!1),u=rn(e,r,!1);if(l.content.length>a||u.content.length>a)return{oldLine:{prefix:l.prefix,content:ka(l.content)},newLine:{prefix:u.prefix,content:ka(u.content)}};let c=o==="char"?$F(l.content,u.content):OF(l.content,u.content),f=[];if(o==="word"&&i==="words"){let h=c.filter(v=>v.removed),m=c.filter(v=>v.added);Gz(m,h).forEach(v=>{v[0].length===1&&v[1].length===1&&MF(v[0][0],v[1][0]){let g=m.added?"ins":m.removed?"del":null,v=f.indexOf(m)>-1?' class="d2h-change"':"",w=ka(m.value);return g!==null?`${h}<${g}${v}>${w}`:`${h}${w}`},"");return{oldLine:{prefix:l.prefix,content:qz(d)},newLine:{prefix:u.prefix,content:zz(d)}}}var DF="file-summary",Wz="icon",Yz={colorScheme:gs.colorScheme},Bh=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Yz),r)}render(e){let r=e.map(n=>this.hoganUtils.render(DF,"line",{fileHtmlId:sl(n),oldName:n.oldName,newName:n.newName,fileName:vs(n),deletedLines:"-"+n.deletedLines,addedLines:"+"+n.addedLines},{fileIcon:this.hoganUtils.template(Wz,ol(n))})).join(` +`);return this.hoganUtils.render(DF,"wrapper",{colorScheme:al(this.config.colorScheme),filesNumber:e.length,files:r})}};p();var I0=Object.assign(Object.assign({},gs),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),iu="generic",LF="line-by-line",Xz="icon",Zz="tag",au=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},I0),r)}render(e){let r=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` +`);return this.hoganUtils.render(iu,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(LF,"file-diff"),i=this.hoganUtils.template(iu,"file-path"),a=this.hoganUtils.template(Xz,"file"),s=this.hoganUtils.template(Zz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(iu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Lt})}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(iu,"block-header",{CSSLineClass:Lt,blockHeader:e.isTooBig?n.header:ka(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e,e.isCombined,l,u);i+=c,i+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:Lt.CONTEXT,prefix:u,content:c,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=u}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` +`)}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.concat(r).map(o=>o.content.length));return i{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(` +`);return this.hoganUtils.render(su,"wrapper",{colorScheme:al(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(Kz,"file-diff"),i=this.hoganUtils.template(su,"file-path"),a=this.hoganUtils.template(Jz,"file"),s=this.hoganUtils.template(Qz,ol(e));return n.render({file:e,fileHtmlId:sl(e),diffs:r,filePath:i.render({fileDiffName:vs(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(su,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Lt})}}generateFileHtml(e){let r=nl(rl(n=>rn(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,r).map(([l,u])=>{let{left:c,right:f}=this.processChangedLines(e.isCombined,l,u);i.left+=c,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:u,content:c}=rn(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Lt.CONTEXT,prefix:u,content:c,number:l.oldNumber},{type:Lt.CONTEXT,prefix:u,content:c,number:l.newNumber});i.left+=f,i.right+=d});else if(s.length||o.length){let{left:l,right:u}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=u}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],n=[],i=[];for(let a=0;a0)&&(r.push([[],n,i]),n=[],i=[]),s.type===Ze.CONTEXT?r.push([[s],[],[]]):s.type===Ze.INSERT&&n.length===0?r.push([[],[],[s]]):s.type===Ze.INSERT&&n.length>0?i.push(s):s.type===Ze.DELETE&&n.push(s)}return(n.length||i.length)&&(r.push([[],n,i]),n=[],i=[]),r}applyRematchMatching(e,r,n){let i=e.length*r.length,a=Oh(e.concat(r).map(o=>o.content.length));return i'),n.b(` `+r),n.b(' '),n.b(` -`+r),n.b(n.rp("'),n.b(n.v(n.f("fileName",e,t,0))),n.b(""),n.b(` +`+r),n.b(n.rp("'),n.b(n.v(n.f("fileName",t,e,0))),n.b(""),n.b(` `+r),n.b(' '),n.b(` -`+r),n.b(' '),n.b(n.v(n.f("addedLines",e,t,0))),n.b(""),n.b(` -`+r),n.b(' '),n.b(n.v(n.f("deletedLines",e,t,0))),n.b(""),n.b(` +`+r),n.b(' '),n.b(n.v(n.f("addedLines",t,e,0))),n.b(""),n.b(` +`+r),n.b(' '),n.b(n.v(n.f("deletedLines",t,e,0))),n.b(""),n.b(` `+r),n.b(" "),n.b(` `+r),n.b(" "),n.b(` -`+r),n.b(""),n.fl()},partials:{"'),n.b(` +`+r),n.b(""),n.fl()},partials:{"'),n.b(` `+r),n.b('
'),n.b(` -`+r),n.b(' Files changed ('),n.b(n.v(n.f("filesNumber",e,t,0))),n.b(")"),n.b(` +`+r),n.b(' Files changed ('),n.b(n.v(n.f("filesNumber",t,e,0))),n.b(")"),n.b(` `+r),n.b(' hide'),n.b(` `+r),n.b(' show'),n.b(` `+r),n.b("
"),n.b(` `+r),n.b('
    '),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("files",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("files",t,e,0))),n.b(` `+r),n.b("
"),n.b(` -`+r),n.b(""),n.fl()},partials:{},subs:{}});st["generic-block-header"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` -`+r),n.b(' '),n.b(` -`+r),n.b(' '),n.b(` -`+r),n.b('
'),n.s(n.f("blockHeader",e,t,1),e,t,0,156,173,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),e.pop()),n.s(n.f("blockHeader",e,t,1),e,t,1,0,0,"")||n.b(" "),n.b("
"),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-block-header"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.s(n.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),n.s(n.f("blockHeader",t,e,1),t,e,1,0,0,"")||n.b(" "),n.b("
"),n.b(` `+r),n.b(" "),n.b(` -`+r),n.b(""),n.fl()},partials:{},subs:{}});st["generic-empty-diff"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` -`+r),n.b(' '),n.b(` -`+r),n.b('
'),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-empty-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.b(` `+r),n.b(" File without changes"),n.b(` `+r),n.b("
"),n.b(` `+r),n.b(" "),n.b(` -`+r),n.b(""),n.fl()},partials:{},subs:{}});st["generic-file-path"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b(''),n.b(` -`+r),n.b(n.rp("'),n.b(n.v(n.f("fileDiffName",e,t,0))),n.b(""),n.b(` -`+r),n.b(n.rp(""),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["generic-file-path"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b(''),n.b(` +`+r),n.b(n.rp("'),n.b(n.v(n.f("fileDiffName",t,e,0))),n.b(""),n.b(` +`+r),n.b(n.rp(""),n.b(` `+r),n.b('"),n.fl()},partials:{""),n.b(` -`+r),n.b(' '),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("lineNumber",e,t,0))),n.b(` +`+r),n.b(""),n.fl()},partials:{""),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("lineNumber",t,e,0))),n.b(` `+r),n.b(" "),n.b(` -`+r),n.b(' '),n.b(` -`+r),n.b('
'),n.b(` -`+r),n.s(n.f("prefix",e,t,1),e,t,0,162,238,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` -`+r)}),e.pop()),n.s(n.f("prefix",e,t,1),e,t,1,0,0,"")||(n.b('  '),n.b(` -`+r)),n.s(n.f("content",e,t,1),e,t,0,371,445,"{{ }}")&&(n.rs(e,t,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` -`+r)}),e.pop()),n.s(n.f("content",e,t,1),e,t,1,0,0,"")||(n.b('
'),n.b(` +`+r),n.b(' '),n.b(` +`+r),n.b('
'),n.b(` +`+r),n.s(n.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` +`+r)}),t.pop()),n.s(n.f("prefix",t,e,1),t,e,1,0,0,"")||(n.b('  '),n.b(` +`+r)),n.s(n.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(n.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` +`+r)}),t.pop()),n.s(n.f("content",t,e,1),t,e,1,0,0,"")||(n.b('
'),n.b(` `+r)),n.b("
"),n.b(` `+r),n.b(" "),n.b(` -`+r),n.b(""),n.fl()},partials:{},subs:{}});st["generic-wrapper"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("content",e,t,0))),n.b(` -`+r),n.b("
"),n.fl()},partials:{},subs:{}});st["icon-file-added"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("content",t,e,0))),n.b(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["icon-file-added"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('"),n.fl()},partials:{},subs:{}});st["icon-file-changed"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b(""),n.fl()},partials:{},subs:{}});dt["line-by-line-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` `+r),n.b('
'),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("filePath",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("filePath",t,e,0))),n.b(` `+r),n.b("
"),n.b(` `+r),n.b('
'),n.b(` `+r),n.b('
'),n.b(` `+r),n.b(' '),n.b(` `+r),n.b(' '),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("diffs",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("diffs",t,e,0))),n.b(` `+r),n.b(" "),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` -`+r),n.b("
"),n.fl()},partials:{},subs:{}});st["line-by-line-numbers"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(n.v(n.f("oldNumber",e,t,0))),n.b("
"),n.b(` -`+r),n.b('
'),n.b(n.v(n.f("newNumber",e,t,0))),n.b("
"),n.fl()},partials:{},subs:{}});st["side-by-side-file-diff"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["line-by-line-numbers"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(n.v(n.f("oldNumber",t,e,0))),n.b("
"),n.b(` +`+r),n.b('
'),n.b(n.v(n.f("newNumber",t,e,0))),n.b("
"),n.fl()},partials:{},subs:{}});dt["side-by-side-file-diff"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('
'),n.b(` `+r),n.b('
'),n.b(` -`+r),n.b(" "),n.b(n.t(n.f("filePath",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.f("filePath",t,e,0))),n.b(` `+r),n.b("
"),n.b(` `+r),n.b('
'),n.b(` `+r),n.b('
'),n.b(` `+r),n.b('
'),n.b(` `+r),n.b(' '),n.b(` `+r),n.b(' '),n.b(` -`+r),n.b(" "),n.b(n.t(n.d("diffs.left",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.d("diffs.left",t,e,0))),n.b(` `+r),n.b(" "),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` @@ -312,61 +329,75 @@ Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(t) `+r),n.b('
'),n.b(` `+r),n.b(' '),n.b(` `+r),n.b(' '),n.b(` -`+r),n.b(" "),n.b(n.t(n.d("diffs.right",e,t,0))),n.b(` +`+r),n.b(" "),n.b(n.t(n.d("diffs.right",t,e,0))),n.b(` `+r),n.b(" "),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` `+r),n.b("
"),n.b(` -`+r),n.b("
"),n.fl()},partials:{},subs:{}});st["tag-file-added"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('ADDED'),n.fl()},partials:{},subs:{}});st["tag-file-changed"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('CHANGED'),n.fl()},partials:{},subs:{}});st["tag-file-deleted"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('DELETED'),n.fl()},partials:{},subs:{}});st["tag-file-renamed"]=new ut.Template({code:function(e,t,r){var n=this;return n.b(r=r||""),n.b('RENAMED'),n.fl()},partials:{},subs:{}});var sc=class{constructor({compiledTemplates:t={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=C0.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},st),t),n)}static compile(t){return C0.compile(t,{asString:!1})}render(t,r,n,i,a){let s=this.templateKey(t,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(t,r){return this.preCompiledTemplates[this.templateKey(t,r)]}templateKey(t,r){return`${t}-${r}`}};var qj=Object.assign(Object.assign(Object.assign({},S0),E0),{outputFormat:hC.LINE_BY_LINE,drawFileList:!0});function IC(e,t={}){let r=Object.assign(Object.assign({},qj),t),n=typeof e=="string"?_C(e,r):e,i=new sc(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new dd(i,s).render(n):"",l=r.outputFormat==="side-by-side"?new ac(i,r).render(n):new nc(i,r).render(n);return o+l}var pd=require("obsidian");var Ra=class extends pd.ItemView{constructor(r,n){super(r);this.plugin=n;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ti.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return Ti.name}getIcon(){return Ti.icon}async setState(r,n){this.state=r,pd.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof Ce&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` +`+r),n.b("
"),n.fl()},partials:{},subs:{}});dt["tag-file-added"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('ADDED'),n.fl()},partials:{},subs:{}});dt["tag-file-changed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('CHANGED'),n.fl()},partials:{},subs:{}});dt["tag-file-deleted"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('DELETED'),n.fl()},partials:{},subs:{}});dt["tag-file-renamed"]=new pt.Template({code:function(t,e,r){var n=this;return n.b(r=r||""),n.b('RENAMED'),n.fl()},partials:{},subs:{}});var lu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let n=Object.entries(r).reduce((i,[a,s])=>{let o=D0.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},dt),e),n)}static compile(e){return D0.compile(e,{asString:!1})}render(e,r,n,i,a){let s=this.templateKey(e,r);try{return this.preCompiledTemplates[s].render(n,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var tV=Object.assign(Object.assign(Object.assign({},I0),$0),{outputFormat:wF.LINE_BY_LINE,drawFileList:!0});function Uh(t,e={}){let r=Object.assign(Object.assign({},tV),e),n=typeof t=="string"?AF(t,r):t,i=new lu(r),{colorScheme:a}=r,s={colorScheme:a},o=r.drawFileList?new Bh(i,s).render(n):"",l=r.outputFormat==="side-by-side"?new ou(i,r).render(n):new au(i,r).render(n);return o+l}var zF=bt(GF());var uu=require("obsidian"),L0=cu.StateEffect.define();function ws(t,e){let r=t.state,n=r.field(Gh),i=r.field(xr),a=r.doc.lineAt(e!=null?e:r.selection.main.head).number,s=Et.findHunk(a,i==null?void 0:i.hunks)[0];if(!s)return;let o=r.doc.line(Math.max(1,s.added.start)).from,l=n.has(o);return r.field(uu.editorEditorField).dispatch({effects:L0.of({pos:o,add:!l})})}var Gh=cu.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let n of e.effects)n.is(L0)&&(n.value.add?t.add(n.value.pos):t.delete(n.value.pos));for(let n of t)r.add(e.changes.mapPos(n));return r}}),VF=cu.StateField.define({create:t=>qF(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(tl)||r.is(L0))?qF(e.state):t},provide:t=>jh.showTooltip.computeN([t],e=>e.field(t))}),WF=jh.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function qF(t){let e=t.field(xr);return e?[...t.field(Gh)].map(n=>{let i=t.doc.lineAt(n),a=Et.findHunk(i.number,e.hunks)[0];if(a)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>rV(a,t,n)}}).filter(n=>n!==void 0):[]}function rV(t,e,r){let n=Et.createPatch("file",[t],"10064",!1).join(` +`)+` +`,i=Uh(n,{colorScheme:zF.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),a=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),s=document.createElement("div"),o=document.createElement("div");o.addClass("tooltip-toolbar");let l=(h,m)=>{let g=document.createElement("div");return(0,uu.setIcon)(g,h),g.setAttr("aria-label",m),g.addClass("clickable-icon"),g},u=l("x","Close hunk"),c=l("plus","Stage hunk"),f=l("undo","Reset hunk");o.appendChild(u),o.appendChild(c),o.appendChild(f),s.appendChild(o),s.appendChild(a),s.addClass("git-diff-tooltip","git-diff");let d=e.field(uu.editorEditorField);return u.onclick=()=>{ws(d,r)},c.onclick=()=>{let h=Zn.plugin;h&&(h.promiseQueue.addTask(()=>h.hunkActions.stageHunk(r)),ws(d,r))},f.onclick=()=>{let h=Zn.plugin;h&&(h.hunkActions.resetHunk(r),ws(d,r))},{dom:s,update:h=>{r=h.changes.mapPos(r)}}}function YF(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let n=await e.vault.adapter.read(r),a=await new Eh(e,n).openAndGetReslt();a!==void 0&&(await e.vault.adapter.write(r,a),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Dt.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Dt.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let r=e.workspace.getLeavesOfType(Qr.type),n;r.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:Qr.type})):n=r.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;{let i=t.gitManager.getRelativeRepoPath(n.path,!0);t.tools.openDiff({aFile:i,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:n})=>{if(n)return C$(r,n,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:n})=>{if(n)return P$(n,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.addFileToGitignore(n.path,n instanceof kn.TFolder).catch(i=>t.displayError(i))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:n})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),kn.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let n=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:n})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.promiseQueue.addTask(()=>t.stageFile(n))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let n=e.workspace.getActiveFile();if(r)return n!==null;t.promiseQueue.addTask(()=>t.unstageFile(n))}}),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 ze(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 kn.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new kn.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 Sh(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 kn.Notice("Discarded all changes in tracked files.");break;case"delete":new kn.Notice("Discarded all files.");break;case!1:break;default:Md(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 kn.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new kn.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let n=t.gitManager;if(r)return n instanceof _e;t.tools.runRawCommand().catch(i=>t.displayError(i))}}),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,n,i){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,n,i)=>{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,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let a=t.hunkActions.editor.editor;ws(a)}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,n,i)=>{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,n,i)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("prev")}})}p();var qh=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 n=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&n!=null&&n!=null&&(this.app.saveLocalStorage(this.prefix+r,n),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 ll=require("obsidian");var fu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),n=r.tracking?Ri(r.tracking)[0]:null;if(!n)return!1;let i=await this.plugin.gitManager.getRemoteUrl(n);if(i!=null&&i.includes("github.com")){let a=[],s=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),u=!1;if(l instanceof ll.TFile)l.stat.size>=1e8&&(u=!0);else{let c=await this.plugin.app.vault.adapter.stat(o.vaultPath);c&&c.size>=1e8&&(u=!0)}if(u){let c=!1;s instanceof _e&&(c=await s.isFileTrackedByLFS(o.path)),c||a.push(o)}}if(a.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: +- ${a.map(o=>o.vaultPath).join(` +- `)} +Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Ro,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(n=>{n.getDisplayText()!=""&&Ro.startsWith(n.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(Ro,"/",!0)}openDiff({aFile:e,bFile:r,aRef:n,bRef:i,event:a}){var l,u;let s=this.plugin.settings.diffStyle;ll.Platform.isMobileApp&&(s="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:n,bRef:i};s=="split"?(l=bn(this.plugin.app,a))==null||l.setViewState({type:ma.type,active:!0,state:o}):s=="git_unified"&&((u=bn(this.plugin.app,a))==null||u.setViewState({type:ga.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof _e))return;let n=await new ze(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();n!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let i=new ll.Notice(`Running '${n}'...`,999999);try{let a=await e.rawCommand(n);a?(i.setMessage(a),window.setTimeout(()=>i.hide(),5e3)):i.hide()}catch(a){throw i.hide(),a}})}};p();var zh=require("obsidian");var ys=class extends zh.ItemView{constructor(r,n){super(r);this.plugin=n;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return ga.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return ga.name}getIcon(){return ga.icon}async setState(r,n){this.state=r,zh.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof _e&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` `);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);n=[...`--- /dev/null +++ ${this.state.bFile} @@ -0,0 +1,${a.split(` `).length} @@`.split(` `),...a.split(` `).map(o=>`+${o}`)].join(` -`)}}if(n){let a=this.parser.parseFromString(IC(n),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};g();var ho=require("obsidian");var po=require("@codemirror/commands");g();var Me=require("@codemirror/view"),Ee=require("@codemirror/state");g();var P0="\u037C",FC=typeof Symbol=="undefined"?"__"+P0:Symbol.for(P0),R0=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$C=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},md=class{constructor(t,r){this.rules=[];let{finish:n}=r||{};function i(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function a(s,o,l,c){let u=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&o==null)return l.push(s[0]+";");for(let h in o){let p=o[h];if(/&/.test(h))a(h.split(/,\s*/).map(m=>s.map(v=>m.replace(/&/,v))).reduce((m,v)=>m.concat(v)),p,l);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");a(i(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((n&&!f&&!c?s.map(n):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in t)a(i(s),t[s],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let t=$C[FC]||1;return $C[FC]=t+1,P0+t.toString(36)}static mount(t,r,n){let i=t[R0],a=n&&n.nonce;i?a&&i.setNonce(a):i=new M0(t,a),i.mount(Array.isArray(r)?r:[r],t)}},LC=new Map,M0=class{constructor(t,r){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let a=LC.get(n);if(a)return t[R0]=a;this.sheet=new i.CSSStyleSheet,LC.set(n,this)}else this.styleTag=n.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],t[R0]=this}mount(t,r){let n=this.sheet,i=0,a=0;for(let s=0;s-1&&(this.modules.splice(l,1),a--,l=-1),l==-1){if(this.modules.splice(a++,0,o),n)for(let c=0;cc){let f=e.slice(t,r).indexOf(n.slice(i,a));if(f>-1)return[new ft(t,t+f,i,i),new ft(t+f+c,r,a,a)]}else if(c>l){let f=n.slice(i,a).indexOf(e.slice(t,r));if(f>-1)return[new ft(t,t,i,i+f),new ft(r,r,i+f+l,a)]}if(l==1||c==1)return[new ft(t,r,i,a)];let u=r3(e,t,r,n,i,a);if(u){let[f,d,h]=u;return Oa(e,t,f,n,i,d).concat(Oa(e,f+h,r,n,d+h,a))}return Xj(e,t,r,n,i,a)}var oc=1e9;function Xj(e,t,r,n,i,a){let s=r-t,o=a-i;if(oc<1e9&&Math.min(s,o)>oc*16)return Math.min(s,o)>oc*64?[new ft(t,r,i,a)]:DC(e,t,r,n,i,a);let l=Math.ceil((s+o)/2);O0.reset(l),I0.reset(l);let c=(h,p)=>e.charCodeAt(t+h)==n.charCodeAt(i+p),u=(h,p)=>e.charCodeAt(r-h-1)==n.charCodeAt(a-p-1),f=(s-o)%2!=0?I0:null,d=f?null:O0;for(let h=0;hoc)return DC(e,t,r,n,i,a);let p=O0.advance(h,s,o,l,f,!1,c)||I0.advance(h,s,o,l,d,!0,u);if(p)return Zj(e,t,r,t+p[0],n,i,a,i+p[1])}return[new ft(t,r,i,a)]}var bd=class{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;rr)this.end+=2;else if(f>n)this.start+=2;else if(a){let d=i+(r-n)-l;if(d>=0&&d=r-u)return[h,i+h-d]}else{let h=r-a.vec[d];if(u>=h)return[u,f]}}}return null}},O0=new bd,I0=new bd;function Zj(e,t,r,n,i,a,s,o){let l=!1;return!co(e,n)&&++n==r&&(l=!0),!co(i,o)&&++o==s&&(l=!0),l?[new ft(t,r,a,s)]:Oa(e,t,n,i,a,o).concat(Oa(e,n,r,i,o,s))}function t3(e,t){let r=1,n=Math.min(e,t);for(;rr||u>a||e.slice(o,c)!=n.slice(l,u)){if(s==1)return o-t-(co(e,o)?0:1);s=s>>1}else{if(c==r||u==a)return c-t;o=c,l=u}}}function B0(e,t,r,n,i,a){if(t==r||i==a||e.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let s=t3(r-t,a-i);for(let o=r,l=a;;){let c=o-s,u=l-s;if(c>1}else{if(c==t||u==i)return r-c;o=c,l=u}}}function F0(e,t,r,n,i,a,s,o){let l=n.slice(i,a),c=null;for(;;){if(c||s=r)break;let d=e.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=N0(e,f,r,n,i+h+d.length,a),m=B0(e,t,u,n,i,i+h),v=d.length+p+m;(!c||c[2]>1}}function r3(e,t,r,n,i,a){let s=r-t,o=a-i;if(si.fromA-t&&n.toB>i.fromB-t&&(e[r-1]=new ft(n.fromA,i.toA,n.fromB,i.toB),e.splice(r--,1))}}function Kj(e,t,r){for(;;){n3(r,1);let n=!1;for(let i=0;i3||o>3){let l=i==e.length-1?t.length:e[i+1].fromA,c=a.fromA-n,u=l-a.toA,f=BC(t,a.fromA,Math.min(c,5)),d=NC(t,a.toA,Math.min(u,5)),h=a.fromA-f,p=d-a.toA;if(!s||!o){let m=Math.max(s,o),[v,y,b]=s?[t,a.fromA,a.toA]:[r,a.fromB,a.toB];h&&p&&(m>h&&t.slice(f,a.fromA)==v.slice(b-h,b)?(a=e[i]=new ft(f,f+s,a.fromB-h,a.toB-h),f=a.fromA,d=NC(t,a.toA,Math.min(l-a.toA,5))):m>p&&t.slice(a.toA,d)==v.slice(y,y+p)&&(a=e[i]=new ft(d-s,d,a.fromB+p,a.toB+p),d=a.toA,f=BC(t,a.fromA,Math.min(a.fromA-n,5))),h=a.fromA-f,p=d-a.toA)}if(h||p)a=e[i]=new ft(a.fromA-h,a.toA+p,a.fromB-h,a.toB+p);else if(s){if(!o){let m=HC(t,a.fromA,a.toA),v,y=m<0?-1:jC(t,a.toA,a.fromA);m>-1&&(v=m-a.fromA)<=u&&t.slice(a.fromA,m)==t.slice(a.toA,a.toA+v)?a=e[i]=a.offset(v):y>-1&&(v=a.toA-y)<=c&&t.slice(a.fromA-v,a.fromA)==t.slice(y,a.toA)&&(a=e[i]=a.offset(-v))}}else{let m=HC(r,a.fromB,a.toB),v,y=m<0?-1:jC(r,a.toB,a.fromB);m>-1&&(v=m-a.fromB)<=u&&r.slice(a.fromB,m)==r.slice(a.toB,a.toB+v)?a=e[i]=a.offset(v):y>-1&&(v=a.toB-y)<=c&&r.slice(a.fromB-v,a.fromB)==r.slice(y,a.toB)&&(a=e[i]=a.offset(-v))}n=a.toA}}return n3(e,3),e}var Ma;try{Ma=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(e){}function i3(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function a3(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?i3(r)?1:0:Ma?!o3(r)||t==e.length-1?Ma.test(String.fromCharCode(r))?1:0:Ma.test(e.slice(t,t+2))?2:0:0}function s3(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?i3(r)?1:0:Ma?!l3(r)||t==1?Ma.test(String.fromCharCode(r))?1:0:Ma.test(e.slice(t-2,t))?2:0:0}function NC(e,t,r){if(t==e.length||!s3(e,t))return t;for(let n=t,i=t+r;;){let a=a3(e,n);if(!a)return n;if(n+=a,n>i)return t}}function BC(e,t,r){if(!t||!a3(e,t))return t;for(let n=t,i=t-r;;){let a=s3(e,n);if(!a)return n;if(n-=a,ne>=55296&&e<=56319,l3=e=>e>=56320&&e<=57343;function co(e,t){return!t||t==e.length||!o3(e.charCodeAt(t-1))||!l3(e.charCodeAt(t))}function Qj(e,t,r){var n;return oc=((n=r==null?void 0:r.scanLimit)!==null&&n!==void 0?n:1e9)>>1,Kj(e,t,Oa(e,0,e.length,t,0,t.length))}function c3(e,t,r){return Jj(Qj(e,t,r),e,t)}var Rn=Ee.Facet.define({combine:e=>e[0]}),$0=Ee.StateEffect.define(),uo=Ee.StateField.define({create(e){return null},update(e,t){for(let r of t.effects)r.is($0)&&(e=r.value);return e}});var lo=class e{constructor(t,r,n,i,a){this.changes=t,this.fromA=r,this.toA=n,this.fromB=i,this.toB=a}offset(t,r){return t||r?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,r,n){return u3(c3(t.toString(),r.toString(),n),t,r,0,0)}static updateA(t,r,n,i,a){return WC(VC(t,i,!0,n.length),t,r,n,a)}static updateB(t,r,n,i,a){return WC(VC(t,i,!1,r.length),t,r,n,a)}};function UC(e,t,r,n){let i=r.lineAt(e),a=n.lineAt(t);return i.to==e&&a.to==t&&eu+1&&m>f+1)break;d.push(h.offset(-l+n,-c+i)),[u,f]=GC(h.toA+n,h.toB+i,t,r),s++}a.push(new lo(d,l,Math.max(l,u),c,Math.max(c,f)))}return a}var gd=1e3;function zC(e,t,r,n){let i=0,a=e.length;for(;;){if(i==a){let u=0,f=0;i&&({toA:u,toB:f}=e[i-1]);let d=t-(r?u:f);return[u+d,f+d]}let s=i+a>>1,o=e[s],[l,c]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>t)a=s;else if(c<=t)i=s+1;else return n?[o.fromA,o.fromB]:[o.toA,o.toB]}}function VC(e,t,r,n){let i=[];return t.iterChangedRanges((a,s,o,l)=>{let c=0,u=r?t.length:n,f=0,d=r?n:t.length;a>gd&&([c,f]=zC(e,a-gd,r,!0)),s=c?i[i.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:d,diffA:p.diffA+m,diffB:p.diffB+v}:i.push({fromA:c,toA:u,fromB:f,toB:d,diffA:m,diffB:v})}),i}function WC(e,t,r,n,i){if(!e.length)return t;let a=[];for(let s=0,o=0,l=0,c=0;;s++){let u=s==e.length?null:e[s],f=u?u.fromA+o:r.length,d=u?u.fromB+l:n.length;for(;cf||v.toB+l>d)break;a.push(v.offset(o,l)),c++}if(!u)break;let h=u.toA+o+u.diffA,p=u.toB+l+u.diffB,m=c3(r.sliceString(f,h),n.sliceString(d,p),i);for(let v of u3(m,r,n,f,d))a.push(v);for(o+=u.diffA,l+=u.diffB;ch&&v.fromB+l>p)break;c++}}return a}var e7={scanLimit:500},f3=Me.ViewPlugin.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=XC(e))}update(e){(e.docChanged||e.viewportChanged||t7(e.startState,e.state)||r7(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=XC(e.view))}},{decorations:e=>e.deco}),vd=Ee.Prec.low((0,Me.gutter)({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(f3))===null||t===void 0?void 0:t.gutter)||Ee.RangeSet.empty}}));function t7(e,t){return e.field(uo,!1)!=t.field(uo,!1)}function r7(e,t){return e.facet(Rn)!=t.facet(Rn)}var qC=Me.Decoration.line({class:"cm-changedLine"}),n7=Me.Decoration.mark({class:"cm-changedText"}),i7=Me.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),a7=Me.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),YC=new class extends Me.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function s7(e,t,r,n,i,a){let s=r?e.fromA:e.fromB,o=r?e.toA:e.toB,l=0;if(s!=o){i.add(s,s,qC),i.add(s,o,r?a7:i7),a&&a.add(s,s,YC);for(let c=t.iterRange(s,o-1),u=s;!c.next().done;){if(c.lineBreak){u++,i.add(u,u,qC),a&&a.add(u,u,YC);continue}let f=u+c.value.length;if(n)for(;l=c)break;(a?u.toA:u.toB)>l&&s7(u,e.state.doc,a,n,s,o)}return{deco:s.finish(),gutter:o&&o.finish()}}var oo=class extends Me.WidgetType{constructor(t){super(),this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},_d=Ee.StateEffect.define({map:(e,t)=>e.map(t)}),lc=Ee.StateField.define({create:()=>Me.Decoration.none,update:(e,t)=>{for(let r of t.effects)if(r.is(_d))return r.value;return e.map(t.changes)},provide:e=>Me.EditorView.decorations.from(e)}),yd=.01;function ZC(e,t){if(e.size!=t.size)return!1;let r=e.iter(),n=t.iter();for(;r.value;){if(r.from!=n.from||Math.abs(r.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;r.next(),n.next()}return!0}function o7(e,t,r){let n=new Ee.RangeSetBuilder,i=new Ee.RangeSetBuilder,a=e.state.field(lc).iter(),s=t.state.field(lc).iter(),o=0,l=0,c=0,u=0,f=e.viewport,d=t.viewport;for(let v=0;;v++){let y=vyd&&(u+=k,i.add(l,l,Me.Decoration.widget({widget:new oo(k),block:!0,side:-1})))}if(b>o+1e3&&of.from&&ld.from){let E=Math.min(f.from-o,d.from-l);o+=E,l+=E,v--}else if(y)o=y.toA,l=y.toB;else break;for(;a.value&&a.fromyd&&i.add(t.state.doc.length,t.state.doc.length,Me.Decoration.widget({widget:new oo(h),block:!0,side:1}));let p=n.finish(),m=i.finish();ZC(p,e.state.field(lc))||e.dispatch({effects:_d.of(p)}),ZC(m,t.state.field(lc))||t.dispatch({effects:_d.of(m)})}var L0=Ee.StateEffect.define({map:(e,t)=>t.mapPos(e)}),D0=class extends Me.WidgetType{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let i=t.posAtDOM(n.target);t.dispatch({effects:L0.of(i)});let{side:a,sibling:s}=t.state.facet(Rn);s&&s().dispatch({effects:L0.of(l7(i,t.state.field(uo),a=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}};function l7(e,t,r){let n=0,i=0;for(let a=0;;a++){let s=a=e)return i+(e-n);[n,i]=r?[s.toA,s.toB]:[s.toB,s.toA]}}var c7=Ee.StateField.define({create(e){return Me.Decoration.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(L0)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>Me.EditorView.decorations.from(e)});function KC({margin:e=3,minSize:t=4}){return c7.init(r=>u7(r,e,t))}function u7(e,t,r){let n=new Ee.RangeSetBuilder,i=e.facet(Rn).side=="a",a=e.field(uo),s=1;for(let o=0;;o++){let l=o=r&&n.add(e.doc.line(c).from,e.doc.line(u).to,Me.Decoration.replace({widget:new D0(f),block:!0})),!l)break;s=e.doc.lineAt(Math.min(e.doc.length,i?l.toA:l.toB)).number}return n.finish()}var f7=Me.EditorView.styleModule.of(new md({".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"}})),d7=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":{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(#22bb2266, #22bb2266) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff8866, #88ff8866) bottom/100% 2px no-repeat"},".cm-insertedLine, .cm-deletedLine":{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"}}),JC=new Ee.Compartment,wd=new Ee.Compartment,xd=class{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||e7;let r=[Ee.Prec.low(f3),d7,f7,lc,Me.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(_d)))&&this.measure()})],n=[Rn.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&n.push(vd);let i=Ee.EditorState.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],Me.EditorView.editorAttributes.of({class:"cm-merge-a"}),wd.of(n),r]}),a=[Rn.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&a.push(vd);let s=Ee.EditorState.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],Me.EditorView.editorAttributes.of({class:"cm-merge-b"}),wd.of(a),r]});this.chunks=lo.build(i.doc,s.doc,this.diffConf);let o=[uo.init(()=>this.chunks),JC.of(t.collapseUnchanged?KC(t.collapseUnchanged):[])];i=i.update({effects:Ee.StateEffect.appendConfig.of(o)}).state,s=s.update({effects:Ee.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=t.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:i,parent:c,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Me.EditorView({state:s,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,r){if(t.some(n=>n.docChanged)){let n=t[t.length-1],i=t.reduce((s,o)=>s.compose(o.changes),Ee.ChangeSet.empty(t[0].startState.doc.length));this.chunks=r==this.a?lo.updateA(this.chunks,n.newDoc,this.b.state.doc,i,this.diffConf):lo.updateB(this.chunks,this.a.state.doc,n.newDoc,i,this.diffConf),r.update([...t,n.state.update({effects:$0.of(this.chunks)})]);let a=r==this.a?this.b:this.a;a.update([a.state.update({effects:$0.of(this.chunks)})]),this.scheduleMeasure()}else r.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let a=t.orientation!="b-a";if(a!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(a?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(a?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let a=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in t&&(a=!!t.revertControls,s=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(o=t.renderRevertControl),this.setupRevertControls(a,s,o)}let r="highlightChanges"in t,n="gutter"in t,i="collapseUnchanged"in t;if(r||n||i){let a=[],s=[];if(r||n){let o=this.a.state.facet(Rn),l=n?t.gutter!==!1:o.markGutter,c=r?t.highlightChanges!==!1:o.highlightChanges;a.push(wd.reconfigure([Rn.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?vd:[]])),s.push(wd.reconfigure([Rn.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?vd:[]]))}if(i){let o=JC.reconfigure(t.collapseUnchanged?KC(t.collapseUnchanged):[]);a.push(o),s.push(o)}this.a.dispatch({effects:a}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(t,r,n){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!t&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):t&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){o7(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,r=t.firstChild,n=this.a.viewport,i=this.b.viewport;for(let a=0;an.to||s.fromB>i.to)break;if(s.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function QC(e){let t=e.nextSibling;return e.remove(),t}var Sd=require("@codemirror/search"),fo=require("@codemirror/state"),Hr=require("@codemirror/view");var Ia=class extends ho.ItemView{constructor(r,n){super(r);this.plugin=n;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.state.bRef==null&&i.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,a)=>{this.state.bRef==null&&(i.path===this.state.bFile||a===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ho.debounce)(i=>{let a=this.state.bFile;a&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(a,i).catch(s=>this.plugin.displayError(s)))},1e3,!1)}getViewType(){return ki.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return ki.name}getIcon(){return ki.icon}async setState(r,n){this.state=r,ho.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,n),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,n){try{return await this.plugin.gitManager.show(r,n,!1)}catch(i){if(i instanceof wr&&(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: bad object")))return i.message.includes("fatal: bad object")&&this.plugin.displayError(i.message),"";throw i}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let n=await this.app.vault.adapter.read(this.state.bFile);if(n!=r.state.doc.toString()){let i=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n},annotations:[fo.Transaction.remote.of(!0)]});r.dispatch(i)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,n=this.mergeView.b;this.refreshing=!0;let i=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null&&(a=await this.gitShow(this.state.bRef,this.state.bFile)),i!=r.state.doc.toString()){let s=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i}});r.dispatch(s)}if(a!=null&&a!=n.state.doc.toString()){let s=n.state.update({changes:{from:0,to:n.state.doc.length,insert:a}});n.dispatch(s)}this.refreshing=!1}async createMergeView(){var r,n,i;if((r=this.state)!=null&&r.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(i=this.mergeView)==null||i.destroy();let a=this.containerEl.children[1];a.empty(),this.contentEl.addClass("git-split-diff-view"),this.bIsEditable=await this.bShouldBeEditable();let s=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let p=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(p)?o=await this.app.vault.adapter.read(p):o=""}let l=[(0,Hr.lineNumbers)(),(0,Sd.highlightSelectionMatches)(),(0,Hr.drawSelection)(),Hr.keymap.of([...po.standardKeymap,po.indentWithTab]),(0,po.history)(),(0,Sd.search)(),Hr.EditorView.lineWrapping],c=this,u=Hr.ViewPlugin.define(p=>({update(m){if(m.docChanged&&!m.transactions.some(v=>v.annotation(fo.Transaction.remote))){let v=p.state.doc.toString();c.fileSaveDebouncer(v)}}})),f={doc:s,extensions:[...l,Hr.EditorView.editable.of(!1),fo.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Hr.EditorView.editable.of(!1),fo.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};a.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]),this.mergeView=new xd({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:a}),this.refreshing=!1}}};g();var CP=require("obsidian");g();g();g();var d3="5";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(d3);g();g();var mo="[",Fa="[!",$a="]",Ni={};var dt=Symbol(),Yt=Symbol("filename"),h3=Symbol("hmr");g();g();var h7=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory"];var MZ=[...h7,"formNoValidate","isMap","noModule","playsInline","readOnly","value","inert","volume","defaultValue","defaultChecked","srcObject"];var p7=["touchstart","touchmove"];function p3(e){return p7.includes(e)}g();g();g();var Ed=!0;g();var G=!1;g();var on=Array.isArray,cc=Array.from,j0=Object.keys,It=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,H0=Object.getOwnPropertyDescriptors,U0=Object.prototype,m3=Array.prototype,La=Object.getPrototypeOf;function G0(e){return typeof e=="function"}var xr=()=>{};function Ad(e){for(var t=0;t{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.state.bRef==null&&i.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.state.bRef==null&&i.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,a)=>{this.state.bRef==null&&(i.path===this.state.bFile||a===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Mi.debounce)(i=>{let a=this.state.bFile;a&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(a),i).catch(s=>this.plugin.displayError(s)))},1e3,!1)}getViewType(){return ma.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return ma.name}getIcon(){return ma.icon}async setState(r,n){this.state=r,Mi.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,n),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,n){try{return await this.plugin.gitManager.show(r,n,!1)}catch(i){if(i instanceof br&&(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: bad object")))return i.message.includes("fatal: bad object")&&this.plugin.displayError(i.message),"";throw i}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let n=await this.app.vault.adapter.read(this.state.bFile);if(n!=r.state.doc.toString()){let i=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n},annotations:[cl.Transaction.remote.of(!0)]});r.dispatch(i)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,n=this.mergeView.b;this.refreshing=!0;let i=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null&&(a=await this.gitShow(this.state.bRef,this.state.bFile)),i!=r.state.doc.toString()){let s=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i}});r.dispatch(s)}if(a!=null&&a!=n.state.doc.toString()){let s=n.state.update({changes:{from:0,to:n.state.doc.length,insert:a}});n.dispatch(s)}this.refreshing=!1}renderButtons(){let r=document.createElement("div"),n=r.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Mi.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async i=>{var h;let a=this.mergeView.b,s=this.mergeView.a,o=g0(a.state),l=(h=r.parentElement)==null?void 0:h.indexOf(r),u=o.chunks[l],c=y0(u,s.state.doc,a.state.doc),f=w0(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[c])[0],d=Et.createPatch(this.state.bFile,[f],"100644",this.state.bRef!=null).join(` +`)+` +`;await this.plugin.gitManager.applyPatch(d),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let i=r.createDiv();i.addClass("clickable-icon"),i.setAttr("aria-label","Reset hunk"),(0,Mi.setIcon)(i,"undo"),i.onmousedown=a=>{var f;let s=this.mergeView.a,o=this.mergeView.b,l=g0(o.state),u=(f=r.parentElement)==null?void 0:f.indexOf(r),c=l.chunks[u];if(c){let d=c.fromA,h=c.toA,m=c.fromB,g=c.toB,v=s.state.sliceDoc(d,Math.max(d,h-1));d!=h&&g<=o.state.doc.length&&(v+=s.state.lineBreak),o.dispatch({changes:{from:m,to:Math.min(o.state.doc.length,g),insert:v},userEvent:"revert"})}}}return r.onmousedown=i=>{i.preventDefault(),i.stopPropagation()},r}async createMergeView(){var r,n,i;if((r=this.state)!=null&&r.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(i=this.mergeView)==null||i.destroy();let a=this.containerEl.children[1];a.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let s=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,an.lineNumbers)(),(0,Vh.highlightSelectionMatches)(),(0,an.drawSelection)(),an.keymap.of([...ul.standardKeymap,ul.indentWithTab]),(0,ul.history)(),(0,Vh.search)(),an.EditorView.lineWrapping],u=this,c=an.ViewPlugin.define(g=>({update(v){if(v.docChanged&&!v.transactions.some(w=>w.annotation(cl.Transaction.remote))){let w=g.state.doc.toString();u.fileSaveDebouncer(w)}}})),f={doc:s,extensions:[...l,an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(c):d.push(an.EditorView.editable.of(!1),cl.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};a.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let m=this.plugin.gitManager instanceof _e&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new $h({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:m?()=>this.renderButtons():void 0,revertControls:m?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:a}),this.refreshing=!1}}};p();var yM=require("obsidian");p();p();p();var XF="5";var ZF,KF,JF;typeof window!="undefined"&&((JF=(KF=(ZF=window.__svelte)!=null?ZF:window.__svelte={}).v)!=null?JF:KF.v=new Set).add(XF);p();p();p();var fl="[",Aa="[!",_s="]",Di={};var Ve=Symbol(),sn=Symbol("filename"),QF=Symbol("hmr"),eO="http://www.w3.org/1999/xhtml";p();p();p();p();var Wh=!0;p();var L=!1;p();var on=Array.isArray,tO=Array.prototype.indexOf,du=Array.from,N0=Object.keys,Wt=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,B0=Object.getOwnPropertyDescriptors,H0=Object.prototype,rO=Array.prototype,dl=Object.getPrototypeOf,U0=Object.isExtensible;function j0(t){return typeof t=="function"}var ar=()=>{};function hu(t){for(var e=0;e{t=n,e=i});return{promise:r,resolve:t,reject:e}}p();p();var Er=Symbol("$state"),pu=Symbol("legacy props"),iO=Symbol(""),Yh=Symbol("proxy path"),hl=new class extends Error{constructor(){super(...arguments);vt(this,"name","StaleReactionError");vt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var mu=3,ln=8;p();p();function aO(){if(L){let t=new Error("await_outside_boundary\nCannot await outside a `` with a `pending` snippet\nhttps://svelte.dev/e/await_outside_boundary");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/await_outside_boundary")}function gu(t){if(L){let e=new Error(`lifecycle_outside_component +\`${t}(...)\` can only be used during component initialisation +https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function sO(){if(L){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function G0(){if(L){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function oO(){if(L){let t=new Error(`derived_references_self A derived value cannot reference itself recursively -https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/derived_references_self")}function y3(e){if(G){let t=new Error(`effect_in_teardown -\`${e}\` cannot be used inside an effect cleanup function -https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function w3(){if(G){let e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function b3(e){if(G){let t=new Error(`effect_orphan -\`${e}\` can only be used inside an effect (e.g. during component initialisation) -https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_orphan")}function _3(){if(G){let e=new Error(`effect_update_depth_exceeded -Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops -https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function x3(){if(G){let e=new Error(`hydration_failed +https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function lO(t){if(L){let e=new Error(`effect_in_teardown +\`${t}\` cannot be used inside an effect cleanup function +https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function cO(){if(L){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function uO(t){if(L){let e=new Error(`effect_orphan +\`${t}\` can only be used inside an effect (e.g. during component initialisation) +https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function fO(){if(L){let t=new Error(`effect_update_depth_exceeded +Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state +https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function dO(){if(L){let t=new Error("flush_sync_in_effect\nCannot use `flushSync` inside an effect\nhttps://svelte.dev/e/flush_sync_in_effect");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/flush_sync_in_effect")}function hO(){if(L){let t=new Error(`hydration_failed Failed to hydrate the application -https://svelte.dev/e/hydration_failed`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/hydration_failed")}function S3(e){if(G){let t=new Error(`props_invalid_value -Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value -https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_invalid_value")}function E3(e){if(G){let t=new Error(`rune_outside_svelte -The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files -https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function A3(){if(G){let e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function k3(){if(G){let e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function T3(){if(G){let e=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function C3(){if(G){let e=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}g();var ei=!1,ti=!1;g();g();g();var uc=null;function ri(e){let t=Error(),r=t.stack;if(r){let n=r.split(` -`),i=[` -`];for(let a=0;a0)){let n=Array.from(Na);var r=ii;vo(!0);try{for(let i of n)i.f&1024&&Zt(i,4096),Hi(i)&&ja(i)}finally{vo(r)}Na.clear()}return t}function R3(e,t){var r=e.reactions;if(r!==null)for(var n=ji(),i=r.length,a=0;an.line)return a.component}}return null}var _7=Symbol("ADD_OWNER");function Z0(e,t){if(t.owners!==null)for(;e;){if(e.owners===null){t.owners=null;break}for(let r of e.owners)t.owners.add(r);e=e.parent}}function L3(e,t){return e.owners===null?!0:e.owners.has(t)||e.parent!==null&&L3(e.parent,t)}function D3(e){var t,r;return(r=(t=e==null?void 0:e.owners)==null?void 0:t.values().next().value)!=null?r:D3(e.parent)}var x7=!1;function N3(e){if(x7)return;let t=$3();if(t&&!L3(e,t)){let r=D3(e);r[Yt]!==t[Yt]?X0(t[Yt],r[Yt]):X0()}}function _e(e,t=null,r){var c,u;var n=null;if(G&&ti&&(n=ri("CreatedAt")),typeof e!="object"||e===null||Sr in e)return e;let i=La(e);if(i!==U0&&i!==m3)return e;var a=new Map,s=on(e),o=ht(0);s&&a.set("length",ht(e.length,n));var l;if(G)if(l={parent:t,owners:null},r){let f=(u=(c=r.v)==null?void 0:c[Da])==null?void 0:u.owners;l.owners=f?new Set(f):null}else l.owners=t===null?pe!==null?new Set([pe.function]):null:new Set;return new Proxy(e,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&A3();var p=a.get(d);return p===void 0?(p=ht(h.value,n),a.set(d,p)):re(p,_e(h.value,l)),!0},deleteProperty(f,d){var h=a.get(d);if(h===void 0)d in f&&a.set(d,ht(dt,n));else{if(s&&typeof d=="string"){var p=a.get("length"),m=Number(d);Number.isInteger(m)&&m=_.v&&re(_,k+1)}B3(o)}return!0},ownKeys(f){R(o);var d=Reflect.ownKeys(f).filter(m=>{var v=a.get(m);return v===void 0||v.v!==dt});for(var[h,p]of a)p.v!==dt&&!(h in f)&&d.push(h);return d},setPrototypeOf(){k3()}})}function B3(e,t=1){re(e,e.v+t)}function Md(e){return e!==null&&typeof e=="object"&&Sr in e?e[Sr]:e}function j3(){let e=Array.prototype,t=Array.__svelte_cleanup;t&&t();let{indexOf:r,lastIndexOf:n,includes:i}=e;e.indexOf=function(a,s){let o=r.call(this,a,s);if(o===-1){for(let l=s!=null?s:0;l{e.indexOf=r,e.lastIndexOf=n,e.includes=i}}var K0,H3,U3,G3;function Od(){if(K0===void 0){K0=window,H3=document;var e=Element.prototype,t=Node.prototype;U3=Ur(t,"firstChild").get,G3=Ur(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0,G&&(e.__svelte_meta=null,j3())}}function qr(e=""){return document.createTextNode(e)}function Pt(e){return U3.call(e)}function $t(e){return G3.call(e)}function j(e,t){if(!ae)return Pt(e);var r=Pt(ue);if(r===null)r=ue.appendChild(qr());else if(t&&r.nodeType!==3){var n=qr();return r==null||r.before(n),tt(n),n}return tt(r),r}function cr(e,t){var i,a;if(!ae){var r=Pt(e);return r instanceof Comment&&r.data===""?$t(r):r}if(t&&((i=ue)==null?void 0:i.nodeType)!==3){var n=qr();return(a=ue)==null||a.before(n),tt(n),n}return ue}function Z(e,t=1,r=!1){let n=ae?ue:e;for(var i;t--;)i=n,n=$t(n);if(!ae)return n;var a=n==null?void 0:n.nodeType;if(r&&a!==3){var s=qr();return n===null?i==null||i.after(s):n.before(s),tt(s),s}return tt(n),n}function So(e){e.textContent=""}g();function Xe(e){var i;var t=2050;te===null?t|=256:te.f|=1048576;var r=de!==null&&de.f&2?de:null;let n={children:null,ctx:pe,deps:null,equals:Td,f:t,fn:e,reactions:null,v:null,version:0,parent:r!=null?r:te};return G&&ti&&(n.created=ri("CreatedAt")),r!==null&&((i=r.children)!=null?i:r.children=[]).push(n),n}function tv(e){let t=Xe(e);return t.equals=go,t}function Q0(e){var t=e.children;if(t!==null){e.children=null;for(var r=0;r{Lt(t)}}function W3(e){let t=Ua(64,e,!0);return(r={})=>new Promise(n=>{r.outro?un(t,()=>{Lt(t),n(void 0)}):(Lt(t),n(void 0))})}function Er(e){return Ua(4,e,!1)}function lr(e){return Ua(8,e,!0)}function Ae(e){return G&&It(e,"name",{value:"{expression}"}),ur(e)}function ur(e,t=0){return Ua(24|t,e,!0)}function Nt(e,t=!0){return Ua(40,e,!0,t)}function lv(e){var t=e.teardown;if(t!==null){let r=$d,n=de;iv(!0),Rt(null);try{t.call(null)}finally{iv(r),Rt(n)}}}function cv(e){var t=e.deriveds;if(t!==null){e.deriveds=null;for(var r=0;r{Lt(e),t&&t()})}function dv(e,t){var r=e.length;if(r>0){var n=()=>--r||t();for(var i of e)i.out(n)}else t()}function Fd(e,t,r){if(!(e.f&8192)){if(e.f^=8192,e.transitions!==null)for(let s of e.transitions)(s.is_global||r)&&t.push(s);for(var n=e.first;n!==null;){var i=n.next,a=(n.f&65536)!==0||(n.f&32)!==0;Fd(n,t,a?r:!1),n=i}}}function zi(e){Y3(e,!0)}function Y3(e,t){if(e.f&8192){Hi(e)&&ja(e),e.f^=8192;for(var r=e.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;Y3(r,i?t:!1),r=n}if(e.transitions!==null)for(let a of e.transitions)(a.is_global||t)&&a.in()}}g();var Ld=!1,Z3=!1,hv=[],X3=[];function K3(){Ld=!1;let e=hv.slice();hv=[],Ad(e)}function A7(){Z3=!1;let e=X3.slice();X3=[],Ad(e)}function fr(e){Ld||(Ld=!0,queueMicrotask(K3)),hv.push(e)}function J3(){Ld&&K3(),Z3&&A7()}g();function mc(e){if(G){let t=new Error(`lifecycle_outside_component -\`${e}(...)\` can only be used during component initialisation -https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var iP=0,C7=1,Q3=new WeakSet,Dd=!1,Nd=iP,gc=!1,Ao=null,ii=!1,$d=!1;function vo(e){ii=e}function iv(e){$d=e}var Ga=[],ko=0,vc=[],de=null;function Rt(e){de=e}var te=null;function ot(e){te=e}var ln=null;function M3(e){ln=e}var Ct=null,Ar=0,ni=null;function O3(e){ni=e}var aP=1,ai=!1,fc=null;var pe=null;var Wr=null;function Cd(){return++aP}function ji(){return!ei||pe!==null&&pe.l===null}function Hi(e){var s,o,l,c;var t=e.f;if(t&2048)return!0;if(t&4096){var r=e.deps,n=(t&256)!==0;if(r!==null){var i;if(t&512){for(i=0;ie.version)return!0}}(!n||te!==null&&!ai)&&Zt(e,1024)}return!1}function eP(e,t){for(var r=t;r!==null;){if(r.f&128)try{r.fn(e);return}catch(n){r.f^=128}r=r.parent}throw Dd=!1,e}function tP(e){return(e.f&16384)===0&&(e.parent===null||(e.parent.f&128)===0)}function To(e,t,r,n){var u,f;if(Dd){if(r===null&&(Dd=!1),tP(t))throw e;return}if(r!==null&&(Dd=!0),!G||n===null||!(e instanceof Error)||Q3.has(e)){eP(e,t);return}Q3.add(e);let i=[],a=(u=t.fn)==null?void 0:u.name;a&&i.push(a);let s=n;for(;s!==null;){if(G){var o=(f=s.function)==null?void 0:f[Yt];if(o){let d=o.split("/").pop();i.push(d)}}s=s.p}let l=/Firefox/.test(navigator.userAgent)?" ":" ";It(e,"message",{value:e.message+` -${i.map(d=>` -${l}in ${d}`).join("")} -`}),It(e,"component_stack",{value:i});let c=e.stack;if(c){let d=c.split(` -`),h=[];for(let p=0;p0)for(u.length=Ar+Ct.length,f=0;fe.fn)),vc=[]}function sP(){if(ko>1e3){ko=0;try{_3()}catch(e){if(G&&It(e,"stack",{value:""}),Ao!==null)if(G)try{To(e,Ao,null,null)}catch(t){throw rP(),t}else To(e,Ao,null,null);else throw G&&rP(),e}}ko++}function oP(e){var t=e.length;if(t!==0){sP();var r=ii;ii=!0;try{for(var n=0;n1001)return;let e=Ga;Ga=[],oP(e),gc||(ko=0,Ao=null,G&&(vc=[]))}function wo(e){Nd===iP&&(gc||(gc=!0,queueMicrotask(M7))),Ao=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024))return;t.f^=1024}}Ga.push(t)}function lP(e,t){var r=e.first,n=[];e:for(;r!==null;){var i=r.f,a=(i&32)!==0,s=a&&(i&1024)!==0,o=r.next;if(!s&&!(i&8192))if(i&8){if(a)r.f^=1024;else try{Hi(r)&&ja(r)}catch(f){To(f,r,null,r.ctx)}var l=r.first;if(l!==null){r=l;continue}}else i&4&&n.push(r);if(o===null){let f=r.parent;for(;f!==null;){if(e===f)break e;var c=f.next;if(c!==null){r=c;continue e}f=f.parent}}r=o}for(var u=0;u0||i.length>0)&&Co(),ko=0,Ao=null,G&&(vc=[]),n}finally{Nd=t,Ga=r}}function R(e){var f,d;var t=e.f,r=(t&2)!==0;if(r&&t&16384){var n=rv(e);return pc(e),n}if(fc!==null&&fc.add(e),de!==null){ln!==null&&ln.includes(e)&&T3();var i=de.deps;Ct===null&&i!==null&&i[Ar]===e?Ar++:Ct===null?Ct=[e]:Ct.push(e),ni!==null&&te!==null&&te.f&1024&&!(te.f&32)&&ni.includes(e)&&(Zt(te,2048),wo(te))}else if(r&&e.deps===null)for(var a=e,s=a.parent,o=a;s!==null;)if(s.f&2){var l=s;o=l,s=l.parent}else{var c=s;(f=c.deriveds)!=null&&f.includes(o)||((d=c.deriveds)!=null?d:c.deriveds=[]).push(o);break}if(r&&(a=e,Hi(a)&&nv(a)),G&&ti&&uc!==null&&de!==null&&uc.reaction===de){if(e.debug)e.debug();else if(e.created){var u=uc.entries.get(e);u===void 0&&(u={read:[]},uc.entries.set(e,u)),u.read.push(ri("TracedAt"))}}return e.v}function He(e){let t=de;try{return de=null,e()}finally{de=t}}var O7=-7169;function Zt(e,t){e.f=e.f&O7|t}function Ze(e,t=!1,r){pe={p:pe,c:null,e:null,m:!1,s:e,x:null,l:null},ei&&!t&&(pe.l={s:null,u:null,r1:[],r2:ht(!1)}),G&&(pe.function=r,Wr=r)}function Ke(e){var s,o;let t=pe;if(t!==null){e!==void 0&&(t.x=e);let l=t.e;if(l!==null){var r=te,n=de;t.e=null;try{for(var i=0;i{if(r!==void 0)return r;E3(t)},set:n=>{r=n}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}g();var cP=new Map;function uP(e,t){var r=cP.get(e);r||(r=new Set,cP.set(e,r)),r.add(t)}g();g();g();g();g();g();function pv(e){ae&&Pt(e)!==null&&So(e)}var fP=!1;function mv(){fP||(fP=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(let r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Hd(e){var t=de,r=te;Rt(null),ot(null);try{return e()}finally{Rt(t),ot(r)}}function gv(e,t,r,n=r){e.addEventListener(t,()=>Hd(r));let i=e.__on_r;i?e.__on_r=()=>{i(),n(!0)}:e.__on_r=()=>n(!0),mv()}var vv=new Set,Ud=new Set;function dP(e,t,r,n){function i(a){if(n.capture||Po.call(t,a),!a.cancelBubble)return Hd(()=>r.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?fr(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function kr(e,t,r,n,i){var a={capture:n,passive:i},s=dP(e,t,r,a);(t===document.body||t===window||t===document)&&Xr(()=>{t.removeEventListener(e,s,a)})}function mt(e){for(var t=0;t{throw x});throw d}}finally{e.__root=t,delete e.currentTarget,Rt(u),ot(f)}}}g();var F7;function hP(){F7=void 0}g();g();function Gd(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function In(e,t){var r=te;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function se(e,t){var r=(t&1)!==0,n=(t&2)!==0,i,a=!e.startsWith("");return()=>{if(ae)return In(ue,null),ue;i===void 0&&(i=Gd(a?e:""+e),r||(i=Pt(i)));var s=n?document.importNode(i,!0):i.cloneNode(!0);if(r){var o=Pt(s),l=s.lastChild;In(o,l)}else In(s,s);return s}}function si(){if(ae)return In(ue,null),ue;var e=document.createDocumentFragment(),t=document.createComment(""),r=qr();return e.append(t,r),In(t,r),e}function ne(e,t){if(ae){te.nodes_end=ue,Ft();return}e!==null&&e.before(t)}var zd=!0;function Oe(e,t){var n;var r=t==null?"":typeof t=="object"?t+"":t;r!==((n=e.__t)!=null?n:e.__t=e.nodeValue)&&(e.__t=r,e.nodeValue=r==null?"":r+"")}function Vi(e,t){return pP(e,t)}function wv(e,t){var s;Od(),t.intro=(s=t.intro)!=null?s:!1;let r=t.target,n=ae,i=ue;try{for(var a=Pt(r);a&&(a.nodeType!==8||a.data!==mo);)a=$t(a);if(!a)throw Ni;or(!0),tt(a),Ft();let o=pP(e,{...t,anchor:a});if(ue===null||ue.nodeType!==8||ue.data!==$a)throw bo(),Ni;return or(!1),o}catch(o){if(o===Ni)return t.recover===!1&&x3(),Od(),So(r),or(!1),Vi(e,t);throw o}finally{or(n),tt(i),hP()}}var Ro=new Map;function pP(e,{target:t,anchor:r,props:n={},events:i,context:a,intro:s=!0}){Od();var o=new Set,l=f=>{for(var d=0;d{var f=r!=null?r:t.appendChild(qr());return Nt(()=>{if(a){Ze({});var d=pe;d.c=a}i&&(n.$$events=i),ae&&In(f,null),zd=s,c=e(f,n)||{},zd=!0,ae&&(te.nodes_end=ue),a&&Ke()}),()=>{var p;for(var d of o){t.removeEventListener(d,Po);var h=Ro.get(d);--h===0?(document.removeEventListener(d,Po),Ro.delete(d)):Ro.set(d,h)}Ud.delete(l),f!==r&&((p=f.parentNode)==null||p.removeChild(f))}});return yv.set(c,u),c}var yv=new WeakMap;function oi(e,t){let r=yv.get(e);return r?(yv.delete(e),r(t)):(G&&F3(),Promise.resolve())}g();g();g();g();function ye(e,t,r=!1){ae&&Ft();var n=e,i=null,a=null,s=dt,o=r?65536:0,l=!1;let c=(f,d=!0)=>{l=!0,u(d,f)},u=(f,d)=>{if(s===(s=f))return;let h=!1;if(ae){let p=n.data===Fa;!!s===p&&(n=xo(),tt(n),or(!1),h=!0)}s?(i?zi(i):d&&(i=Nt(()=>d(n))),a&&un(a,()=>{a=null})):(a?zi(a):d&&(a=Nt(()=>d(n))),i&&un(i,()=>{i=null})),h&&or(!0)};ur(()=>{l=!1,t(c),l||u(null,null)},o),ae&&(n=ue)}g();g();g();var yc=null;function Tr(e,t){return t}function U7(e,t,r,n){for(var i=[],a=t.length,s=0;s0&&i.length===0&&r!==null;if(o){var l=r.parentNode;So(l),l.append(r),n.clear(),Wi(e,t[0].prev,t[a-1].next)}dv(i,()=>{for(var c=0;c{var d=r(),h=on(d)?d:d==null?[]:cc(d),p=h.length;if(f&&p===0)return;f=p===0;let m=!1;if(ae){var v=s.data===Fa;v!==(p===0)&&(s=xo(),tt(s),or(!1),m=!0)}if(ae){for(var y=null,b,x=0;x0&&tt(xo())}if(!ae){var k=de;G7(h,o,s,i,t,(k.f&8192)!==0,n,r)}a!==null&&(p===0?u?zi(u):u=Nt(()=>a(s)):u!==null&&un(u,()=>{u=null})),m&&or(!0),r()}),ae&&(s=ue)}function G7(e,t,r,n,i,a,s,o){var ee,fe,J,Q;var l=(i&8)!==0,c=(i&3)!==0,u=e.length,f=t.items,d=t.first,h=d,p,m=null,v,y=[],b=[],x,E,_,k;if(l)for(k=0;k0){var L=i&4&&u===0?r:null;if(l){for(k=0;k{var Pe;if(v!==void 0)for(_ of v)(Pe=_.a)==null||Pe.apply()}),te.first=t.first&&t.first.e,te.last=m&&m.e}function z7(e,t,r,n){n&1&&yo(e.v,t),n&2?yo(e.i,r):e.i=r}function vP(e,t,r,n,i,a,s,o,l,c){var u=yc,f=(l&1)!==0,d=(l&16)===0,h=f?d?Bi(i):ht(i):i,p=l&2?ht(s):s;G&&f&&(h.debug=()=>{var v=typeof p=="number"?s:p.v;c()[v]});var m={i:p,v:h,k:a,a:null,e:null,prev:r,next:n};yc=m;try{return m.e=Nt(()=>o(e,h,p),ae),m.e.prev=r&&r.e,m.e.next=n&&n.e,r===null?t.first=m:(r.next=m,r.e.next=m.e),n!==null&&(n.prev=m,n.e.prev=m.e),m}finally{yc=u}}function mP(e,t,r){for(var n=e.next?e.next.e.nodes_start:r,i=t?t.e.nodes_start:r,a=e.e.nodes_start;a!==n;){var s=$t(a);i.before(a),a=s}}function Wi(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}g();g();g();g();g();g();function wt(e,t){fr(()=>{var i;var r=e.getRootNode(),n=r.host?r:(i=r.head)!=null?i:r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){let a=document.createElement("style");a.id=t.hash,a.textContent=t.code,n.appendChild(a),G&&uP(t.hash,a)}})}g();g();g();g();g();function me(e,t,r,n){var a;var i=(a=e.__attributes)!=null?a:e.__attributes={};if(ae&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")){n||X7(e,t,r!=null?r:"");return}i[t]!==(i[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[g3]=r),r==null?e.removeAttribute(t):typeof r!="string"&&Y7(e).includes(t)?e[t]=r:e.setAttribute(t,r))}var wP=new Map;function Y7(e){var t=wP.get(e.nodeName);if(t)return t;wP.set(e.nodeName,t=[]);for(var r,n=e,i=Element.prototype;i!==n;){r=H0(n);for(var a in r)r[a].set&&t.push(a);n=La(n)}return t}function X7(e,t,r){var n;G&&(t==="srcset"&&Z7(e,r)||xv((n=e.getAttribute(t))!=null?n:"",r)||I3(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r)))}function xv(e,t){return e===t?!0:new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function bP(e){return e.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function Z7(e,t){var r=bP(e.srcset),n=bP(t);return n.length===r.length&&n.every(([i,a],s)=>a===r[s][1]&&(xv(r[s][0],i)||xv(i,r[s][0])))}g();function lt(e,t,r){if(r){if(e.classList.contains(t))return;e.classList.add(t)}else{if(!e.classList.contains(t))return;e.classList.remove(t)}}g();g();g();g();var K7=Ed?()=>performance.now():()=>Date.now(),fn={tick:e=>(Ed?requestAnimationFrame:xr)(e),now:()=>K7(),tasks:new Set};function _P(){let e=fn.now();fn.tasks.forEach(t=>{t.c(e)||(fn.tasks.delete(t),t.f())}),fn.tasks.size!==0&&fn.tick(_P)}function xP(e){let t;return fn.tasks.size===0&&fn.tick(_P),{promise:new Promise(r=>{fn.tasks.add(t={c:e,f:r})}),abort(){fn.tasks.delete(t)}}}function Vd(e,t){e.dispatchEvent(new CustomEvent(t))}function t9(e){if(e==="float")return"cssFloat";if(e==="offset")return"cssOffset";if(e.startsWith("--"))return e;let t=e.split("-");return t.length===1?t[0]:t[0]+t.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function SP(e){let t={},r=e.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let s=t9(i.trim());t[s]=a.trim()}return t}var r9=e=>e;function dn(e,t,r,n){var b;var i=(e&1)!==0,a=(e&2)!==0,s=i&&a,o=(e&4)!==0,l=s?"both":i?"in":"out",c,u=t.inert,f,d;function h(){var _;var x=de,E=te;Rt(null),ot(null);try{return c!=null?c:c=r()(t,(_=n==null?void 0:n())!=null?_:{},{direction:l})}finally{Rt(x),ot(E)}}var p={is_global:o,in(){var x;if(t.inert=u,!i){d==null||d.abort(),(x=d==null?void 0:d.reset)==null||x.call(d);return}a||f==null||f.abort(),Vd(t,"introstart"),f=Sv(t,h(),d,1,()=>{Vd(t,"introend"),f==null||f.abort(),f=c=void 0})},out(x){if(!a){x==null||x(),c=void 0;return}t.inert=!0,Vd(t,"outrostart"),d=Sv(t,h(),f,0,()=>{Vd(t,"outroend"),x==null||x()})},stop:()=>{f==null||f.abort(),d==null||d.abort()}},m=te;if(((b=m.transitions)!=null?b:m.transitions=[]).push(p),i&&zd){var v=o;if(!v){for(var y=m.parent;y&&y.f&65536;)for(;(y=y.parent)&&!(y.f&16););v=!y||(y.f&32768)!==0}v&&Er(()=>{He(()=>p.in())})}}function Sv(e,t,r,n,i){var a=n===1;if(G0(t)){var s,o=!1;return fr(()=>{if(!o){var v=t({direction:a?"in":"out"});s=Sv(e,v,r,n,i)}}),{abort:()=>{o=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(t!=null&&t.duration))return i(),{abort:xr,deactivate:xr,reset:xr,t:()=>n};let{delay:l=0,css:c,tick:u,easing:f=r9}=t;var d=[];if(a&&r===void 0&&(u&&u(0,1),c)){var h=SP(c(0,1));d.push(h,h)}var p=()=>1-n,m=e.animate(d,{duration:l});return m.onfinish=()=>{var A;var v=(A=r==null?void 0:r.t())!=null?A:1-n;r==null||r.abort();var y=n-v,b=t.duration*Math.abs(y),x=[];if(b>0){if(c)for(var E=Math.ceil(b/16.666666666666668),_=0;_<=E;_+=1){var k=v+y*f(_/E),w=c(k,1-k);x.push(SP(w))}p=()=>{var S=m.currentTime;return v+y*f(S/b)},u&&xP(()=>{if(m.playState!=="running")return!1;var S=p();return u(S,1-S),!0})}m=e.animate(x,{duration:b,fill:"forwards"}),m.onfinish=()=>{p=()=>n,u==null||u(n,1-n),i()}},{abort:()=>{m&&(m.cancel(),m.effect=null,m.onfinish=xr)},deactivate:()=>{i=xr},reset:()=>{n===0&&(u==null||u(1,0))},t:()=>p()}}g();g();function kv(e,t,r=t){var n=ji();gv(e,"input",i=>{G&&e.type==="checkbox"&&V0();var a=i?e.defaultValue:e.value;if(a=Ev(e)?Av(a):a,r(a),n&&a!==(a=t())){var s=e.selectionStart,o=e.selectionEnd;e.value=a!=null?a:"",o!==null&&(e.selectionStart=s,e.selectionEnd=Math.min(o,e.value.length))}}),(ae&&e.defaultValue!==e.value||He(t)==null&&e.value)&&r(Ev(e)?Av(e.value):e.value),lr(()=>{G&&e.type==="checkbox"&&V0();var i=t();Ev(e)&&i===Av(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i!=null?i:"")})}function Ev(e){var t=e.type;return t==="number"||t==="range"}function Av(e){return e===""?null:+e}g();g();g();g();g();g();function EP(e,t){return e===t||(e==null?void 0:e[Sr])===t}function Ue(e={},t,r,n){return Er(()=>{var i,a;return lr(()=>{i=a,a=(n==null?void 0:n())||[],He(()=>{e!==r(...a)&&(t(e,...a),i&&EP(r(...i),e)&&t(null,...i))})}),()=>{fr(()=>{a&&EP(r(...a),e)&&t(null,...a)})}}),e}g();g();g();g();g();g();g();g();g();function Tv(e){pe===null&&mc("onMount"),ei&&pe.l!==null?c9(pe).m.push(e):Dt(()=>{let t=He(e);if(typeof t=="function")return t})}function AP(e){pe===null&&mc("onDestroy"),Tv(()=>()=>He(e))}function c9(e){var r;var t=e.l;return(r=t.u)!=null?r:t.u={a:[],b:[],m:[]}}var qd=!1;function Cv(e){var t=qd;try{return qd=!1,[e(),qd]}finally{qd=t}}function kP(e){for(var t=te,r=te;t!==null&&!(t.f&96);)t=t.parent;try{return ot(t),e()}finally{ot(r)}}function Fn(e,t,r,n){var w,A;var i=(r&1)!==0,a=!ei||(r&2)!==0,s=(r&8)!==0,o=(r&16)!==0,l=!1,c;s?[c,l]=Cv(()=>e[t]):c=e[t];var u=Sr in e||kd in e,f=(A=(w=Ur(e,t))==null?void 0:w.set)!=null?A:u&&s&&t in e?S=>e[t]=S:void 0,d=n,h=!0,p=!1,m=()=>(p=!0,h&&(h=!1,o?d=He(n):d=n),d);c===void 0&&n!==void 0&&(f&&a&&S3(t),c=m(),f&&f(c));var v;if(a)v=()=>{var S=e[t];return S===void 0?m():(h=!0,p=!1,S)};else{var y=kP(()=>(i?Xe:tv)(()=>e[t]));y.f|=131072,v=()=>{var S=R(y);return S!==void 0&&(d=void 0),S===void 0?d:S}}if(!(r&4))return v;if(f){var b=e.$$legacy;return function(S,T){return arguments.length>0?((!a||!T||b||l)&&f(T?v():S),S):v()}}var x=!1,E=!1,_=Bi(c),k=kP(()=>Xe(()=>{var S=v(),T=R(_);return x?(x=!1,E=!0,T):(E=!1,_.v=S)}));return i||(k.equals=go),function(S,T){if(fc!==null&&(x=E,v(),R(_)),arguments.length>0){let P=T?R(k):a&&s?_e(S):S;return k.equals(P)||(x=!0,re(_,P),p&&d!==void 0&&(d=P),He(()=>R(k))),S}return R(k)}}g();g();g();g();function TP(e){return new Pv(e)}var li,Zr,Pv=class{constructor(t){Tc(this,li);Tc(this,Zr);var a,s;var r=new Map,n=(o,l)=>{var c=Bi(l);return r.set(o,c),c};let i=new Proxy({...t.props||{},$$events:{}},{get(o,l){var c;return R((c=r.get(l))!=null?c:n(l,Reflect.get(o,l)))},has(o,l){var c;return l===kd?!0:(R((c=r.get(l))!=null?c:n(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return re((u=r.get(l))!=null?u:n(l,c),c),Reflect.set(o,l,c)}});Cc(this,Zr,(t.hydrate?wv:Vi)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:(a=t.intro)!=null?a:!1,recover:t.recover})),(!((s=t==null?void 0:t.props)!=null&&s.$$host)||t.sync===!1)&&Co(),Cc(this,li,i.$$events);for(let o of Object.keys(Ht(this,Zr)))o==="$set"||o==="$destroy"||o==="$on"||It(this,o,{get(){return Ht(this,Zr)[o]},set(l){Ht(this,Zr)[o]=l},enumerable:!0});Ht(this,Zr).$set=o=>{Object.assign(i,o)},Ht(this,Zr).$destroy=()=>{oi(Ht(this,Zr))}}$set(t){Ht(this,Zr).$set(t)}$on(t,r){Ht(this,li)[t]=Ht(this,li)[t]||[];let n=(...i)=>r.call(this,...i);return Ht(this,li)[t].push(n),()=>{Ht(this,li)[t]=Ht(this,li)[t].filter(i=>i!==n)}}$destroy(){Ht(this,Zr).$destroy()}};li=new WeakMap,Zr=new WeakMap;var x9;typeof HTMLElement=="function"&&(x9=class extends HTMLElement{constructor(t,r,n){super();Pr(this,"$$ctor");Pr(this,"$$s");Pr(this,"$$c");Pr(this,"$$cn",!1);Pr(this,"$$d",{});Pr(this,"$$r",!1);Pr(this,"$$p_d",{});Pr(this,"$$l",{});Pr(this,"$$l_u",new Map);Pr(this,"$$me");this.$$ctor=t,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(t,r,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(r),this.$$c){let i=this.$$c.$on(t,r);this.$$l_u.set(r,i)}super.addEventListener(t,r,n)}removeEventListener(t,r,n){if(super.removeEventListener(t,r,n),this.$$c){let i=this.$$l_u.get(r);i&&(i(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(i){return a=>{let s=document.createElement("slot");i!=="default"&&(s.name=i),ne(a,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},n=S9(this);for(let i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=t(i),r.default=!0):r[i]=t(i));for(let i of this.attributes){let a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=Rv(a,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=TP({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=ov(()=>{lr(()=>{var i;this.$$r=!0;for(let a of j0(this.$$c)){if(!((i=this.$$p_d[a])!=null&&i.reflect))continue;this.$$d[a]=this.$$c[a];let s=Rv(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1})});for(let i in this.$$l)for(let a of this.$$l[i]){let s=this.$$c.$on(i,a);this.$$l_u.set(a,s)}this.$$l={}}}attributeChangedCallback(t,r,n){var i;this.$$r||(t=this.$$g_p(t),this.$$d[t]=Rv(t,n,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return j0(this.$$p_d).find(r=>this.$$p_d[r].attribute===t||!this.$$p_d[r].attribute&&r.toLowerCase()===t)||t}});function Rv(e,t,r,n){var a;let i=(a=r[e])==null?void 0:a.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(i){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t==null?null:t;default:return t}else switch(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function S9(e){let t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}g();g();g();function Mo(e,t,r,n){function i(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(f){s(f)}}function l(u){try{c(n.throw(u))}catch(f){s(f)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}var Iv=require("obsidian");g();var Mv=require("obsidian");g();function A9(e){let t=e-1;return t*t*t+1}function Ln(e,{delay:t=0,duration:r=400,easing:n=A9,axis:i="y"}={}){let a=getComputedStyle(e),s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),f=parseFloat(a[`padding${u[0]}`]),d=parseFloat(a[`padding${u[1]}`]),h=parseFloat(a[`margin${u[0]}`]),p=parseFloat(a[`margin${u[1]}`]),m=parseFloat(a[`border${u[0]}Width`]),v=parseFloat(a[`border${u[1]}Width`]);return{delay:t,duration:r,easing:n,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*s};${o}: ${y*l}px;padding-${c[0]}: ${y*f}px;padding-${c[1]}: ${y*d}px;margin-${c[0]}: ${y*h}px;margin-${c[1]}: ${y*p}px;border-${c[0]}-width: ${y*m}px;border-${c[1]}-width: ${y*v}px;`}}g();var Yd=require("obsidian");var k9=se('
'),T9=se('
'),C9={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function wc(e,t){Ze(t,!0),wt(e,C9);let r=_e([]),n=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");Dt(()=>{for(let y of r)y&&(0,Yd.setIcon)(y,y.getAttr("data-icon"))});function i(y){y.stopPropagation(),Ws(t.diff.path)?a(y):s(y)}function a(y){var b;y.stopPropagation();let x=t.view.app.vault.getAbstractFileByPath(t.diff.vaultPath);x instanceof Yd.TFile&&((b=nn(t.view.app,y))===null||b===void 0||b.openFile(x).catch(E=>t.view.plugin.displayError(E)))}function s(y){var b;t.view.plugin.tools.openDiff({event:y,aFile:(b=t.diff.fromPath)!==null&&b!==void 0?b:t.diff.path,aRef:`${t.diff.hash}^`,bFile:t.diff.path,bRef:t.diff.hash})}var o=T9();o.__click=i;var l=j(o),c=j(l),u=j(c,!0);Ae(()=>Oe(u,Cn(t.diff.vaultPath))),B(c);var f=Z(c,2),d=j(f),h=j(d);{var p=y=>{var b=k9();b.__click=a,Ue(b,x=>r[0]=x,()=>r==null?void 0:r[0]),kr("auxclick",b,a),ne(y,b)};ye(h,y=>{qs(t.diff.vaultPath,t.view.app)&&y(p)})}B(d);var m=Z(d,2),v=j(m,!0);B(m),B(f),B(l),B(o),Ae(()=>{me(l,"data-path",t.diff.vaultPath),me(l,"data-tooltip-position",R(n)),me(l,"aria-label",t.diff.vaultPath),me(m,"data-type",t.diff.status),Oe(v,t.diff.status)}),kr("auxclick",o,y=>{y.stopPropagation(),y.button==2?Tn(t.view.app,y,t.diff.vaultPath,t.view.leaf,"git-history"):i(y)}),ne(e,o),Ke()}mt(["click"]);g();var P9=se("
"),R9=(e,t,r)=>t(R(r)),M9=se(''),O9=se(''),I9=se('
'),F9={hash:"svelte-1lnl15d",code:"main.svelte-1lnl15d .nav-folder-title-content:where(.svelte-1lnl15d) {display:flex;align-items:center;}"};function bc(e,t){Ze(t,!0),wt(e,F9);let r=Fn(t,"topLevel",3,!1),n=_e({}),i=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");function a(o){n[o.title]=!n[o.title]}var s=I9();Cr(s,21,()=>t.hierarchy.children,Tr,(o,l)=>{var c=si(),u=cr(c);{var f=h=>{var p=P9(),m=j(p);wc(m,{get diff(){return R(l).data},get view(){return t.view}}),B(p),ne(h,p)},d=h=>{var p=O9(),m=j(p);m.__click=[R9,a,l];var v=Z(j(m),2),y=Z(v,2),b=j(y,!0);B(y),B(m);var x=Z(m,2);{var E=_=>{var k=M9(),w=j(k);bc(w,{get hierarchy(){return R(l)},get plugin(){return t.plugin},get view(){return t.view}}),B(k),dn(3,k,()=>Ln,()=>({duration:150})),ne(_,k)};ye(x,_=>{n[R(l).title]||_(E)})}B(p),Ae(()=>{lt(p,"is-collapsed",n[R(l).title]),me(m,"data-tooltip-position",R(i)),me(m,"aria-label",R(l).vaultPath),lt(v,"is-collapsed",n[R(l).title]),Oe(b,R(l).title)}),ne(h,p)};ye(u,h=>{R(l).data?h(f):h(d,!1)})}ne(o,c)}),B(s),Ae(()=>lt(s,"topLevel",r())),ne(e,s),Ke()}mt(["click"]);var $9=(e,t)=>re(t,!R(t)),L9=se('
'),D9=se('
'),N9=se('
'),B9=se(''),j9=se('
'),H9={hash:"svelte-45h",code:""};function Ov(e,t){Ze(t,!0),wt(e,H9);let r=Xe(()=>({title:"",path:"",vaultPath:"",children:t.plugin.gitManager.getTreeStructure(t.log.diff.files)})),n=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left"),i=pt(!0);function a(_){let k=_.author.name;if(t.plugin.settings.authorInHistoryView=="full")return k;if(t.plugin.settings.authorInHistoryView=="initials")return k.split(" ").filter(A=>A.length>0).map(A=>A[0].toUpperCase()).join("")}var s=j9(),o=j(s),l=j(o);Ae(()=>{var _;return me(l,"aria-label",`${t.log.refs.length>0?t.log.refs.join(", ")+` -`:""}${(_=t.log.author)==null?void 0:_.name} -${(0,Mv.moment)(t.log.date).format(t.plugin.settings.commitDateFormat)} -${t.log.message}`)}),l.__click=[$9,i];var c=j(l),u=Z(c,2),f=j(u);{var d=_=>{var k=L9(),w=j(k,!0);Ae(()=>Oe(w,t.log.refs.join(", "))),B(k),ne(_,k)};ye(f,_=>{t.log.refs.length>0&&_(d)})}var h=Z(f,2);{var p=_=>{var k=D9(),w=j(k,!0);Ae(()=>Oe(w,a(t.log))),B(k),ne(_,k)};ye(h,_=>{var k;t.plugin.settings.authorInHistoryView!="hide"&&((k=t.log.author)!=null&&k.name)&&_(p)})}var m=Z(h,2);{var v=_=>{var k=N9(),w=j(k,!0);Ae(()=>Oe(w,(0,Mv.moment)(t.log.date).format(t.plugin.settings.commitDateFormat))),B(k),ne(_,k)};ye(m,_=>{t.plugin.settings.dateInHistoryView&&_(v)})}var y=Z(m,2),b=j(y,!0);B(y),B(u),B(l);var x=Z(l,2);{var E=_=>{var k=B9(),w=j(k);{var A=T=>{bc(T,{get hierarchy(){return R(r)},get plugin(){return t.plugin},get view(){return t.view},topLevel:!0})},S=T=>{var P=si(),I=cr(P);Cr(I,17,()=>t.log.diff.files,Tr,(N,L)=>{wc(N,{get view(){return t.view},get diff(){return R(L)}})}),ne(T,P)};ye(w,T=>{t.showTree?T(A):T(S,!1)})}B(k),dn(3,k,()=>Ln,()=>({duration:150})),ne(_,k)};ye(x,_=>{R(i)||_(E)})}B(o),B(s),Ae(()=>{lt(o,"is-collapsed",R(i)),me(l,"data-tooltip-position",R(n)),lt(c,"is-collapsed",R(i)),Oe(b,t.log.message)}),ne(e,s),Ke()}mt(["click"]);function U9(e,t){t().catch(console.error)}var G9=(e,t,r,n)=>{re(t,!R(t)),(0,Iv.setIcon)(r[0],R(t)?"list":"folder"),n(n().settings.treeStructure=R(t),!0),n().saveSettings()},z9=se(''),V9=se('
'),W9={hash:"svelte-45h",code:""};function Fv(e,t){Ze(t,!0),wt(e,W9);let r=Fn(t,"plugin",15),n=pt(!1),i=_e([]),a=pt(void 0),s=pt(_e(r().settings.treeStructure)),o,l;Dt(()=>{l&&l.empty()}),o=t.view.app.workspace.on("obsidian-git:head-change",()=>void c().catch(console.error)),Dt(()=>{i.forEach(x=>(0,Iv.setIcon)(x,x.getAttr("data-icon")))}),AP(()=>{t.view.app.workspace.offref(o)}),Tv(()=>{let x=new IntersectionObserver(_=>{_[0].isIntersecting&&!R(n)&&u().catch(console.error)}),E=document.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),c().catch(console.error);function c(){return Mo(this,void 0,void 0,function*(){var x;if(!r().gitReady){re(a,void 0);return}re(n,!0);let E=r().gitManager instanceof Ce,_;((x=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&x!==void 0?x:0)==0?_=E?50:10:_=R(a).length,re(a,_e(yield r().gitManager.log(void 0,!1,_))),re(n,!1)})}function u(){return Mo(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(a)===void 0)return;re(n,!0);let _=r().gitManager instanceof Ce?50:10,k=yield r().gitManager.log(void 0,!1,_,(x=R(a).last())===null||x===void 0?void 0:x.hash);R(a).push(...k.slice(1)),re(n,!1)})}var f=V9(),d=j(f),h=j(d),p=j(h);p.__click=[G9,s,i,r],Ue(p,x=>i[0]=x,()=>i==null?void 0:i[0]);var m=Z(p,2);m.__click=[U9,c],Ue(m,x=>i[1]=x,()=>i==null?void 0:i[1]),B(h),B(d);var v=Z(d,2),y=j(v);{var b=x=>{var E=z9();Cr(E,21,()=>R(a),Tr,(_,k)=>{Ov(_,{get view(){return t.view},get showTree(){return R(s)},get log(){return R(k)},get plugin(){return r()}})}),B(E),ne(x,E)};ye(y,x=>{R(a)&&x(b)})}_o(4),B(v),B(f),Ae(()=>{me(p,"data-icon",R(s)?"list":"folder"),lt(m,"loading",R(n))}),ne(e,f),Ke()}mt(["click"]);var _c=class extends CP.ItemView{constructor(t,r){super(t),this.plugin=r,this.hoverPopover=null}getViewType(){return Lr.type}getDisplayText(){return Lr.name}getIcon(){return Lr.icon}onClose(){return this._view&&oi(this._view),super.onClose()}reload(){this._view&&oi(this._view),this._view=Vi(Fv,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};g();var PP=require("obsidian"),Xd=class extends PP.FuzzySuggestModal{constructor(r,n){super(r.app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,n){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};g();var $P=require("obsidian");g();var qa=require("obsidian");g();var RP=require("obsidian"),qi=class extends RP.Modal{constructor(r,n,i){super(r);this.deletion=n;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let{contentEl:r,titleEl:n}=this;n.setText(`${this.deletion?"Delete":"Discard"} this file?`),r.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=r.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",()=>{this.resolve&&this.resolve(!0),this.close()}),a.addEventListener("keypress",()=>{this.resolve&&this.resolve(!0),this.close()});let s=i.createEl("button",{text:"Cancel"});s.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),s.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};g();var Zd=require("obsidian");g();g();var q9=ze(MP()),Yi=require("obsidian");function za(e,t,r){let n=e.target;app.workspace.trigger("hover-link",{event:e,source:t.getViewType(),hoverParent:t,targetEl:n,linktext:r})}function Y9(e,t){t.view.app.vault.getAbstractFileByPath(t.change.vaultPath)&&za(e,t.view,t.change.vaultPath)}function X9(e,t){e.stopPropagation(),t.manager.stage(t.change.path,!1).catch(r=>t.view.plugin.displayError(r)).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})}function Z9(e,t){e.stopPropagation();let r=t.change.workingDir=="U";new qi(t.view.app,r,t.change.vaultPath).myOpen().then(n=>{if(n===!0)return r?t.view.app.vault.adapter.remove(t.change.vaultPath).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")}):t.manager.discard(t.change.path).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})},n=>t.view.plugin.displayError(n))}var K9=se('
'),J9=se('
'),Q9={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function Sc(e,t){Ze(t,!0),wt(e,Q9);let r=_e([]),n=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");Dt(()=>{for(let x of r)x&&(0,Zd.setIcon)(x,x.getAttr("data-icon"))});function i(x){x.stopPropagation(),Ws(t.change.path)?a(x):s(x)}function a(x){var E;x.stopPropagation();let _=t.view.app.vault.getAbstractFileByPath(t.change.vaultPath);_ instanceof Zd.TFile&&((E=nn(t.view.app,x))===null||E===void 0||E.openFile(_).catch(k=>t.view.plugin.displayError(k)))}function s(x){x.stopPropagation(),t.view.plugin.tools.openDiff({aFile:t.change.path,aRef:"",event:x})}var o=J9();o.__mouseover=[Y9,t],o.__click=i;var l=j(o),c=j(l),u=j(c,!0);Ae(()=>Oe(u,Cn(t.change.vaultPath))),B(c);var f=Z(c,2),d=j(f),h=j(d);{var p=x=>{var E=K9();E.__click=a,Ue(E,_=>r[0]=_,()=>r==null?void 0:r[0]),kr("auxclick",E,a),ne(x,E)};ye(h,x=>{qs(t.change.vaultPath,t.view.app)&&x(p)})}var m=Z(h,2);m.__click=[Z9,t],Ue(m,x=>r[1]=x,()=>r==null?void 0:r[1]);var v=Z(m,2);v.__click=[X9,t],Ue(v,x=>r[2]=x,()=>r==null?void 0:r[2]),B(d);var y=Z(d,2),b=j(y,!0);B(y),B(f),B(l),B(o),Ae(()=>{me(l,"data-path",t.change.vaultPath),me(l,"data-tooltip-position",R(n)),me(l,"aria-label",t.change.vaultPath),me(y,"data-type",t.change.workingDir),Oe(b,t.change.workingDir)}),kr("auxclick",o,x=>{x.stopPropagation(),x.button==2?Tn(t.view.app,x,t.change.vaultPath,t.view.leaf,"git-source-control"):i(x)}),ne(e,o),Ke()}mt(["mouseover","click"]);g();var OP=require("obsidian");function eH(e,t){t.view.app.vault.getAbstractFileByPath(t.change.vaultPath)&&za(e,t.view,t.change.vaultPath)}var tH=se('
'),rH={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function Ec(e,t){Ze(t,!0),wt(e,rH);let r=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");function n(f){var d;f.stopPropagation();let h=t.view.app.vault.getAbstractFileByPath(t.change.vaultPath);h instanceof OP.TFile&&((d=nn(t.view.app,f))===null||d===void 0||d.openFile(h).catch(p=>t.view.plugin.displayError(p)))}var i=tH();i.__mouseover=[eH,t],i.__click=n;var a=j(i),s=j(a),o=j(s,!0);Ae(()=>Oe(o,Cn(t.change.vaultPath))),B(s);var l=Z(s,2),c=j(l),u=j(c,!0);B(c),B(l),B(a),B(i),Ae(()=>{me(a,"data-path",t.change.vaultPath),me(a,"data-tooltip-position",R(r)),me(a,"aria-label",t.change.vaultPath),me(c,"data-type",t.change.workingDir),Oe(u,t.change.workingDir)}),kr("auxclick",i,f=>{f.stopPropagation(),f.button==2?Tn(t.view.app,f,t.change.vaultPath,t.view.leaf,"git-source-control"):n(f)}),ne(e,i),Ke()}mt(["mouseover","click"]);g();var Kd=require("obsidian");function nH(e,t){t.view.app.vault.getFileByPath(t.change.vaultPath)&&za(e,t.view,t.change.vaultPath)}function iH(e,t){e.stopPropagation(),t.manager.unstage(t.change.path,!1).catch(r=>t.view.plugin.displayError(r)).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})}var aH=se('
'),sH=se('
'),oH={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function Ac(e,t){Ze(t,!0),wt(e,oH);let r=_e([]),n=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");Dt(()=>{for(let b of r)b&&(0,Kd.setIcon)(b,b.getAttr("data-icon"))});function i(b){b.stopPropagation(),Ws(t.change.path)?a(b):s(b)}function a(b){var x;b.stopPropagation();let E=t.view.app.vault.getAbstractFileByPath(t.change.vaultPath);E instanceof Kd.TFile&&((x=nn(t.view.app,b))===null||x===void 0||x.openFile(E).catch(_=>t.view.plugin.displayError(_)))}function s(b){b.stopPropagation(),t.view.plugin.tools.openDiff({aFile:t.change.path,aRef:"HEAD",bRef:"",event:b})}var o=sH();o.__mouseover=[nH,t],o.__click=i;var l=j(o),c=j(l),u=j(c,!0);Ae(()=>Oe(u,Cn(t.change.vaultPath))),B(c);var f=Z(c,2),d=j(f),h=j(d);{var p=b=>{var x=aH();x.__click=a,Ue(x,E=>r[0]=E,()=>r==null?void 0:r[0]),ne(b,x)};ye(h,b=>{qs(t.change.vaultPath,t.view.app)&&b(p)})}var m=Z(h,2);m.__click=[iH,t],Ue(m,b=>r[1]=b,()=>r==null?void 0:r[1]),B(d);var v=Z(d,2),y=j(v,!0);B(v),B(f),B(l),B(o),Ae(()=>{me(l,"data-path",t.change.vaultPath),me(l,"data-tooltip-position",R(n)),me(l,"aria-label",t.change.vaultPath),me(v,"data-type",t.change.index),Oe(y,t.change.index)}),kr("auxclick",o,b=>{b.stopPropagation(),b.button==2?Tn(t.view.app,b,t.change.vaultPath,t.view.leaf,"git-source-control"):i(b)}),ne(e,o),Ke()}mt(["mouseover","click"]);g();g();var lH=se(''),cH=se("
");function Va(e,t){Ze(t,!0);var r=cH(),n=j(r);{var i=a=>{var s=lH(),o=j(s),l=j(o),c=j(l,!0);B(l),B(o),B(s),Ae(()=>{me(o,"aria-label","And "+(t.files.length-500)+" more files"),Oe(c,"And "+(t.files.length-500)+" more files")}),ne(a,s)};ye(n,a=>{t.files.length>500&&a(i)})}B(r),ne(e,r),Ke()}var fH=se("
"),dH=(e,t,r)=>t(R(r)),hH=(e,t,r)=>t(e,R(r).path),pH=se('
'),mH=(e,t,r)=>t(e,R(r)),gH=(e,t,r)=>t(e,R(r).path),vH=se('
',1),yH=se(''),wH=se(''),bH=se('
'),_H={hash:"svelte-hup5mn",code:"main.svelte-hup5mn .nav-folder-title:where(.svelte-hup5mn) {align-items:center;}"};function Wa(e,t){Ze(t,!0),wt(e,_H);var r,n;let i=Fn(t,"topLevel",3,!1),a=_e({});for(let p of t.hierarchy.children)a[p.title]=((n=(r=p.children)===null||r===void 0?void 0:r.length)!==null&&n!==void 0?n:0)>100;let s=Xe(()=>t.view.leaf.getRoot().side=="left"?"right":"left");function o(p,m){p.stopPropagation(),t.plugin.gitManager.stageAll({dir:m}).catch(v=>t.plugin.displayError(v)).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})}function l(p,m){p.stopPropagation(),t.plugin.gitManager.unstageAll({dir:m}).catch(v=>t.plugin.displayError(v)).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})}function c(p,m){p.stopPropagation(),new qi(t.view.app,!1,m.vaultPath).myOpen().then(v=>{if(v===!0)return t.plugin.gitManager.discardAll({dir:m.path,status:t.plugin.cachedStatus}).finally(()=>{t.view.app.workspace.trigger("obsidian-git:refresh")})},v=>t.plugin.displayError(v))}function u(p){a[p.title]=!a[p.title]}var f=bH(),d=j(f);Cr(d,17,()=>ql(t.hierarchy.children,500),Tr,(p,m)=>{var v=si(),y=cr(v);{var b=E=>{var _=fH(),k=j(_);{var w=S=>{Ac(S,{get change(){return R(m).data},get manager(){return t.plugin.gitManager},get view(){return t.view}})},A=S=>{var T=si(),P=cr(T);{var I=L=>{Sc(L,{get change(){return R(m).data},get manager(){return t.plugin.gitManager},get view(){return t.view}})},N=L=>{var ee=si(),fe=cr(ee);{var J=Q=>{Ec(Q,{get change(){return R(m).data},get view(){return t.view}})};ye(fe,Q=>{t.fileType==2&&Q(J)},!0)}ne(L,ee)};ye(P,L=>{t.fileType==1?L(I):L(N,!1)},!0)}ne(S,T)};ye(k,S=>{t.fileType==0?S(w):S(A,!1)})}B(_),ne(E,_)},x=E=>{var _=wH();_.__click=[dH,u,m];var k=j(_),w=Z(j(k),2),A=Z(w,2),S=j(A,!0);B(A);var T=Z(A,2),P=j(T),I=j(P);{var N=J=>{var Q=pH();Q.__click=[hH,l,m],ne(J,Q)},L=J=>{var Q=vH(),Pe=cr(Q);Pe.__click=[mH,c,m];var ge=Z(Pe,2);ge.__click=[gH,o,m],ne(J,Q)};ye(I,J=>{t.fileType==0?J(N):J(L,!1)})}_o(2),B(P),B(T),B(k);var ee=Z(k,2);{var fe=J=>{var Q=yH(),Pe=j(Q);Wa(Pe,{get hierarchy(){return R(m)},get plugin(){return t.plugin},get view(){return t.view},get fileType(){return t.fileType}}),B(Q),dn(3,Q,()=>Ln,()=>({duration:150})),ne(J,Q)};ye(ee,J=>{a[R(m).title]||J(fe)})}B(_),Ae(()=>{lt(_,"is-collapsed",a[R(m).title]),me(k,"data-tooltip-position",R(s)),me(k,"aria-label",R(m).vaultPath),lt(w,"is-collapsed",a[R(m).title]),Oe(S,R(m).title)}),kr("auxclick",_,J=>Tn(t.view.app,J,R(m).vaultPath,t.view.leaf,"git-source-control")),ne(E,_)};ye(y,E=>{R(m).data?E(b):E(x,!1)})}ne(p,v)});var h=Z(d,2);Va(h,{get files(){return t.hierarchy.children}}),B(f),Ae(()=>lt(f,"topLevel",i())),ne(e,f),Ke()}mt(["click"]);function xH(e,t,r,n,i,a){return Mo(this,void 0,void 0,function*(){if(re(t,!0),R(r)){if(yield n().tools.hasTooBigFiles(R(r).staged))return n().setPluginState({gitAction:0}),!1;n().promiseQueue.addTask(()=>n().gitManager.commit({message:R(i)}).then(()=>re(i,_e(n().settings.commitMessage))).finally(a))}})}function IP(e,t,r,n,i){re(t,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:R(n)}).finally(i))}function FP(e,t,r,n,i){re(t,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:R(n)}).finally(i))}function SH(e,t,r,n){re(t,!0),r().promiseQueue.addTask(()=>r().push().finally(n))}function EH(e,t,r,n){re(t,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(n))}function AH(e,t,r){e.stopPropagation(),new qi(t().app,!1,r().gitManager.getRelativeVaultPath("/")).myOpen().then(n=>{n===!0&&r().promiseQueue.addTask(()=>r().gitManager.discardAll({status:r().cachedStatus}).finally(()=>{t().app.workspace.trigger("obsidian-git:refresh")}))},console.error)}var kH=(e,t,r,n)=>{re(t,!R(t)),(0,qa.setIcon)(r[6],R(t)?"list":"folder"),n().settings.treeStructure=R(t),n().saveSettings()},TH=(e,t)=>re(t,""),CH=se('
'),PH=(e,t)=>re(t,!R(t)),RH=se(" ",1),MH=se(''),OH=(e,t)=>re(t,!R(t)),IH=se(" ",1),FH=se(''),$H=(e,t)=>re(t,!R(t)),LH=se(" ",1),DH=se(''),NH=se(''),BH=se(''),jH=se('
'),HH={hash:"svelte-11adhly",code:`.commit-msg-input.svelte-11adhly {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-11adhly {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-11adhly .git-tools:where(.svelte-11adhly) .files-count:where(.svelte-11adhly) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-11adhly {align-items:center;}.git-commit-msg-clear-button.svelte-11adhly {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-11adhly: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 Lv(e,t){Ze(t,!0),wt(e,HH);let r=Fn(t,"plugin",7),n=Fn(t,"view",7),i=pt(!1),a=pt(void 0),s=pt(_e([])),o=pt(_e(r().settings.commitMessage)),l=_e([]),c=pt(void 0),u=pt(void 0),f=pt(void 0),d=pt(!0),h=pt(!0),p=pt(!0),m=pt(0),v=pt(_e(r().settings.treeStructure));n().registerEvent(n().app.workspace.on("obsidian-git:loading-status",()=>re(i,!0))),n().registerEvent(n().app.workspace.on("obsidian-git:status-changed",()=>void b().catch(console.error))),n().plugin.cachedStatus==null?n().plugin.refresh().catch(console.error):b().catch(console.error),Dt(()=>{l.forEach(O=>(0,qa.setIcon)(O,O.getAttr("data-icon")))}),Dt(()=>{l.forEach(O=>{var he,Ge;!O||O.id!="push"||(qa.Platform.isMobile?(O.removeClass("button-border"),R(m)>0&&O.addClass("button-border")):((he=O.firstElementChild)===null||he===void 0||he.removeAttribute("color"),R(m)>0&&((Ge=O.firstElementChild)===null||Ge===void 0||Ge.setAttr("color","var(--text-accent)"))))})}),n().scope=new qa.Scope(r().app.scope),n().scope.register(["Ctrl"],"Enter",O=>y());function y(){if(re(i,!0),R(a)){let O=R(a).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:R(o),onlyStaged:O}).then(()=>{re(o,_e(r().settings.commitMessage))}).finally(x))}}function b(){return Mo(this,void 0,void 0,function*(){if(!r().gitReady){re(a,void 0);return}if(re(m,_e(yield r().gitManager.getUnpushedCommits())),re(a,_e(r().cachedStatus)),re(i,!1),r().lastPulledFiles&&r().lastPulledFiles!=R(s)&&(re(s,_e(r().lastPulledFiles)),re(f,_e({title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(s))}))),R(a)){let O=(he,Ge)=>he.vaultPath.split("/").last().localeCompare(Cn(Ge.vaultPath));R(a).changed.sort(O),R(a).staged.sort(O),re(c,_e({title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).changed)})),re(u,_e({title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).staged)}))}else re(c,void 0),re(u,void 0)})}function x(){n().app.workspace.trigger("obsidian-git:refresh")}let E=Xe(()=>(R(o).match(/\n/g)||[]).length+1||1);var _=jH(),k=j(_),w=j(k),A=j(w);A.__click=y,Ue(A,O=>l[0]=O,()=>l==null?void 0:l[0]);var S=Z(A,2);S.__click=[xH,i,a,r,o,x],Ue(S,O=>l[1]=O,()=>l==null?void 0:l[1]);var T=Z(S,2);T.__click=[IP,i,r,a,x],Ue(T,O=>l[2]=O,()=>l==null?void 0:l[2]);var P=Z(T,2);P.__click=[FP,i,r,a,x],Ue(P,O=>l[3]=O,()=>l==null?void 0:l[3]);var I=Z(P,2);I.__click=[SH,i,r,x],Ue(I,O=>l[4]=O,()=>l==null?void 0:l[4]);var N=Z(I,2);N.__click=[EH,i,r,x],Ue(N,O=>l[5]=O,()=>l==null?void 0:l[5]);var L=Z(N,2);L.__click=[kH,v,l,r],Ue(L,O=>l[6]=O,()=>l==null?void 0:l[6]);var ee=Z(L,2);ee.__click=x,Ue(ee,O=>l[7]=O,()=>l==null?void 0:l[7]),B(w),B(k);var fe=Z(k,2),J=j(fe);pv(J);var Q=Z(J,2);{var Pe=O=>{var he=CH();he.__click=[TH,o],me(he,"aria-label","Clear"),ne(O,he)};ye(Q,O=>{R(o)&&O(Pe)})}B(fe);var ge=Z(fe,2),z=j(ge);{var Y=O=>{var he=BH(),Ge=j(he),gt=j(Ge);gt.__click=[PH,h];var Re=j(gt),ct=Z(Re,4),rt=j(ct),Et=j(rt);Et.__click=[FP,i,r,a,x],Ue(Et,Bt=>l[8]=Bt,()=>l==null?void 0:l[8]),B(rt);var Ie=Z(rt,2),H=j(Ie,!0);B(Ie),B(ct),B(gt);var Je=Z(gt,2);{var D=Bt=>{var Kt=MH(),ci=j(Kt);{var Ya=jt=>{Wa(jt,{get hierarchy(){return R(u)},get plugin(){return r()},get view(){return n()},get fileType(){return 0},topLevel:!0})},Oo=jt=>{var Zi=RH(),Dn=cr(Zi);Cr(Dn,17,()=>ql(R(a).staged,500),Tr,(Io,Fo)=>{Ac(Io,{get change(){return R(Fo)},get view(){return n()},get manager(){return r().gitManager}})});var ui=Z(Dn,2);Va(ui,{get files(){return R(a).staged}}),ne(jt,Zi)};ye(ci,jt=>{R(v)?jt(Ya):jt(Oo,!1)})}B(Kt),dn(3,Kt,()=>Ln,()=>({duration:150})),ne(Bt,Kt)};ye(Je,Bt=>{R(h)&&Bt(D)})}B(Ge);var q=Z(Ge,2),ve=j(q);ve.__click=[OH,d];var Ne=j(ve),bt=Z(Ne,4),Xi=j(bt),Dv=j(Xi);Dv.__click=[AH,n,r];var Nv=Z(Dv,2);Nv.__click=[IP,i,r,a,x],Ue(Nv,Bt=>l[9]=Bt,()=>l==null?void 0:l[9]),B(Xi);var Bv=Z(Xi,2),DP=j(Bv,!0);B(Bv),B(bt),B(ve);var NP=Z(ve,2);{var BP=Bt=>{var Kt=FH(),ci=j(Kt);{var Ya=jt=>{Wa(jt,{get hierarchy(){return R(c)},get plugin(){return r()},get view(){return n()},get fileType(){return 1},topLevel:!0})},Oo=jt=>{var Zi=IH(),Dn=cr(Zi);Cr(Dn,17,()=>ql(R(a).changed,500),Tr,(Io,Fo)=>{Sc(Io,{get change(){return R(Fo)},get view(){return n()},get manager(){return r().gitManager}})});var ui=Z(Dn,2);Va(ui,{get files(){return R(a).changed}}),ne(jt,Zi)};ye(ci,jt=>{R(v)?jt(Ya):jt(Oo,!1)})}B(Kt),dn(3,Kt,()=>Ln,()=>({duration:150})),ne(Bt,Kt)};ye(NP,Bt=>{R(d)&&Bt(BP)})}B(q);var jP=Z(q,2);{var HP=Bt=>{var Kt=NH(),ci=j(Kt);ci.__click=[$H,p];var Ya=Z(j(ci),4),Oo=j(Ya,!0);B(Ya),B(ci);var jt=Z(ci,2);{var Zi=Dn=>{var ui=DH(),Io=j(ui);{var Fo=Xa=>{Wa(Xa,{get hierarchy(){return R(f)},get plugin(){return r()},get view(){return n()},get fileType(){return 2},topLevel:!0})},UP=Xa=>{var jv=LH(),Hv=cr(jv);Cr(Hv,17,()=>R(s),Tr,(zP,VP)=>{Ec(zP,{get change(){return R(VP)},get view(){return n()}})});var GP=Z(Hv,2);Va(GP,{get files(){return R(s)}}),ne(Xa,jv)};ye(Io,Xa=>{R(v)?Xa(Fo):Xa(UP,!1)})}B(ui),dn(3,ui,()=>Ln,()=>({duration:150})),ne(Dn,ui)};ye(jt,Dn=>{R(p)&&Dn(Zi)})}B(Kt),Ae(()=>{lt(Kt,"is-collapsed",!R(p)),Oe(Oo,R(s).length)}),ne(Bt,Kt)};ye(jP,Bt=>{R(s).length>0&&R(f)&&Bt(HP)})}B(he),Ae(()=>{lt(Ge,"is-collapsed",!R(h)),lt(Re,"is-collapsed",!R(h)),Oe(H,R(a).staged.length),lt(q,"is-collapsed",!R(d)),lt(Ne,"is-collapsed",!R(d)),Oe(DP,R(a).changed.length)}),ne(O,he)};ye(z,O=>{R(a)&&R(u)&&R(c)&&O(Y)})}B(ge),B(_),Ae(()=>{me(_,"data-type",kt.type),me(L,"data-icon",R(v)?"list":"folder"),lt(ee,"loading",R(i)),me(J,"rows",R(E))}),kv(J,()=>R(o),O=>re(o,O)),ne(e,_),Ke()}mt(["click"]);var kc=class extends $P.ItemView{constructor(t,r){super(t),this.plugin=r,this.hoverPopover=null}getViewType(){return kt.type}getDisplayText(){return kt.name}getIcon(){return kt.icon}onClose(){return this._view&&oi(this._view),super.onClose()}reload(){this._view&&oi(this._view),this._view=Vi(Lv,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};g();var Jd=class{constructor(t,r){this.statusBarEl=t;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(n=>{this.plugin.switchBranch().catch(i=>r.displayError(i))})}async display(){if(this.plugin.gitReady){let t=await this.plugin.gitManager.branchInfo();t.current!=null?this.statusBarEl.setText(t.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}remove(){this.statusBarEl.remove()}};var Qd=class extends xe.Plugin{constructor(){super(...arguments);this.automaticsManager=new Jl(this);this.tools=new ec(this);this.localStorage=new cd(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new nd(this);this.intervalsToClear=[];this.lineAuthoringFeature=new rd(this)}setPluginState(r){var n;this.state=Object.assign(this.state,r),(n=this.statusBar)==null||n.display()}async updateCachedStatus(){var r,n;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((n=this.branchBar)==null?void 0:n.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(kt.type),n=this.app.workspace.getLeavesOfType(Lr.type);(this.settings.changedFilesInStatusBar||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&await this.updateCachedStatus().catch(i=>this.displayError(i)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Kl.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new Uf(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 n=JSON.stringify(this.settings);r!==n&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(kt.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}),this.app.workspace.getLeavesOfType(Lr.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.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,n,i)=>{this.handleFileMenu(r,n,i,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,n,i)=>{this.handleFileMenu(r,n,i,"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(kt.type,r=>new kc(r,this)),this.registerView(Lr.type,r=>new _c(r,this)),this.registerView(Ti.type,r=>new Ra(r,this)),this.registerView(ki.type,r=>new Ia(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let r=this.app.workspace.getLeavesOfType(kt.type),n;r.length===0?(n=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await n.setViewState({type:kt.type})):n=r.first(),await this.app.workspace.revealLeaf(n)}),this.registerHoverLinkSource(kt.type,{display:"Git View",defaultMod:!0}),this.lineAuthoringFeature.onLoadPlugin(),this.setRefreshDebouncer(),dC(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,xe.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,n){let i=this.gitManager.getRelativeRepoPath(r,!0),a=yT({isFolder:n,gitRelativePath:i});return await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` -`+a),this.refresh()}handleFileMenu(r,n,i,a){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let s;if(typeof n=="string"?s=n:s=n.path,i=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof xe.TFile?await this.gitManager.stage(n.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.displayMessage(`Staged ${s}`)})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof xe.TFile?await this.gitManager.unstage(n.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.displayMessage(`Unstaged ${s}`)})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(s,n instanceof xe.TFolder).catch(c=>this.displayError(c))})})),i=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(s,n instanceof xe.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;a==="obsidian-git:menu"&&o instanceof xe.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(s)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(LP.join(o.getBasePath(),s))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,n;this.gitReady=!1,this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(n=this.statusBar)==null||n.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Tx(Ye,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return xe.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new id(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Ce(this),await this.gitManager.setGitInstance()):this.gitManager=new sn(this);let i=await this.gitManager.checkRequirements();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new xe.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}),xe.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Jd(a,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return void((s=this.branchBar)==null?void 0:s.display().catch(console.error))},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.lineAuthoringFeature.conditionallyActivateBySettings(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new xe.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new $e(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new $e(this,{options:this.gitManager instanceof sn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof sn}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,xe.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new $e(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 xe.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new $e(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 xe.Notice("Aborted clone");return}}}let s=await new $e(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(s!==""&&(o=parseInt(s),isNaN(o))){new xe.Notice("Invalid depth. Aborting clone.");return}new xe.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,c=a&&a!==".";c&&(this.settings.basePath=a);try{await this.gitManager.clone(Wg(n),a,o),new xe.Notice("Cloned new repo."),new xe.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 Ce){let n=await this.updateCachedStatus();n.conflicted.length>0&&(this.displayError(`You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:n=!1,commitMessage:i,onlyStaged:a=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:n,commitMessage:i,onlyStaged:a}))||(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:n=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c,u;if(this.gitManager instanceof Ce){if(await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),c.conflicted.length==0&&(o=!1),r&&c.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${c.conflicted.length} ${c.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(c.conflicted),!1;l=[...c.changed,...c.staged]}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;if(o)await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),l=[...c.changed,...c.staged];else{let f=this.gitManager;i?l=await f.getStagedFiles():(u=await f.getUnstagedFiles(),l=u.map(({path:d})=>({vaultPath:this.gitManager.getRelativeVaultPath(d),path:d})))}}if(await this.tools.hasTooBigFiles(l))return this.setPluginState({gitAction:0}),!1;if(l.length!==0||o){let f=a!=null?a:a=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||n){!this.settings.disablePopups&&r&&new xe.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new ad(this).openAndGetResult();if(p!=null&&p!=""&&p!="...")f=p;else return this.setPluginState({gitAction:0}),!1}let d;i?d=await this.gitManager.commit({message:f,amend:s}):d=await this.gitManager.commitAll({message:f,status:c,unstagedFiles:u,amend:s}),this.gitManager instanceof Ce&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=l.length),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 Ce&&await this.mayDeleteConflictFile();let n;if(this.gitManager instanceof Ce&&(n=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted),!1;if(this.gitManager instanceof sn&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(n){return n instanceof $s?this.handleNoNetworkError(n):this.displayError(n),!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(Fs);r&&(this.app.workspace.iterateAllLeaves(n=>{var i;n.view instanceof xe.MarkdownView&&((i=n.view.file)==null?void 0:i.path)==r.path&&n.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.displayMessage(`Staged ${r.path}`),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.displayMessage(`Unstaged ${r.path}`),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),n=await new Xd(this,r.branches).openAndGetReslt();if(n!=null)return await this.gitManager.checkout(n),this.displayMessage(`Switched to ${n}`),this.app.workspace.trigger("obsidian-git:refresh"),await((i=this.branchBar)==null?void 0:i.display()),n}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[n,i]=Fi(r);if(i!=null&&n!=null)return await this.gitManager.checkout(i,n),this.displayMessage(`Switched to ${r}`),await((a=this.branchBar)==null?void 0:a.display()),r}async createBranch(){var n;if(!await this.isAllInitialized())return;let r=await new $e(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((n=this.branchBar)==null?void 0:n.display()),r}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let n=await new $e(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(n!=null){let a=!1;if(!await this.gitManager.branchIsMerged(n)){let o=await new $e(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(n,a),this.displayMessage(`Deleted branch ${n}`),await((i=this.branchBar)==null?void 0:i.display()),n}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new xe.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(){await this.gitManager.discardAll({status:this.cachedStatus}),new xe.Notice("All local changes have been discarded. New files remain untouched."),this.app.workspace.trigger("obsidian-git:refresh")}async handleConflict(r){this.localStorage.setConflict(!0);let n;r!==void 0&&(n=["# 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(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof xe.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` +https://svelte.dev/e/lifecycle_double_unmount`,xs,Ss):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Xh(t){L?console.warn(`%c[svelte] state_proxy_equality_mismatch +%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results +https://svelte.dev/e/state_proxy_equality_mismatch`,xs,Ss):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function SO(t){L?console.warn(`%c[svelte] transition_slide_display +%cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\` +https://svelte.dev/e/transition_slide_display`,xs,Ss):console.warn("https://svelte.dev/e/transition_slide_display")}var ae=!1;function Xt(t){ae=t}var pe;function et(t){if(t===null)throw Es(),Di;return pe=t}function Zt(){return et(Bt(pe))}function j(t){if(ae){if(Bt(pe)!==null)throw Es(),Di;pe=t}}function pl(t=1){if(ae){for(var e=t,r=pe;e--;)r=Bt(r);pe=r}}function ks(){for(var t=0,e=pe;;){if(e.nodeType===ln){var r=e.data;if(r===_s){if(t===0)return e;t-=1}else(r===fl||r===Aa)&&(t+=1)}var n=Bt(e);e.remove(),e=n}}function Zh(t){if(!t||t.nodeType!==ln)throw Es(),Di;return t.data}p();p();p();p();function Kh(t){return t===this.v}function Jh(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Qh(t){return!Jh(t,this.v)}p();var An=!1,Li=!1,ii=!1;p();p();p();var vu=null;function ai(t){let e=Error(),r=e.stack;if(!r)return null;let n=r.split(` +`),i=[` +`];for(let a=0;a"}`,a=e.ctx;a!==null;)i+=` +${n}in ${(o=a.function)==null?void 0:o[sn].split("/").pop()}`,a=a.p;return{message:t.message+` +${i} +`,stack:(l=t.stack)==null?void 0:l.split(` +`).filter(u=>!u.includes("svelte/src/internal")).join(` +`)}}}function AO(t){let e=V0.get(t);e&&(Wt(t,"message",{value:e.message}),Wt(t,"stack",{value:e.stack}))}p();var bu=[],Y0=[];function TO(){var t=bu;bu=[],hu(t)}function aV(){var t=Y0;Y0=[],hu(t)}function Br(t){bu.length===0&&queueMicrotask(TO),bu.push(t)}function CO(){bu.length>0&&TO(),Y0.length>0&&aV()}p();var Pie=589952;function np(){for(var t=Q.b;t!==null&&!t.has_pending_snippet();)t=t.parent;return t===null&&aO(),t}p();p();var Ui=null;function J0(t){Ui=t}var xu=new Set;function As(t){var e=2050,r=se!==null&&se.f&2?se:null;Q===null||r!==null&&r.f&256?e|=256:Q.f|=524288;let n={ctx:ve,deps:null,effects:null,equals:Kh,f:e,fn:t,reactions:null,rv:0,v:Ve,wv:0,parent:r!=null?r:Q,ac:null};return L&&ii&&(n.created=ai("CreatedAt")),n}function Q0(t,e){let r=Q;r===null&&sO();var n=r.b,i=void 0,a=Hr(Ve),s=null,o=!se;return PO(()=>{var h;L&&(Ui=Q);try{var l=t()}catch(m){l=Promise.reject(m)}L&&(Ui=null);var u=()=>l;i=(h=s==null?void 0:s.then(u,u))!=null?h:Promise.resolve(l),s=i;var c=Se,f=n.pending;o&&(n.update_pending_count(1),f||c.increment());let d=(m,g=void 0)=>{s=null,Ui=null,f||c.activate(),g?g!==hl&&(a.f|=8388608,oi(a,g)):(a.f&8388608&&(a.f^=8388608),oi(a,m),L&&e!==void 0&&(xu.add(a),setTimeout(()=>{xu.has(a)&&(bO(a.label,e),xu.delete(a))}))),o&&(n.update_pending_count(-1),f||c.decrement()),sp()};if(i.then(d,m=>d(null,m||"unknown")),c)return()=>{queueMicrotask(()=>c.neuter())}}),L&&(a.f|=4194304),new Promise(l=>{function u(c){function f(){c===i?l(a):u(i)}c.then(f,f)}u(i)})}function Rt(t){let e=As(t);return op(e),e}function Ts(t){let e=As(t);return e.equals=Qh,e}function ip(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;rQ0(l))).then(l=>{i==null||i.activate(),s();try{r([...t.map(n),...l])}catch(u){a.f&16384||ml(u,a)}i==null||i.deactivate(),sp()}).catch(l=>{o.error(l)})}function oV(){var t=Q,e=se,r=ve;return function(){Ht(t),Ct(e),Ca(r),L&&J0(null)}}function sp(){Ht(null),Ct(null),Ca(null),L&&J0(null)}var ku=new Set,Se=null,Au=null,Pa=null,X0=new Set,fp=[];function IO(){let t=fp.shift();fp.length>0&&queueMicrotask(IO),t()}var Rs=[],pp=null,ty=!1,cp=!1,vl,wl,Ra,Tu,Cu,Ps,yl,Ia,$a,bl,Pu,Ru,Rn,$O,up,ry,dp=class dp{constructor(){wt(this,Rn);vt(this,"current",new Map);wt(this,vl,new Map);wt(this,wl,new Set);wt(this,Ra,0);wt(this,Tu,null);wt(this,Cu,!1);wt(this,Ps,[]);wt(this,yl,[]);wt(this,Ia,[]);wt(this,$a,[]);wt(this,bl,[]);wt(this,Pu,[]);wt(this,Ru,[]);vt(this,"skipped_effects",new Set)}process(e){var a;Rs=[],Au=null;var r=null;if(ku.size>1){r=new Map,Pa=new Map;for(let[s,o]of this.current)r.set(s,{v:s.v,wv:s.wv}),s.v=o;for(let s of ku)if(s!==this)for(let[o,l]of le(s,vl))r.has(o)||(r.set(o,{v:o.v,wv:o.wv}),o.v=l)}for(let s of e)vi(this,Rn,$O).call(this,s);if(le(this,Ps).length===0&&le(this,Ra)===0){vi(this,Rn,ry).call(this);var n=le(this,Ia),i=le(this,$a);Ot(this,Ia,[]),Ot(this,$a,[]),Ot(this,bl,[]),Au=Se,Se=null,RO(n),RO(i),Se===null?Se=this:ku.delete(this),(a=le(this,Tu))==null||a.resolve()}else vi(this,Rn,up).call(this,le(this,Ia)),vi(this,Rn,up).call(this,le(this,$a)),vi(this,Rn,up).call(this,le(this,bl));if(r){for(let[s,{v:o,wv:l}]of r)s.wv<=l&&(s.v=o);Pa=null}for(let s of le(this,Ps))Gi(s);for(let s of le(this,yl))Gi(s);Ot(this,Ps,[]),Ot(this,yl,[])}capture(e,r){le(this,vl).has(e)||le(this,vl).set(e,r),this.current.set(e,e.v)}activate(){Se=this}deactivate(){Se=null,Au=null;for(let e of X0)if(X0.delete(e),e(),Se!==null)break}neuter(){Ot(this,Cu,!0)}flush(){Rs.length>0?ny():vi(this,Rn,ry).call(this),Se===this&&(le(this,Ra)===0&&ku.delete(this),this.deactivate())}increment(){Ot(this,Ra,le(this,Ra)+1)}decrement(){if(Ot(this,Ra,le(this,Ra)-1),le(this,Ra)===0){for(let e of le(this,Pu))mt(e,2048),ci(e);for(let e of le(this,Ru))mt(e,4096),ci(e);Ot(this,Ia,[]),Ot(this,$a,[]),this.flush()}else this.deactivate()}add_callback(e){le(this,wl).add(e)}settled(){var e;return((e=le(this,Tu))!=null?e:Ot(this,Tu,nO())).promise}static ensure(){if(Se===null){let e=Se=new dp;ku.add(Se),cp||dp.enqueue(()=>{Se===e&&e.flush()})}return Se}static enqueue(e){fp.length===0&&queueMicrotask(IO),fp.unshift(e)}};vl=new WeakMap,wl=new WeakMap,Ra=new WeakMap,Tu=new WeakMap,Cu=new WeakMap,Ps=new WeakMap,yl=new WeakMap,Ia=new WeakMap,$a=new WeakMap,bl=new WeakMap,Pu=new WeakMap,Ru=new WeakMap,Rn=new WeakSet,$O=function(e){var c;e.f^=1024;for(var r=e.first;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0,s=a||(n&8192)!==0||this.skipped_effects.has(r);if(!s&&r.fn!==null){if(i)r.f^=1024;else if(!(n&1024))if(n&4)le(this,$a).push(r);else if(An&&n&8)le(this,Ia).push(r);else if(n&4194304){var o=(c=r.b)!=null&&c.pending?le(this,yl):le(this,Ps);o.push(r)}else Fa(r)&&(r.f&16&&le(this,bl).push(r),Gi(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}},up=function(e){for(let r of e)(r.f&2048?le(this,Pu):le(this,Ru)).push(r),mt(r,1024);e.length=0},ry=function(){if(!le(this,Cu))for(let e of le(this,wl))e();le(this,wl).clear()};var si=dp;function _l(t){An&&Q!==null&&dO();var e=cp;cp=!0;try{var r;for(t&&(ny(),r=t());;){if(CO(),Rs.length===0&&(Se==null||Se.flush(),Rs.length===0))return pp=null,r;ny()}}finally{cp=e}}function ny(){var a;var t=Is;ty=!0;try{var e=0;for(iy(!0);Rs.length>0;){var r=si.ensure();if(e++>1e3){if(L){var n=new Map;for(let s of r.current.keys())for(let[o,l]of(a=s.updated)!=null?a:[]){var i=n.get(o);i||(i={error:l.error,count:0},n.set(o,i)),i.count+=l.count}for(let s of n.values())console.error(s.error)}lV()}r.process(Rs),qi.clear()}}finally{ty=!1,iy(t),pp=null}}function lV(){try{fO()}catch(t){L&&Wt(t,"stack",{value:""}),ml(t,pp)}}function RO(t){var e=t.length;if(e!==0){for(var r=0;ri&&n.f&1048576)break}}for(;r0&&!oy&&ly()}return e}function ly(){oy=!1;let t=Array.from(Cs);for(let e of t)e.f&1024&&mt(e,4096),Fa(e)&&Gi(e);Cs.clear()}function _u(t){ne(t,t.v+1)}function OO(t,e){var r=t.reactions;if(r!==null)for(var n=un(),i=r.length,a=0;a{if(Oa===s)return c();var f=se,d=Oa;Ct(null),cy(s);var h=c();return Ct(f),cy(d),h};n&&(r.set("length",Ce(t.length,a)),L&&(t=fV(t)));var l="";function u(c){l=c,cn(i,`${l} version`);for(let[f,d]of r)cn(d,Fs(l,f))}return new Proxy(t,{defineProperty(c,f,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&gO();var h=r.get(f);return h===void 0?h=o(()=>{var m=Ce(d.value,a);return r.set(f,m),L&&typeof f=="string"&&cn(m,Fs(l,f)),m}):ne(h,d.value,!0),!0},deleteProperty(c,f){var d=r.get(f);if(d===void 0){if(f in c){let h=o(()=>Ce(Ve,a));r.set(f,h),_u(i),L&&cn(h,Fs(l,f))}}else ne(d,Ve),_u(i);return!0},get(c,f,d){var v;if(f===Er)return t;if(L&&f===Yh)return u;var h=r.get(f),m=f in c;if(h===void 0&&(!m||(v=Sr(c,f))!=null&&v.writable)&&(h=o(()=>{var w=Ne(m?c[f]:Ve),b=Ce(w,a);return L&&cn(b,Fs(l,f)),b}),r.set(f,h)),h!==void 0){var g=R(h);return g===Ve?void 0:g}return Reflect.get(c,f,d)},getOwnPropertyDescriptor(c,f){var d=Reflect.getOwnPropertyDescriptor(c,f);if(d&&"value"in d){var h=r.get(f);h&&(d.value=R(h))}else if(d===void 0){var m=r.get(f),g=m==null?void 0:m.v;if(m!==void 0&&g!==Ve)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return d},has(c,f){var g;if(f===Er)return!0;var d=r.get(f),h=d!==void 0&&d.v!==Ve||Reflect.has(c,f);if(d!==void 0||Q!==null&&(!h||(g=Sr(c,f))!=null&&g.writable)){d===void 0&&(d=o(()=>{var v=h?Ne(c[f]):Ve,w=Ce(v,a);return L&&cn(w,Fs(l,f)),w}),r.set(f,d));var m=R(d);if(m===Ve)return!1}return h},set(c,f,d,h){var A;var m=r.get(f),g=f in c;if(n&&f==="length")for(var v=d;vCe(Ve,a)),r.set(v+"",w),L&&cn(w,Fs(l,v)))}if(m===void 0)(!g||(A=Sr(c,f))!=null&&A.writable)&&(m=o(()=>Ce(void 0,a)),ne(m,Ne(d)),r.set(f,m),L&&cn(m,Fs(l,f)));else{g=m.v!==Ve;var b=o(()=>Ne(d));ne(m,b)}var E=Reflect.getOwnPropertyDescriptor(c,f);if(E!=null&&E.set&&E.set.call(h,d),!g){if(n&&typeof f=="string"){var x=r.get("length"),k=Number(f);Number.isInteger(k)&&k>=x.v&&ne(x,k+1)}_u(i)}return!0},ownKeys(c){R(i);var f=Reflect.ownKeys(c).filter(m=>{var g=r.get(m);return g===void 0||g.v!==Ve});for(var[d,h]of r)h.v!==Ve&&!(d in c)&&f.push(d);return f},setPrototypeOf(){vO()}})}function Fs(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:cV.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function mp(t){try{if(t!==null&&typeof t=="object"&&Er in t)return t[Er]}catch(e){}return t}var uV=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function fV(t){return new Proxy(t,{get(e,r,n){var i=Reflect.get(e,r,n);return uV.has(r)?function(...a){FO();var s=i.apply(this,a);return ly(),s}:i}})}function DO(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:n,includes:i}=t;t.indexOf=function(a,s){let o=r.call(this,a,s);if(o===-1){for(let l=s!=null?s:0;l{t.indexOf=r,t.lastIndexOf=n,t.includes=i}}var uy,LO,yu,NO,BO;function gp(){if(uy===void 0){uy=window,LO=document,yu=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;NO=Sr(e,"firstChild").get,BO=Sr(e,"nextSibling").get,U0(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),U0(r)&&(r.__t=void 0),L&&(t.__svelte_meta=null,DO())}}function Ut(t=""){return document.createTextNode(t)}function jt(t){return NO.call(t)}function Bt(t){return BO.call(t)}function q(t,e){if(!ae)return jt(t);var r=jt(pe);if(r===null)r=pe.appendChild(Ut());else if(e&&r.nodeType!==mu){var n=Ut();return r==null||r.before(n),et(n),n}return et(r),r}function Cr(t,e){var i,a;if(!ae){var r=jt(t);return r instanceof Comment&&r.data===""?Bt(r):r}if(e&&((i=pe)==null?void 0:i.nodeType)!==mu){var n=Ut();return(a=pe)==null||a.before(n),et(n),n}return pe}function ee(t,e=1,r=!1){let n=ae?pe:t;for(var i;e--;)i=n,n=Bt(n);if(!ae)return n;if(r&&(n==null?void 0:n.nodeType)!==mu){var a=Ut();return n===null?i==null||i.after(a):n.before(a),et(a),a}return et(n),n}function xl(t){t.textContent=""}function Sl(){if(!An)return!1;var t=Q.f;return(t&32768)!==0}function UO(t){Q===null&&se===null&&uO(t),se!==null&&se.f&256&&Q===null&&cO(),Cn&&lO(t)}function dV(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function fi(t,e,r,n=!0){var l;var i=Q;if(L)for(;i!==null&&i.f&131072;)i=i.parent;i!==null&&i.f&8192&&(t|=8192);var a={ctx:ve,deps:null,nodes_start:null,nodes_end:null,f:t|2048,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(L&&(a.component_function=Tn),r)try{Gi(a),a.f|=32768}catch(u){throw Tt(a),u}else e!==null&&ci(a);var s=r&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&524288)===0;if(!s&&n&&(i!==null&&dV(a,i),se!==null&&se.f&2&&!(t&64))){var o=se;((l=o.effects)!=null?l:o.effects=[]).push(a)}return a}function Gr(t){let e=fi(8,null,!1);return mt(e,1024),e.teardown=t,e}function Jt(t){var i;UO("$effect"),L&&Wt(t,"name",{value:"$effect"});var e=Q.f,r=!se&&(e&32)!==0&&(e&32768)===0;if(r){var n=ve;((i=n.e)!=null?i:n.e=[]).push(t)}else return z0(t)}function z0(t){return fi(1048580,t,!1)}function dy(t){si.ensure();let e=fi(64,t,!0);return()=>{Tt(e)}}function jO(t){si.ensure();let e=fi(64,t,!0);return(r={})=>new Promise(n=>{r.outro?li(e,()=>{Tt(e),n(void 0)}):(Tt(e),n(void 0))})}function Pr(t){return fi(4,t,!1)}function PO(t){return fi(4718592,t,!0)}function Kt(t,e=0){return fi(8|e,t,!0)}function Fe(t,e=[],r=[]){lp(e,r,n=>{fi(8,()=>t(...n.map(R)),!0)})}function kr(t,e=0){var r=fi(16|e,t,!0);return L&&(r.dev_stack=Bi),r}function At(t,e=!0){return fi(32,t,!0,e)}function hy(t){var e=t.teardown;if(e!==null){let r=Cn,n=se;fy(!0),Ct(null);try{e.call(null)}finally{fy(r),Ct(n)}}}function py(t,e=!1){var i;var r=t.first;for(t.first=t.last=null;r!==null;){(i=r.ac)==null||i.abort(hl);var n=r.next;r.f&64?r.parent=null:Tt(r,e),r=n}}function GO(t){for(var e=t.first;e!==null;){var r=e.next;e.f&32||Tt(e),e=r}}function Tt(t,e=!0){var r=!1;(e||t.f&262144)&&t.nodes_start!==null&&t.nodes_end!==null&&(qO(t.nodes_start,t.nodes_end),r=!0),py(t,e&&!r),Fu(t,0),mt(t,16384);var n=t.transitions;if(n!==null)for(let a of n)a.stop();hy(t);var i=t.parent;i!==null&&i.first!==null&&sy(t),L&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function qO(t,e){for(;t!==null;){var r=t===e?null:Bt(t);t.remove(),t=r}}function sy(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function li(t,e){var r=[];vp(t,r,!0),my(r,()=>{Tt(t),e&&e()})}function my(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var i of t)i.out(n)}else e()}function vp(t,e,r){if(!(t.f&8192)){if(t.f^=8192,t.transitions!==null)for(let s of t.transitions)(s.is_global||r)&&e.push(s);for(var n=t.first;n!==null;){var i=n.next,a=(n.f&65536)!==0||(n.f&32)!==0;vp(n,e,a?r:!1),n=i}}}function Os(t){zO(t,!0)}function zO(t,e){if(t.f&8192){t.f^=8192,t.f&1024||(mt(t,2048),ci(t));for(var r=t.first;r!==null;){var n=r.next,i=(r.f&65536)!==0||(r.f&32)!==0;zO(r,i?e:!1),r=n}if(t.transitions!==null)for(let a of t.transitions)(a.is_global||e)&&a.in()}}p();var VO=null;var Is=!1;function iy(t){Is=t}var Cn=!1;function fy(t){Cn=t}var se=null,Ar=!1;function Ct(t){se=t}var Q=null;function Ht(t){Q=t}var Tr=null;function op(t){se!==null&&(!An||se.f&2)&&(Tr===null?Tr=[t]:Tr.push(t))}var lr=null,qr=0,jr=null;function MO(t){jr=t}var WO=1,Ou=0,Oa=Ou;function cy(t){Oa=t}var ji=!1;function Eu(){return++WO}function Fa(t){var f,d;var e=t.f;if(e&2048)return!0;if(e&4096){var r=t.deps,n=(e&256)!==0;if(r!==null){var i,a,s=(e&512)!==0,o=n&&Q!==null&&!ji,l=r.length;if((s||o)&&(Q===null||!(Q.f&16384))){var u=t,c=u.parent;for(i=0;it.wv)return!0}(!n||Q!==null&&!ji)&&mt(t,1024)}return!1}function YO(t,e,r=!0){var n=t.reactions;if(n!==null&&!(!An&&(Tr!=null&&Tr.includes(t))))for(var i=0;i0)for(d.length=qr+lr.length,h=0;h{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 Ms(t){var e=se,r=Q;Ct(null),Ht(null);try{return t()}finally{Ct(e),Ht(r)}}function wy(t,e,r,n=r){t.addEventListener(e,()=>Ms(r));let i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),vy()}var yy=new Set,bp=new Set;function KO(t,e,r,n={}){function i(a){if(n.capture||El.call(e,a),!a.cancelBubble)return Ms(()=>r==null?void 0:r.call(this,a))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Br(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function zr(t,e,r,n,i){var a={capture:n,passive:i},s=KO(t,e,r,a);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Gr(()=>{e.removeEventListener(t,s,a)})}function gt(t){for(var e=0;e{throw E});throw d}}finally{t.__root=e,delete t.currentTarget,Ct(c),Ht(f)}}}p();var mV;function JO(){mV=void 0}p();p();function _p(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function di(t,e){var r=Q;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function ce(t,e){var r=(e&1)!==0,n=(e&2)!==0,i,a=!t.startsWith("");return()=>{if(ae)return di(pe,null),pe;i===void 0&&(i=_p(a?t:""+t),r||(i=jt(i)));var s=n||yu?document.importNode(i,!0):i.cloneNode(!0);if(r){var o=jt(s),l=s.lastChild;di(o,l)}else di(s,s);return s}}function zi(){if(ae)return di(pe,null),pe;var t=document.createDocumentFragment(),e=document.createComment(""),r=Ut();return t.append(e,r),di(e,r),t}function ie(t,e){if(ae){Q.nodes_end=pe,Zt();return}t!==null&&t.before(e)}p();var yV=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var woe=[...yV,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var bV=["touchstart","touchmove"];function eM(t){return bV.includes(t)}var _V=["$state","$state.raw","$derived","$derived.by"],yoe=[..._V,"$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var xp=!0;function Be(t,e){var n;var r=e==null?"":typeof e=="object"?e+"":e;r!==((n=t.__t)!=null?n:t.__t=t.nodeValue)&&(t.__t=r,t.nodeValue=r+"")}function Ma(t,e){return tM(t,e)}function _y(t,e){var s;gp(),e.intro=(s=e.intro)!=null?s:!1;let r=e.target,n=ae,i=pe;try{for(var a=jt(r);a&&(a.nodeType!==ln||a.data!==fl);)a=Bt(a);if(!a)throw Di;Xt(!0),et(a),Zt();let o=tM(t,{...e,anchor:a});if(pe===null||pe.nodeType!==ln||pe.data!==_s)throw Es(),Di;return Xt(!1),o}catch(o){if(o===Di)return e.recover===!1&&hO(),gp(),xl(r),Xt(!1),Ma(t,e);throw o}finally{Xt(n),et(i),JO()}}var kl=new Map;function tM(t,{target:e,anchor:r,props:n={},events:i,context:a,intro:s=!0}){gp();var o=new Set,l=f=>{for(var d=0;d{var f=r!=null?r:e.appendChild(Ut());return At(()=>{if(a){tt({});var d=ve;d.c=a}i&&(n.$$events=i),ae&&di(f,null),xp=s,u=t(f,n)||{},xp=!0,ae&&(Q.nodes_end=pe),a&&rt()}),()=>{var m;for(var d of o){e.removeEventListener(d,El);var h=kl.get(d);--h===0?(document.removeEventListener(d,El),kl.delete(d)):kl.set(d,h)}bp.delete(l),f!==r&&((m=f.parentNode)==null||m.removeChild(f))}});return by.set(u,c),u}var by=new WeakMap;function Vi(t,e){let r=by.get(t);return r?(by.delete(t),r(e)):(L&&xO(),Promise.resolve())}p();p();if(L){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;mO(e)},set:n=>{r=n}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function xy(t){ve===null&&gu("onMount"),Li&&ve.l!==null?kV(ve).m.push(t):Jt(()=>{let e=je(t);if(typeof e=="function")return e})}function nM(t){ve===null&&gu("onDestroy"),xy(()=>()=>je(t))}function kV(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}p();p();var aM=new Map;function sM(t,e){var r=aM.get(t);r||(r=new Set,aM.set(t,r)),r.add(e)}p();p();p();p();p();p();p();p();p();function xe(t,e,r=!1){ae&&Zt();var n=t,i=null,a=null,s=Ve,o=r?65536:0,l=!1;let u=(h,m=!0)=>{l=!0,d(m,h)};var c=null;function f(){c!==null&&(c.lastChild.remove(),n.before(c),c=null);var h=s?i:a,m=s?a:i;h&&Os(h),m&&li(m,()=>{s?a=null:i=null})}let d=(h,m)=>{if(s===(s=h))return;let g=!1;if(ae){let k=Zh(n)===Aa;!!s===k&&(n=ks(),et(n),Xt(!1),g=!0)}var v=Sl(),w=n;if(v&&(c=document.createDocumentFragment(),c.append(w=Ut())),s?i!=null||(i=m&&At(()=>m(w))):a!=null||(a=m&&At(()=>m(w))),v){var b=Se,E=s?i:a,x=s?a:i;E&&b.skipped_effects.delete(E),x&&b.skipped_effects.add(x),b.add_callback(f)}else f();g&&Xt(!0)};kr(()=>{l=!1,e(u),l||d(null,null)},o),ae&&(n=pe)}p();p();p();var Mu=null;function Vr(t,e){return e}function RV(t,e,r){for(var n=t.items,i=[],a=e.length,s=0;s0&&i.length===0&&r!==null;if(o){var l=r.parentNode;xl(l),l.append(r),n.clear(),hi(t,e[0].prev,e[a-1].next)}my(i,()=>{for(var u=0;u{var w=r();return on(w)?w:w==null?[]:du(w)}),m,g;function v(){IV(g,m,o,d,s,i,e,n,r),a!==null&&(m.length===0?c?Os(c):c=At(()=>a(s)):c!==null&&li(c,()=>{c=null}))}kr(()=>{var F;g!=null||(g=Q),m=R(h);var w=m.length;if(f&&w===0)return;f=w===0;let b=!1;if(ae){var E=Zh(s)===Aa;E!==(w===0)&&(s=ks(),et(s),Xt(!1),b=!0)}if(ae){for(var x=null,k,A=0;A0&&et(ks())}if(ae)w===0&&a&&(c=At(()=>a(s)));else if(Sl()){var _=new Set,T=Se;for(A=0;A0){var me=s&4&&f===0?i:null;if(u){for(y=0;y{var H;if(w!==void 0)for(A of w)(H=A.a)==null||H.apply()}),t.first=r.first&&r.first.e,t.last=v&&v.e;for(var fe of n.values())Tt(fe.e);n.clear()}function lM(t,e,r,n){n&1&&oi(t.v,e),n&2?oi(t.i,r):t.i=r}function Ey(t,e,r,n,i,a,s,o,l,u,c){var f=Mu,d=(l&1)!==0,h=(l&16)===0,m=d?h?$s(i,!1,!1):Hr(i):i,g=l&2?Hr(s):s;L&&d&&(m.trace=()=>{var b=typeof g=="number"?s:g.v;u()[b]});var v={i:g,v:m,k:a,a:null,e:null,prev:r,next:n};Mu=v;try{if(t===null){var w=document.createDocumentFragment();w.append(t=Ut())}return v.e=At(()=>o(t,m,g,u),ae),v.e.prev=r&&r.e,v.e.next=n&&n.e,r===null?c||(e.first=v):(r.next=v,r.e.next=v.e),n!==null&&(n.prev=v,n.e.prev=v.e),v}finally{Mu=f}}function Sy(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,i=e?e.e.nodes_start:r,a=t.e.nodes_start;a!==null&&a!==n;){var s=Bt(a);i.before(a),a=s}}function hi(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}p();p();p();p();p();function $n(t,e){Pr(()=>{var i;var r=t.getRootNode(),n=r.host?r:(i=r.head)!=null?i:r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a),L&&sM(e.hash,a)}})}p();p();p();p();p();p();var uM=[...` +\r\f\xA0\v\uFEFF`];function fM(t,e,r){var n=t==null?"":""+t;if(e&&(n=n?n+" "+e:e),r){for(var i in r)if(r[i])n=n?n+" "+i:i;else if(n.length)for(var a=i.length,s=0;(s=n.indexOf(i,s))>=0;){var o=s+a;(s===0||uM.includes(n[s-1]))&&(o===n.length||uM.includes(n[o]))?n=(s===0?"":n.substring(0,s))+n.substring(o+1):s=o}}return n===""?null:n}p();function ot(t,e,r,n,i,a){var s=t.__className;if(ae||s!==r||s===void 0){var o=fM(r,n,a);(!ae||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t.__className=r}else if(a&&i!==a)for(var l in a){var u=!!a[l];(i==null||u!==!!i[l])&&t.classList.toggle(l,u)}return a}p();p();var BV=Symbol("class"),HV=Symbol("style"),UV=Symbol("is custom element"),jV=Symbol("is html");function ge(t,e,r,n){var i=GV(t);if(ae&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")){n||zV(t,e,r!=null?r:"");return}i[e]!==(i[e]=r)&&(e==="loading"&&(t[iO]=r),r==null?t.removeAttribute(e):typeof r!="string"&&qV(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function GV(t){var e;return(e=t.__attributes)!=null?e:t.__attributes={[UV]:t.nodeName.includes("-"),[jV]:t.namespaceURI===eO}}var dM=new Map;function qV(t){var e=dM.get(t.nodeName);if(e)return e;dM.set(t.nodeName,e=[]);for(var r,n=t,i=Element.prototype;i!==n;){r=B0(n);for(var a in r)r[a].set&&e.push(a);n=dl(n)}return e}function zV(t,e,r){var n;L&&(e==="srcset"&&VV(t,r)||ky((n=t.getAttribute(e))!=null?n:"",r)||_O(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function ky(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function hM(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function VV(t,e){var r=hM(t.srcset),n=hM(e);return n.length===r.length&&n.every(([i,a],s)=>a===r[s][1]&&(ky(r[s][0],i)||ky(i,r[s][0])))}p();p();p();var WV=Wh?()=>performance.now():()=>Date.now(),Fn={tick:t=>(Wh?requestAnimationFrame:ar)(t),now:()=>WV(),tasks:new Set};function pM(){let t=Fn.now();Fn.tasks.forEach(e=>{e.c(t)||(Fn.tasks.delete(e),e.f())}),Fn.tasks.size!==0&&Fn.tick(pM)}function mM(t){let e;return Fn.tasks.size===0&&Fn.tick(pM),{promise:new Promise(r=>{Fn.tasks.add(e={c:t,f:r})}),abort(){Fn.tasks.delete(e)}}}function kp(t,e){Ms(()=>{t.dispatchEvent(new CustomEvent(e))})}function KV(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function gM(t){let e={},r=t.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let s=KV(i.trim());e[s]=a.trim()}return e}var JV=t=>t;function On(t,e,r,n){var E;var i=(t&1)!==0,a=(t&2)!==0,s=i&&a,o=(t&4)!==0,l=s?"both":i?"in":"out",u,c=e.inert,f=e.style.overflow,d,h;function m(){return Ms(()=>{var x;return u!=null?u:u=r()(e,(x=n==null?void 0:n())!=null?x:{},{direction:l})})}var g={is_global:o,in(){var x;if(e.inert=c,!i){h==null||h.abort(),(x=h==null?void 0:h.reset)==null||x.call(h);return}a||d==null||d.abort(),kp(e,"introstart"),d=Ay(e,m(),h,1,()=>{kp(e,"introend"),d==null||d.abort(),d=u=void 0,e.style.overflow=f})},out(x){if(!a){x==null||x(),u=void 0;return}e.inert=!0,kp(e,"outrostart"),h=Ay(e,m(),d,0,()=>{kp(e,"outroend"),x==null||x()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=Q;if(((E=v.transitions)!=null?E:v.transitions=[]).push(g),i&&xp){var w=o;if(!w){for(var b=v.parent;b&&b.f&65536;)for(;(b=b.parent)&&!(b.f&16););w=!b||(b.f&32768)!==0}w&&Pr(()=>{je(()=>g.in())})}}function Ay(t,e,r,n,i){var a=n===1;if(j0(e)){var s,o=!1;return Br(()=>{if(!o){var v=e({direction:a?"in":"out"});s=Ay(t,v,r,n,i)}}),{abort:()=>{o=!0,s==null||s.abort()},deactivate:()=>s.deactivate(),reset:()=>s.reset(),t:()=>s.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration))return i(),{abort:ar,deactivate:ar,reset:ar,t:()=>n};let{delay:l=0,css:u,tick:c,easing:f=JV}=e;var d=[];if(a&&r===void 0&&(c&&c(0,1),u)){var h=gM(u(0,1));d.push(h,h)}var m=()=>1-n,g=t.animate(d,{duration:l,fill:"forwards"});return g.onfinish=()=>{var _;g.cancel();var v=(_=r==null?void 0:r.t())!=null?_:1-n;r==null||r.abort();var w=n-v,b=e.duration*Math.abs(w),E=[];if(b>0){var x=!1;if(u)for(var k=Math.ceil(b/16.666666666666668),A=0;A<=k;A+=1){var y=v+w*f(A/k),S=gM(u(y,1-y));E.push(S),x||(x=S.overflow==="hidden")}x&&(t.style.overflow="hidden"),m=()=>{var T=g.currentTime;return v+w*f(T/b)},c&&mM(()=>{if(g.playState!=="running")return!1;var T=m();return c(T,1-T),!0})}g=t.animate(E,{duration:b,fill:"forwards"}),g.onfinish=()=>{m=()=>n,c==null||c(n,1-n),i()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=ar)},deactivate:()=>{i=ar},reset:()=>{n===0&&(c==null||c(1,0))},t:()=>m()}}p();p();function Py(t,e,r=e){var n=un(),i=new WeakSet;wy(t,"input",a=>{L&&t.type==="checkbox"&&G0();var s=a?t.defaultValue:t.value;if(s=Ty(t)?Cy(s):s,r(s),Se!==null&&i.add(Se),n&&s!==(s=e())){var o=t.selectionStart,l=t.selectionEnd;t.value=s!=null?s:"",l!==null&&(t.selectionStart=o,t.selectionEnd=Math.min(l,t.value.length))}}),(ae&&t.defaultValue!==t.value||je(e)==null&&t.value)&&(r(Ty(t)?Cy(t.value):t.value),Se!==null&&i.add(Se)),Kt(()=>{var o;L&&t.type==="checkbox"&&G0();var a=e();if(t===document.activeElement){var s=(o=Au)!=null?o:Se;if(i.has(s))return}Ty(t)&&a===Cy(t.value)||t.type==="date"&&!a&&!t.value||a!==t.value&&(t.value=a!=null?a:"")})}function Ty(t){var e=t.type;return e==="number"||e==="range"}function Cy(t){return t===""?null:+t}p();p();p();p();p();function vM(t,e){return t===e||(t==null?void 0:t[Er])===e}function Ke(t={},e,r,n){return Pr(()=>{var i,a;return Kt(()=>{i=a,a=(n==null?void 0:n())||[],je(()=>{t!==r(...a)&&(e(t,...a),i&&vM(r(...i),t)&&e(null,...i))})}),()=>{Br(()=>{a&&vM(r(...a),t)&&e(null,...a)})}}),t}p();p();p();p();p();p();p();p();p();var Tp=!1,vpe=Symbol();function Iy(t){var e=Tp;try{return Tp=!1,[t(),Tp]}finally{Tp=e}}function dn(t,e,r,n){var E,x;var i=!Li||(r&2)!==0,a=(r&8)!==0,s=(r&16)!==0,o=n,l=!0,u=()=>(l&&(l=!1,o=s?je(n):n),o),c;if(a){var f=Er in t||pu in t;c=(x=(E=Sr(t,e))==null?void 0:E.set)!=null?x:f&&e in t?k=>t[e]=k:void 0}var d,h=!1;a?[d,h]=Iy(()=>t[e]):d=t[e],d===void 0&&n!==void 0&&(d=u(),c&&(i&&pO(e),c(d)));var m;if(i?m=()=>{var k=t[e];return k===void 0?u():(l=!0,k)}:m=()=>{var k=t[e];return k!==void 0&&(o=void 0),k===void 0?o:k},i&&!(r&4))return m;if(c){var g=t.$$legacy;return function(k,A){return arguments.length>0?((!i||!A||g||h)&&c(A?m():k),k):m()}}var v=!1,w=(r&1?As:Ts)(()=>(v=!1,m()));L&&(w.label=e),a&&R(w);var b=Q;return function(k,A){if(arguments.length>0){let y=A?R(w):i&&a?Ne(k):k;return ne(w,y),v=!0,o!==void 0&&(o=y),k}return Cn&&v||b.f&16384?w.v:R(w)}}p();p();p();function wM(t){return new $y(t)}var Wi,hn,$y=class{constructor(e){wt(this,Wi);wt(this,hn);var a,s;var r=new Map,n=(o,l)=>{var u=$s(l,!1,!1);return r.set(o,u),u};let i=new Proxy({...e.props||{},$$events:{}},{get(o,l){var u;return R((u=r.get(l))!=null?u:n(l,Reflect.get(o,l)))},has(o,l){var u;return l===pu?!0:(R((u=r.get(l))!=null?u:n(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,u){var c;return ne((c=r.get(l))!=null?c:n(l,u),u),Reflect.set(o,l,u)}});Ot(this,hn,(e.hydrate?_y:Ma)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(a=e.intro)!=null?a:!1,recover:e.recover})),!An&&(!((s=e==null?void 0:e.props)!=null&&s.$$host)||e.sync===!1)&&_l(),Ot(this,Wi,i.$$events);for(let o of Object.keys(le(this,hn)))o==="$set"||o==="$destroy"||o==="$on"||Wt(this,o,{get(){return le(this,hn)[o]},set(l){le(this,hn)[o]=l},enumerable:!0});le(this,hn).$set=o=>{Object.assign(i,o)},le(this,hn).$destroy=()=>{Vi(le(this,hn))}}$set(e){le(this,hn).$set(e)}$on(e,r){le(this,Wi)[e]=le(this,Wi)[e]||[];let n=(...i)=>r.call(this,...i);return le(this,Wi)[e].push(n),()=>{le(this,Wi)[e]=le(this,Wi)[e].filter(i=>i!==n)}}$destroy(){le(this,hn).$destroy()}};Wi=new WeakMap,hn=new WeakMap;var dW;typeof HTMLElement=="function"&&(dW=class extends HTMLElement{constructor(e,r,n){super();vt(this,"$$ctor");vt(this,"$$s");vt(this,"$$c");vt(this,"$$cn",!1);vt(this,"$$d",{});vt(this,"$$r",!1);vt(this,"$$p_d",{});vt(this,"$$l",{});vt(this,"$$l_u",new Map);vt(this,"$$me");this.$$ctor=e,this.$$s=r,n&&this.attachShadow({mode:"open"})}addEventListener(e,r,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let i=this.$$c.$on(e,r);this.$$l_u.set(r,i)}super.addEventListener(e,r,n)}removeEventListener(e,r,n){if(super.removeEventListener(e,r,n),this.$$c){let i=this.$$l_u.get(r);i&&(i(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return a=>{let s=document.createElement("slot");i!=="default"&&(s.name=i),ie(a,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},n=hW(this);for(let i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),r.default=!0):r[i]=e(i));for(let i of this.attributes){let a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=Fy(a,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=wM({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=dy(()=>{Kt(()=>{var i;this.$$r=!0;for(let a of N0(this.$$c)){if(!((i=this.$$p_d[a])!=null&&i.reflect))continue;this.$$d[a]=this.$$c[a];let s=Fy(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1})});for(let i in this.$$l)for(let a of this.$$l[i]){let s=this.$$c.$on(i,a);this.$$l_u.set(a,s)}this.$$l={}}}attributeChangedCallback(e,r,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Fy(e,n,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$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 N0(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function Fy(t,e,r,n){var a;let i=(a=r[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!r[t])return e;if(n==="toAttribute")switch(i){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(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function hW(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}p();p();function Ds(t,e,r,n){function i(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(f){s(f)}}function l(c){try{u(n.throw(c))}catch(f){s(f)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(t,e||[])).next())})}var Ly=require("obsidian");p();var My=require("obsidian");p();function pW(t){let e=t-1;return e*e*e+1}var Oy=!1;function mi(t,{delay:e=0,duration:r=400,easing:n=pW,axis:i="y"}={}){let a=getComputedStyle(t);L&&!Oy&&/(contents|inline|table)/.test(a.display)&&(Oy=!0,Promise.resolve().then(()=>Oy=!1),SO(a.display));let s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),u=i==="y"?["top","bottom"]:["left","right"],c=u.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${c[0]}`]),d=parseFloat(a[`padding${c[1]}`]),h=parseFloat(a[`margin${c[0]}`]),m=parseFloat(a[`margin${c[1]}`]),g=parseFloat(a[`border${c[0]}Width`]),v=parseFloat(a[`border${c[1]}Width`]);return{delay:e,duration:r,easing:n,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${u[0]}: ${w*f}px;padding-${u[1]}: ${w*d}px;margin-${u[0]}: ${w*h}px;margin-${u[1]}: ${w*m}px;border-${u[0]}-width: ${w*g}px;border-${u[1]}-width: ${w*v}px;min-${o}: 0`}}p();var Cp=require("obsidian");var mW=ce('
'),gW=ce('
'),vW={hash:"svelte-1wbh8tp",code:"main.svelte-1wbh8tp .nav-file-title:where(.svelte-1wbh8tp) {align-items:center;}"};function Du(t,e){tt(e,!0),$n(t,vW);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let w of r)w&&(0,Cp.setIcon)(w,w.getAttr("data-icon"))});function i(w){w.stopPropagation(),Do(e.diff.path)?a(w):s(w)}function a(w){var b;w.stopPropagation();let E=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);E instanceof Cp.TFile&&((b=bn(e.view.app,w))===null||b===void 0||b.openFile(E).catch(x=>e.view.plugin.displayError(x)))}function s(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=gW();o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=w=>{var b=mW();b.__click=a,Ke(b,E=>r[0]=E,()=>r==null?void 0:r[0]),zr("auxclick",b,a),ie(w,b)};xe(h,w=>{Lo(e.diff.vaultPath,e.view.app)&&w(m)})}j(d);var g=ee(d,2),v=q(g,!0);j(g),j(f),j(l),j(o),Fe(w=>{ge(l,"data-path",e.diff.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.diff.vaultPath),Be(c,w),ge(g,"data-type",e.diff.status),Be(v,e.diff.status)},[()=>ei(e.diff.vaultPath)]),zr("auxclick",o,w=>{w.stopPropagation(),w.button==2?Qn(e.view.app,w,e.diff.vaultPath,e.view.leaf,"git-history"):i(w)}),ie(t,o),rt()}gt(["click"]);p();var wW=ce("
"),yW=(t,e,r)=>e(t,R(r)),bW=ce(''),_W=ce('
'),xW=ce("
"),SW={hash:"svelte-1lnl15d",code:"main.svelte-1lnl15d .nav-folder-title-content:where(.svelte-1lnl15d) {display:flex;align-items:center;}"};function Lu(t,e){tt(e,!0),$n(t,SW);let r=dn(e,"topLevel",3,!1),n=dn(e,"closed",15),i=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function a(l,u){l.stopPropagation(),n(n()[u.path]=!n()[u.path],!0)}var s=xW();let o;Wr(s,21,()=>e.hierarchy.children,Vr,(l,u)=>{var c=zi(),f=Cr(c);{var d=m=>{var g=wW(),v=q(g);Du(v,{get diff(){return R(u).data},get view(){return e.view}}),j(g),ie(m,g)},h=m=>{var g=_W();let v;var w=q(g);w.__click=[yW,a,u];var b=ee(q(w),2);let E;var x=ee(b,2),k=q(x,!0);j(x),j(w);var A=ee(w,2);{var y=S=>{var _=bW(),T=q(_);Lu(T,{get hierarchy(){return R(u)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return n()},set closed(P){n(P)}}),j(_),On(3,_,()=>mi,()=>({duration:150})),ie(S,_)};xe(A,S=>{n()[R(u).path]||S(y)})}j(g),Fe((S,_)=>{v=ot(g,1,"tree-item nav-folder",null,v,S),ge(w,"data-tooltip-position",R(i)),ge(w,"aria-label",R(u).vaultPath),E=ot(b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,E,_),Be(k,R(u).title)},[()=>({"is-collapsed":n()[R(u).path]}),()=>({"is-collapsed":n()[R(u).path]})]),ie(m,g)};xe(f,m=>{R(u).data?m(d):m(h,!1)})}ie(l,c)}),j(s),Fe(l=>o=ot(s,1,"svelte-1lnl15d",null,o,l),[()=>({topLevel:r()})]),ie(t,s),rt()}gt(["click"]);var EW=(t,e)=>ne(e,!R(e)),kW=ce('
'),AW=ce('
'),TW=ce('
'),CW=ce(''),PW=ce('
'),RW={hash:"svelte-45h",code:""};function Dy(t,e){tt(e,!0),$n(t,RW);let r=Rt(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left"),i=Ce(!0),a=Ce(Ne({}));function s(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=PW(),l=q(o);let u;var c=q(l);c.__click=[EW,i];var f=q(c);let d;var h=ee(f,2),m=q(h);{var g=S=>{var _=kW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>e.log.refs.join(", ")]),ie(S,_)};xe(m,S=>{e.log.refs.length>0&&S(g)})}var v=ee(m,2);{var w=S=>{var _=AW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>s(e.log)]),ie(S,_)};xe(v,S=>{var _;e.plugin.settings.authorInHistoryView!="hide"&&((_=e.log.author)!=null&&_.name)&&S(w)})}var b=ee(v,2);{var E=S=>{var _=TW(),T=q(_,!0);j(_),Fe(P=>Be(T,P),[()=>(0,My.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),ie(S,_)};xe(b,S=>{e.plugin.settings.dateInHistoryView&&S(E)})}var x=ee(b,2),k=q(x,!0);j(x),j(h),j(c);var A=ee(c,2);{var y=S=>{var _=CW(),T=q(_);{var P=D=>{Lu(D,{get hierarchy(){return R(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return R(a)},set closed(M){ne(a,M,!0)}})},F=D=>{var M=zi(),re=Cr(M);Wr(re,17,()=>e.log.diff.files,Vr,(ye,me)=>{Du(ye,{get view(){return e.view},get diff(){return R(me)}})}),ie(D,M)};xe(T,D=>{e.showTree?D(P):D(F,!1)})}j(_),On(3,_,()=>mi,()=>({duration:150})),ie(S,_)};xe(A,S=>{R(i)||S(y)})}j(l),j(o),Fe((S,_,T)=>{u=ot(l,1,"tree-item nav-folder",null,u,S),ge(c,"aria-label",_),ge(c,"data-tooltip-position",R(n)),d=ot(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,T),Be(k,e.log.message)},[()=>({"is-collapsed":R(i)}),()=>{var S;return`${e.log.refs.length>0?e.log.refs.join(", ")+` +`:""}${(S=e.log.author)==null?void 0:S.name} +${(0,My.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} +${e.log.message}`},()=>({"is-collapsed":R(i)})]),ie(t,o),rt()}gt(["click"]);function IW(t,e){e().catch(console.error)}var $W=(t,e,r,n)=>{ne(e,!R(e)),(0,Ly.setIcon)(r[0],R(e)?"list":"folder"),n(n().settings.treeStructure=R(e),!0),n().saveSettings()},FW=ce(''),OW=ce('
'),MW={hash:"svelte-45h",code:""};function Ny(t,e){tt(e,!0),$n(t,MW);let r=dn(e,"plugin",15),n=Ce(!1),i=Ne([]),a=Ce(void 0),s=Ce(Ne(r().settings.treeStructure)),o,l;Jt(()=>{l&&l.empty()}),o=e.view.app.workspace.on("obsidian-git:head-change",()=>void u().catch(console.error)),Jt(()=>{i.forEach(x=>(0,Ly.setIcon)(x,x.getAttr("data-icon")))}),nM(()=>{e.view.app.workspace.offref(o)}),xy(()=>{let x=new IntersectionObserver(A=>{A[0].isIntersecting&&!R(n)&&c().catch(console.error)}),k=document.querySelector("#sentinel");return k&&x.observe(k),()=>{x.disconnect()}}),u().catch(console.error);function u(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady){ne(a,void 0);return}ne(n,!0);let k=r().gitManager instanceof _e,A;((x=R(a)===null||R(a)===void 0?void 0:R(a).length)!==null&&x!==void 0?x:0)==0?A=k?50:10:A=R(a).length,ne(a,yield r().gitManager.log(void 0,!1,A),!0),ne(n,!1)})}function c(){return Ds(this,void 0,void 0,function*(){var x;if(!r().gitReady||R(a)===void 0)return;ne(n,!0);let A=r().gitManager instanceof _e?50:10,y=yield r().gitManager.log(void 0,!1,A,(x=R(a).last())===null||x===void 0?void 0:x.hash);R(a).push(...y.slice(1)),ne(n,!1)})}var f=OW(),d=q(f),h=q(d),m=q(h);m.__click=[$W,s,i,r],Ke(m,x=>i[0]=x,()=>i==null?void 0:i[0]);var g=ee(m,2);let v;g.__click=[IW,u],Ke(g,x=>i[1]=x,()=>i==null?void 0:i[1]),j(h),j(d);var w=ee(d,2),b=q(w);{var E=x=>{var k=FW();Wr(k,21,()=>R(a),Vr,(A,y)=>{Dy(A,{get view(){return e.view},get showTree(){return R(s)},get log(){return R(y)},get plugin(){return r()}})}),j(k),ie(x,k)};xe(b,x=>{R(a)&&x(E)})}pl(4),j(w),j(f),Fe(x=>{ge(m,"data-icon",R(s)?"list":"folder"),v=ot(g,1,"clickable-icon nav-action-button",null,v,x)},[()=>({loading:R(n)})]),ie(t,f),rt()}gt(["click"]);var Nu=class extends yM.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Qr.type}getDisplayText(){return Qr.name}getIcon(){return Qr.icon}onClose(){return this._view&&Vi(this._view),super.onClose()}reload(){this._view&&Vi(this._view),this._view=Ma(Ny,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var bM=require("obsidian"),Pp=class extends bM.FuzzySuggestModal{constructor(r,n){super(r.app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,n){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};p();var kM=require("obsidian");p();var Bs=require("obsidian");p();var Bu=require("obsidian");p();var _M=require("obsidian");var Al=class extends _M.Modal{constructor({app:r,path:n,filesToDeleteCount:i,filesToDiscardCount:a}){super(r);this.resolve=null;this.path=n,this.deleteCount=i,this.discardCount=a}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:n,titleEl:i}=this,a="";this.path!=""&&(r>1?a=`files in "${this.path}"`:a=`"${this.path}"`),i.setText(`${this.discardCount==0?"Delete":"Discard"} ${a}`),this.deleteCount>0&&n.createEl("p").setText(`Are you sure you want to DELETE the ${Lc(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&n.createEl("p").setText(`Are you sure you want to discard ALL changes in ${Lc(this.discardCount,"tracked file")}?`);let s=n.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${Lc(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=s.createEl("button",{cls:"mod-warning",text:`Discard all ${Lc(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=s.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};function DW(t,e){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}function LW(t,e){t.stopPropagation(),e.manager.stage(e.change.path,!1).catch(r=>e.view.plugin.displayError(r)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function NW(t,e){t.stopPropagation();let r=e.change.workingDir=="U";new Al({app:e.view.app,filesToDeleteCount:r?1:0,filesToDiscardCount:r?0:1,path:e.change.vaultPath}).openAndGetResult().then(n=>Ds(this,void 0,void 0,function*(){if(n=="delete"){let i=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);i instanceof Bu.TFile?yield e.view.app.fileManager.trashFile(i):yield e.view.app.vault.adapter.remove(e.change.vaultPath)}else n=="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")}),n=>e.view.plugin.displayError(n))}var BW=ce('
'),HW=ce('
');function Hu(t,e){tt(e,!0);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let E of r)E&&(0,Bu.setIcon)(E,E.getAttr("data-icon"))});function i(E){E.stopPropagation(),Do(e.change.path)?a(E):s(E)}function a(E){var x;E.stopPropagation();let k=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);k instanceof Bu.TFile&&((x=bn(e.view.app,E))===null||x===void 0||x.openFile(k).catch(A=>e.view.plugin.displayError(A)))}function s(E){E.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:E})}var o=HW();o.__mouseover=[DW,e],o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=E=>{var x=BW();x.__click=a,Ke(x,k=>r[0]=k,()=>r==null?void 0:r[0]),zr("auxclick",x,a),ie(E,x)};xe(h,E=>{Lo(e.change.vaultPath,e.view.app)&&E(m)})}var g=ee(h,2);g.__click=[NW,e],Ke(g,E=>r[1]=E,()=>r==null?void 0:r[1]);var v=ee(g,2);v.__click=[LW,e],Ke(v,E=>r[2]=E,()=>r==null?void 0:r[2]),j(d);var w=ee(d,2),b=q(w,!0);j(w),j(f),j(l),j(o),Fe(E=>{ge(l,"data-path",e.change.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.change.vaultPath),Be(c,E),ge(w,"data-type",e.change.workingDir),Be(b,e.change.workingDir)},[()=>ei(e.change.vaultPath)]),zr("auxclick",o,E=>{E.stopPropagation(),E.button==2?Qn(e.view.app,E,e.change.vaultPath,e.view.leaf,"git-source-control"):i(E)}),ie(t,o),rt()}gt(["mouseover","click"]);p();var xM=require("obsidian");function UW(t,e){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}var jW=ce('
');function Uu(t,e){tt(e,!0);let r=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function n(f){var d;f.stopPropagation();let h=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);h instanceof xM.TFile&&((d=bn(e.view.app,f))===null||d===void 0||d.openFile(h).catch(m=>e.view.plugin.displayError(m)))}var i=jW();i.__mouseover=[UW,e],i.__click=n;var a=q(i),s=q(a),o=q(s,!0);j(s);var l=ee(s,2),u=q(l),c=q(u,!0);j(u),j(l),j(a),j(i),Fe(f=>{ge(a,"data-path",e.change.vaultPath),ge(a,"data-tooltip-position",R(r)),ge(a,"aria-label",e.change.vaultPath),Be(o,f),ge(u,"data-type",e.change.workingDir),Be(c,e.change.workingDir)},[()=>ei(e.change.vaultPath)]),zr("auxclick",i,f=>{f.stopPropagation(),f.button==2?Qn(e.view.app,f,e.change.vaultPath,e.view.leaf,"git-source-control"):n(f)}),ie(t,i),rt()}gt(["mouseover","click"]);p();var Rp=require("obsidian");function GW(t,e){e.view.app.vault.getFileByPath(e.change.vaultPath)&&No(e.view.app,t,e.view,e.change.vaultPath)}function qW(t,e){t.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(r=>e.view.plugin.displayError(r)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var zW=ce('
'),VW=ce('
');function ju(t,e){tt(e,!0);let r=Ne([]),n=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");Jt(()=>{for(let b of r)b&&(0,Rp.setIcon)(b,b.getAttr("data-icon"))});function i(b){b.stopPropagation(),Do(e.change.path)?a(b):s(b)}function a(b){var E;b.stopPropagation();let x=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);x instanceof Rp.TFile&&((E=bn(e.view.app,b))===null||E===void 0||E.openFile(x).catch(k=>e.view.plugin.displayError(k)))}function s(b){var E;b.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:b})}var o=VW();o.__mouseover=[GW,e],o.__click=i;var l=q(o),u=q(l),c=q(u,!0);j(u);var f=ee(u,2),d=q(f),h=q(d);{var m=b=>{var E=zW();E.__click=a,Ke(E,x=>r[0]=x,()=>r==null?void 0:r[0]),ie(b,E)};xe(h,b=>{Lo(e.change.vaultPath,e.view.app)&&b(m)})}var g=ee(h,2);g.__click=[qW,e],Ke(g,b=>r[1]=b,()=>r==null?void 0:r[1]),j(d);var v=ee(d,2),w=q(v,!0);j(v),j(f),j(l),j(o),Fe(b=>{ge(l,"data-path",e.change.vaultPath),ge(l,"data-tooltip-position",R(n)),ge(l,"aria-label",e.change.vaultPath),Be(c,b),ge(v,"data-type",e.change.index),Be(w,e.change.index)},[()=>ei(e.change.vaultPath)]),zr("auxclick",o,b=>{b.stopPropagation(),b.button==2?Qn(e.view.app,b,e.change.vaultPath,e.view.leaf,"git-source-control"):i(b)}),ie(t,o),rt()}gt(["mouseover","click"]);p();p();var WW=ce(''),YW=ce("
");function Ls(t,e){tt(e,!0);var r=YW(),n=q(r);{var i=a=>{var s=WW(),o=q(s),l=q(o),u=q(l,!0);j(l),j(o),j(s),Fe(()=>{ge(o,"aria-label","And "+(e.files.length-500)+" more files"),Be(u,"And "+(e.files.length-500)+" more files")}),ie(a,s)};xe(n,a=>{e.files.length>500&&a(i)})}j(r),ie(t,r),rt()}var ZW=ce("
"),KW=(t,e,r)=>e(t,R(r)),JW=(t,e,r)=>e(t,R(r).path),QW=ce('
'),e9=(t,e,r)=>e(t,R(r)),t9=(t,e,r)=>e(t,R(r).path),r9=ce('
',1),n9=ce(''),i9=ce('
'),a9=ce("
");function Ns(t,e){tt(e,!0);var r,n;let i=dn(e,"topLevel",3,!1),a=dn(e,"closed",15);for(let g of e.hierarchy.children)((n=(r=g.children)===null||r===void 0?void 0:r.length)!==null&&n!==void 0?n:0)>100&&a(a()[g.title]=!0,!0);let s=Rt(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function o(g,v){g.stopPropagation(),e.plugin.gitManager.stageAll({dir:v}).catch(w=>e.plugin.displayError(w)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(g,v){g.stopPropagation(),e.plugin.gitManager.unstageAll({dir:v}).catch(w=>e.plugin.displayError(w)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function u(g,v){g.stopPropagation(),e.plugin.discardAll(v.vaultPath)}function c(g,v){g.stopPropagation(),a(a()[v.path]=!a()[v.path],!0)}var f=a9();let d;var h=q(f);Wr(h,17,()=>Nc(e.hierarchy.children,500),Vr,(g,v)=>{var w=zi(),b=Cr(w);{var E=k=>{var A=ZW(),y=q(A);{var S=T=>{ju(T,{get change(){return R(v).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},_=T=>{var P=zi(),F=Cr(P);{var D=re=>{Hu(re,{get change(){return R(v).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},M=re=>{var ye=zi(),me=Cr(ye);{var fe=Ge=>{Uu(Ge,{get change(){return R(v).data},get view(){return e.view}})};xe(me,Ge=>{e.fileType==2&&Ge(fe)},!0)}ie(re,ye)};xe(F,re=>{e.fileType==1?re(D):re(M,!1)},!0)}ie(T,P)};xe(y,T=>{e.fileType==0?T(S):T(_,!1)})}j(A),ie(k,A)},x=k=>{var A=i9();A.__click=[KW,c,v];let y;var S=q(A),_=ee(q(S),2);let T;var P=ee(_,2),F=q(P,!0);j(P);var D=ee(P,2),M=q(D),re=q(M);{var ye=oe=>{var B=QW();B.__click=[JW,l,v],ie(oe,B)},me=oe=>{var B=r9(),Z=Cr(B);Z.__click=[e9,u,v];var H=ee(Z,2);H.__click=[t9,o,v],ie(oe,B)};xe(re,oe=>{e.fileType==0?oe(ye):oe(me,!1)})}pl(2),j(M),j(D),j(S);var fe=ee(S,2);{var Ge=oe=>{var B=n9(),Z=q(B);Ns(Z,{get hierarchy(){return R(v)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return a()},set closed(H){a(H)}}),j(B),On(3,B,()=>mi,()=>({duration:150})),ie(oe,B)};xe(fe,oe=>{a()[R(v).path]||oe(Ge)})}j(A),Fe((oe,B)=>{y=ot(A,1,"tree-item nav-folder",null,y,oe),ge(S,"data-tooltip-position",R(s)),ge(S,"aria-label",R(v).vaultPath),T=ot(_,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,T,B),Be(F,R(v).title)},[()=>({"is-collapsed":a()[R(v).path]}),()=>({"is-collapsed":a()[R(v).path]})]),zr("auxclick",A,oe=>Qn(e.view.app,oe,R(v).vaultPath,e.view.leaf,"git-source-control")),ie(k,A)};xe(b,k=>{R(v).data?k(E):k(x,!1)})}ie(g,w)});var m=ee(h,2);Ls(m,{get files(){return e.hierarchy.children}}),j(f),Fe(g=>d=ot(f,1,"",null,d,g),[()=>({topLevel:i()})]),ie(t,f),rt()}gt(["click"]);function s9(t,e,r,n,i,a){if(ne(e,!0),R(r)){let s=R(r).staged.length>0;n().promiseQueue.addTask(()=>n().commit({fromAuto:!1,commitMessage:R(i),onlyStaged:s}).then(()=>ne(i,n().settings.commitMessage,!0)).finally(a))}}function SM(t,e,r,n,i){t.stopPropagation(),ne(e,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:R(n)}).finally(i))}function EM(t,e,r,n,i){t.stopPropagation(),ne(e,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:R(n)}).finally(i))}function o9(t,e,r,n){ne(e,!0),r().promiseQueue.addTask(()=>r().push().finally(n))}function l9(t,e,r,n){ne(e,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(n))}function c9(t,e){t.stopPropagation(),e().discardAll()}var u9=(t,e,r,n)=>{ne(e,!R(e)),(0,Bs.setIcon)(r[6],R(e)?"list":"folder"),n().settings.treeStructure=R(e),n().saveSettings()},f9=(t,e)=>ne(e,""),d9=ce('
'),h9=(t,e)=>ne(e,!R(e)),p9=ce(" ",1),m9=ce(''),g9=(t,e)=>ne(e,!R(e)),v9=ce(" ",1),w9=ce(''),y9=(t,e)=>ne(e,!R(e)),b9=ce(" ",1),_9=ce(''),x9=ce('
'),S9=ce(''),E9=ce('
'),k9={hash:"svelte-11adhly",code:`.commit-msg-input.svelte-11adhly {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-11adhly {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-11adhly .git-tools:where(.svelte-11adhly) .files-count:where(.svelte-11adhly) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-11adhly {align-items:center;}.git-commit-msg-clear-button.svelte-11adhly {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-11adhly: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 By(t,e){tt(e,!0),$n(t,k9);let r=dn(e,"plugin",7),n=dn(e,"view",7),i=Ce(!1),a=Ce(void 0),s=Ce(Ne([])),o=Ce(Ne(r().settings.commitMessage)),l=Ne([]),u=Ce(void 0),c=Ce(void 0),f=Ce(void 0),d=Ce(!0),h=Ce(!0),m=Ce(!0),g=Ce(0),v=Ce(Ne({})),w=Ce(Ne({})),b=Ce(Ne({})),E=Ce(Ne(r().settings.treeStructure));n().registerEvent(n().app.workspace.on("obsidian-git:loading-status",()=>ne(i,!0))),n().registerEvent(n().app.workspace.on("obsidian-git:status-changed",()=>void k().catch(console.error))),n().plugin.cachedStatus==null?n().plugin.refresh().catch(console.error):k().catch(console.error),Jt(()=>{l.forEach(Y=>(0,Bs.setIcon)(Y,Y.getAttr("data-icon")))}),Jt(()=>{l.forEach(Y=>{var Ie,Me;!Y||Y.id!="push"||(Bs.Platform.isMobile?(Y.removeClass("button-border"),R(g)>0&&Y.addClass("button-border")):((Ie=Y.firstElementChild)===null||Ie===void 0||Ie.removeAttribute("color"),R(g)>0&&((Me=Y.firstElementChild)===null||Me===void 0||Me.setAttr("color","var(--text-accent)"))))})}),n().scope=new Bs.Scope(r().app.scope),n().scope.register(["Ctrl"],"Enter",Y=>x());function x(){if(ne(i,!0),R(a)){let Y=R(a).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:R(o),onlyStaged:Y}).then(()=>{ne(o,r().settings.commitMessage,!0)}).finally(A))}}function k(){return Ds(this,void 0,void 0,function*(){if(!r().gitReady){ne(a,void 0);return}if(ne(g,yield r().gitManager.getUnpushedCommits(),!0),ne(a,r().cachedStatus,!0),ne(i,!1),r().lastPulledFiles&&r().lastPulledFiles!=R(s)&&(ne(s,r().lastPulledFiles,!0),ne(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(s))},!0)),R(a)){let Y=(Ie,Me)=>Ie.vaultPath.split("/").last().localeCompare(ei(Me.vaultPath));R(a).changed.sort(Y),R(a).staged.sort(Y),ne(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).changed)},!0),ne(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(R(a).staged)},!0)}else ne(u,void 0),ne(c,void 0)})}function A(){n().app.workspace.trigger("obsidian-git:refresh")}let y=Rt(()=>(R(o).match(/\n/g)||[]).length+1||1);var S=E9(),_=q(S),T=q(_),P=q(T);P.__click=x,Ke(P,Y=>l[0]=Y,()=>l==null?void 0:l[0]);var F=ee(P,2);F.__click=[s9,i,a,r,o,A],Ke(F,Y=>l[1]=Y,()=>l==null?void 0:l[1]);var D=ee(F,2);D.__click=[SM,i,r,a,A],Ke(D,Y=>l[2]=Y,()=>l==null?void 0:l[2]);var M=ee(D,2);M.__click=[EM,i,r,a,A],Ke(M,Y=>l[3]=Y,()=>l==null?void 0:l[3]);var re=ee(M,2);re.__click=[o9,i,r,A],Ke(re,Y=>l[4]=Y,()=>l==null?void 0:l[4]);var ye=ee(re,2);ye.__click=[l9,i,r,A],Ke(ye,Y=>l[5]=Y,()=>l==null?void 0:l[5]);var me=ee(ye,2);me.__click=[u9,E,l,r],Ke(me,Y=>l[6]=Y,()=>l==null?void 0:l[6]);var fe=ee(me,2);let Ge;fe.__click=A,Ke(fe,Y=>l[7]=Y,()=>l==null?void 0:l[7]),j(T),j(_);var oe=ee(_,2),B=q(oe);gy(B);var Z=ee(B,2);{var H=Y=>{var Ie=d9();Ie.__click=[f9,o],ge(Ie,"aria-label","Clear"),ie(Y,Ie)};xe(Z,Y=>{R(o)&&Y(H)})}j(oe);var Oe=ee(oe,2),cr=q(Oe);{var Gt=Y=>{var Ie=S9(),Me=q(Ie);let It;var De=q(Me);De.__click=[h9,h];var G=q(De);let Je;var N=ee(G,4),X=q(N),Ee=q(X);Ee.__click=[EM,i,r,a,A],Ke(Ee,Ft=>l[8]=Ft,()=>l==null?void 0:l[8]),j(X);var We=ee(X,2),$t=q(We,!0);j(We),j(N),j(De);var Cl=ee(De,2);{var OM=Ft=>{var qt=m9(),Yi=q(qt);{var Mn=Qt=>{Ns(Qt,{get hierarchy(){return R(c)},get plugin(){return r()},get view(){return n()},get fileType(){return 0},topLevel:!0,get closed(){return R(v)},set closed(pn){ne(v,pn,!0)}})},js=Qt=>{var pn=p9(),Da=Cr(pn);Wr(Da,17,()=>Nc(R(a).staged,500),Vr,(Xi,Pl)=>{ju(Xi,{get change(){return R(Pl)},get view(){return n()},get manager(){return r().gitManager}})});var gi=ee(Da,2);Ls(gi,{get files(){return R(a).staged}}),ie(Qt,pn)};xe(Yi,Qt=>{R(E)?Qt(Mn):Qt(js,!1)})}j(qt),On(3,qt,()=>mi,()=>({duration:150})),ie(Ft,qt)};xe(Cl,Ft=>{R(h)&&Ft(OM)})}j(Me);var qu=ee(Me,2);let qy;var zu=q(qu);zu.__click=[g9,d];var zy=q(zu);let Vy;var Wy=ee(zy,4),jp=q(Wy),Yy=q(jp);Yy.__click=[c9,r];var Xy=ee(Yy,2);Xy.__click=[SM,i,r,a,A],Ke(Xy,Ft=>l[9]=Ft,()=>l==null?void 0:l[9]),j(jp);var Zy=ee(jp,2),MM=q(Zy,!0);j(Zy),j(Wy),j(zu);var DM=ee(zu,2);{var LM=Ft=>{var qt=w9(),Yi=q(qt);{var Mn=Qt=>{Ns(Qt,{get hierarchy(){return R(u)},get plugin(){return r()},get view(){return n()},get fileType(){return 1},topLevel:!0,get closed(){return R(w)},set closed(pn){ne(w,pn,!0)}})},js=Qt=>{var pn=v9(),Da=Cr(pn);Wr(Da,17,()=>Nc(R(a).changed,500),Vr,(Xi,Pl)=>{Hu(Xi,{get change(){return R(Pl)},get view(){return n()},get manager(){return r().gitManager}})});var gi=ee(Da,2);Ls(gi,{get files(){return R(a).changed}}),ie(Qt,pn)};xe(Yi,Qt=>{R(E)?Qt(Mn):Qt(js,!1)})}j(qt),On(3,qt,()=>mi,()=>({duration:150})),ie(Ft,qt)};xe(DM,Ft=>{R(d)&&Ft(LM)})}j(qu);var NM=ee(qu,2);{var BM=Ft=>{var qt=x9();let Yi;var Mn=q(qt);Mn.__click=[y9,m];var js=ee(q(Mn),4),Qt=q(js,!0);j(js),j(Mn);var pn=ee(Mn,2);{var Da=gi=>{var Xi=_9(),Pl=q(Xi);{var HM=Gs=>{Ns(Gs,{get hierarchy(){return R(f)},get plugin(){return r()},get view(){return n()},get fileType(){return 2},topLevel:!0,get closed(){return R(b)},set closed(Vu){ne(b,Vu,!0)}})},UM=Gs=>{var Vu=b9(),Ky=Cr(Vu);Wr(Ky,17,()=>R(s),Vr,(GM,qM)=>{Uu(GM,{get change(){return R(qM)},get view(){return n()}})});var jM=ee(Ky,2);Ls(jM,{get files(){return R(s)}}),ie(Gs,Vu)};xe(Pl,Gs=>{R(E)?Gs(HM):Gs(UM,!1)})}j(Xi),On(3,Xi,()=>mi,()=>({duration:150})),ie(gi,Xi)};xe(pn,gi=>{R(m)&&gi(Da)})}j(qt),Fe(gi=>{Yi=ot(qt,1,"pulled nav-folder",null,Yi,gi),Be(Qt,R(s).length)},[()=>({"is-collapsed":!R(m)})]),ie(Ft,qt)};xe(NM,Ft=>{R(s).length>0&&R(f)&&Ft(BM)})}j(Ie),Fe((Ft,qt,Yi,Mn)=>{It=ot(Me,1,"staged tree-item nav-folder",null,It,Ft),Je=ot(G,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Je,qt),Be($t,R(a).staged.length),qy=ot(qu,1,"changes tree-item nav-folder",null,qy,Yi),Vy=ot(zy,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Vy,Mn),Be(MM,R(a).changed.length)},[()=>({"is-collapsed":!R(h)}),()=>({"is-collapsed":!R(h)}),()=>({"is-collapsed":!R(d)}),()=>({"is-collapsed":!R(d)})]),ie(Y,Ie)};xe(cr,Y=>{R(a)&&R(c)&&R(u)&&Y(Gt)})}j(Oe),j(S),Fe(Y=>{ge(S,"data-type",Dt.type),ge(me,"data-icon",R(E)?"list":"folder"),Ge=ot(fe,1,"clickable-icon nav-action-button",null,Ge,Y),ge(B,"rows",R(y))},[()=>({loading:R(i)})]),Py(B,()=>R(o),Y=>ne(o,Y)),ie(t,S),rt()}gt(["click"]);var Gu=class extends kM.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Dt.type}getDisplayText(){return Dt.name}getIcon(){return Dt.icon}onClose(){return this._view&&Vi(this._view),super.onClose()}reload(){this._view&&Vi(this._view),this._view=Ma(By,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};p();var Ip=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(n=>{this.plugin.switchBranch().catch(i=>r.displayError(i))})}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 AM=require("obsidian");var $p=class{constructor(e){this.plugin=e}get editor(){var n;let e=(n=this.plugin.app.workspace.activeEditor)==null?void 0:n.editor,r=e==null?void 0:e.cm;if(!(!e||!Sn.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:n}=this.editor,i=Sn.getHunk(r.state,!1,e);if(i){let a,s;i.type==="delete"?(a=i.added.start+1,s=i.added.start+1):(a=i.added.start-0,s=i.added.start-1+i.added.count);let o=r.state.doc.line(a).from,l=i.type==="delete"?r.state.doc.line(s).from:r.state.doc.line(s).to+1,u=i.removed.lines.join(` +`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(u+=` +`),n.replaceRange(u,n.offsetToPos(o),n.offsetToPos(l)),n.setSelection(n.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,n=Sn.getHunk(r.state,!1,e),i=!1;if(n||(n=Sn.getHunk(r.state,!0,e),i=!0),!n)return;let a=r.state.field(AM.editorInfoField).file.path,s=Et.createPatch(a,[n],"100644",i).join(` +`)+` +`;await this.gitManager.applyPatch(s),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:n}=this.editor,i=Sn.getHunks(r.state,!1),a=n.getCursor().line+1,s=Et.findNearestHunk(a,i,e,!0);if(s==null)return;let o=i[s];if(o){let l=o.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};p();p();var Hs=require("obsidian");var Fp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof Hs.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),a$(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;m$(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new wh(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&Hs.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof _e?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(A$),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),u$(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;return void((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var n;return e instanceof Hs.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof Hs.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",h$)}};p();var Tl=require("obsidian");p();p();var Us=require("@codemirror/state"),Mp=require("@codemirror/view");var Op=class extends Mp.GutterMarker{constructor(r,n){super();this.type=r;this.staged=n}toDOM(r){let n=document.createElement("div");return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},Hy=Us.StateField.define({create:()=>Us.RangeSet.empty,update:(t,e)=>{let r=e.state.field(xr,!1);if(!r)return Us.RangeSet.empty;let n=e.effects.some(a=>a.is(tu)),i=e.effects.some(a=>a.is(tl));if(n||i||(e.docChanged||t.size==0)&&r.isDirty==!1){let a=new Set,s=TM(e,r.hunks,!1,a),o=TM(e,r.stagedHunks,!0,a);return t=Us.RangeSet.of([...s,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function TM(t,e,r,n){let i=[];for(let s=0;s0?e[s-1]:void 0,l=s{var e;return(e=t.state.field(Hy,!1))!=null?e:Us.RangeSet.empty},initialSpacer:t=>new Op("delete",!1),domEventHandlers:{click:(t,e,r)=>{var i;return((i=Sn.getHunkAtPos(t.state,e.from,!1))!=null?i:Sn.getHunkAtPos(t.state,e.from,!0))&&(ws(t,e.from),r.preventDefault()),!1}}});var Dp=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 n=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:n,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Fi.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyGitCompare(r)))}},PM=[VF,WF,CM,Hy,Gh],RM=[xr,b0];p();var Uy=require("obsidian"),Lp=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",n=>{(!n||n.getRoot()==r.app.workspace.rootSplit&&!(n.view instanceof Uy.MarkdownView))&&this.statusBarEl.empty()})}display(e,r){var o;let n=this.plugin.app.workspace.getActiveViewOfType(Uy.MarkdownView);if(!n||((o=n.file)==null?void 0:o.path)!==(r==null?void 0:r.path))return;let i=0,a=0,s=0;for(let l of e)i+=Math.max(0,l.added.count-l.removed.count),a+=Math.min(l.added.count,l.removed.count),s+=Math.max(0,l.removed.count-l.added.count);this.statusBarEl.empty(),i>0&&this.statusBarEl.createSpan({text:`+${i} `,cls:"git-add"}),a>0&&this.statusBarEl.createSpan({text:`~${a} `,cls:"git-change"}),s>0&&this.statusBarEl.createSpan({text:`-${s}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var Np=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 Tl.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 Dp(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new Lp(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&&Tl.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof _e?this.plg.gitManager:void 0}}refresh(){this.plg.settings.hunks.showSigns&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(RM),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...PM),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 n;return Fi.ifFilepathDefinedTransformSubscribers(r,i=>i.forEach(a=>{a.changeToNewFilepath(e.path)})),e instanceof Tl.TFile&&((n=this.signsProvider)==null?void 0:n.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 IM=require("@codemirror/state"),Bp=require("obsidian");var jy=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let n=this.view.state,i=i$(e,r,n);this.view.dispatch(i)}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,n=r.field(xr);if(!n||n.compareText!=e.compareText||n.compareTextHead!=e.compareTextHead){let i=vF(e,r);this.view.dispatch(i)}}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(Gy,!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&&(Fi.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Fi.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(Bp.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(Bp.editorEditorField)}},Gy=IM.StateField.define({create:t=>new jy(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var Hp=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new Fp(this.plg);this.signsFeature=new Np(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature()}onLoadPlugin(){this.plg.registerEditorExtension(Gy),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 Up=class extends we.Plugin{constructor(){super(...arguments);this.automaticsManager=new Zc(this);this.tools=new fu(this);this.localStorage=new qh(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new rd(this);this.intervalsToClear=[];this.editorIntegration=new Hp(this);this.hunkActions=new $p(this)}setPluginState(r){var n;this.state=Object.assign(this.state,r),(n=this.statusBar)==null||n.display()}async updateCachedStatus(){var r,n;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((n=this.branchBar)==null?void 0:n.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(Dt.type),n=this.app.workspace.getLeavesOfType(Qr.type);(this.settings.changedFilesInStatusBar||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&await this.updateCachedStatus().catch(i=>this.displayError(i)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Zn.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new yh(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 n=JSON.stringify(this.settings);r!==n&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(Dt.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}),this.app.workspace.getLeavesOfType(Qr.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.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,n,i)=>{this.handleFileMenu(r,n,i,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,n,i)=>{this.handleFileMenu(r,n,i,"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(Dt.type,r=>new Gu(r,this)),this.registerView(Qr.type,r=>new Nu(r,this)),this.registerView(ga.type,r=>new ys(r,this)),this.registerView(ma.type,r=>new bs(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let r=this.app.workspace.getLeavesOfType(Dt.type),n;r.length===0?(n=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await n.setViewState({type:Dt.type})):n=r.first(),await this.app.workspace.revealLeaf(n)}),this.registerHoverLinkSource(Dt.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),YF(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,we.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,n){let i=this.gitManager.getRelativeRepoPath(r,!0),a=rP({isFolder:n,gitRelativePath:i});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+a),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,n,i,a){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let s;if(typeof n=="string"?s=n:s=n.path,i=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.stageFile(n):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof we.TFile?await this.unstageFile(n):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(s,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(u=>this.displayError(u))})})),i=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(u=>{this.addFileToGitignore(s,n instanceof we.TFolder).catch(c=>this.displayError(c))})});let o=this.app.vault.adapter;a==="obsidian-git:menu"&&o instanceof we.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(u=>{this.app.openWithDefaultApp(s)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(u=>{window.electron.shell.showItemInFolder(FM.join(o.getBasePath(),s))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,n;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(n=this.statusBar)==null||n.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=oA(Xe,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return we.Platform.isDesktopApp}async init({fromReload:r=!1}){var n;if(this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new bh(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new _e(this),await this.gitManager.setGitInstance()):this.gitManager=new _n(this);let i=await this.gitManager.checkRequirements(),a=this.localStorage.getPausedAutomatics();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new we.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),we.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let s=this.addStatusBarItem();this.branchBar=new Ip(s,this),this.intervalsToClear.push(window.setInterval(()=>{var o;return void((o=this.branchBar)==null?void 0:o.display().catch(console.error))},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!a&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),a||await this.automaticsManager.init(),a&&new we.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new we.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let n=await new ze(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(n){let i="Vault Root",a=await new ze(this,{options:this.gitManager instanceof _n?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof _n}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,we.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new ze(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 we.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new ze(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 we.Notice("Aborted clone");return}}}let s=await new ze(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(s===void 0){new we.Notice("Aborted clone");return}if(s!==""&&(o=parseInt(s),isNaN(o))){new we.Notice("Invalid depth. Aborting clone.");return}new we.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,u=a&&a!==".";u&&(this.settings.basePath=a);try{await this.gitManager.clone(ew(n),a,o),new we.Notice("Cloned new repo."),new we.Notice("Please restart Obsidian"),u&&await this.saveSettings()}catch(c){this.displayError(c),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 _e){let n=await this.updateCachedStatus();n.conflicted.length>0&&(this.displayError(`You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:n=!1,commitMessage:i,onlyStaged:a=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:n,commitMessage:i,onlyStaged:a}))||(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:n=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,u=[],c=[];if(this.gitManager instanceof _e){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;u=l.staged,c=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;i?u=await f.getStagedFiles():c=(await f.getUnstagedFiles()).map(({path:h,type:m})=>({vaultPath:this.gitManager.getRelativeVaultPath(h),path:h,type:m}))}}if(await this.tools.hasTooBigFiles(i?u:[...u,...c]))return this.setPluginState({gitAction:0}),!1;if(c.length+u.length!==0||o){let f=a!=null?a:a=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||n){!this.settings.disablePopups&&r&&new we.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let m=await new _h(this).openAndGetResult();if(m!=null&&m!=""&&m!="...")f=m;else return this.setPluginState({gitAction:0}),!1}else if(this.gitManager instanceof _e&&this.settings.commitMessageScript){let m=this.settings.commitMessageScript,g=this.localStorage.getHostname()||"",v=m.replace("{{hostname}}",g);v=v.replace("{{date}}",(0,we.moment)().format(this.settings.commitDateFormat));let w=await Bc("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}let d;i?d=await this.gitManager.commit({message:f,amend:s}):d=await this.gitManager.commitAll({message:f,status:l,unstagedFiles:c,amend:s}),this.gitManager instanceof _e&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=c.length+u.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 _e&&await this.mayDeleteConflictFile();let n;if(this.gitManager instanceof _e&&(n=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${n.conflicted.length} ${n.conflicted.length==1?"file":"files"}`),await this.handleConflict(n.conflicted),!1;if(this.gitManager instanceof _n&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(n){return n instanceof Io?this.handleNoNetworkError(n):this.displayError(n),!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(Ro);r&&(this.app.workspace.iterateAllLeaves(n=>{var i;n.view instanceof we.MarkdownView&&((i=n.view.file)==null?void 0:i.path)==r.path&&n.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 i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),n=await new Pp(this,r.branches).openAndGetReslt();if(n!=null)return await this.gitManager.checkout(n),this.displayMessage(`Switched to ${n}`),this.app.workspace.trigger("obsidian-git:refresh"),await((i=this.branchBar)==null?void 0:i.display()),n}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[n,i]=Ri(r);if(i!=null&&n!=null)return await this.gitManager.checkout(i,n),this.displayMessage(`Switched to ${r}`),await((a=this.branchBar)==null?void 0:a.display()),r}async createBranch(){var n;if(!await this.isAllInitialized())return;let r=await new ze(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((n=this.branchBar)==null?void 0:n.display()),r}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let n=await new ze(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(n!=null){let a=!1;if(!await this.gitManager.branchIsMerged(n)){let o=await new ze(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(n,a),this.displayMessage(`Deleted branch ${n}`),await((i=this.branchBar)==null?void 0:i.display()),n}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new we.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 n=await this.gitManager.status({path:r}),i=0,a=0;for(let o of n.changed)o.workingDir=="U"?i++:a++;if(i+a==0)return!1;let s=await new Al({app:this.app,filesToDeleteCount:i,filesToDiscardCount:a,path:r!=null?r:""}).openAndGetResult();switch(s){case!1:return s;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 u=this.gitManager.getRelativeVaultPath(l),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.fileManager.trashFile(c):l.endsWith("/")?await this.app.vault.adapter.rmdir(u,!0):await this.app.vault.adapter.remove(u)}break}default:Md(s)}return this.app.workspace.trigger("obsidian-git:refresh"),s}async handleConflict(r){this.localStorage.setConflict(!0);let n;r!==void 0&&(n=["# 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(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof we.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` # 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. @@ -377,7 +408,7 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For File changes in remote repository >>>>>>> origin/main \`\`\``]),await this.tools.writeAndOpenFile(n==null?void 0:n.join(` -`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new $e(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new $e(this,{initialValue:a}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,Wg(o)),i}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),n;r.length===0&&(n=await this.editRemotes(),n==null&&(r=await this.gitManager.getRemotes()));let i=new $e(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=n!=null?n:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new $e(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult()}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new $e(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}onActiveLeafChange(r){var s,o;let n=r==null?void 0:r.view;if(!(n!=null&&n.getState().file)&&!(n instanceof Ra||n instanceof Ia))return;let i=this.app.workspace.getLeavesOfType(kt.type).first(),a=this.app.workspace.getLeavesOfType(Lr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Ra||(r==null?void 0:r.view)instanceof Ia){let l=r.view.state.bFile;this.lastDiffViewState=r.view.getState();let c;i&&r.view.state.aRef=="HEAD"?c=i.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${l}']`):i&&r.view.state.aRef==""?c=i.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${l}']`):a&&(c=a.view.containerEl.querySelector(`div.nav-file-title[data-path='${l}']`)),c==null||c.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,n=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(r.toLowerCase(),n),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new xe.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof wl.UserCanceledError){new xe.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new xe.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),n)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; +`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new ze(this,{initialValue:a,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,ew(o)),i}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),n;r.length===0&&(n=await this.editRemotes(),n==null&&(r=await this.gitManager.getRemotes()));let i=new ze(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=n!=null?n:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a),l=await new ze(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(a+"/")?l:`${a}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),i=await new ze(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}onActiveLeafChange(r){var s,o;let n=r==null?void 0:r.view;if(!(n!=null&&n.getState().file)&&!(n instanceof ys||n instanceof bs))return;let i=this.app.workspace.getLeavesOfType(Dt.type).first(),a=this.app.workspace.getLeavesOfType(Qr.type).first();if((s=i==null?void 0:i.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||s.removeClass("is-active"),(o=a==null?void 0:a.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof ys||(r==null?void 0:r.view)instanceof bs){let u=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let c;i&&r.view.state.aRef=="HEAD"?c=i.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${u}"]`):i&&r.view.state.aRef==""?c=i.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${u}"]`):a&&(c=a.view.containerEl.querySelector(`div.tree-item-self[data-path='${u}']`)),c==null||c.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,n=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(r.toLowerCase(),n),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new we.Notice(r,5*1e3),this.log(r)}displayError(r,n=10*1e3){var a;if(r instanceof $M.Errors.UserCanceledError){new we.Notice("Aborted");return}let i;r instanceof Error?i=r:i=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new we.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),n)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; /*! Bundled license information: ieee754/index.js: @@ -406,13 +437,6 @@ js-sha256/src/sha256.js: * @copyright Chen, Yi-Cyuan 2014-2017 * @license MIT *) - -feather-icons/dist/feather.js: - (*! - Copyright (c) 2016 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames - *) */ /* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json index 2f24b79..f0be393 100644 --- a/.obsidian/plugins/obsidian-git/manifest.json +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -6,5 +6,5 @@ "description": "Integrate Git version control with automatic backup and other advanced features.", "isDesktopOnly": false, "fundingUrl": "https://ko-fi.com/vinzent", - "version": "2.35.2" + "version": "2.36.1" } diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css index 9c490e7..92c8af8 100644 --- a/.obsidian/plugins/obsidian-git/styles.css +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -8,17 +8,34 @@ } } +.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: 0; + padding-left: 0; + padding-top: 0; + padding-right: 0; } .workspace-leaf-content[data-type="git-history-view"] .view-content { - padding: 0; + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.loading { + overflow: hidden; } .loading > svg { @@ -55,6 +72,15 @@ .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; @@ -81,6 +107,21 @@ 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); } @@ -97,444 +138,401 @@ color: var(--text-accent); } -.workspace-leaf-content[data-type="diff-view"] .d2h-d-none { - display: none; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-wrapper { - text-align: left; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-header { - background-color: var(--background-primary); - border-bottom: 1px solid var(--interactive-accent); - font-family: var(--font-monospace); - height: 35px; - padding: 5px 10px; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-header, -.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-stats { - font-size: 14px; - margin-left: auto; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-lines-added { - border: 1px solid #b4e2b4; - border-radius: 5px 0 0 5px; - color: #399839; - padding: 2px; - text-align: right; - vertical-align: middle; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-lines-deleted { - border: 1px solid #e9aeae; - border-radius: 0 5px 5px 0; - color: #c33; - margin-left: 1px; - padding: 2px; - text-align: left; - vertical-align: middle; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-name-wrapper { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - font-size: 15px; - width: 100%; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-name { - overflow-x: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-wrapper { - border: 1px solid var(--background-modifier-border); - border-radius: 3px; - margin-bottom: 1em; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse { - -webkit-box-pack: end; - -ms-flex-pack: end; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: 1px solid var(--background-modifier-border); - border-radius: 3px; - cursor: pointer; - display: none; - font-size: 12px; - justify-content: flex-end; - padding: 4px 8px; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse.d2h-selected { - background-color: #c8e1ff; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-collapse-input { - margin: 0 4px 0 0; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-diff-table { - border-collapse: collapse; - font-family: Menlo, Consolas, monospace; - font-size: 13px; - width: 100%; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-files-diff { - width: 100%; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-diff { - overflow-y: hidden; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-side-diff { - display: inline-block; - margin-bottom: -8px; - margin-right: -4px; - overflow-x: scroll; - overflow-y: hidden; - width: 50%; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line { - padding: 0 8em; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line { - display: inline-block; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - white-space: nowrap; - width: 100%; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line { - padding: 0 4.5em; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-ctn { - word-wrap: normal; - background: none; - display: inline-block; - padding: 0; - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; - vertical-align: middle; - white-space: pre; - width: 100%; -} - -.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, -.theme-light - .workspace-leaf-content[data-type="diff-view"] - .d2h-code-side-line - del { - background-color: #ffb6ba; -} - -.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, -.theme-dark - .workspace-leaf-content[data-type="diff-view"] - .d2h-code-side-line - del { - background-color: #8d232881; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line del, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line del, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-line ins { - border-radius: 0.2em; - display: inline-block; - margin-top: -1px; - text-decoration: none; - vertical-align: middle; -} - -.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, -.theme-light - .workspace-leaf-content[data-type="diff-view"] - .d2h-code-side-line - ins { - background-color: #97f295; - text-align: left; -} - -.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-code-line ins, -.theme-dark - .workspace-leaf-content[data-type="diff-view"] - .d2h-code-side-line - ins { - background-color: #1d921996; - text-align: left; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix { - word-wrap: normal; - background: none; - display: inline; - padding: 0; - white-space: pre; -} - -.workspace-leaf-content[data-type="diff-view"] .line-num1 { - float: left; -} - -.workspace-leaf-content[data-type="diff-view"] .line-num1, -.workspace-leaf-content[data-type="diff-view"] .line-num2 { - -webkit-box-sizing: border-box; - box-sizing: border-box; - overflow: hidden; - padding: 0 0.5em; - text-overflow: ellipsis; - width: 3.5em; -} - -.workspace-leaf-content[data-type="diff-view"] .line-num2 { - float: right; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber { - background-color: var(--background-primary); - border: solid var(--background-modifier-border); - border-width: 0 1px; - -webkit-box-sizing: border-box; - box-sizing: border-box; - color: var(--text-muted); - cursor: pointer; - display: inline-block; - position: absolute; - text-align: right; - width: 7.5em; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber:after { - content: "\200b"; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber { - background-color: var(--background-primary); - border: solid var(--background-modifier-border); - border-width: 0 1px; - -webkit-box-sizing: border-box; - box-sizing: border-box; - color: var(--text-muted); - cursor: pointer; - display: inline-block; - overflow: hidden; - padding: 0 0.5em; - position: absolute; - text-align: right; - text-overflow: ellipsis; - width: 4em; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-diff-tbody tr { - position: relative; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber:after { - content: "\200b"; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-emptyplaceholder, -.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { - background-color: var(--background-primary); - border-color: var(--background-modifier-border); -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-line-prefix, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber, -.workspace-leaf-content[data-type="diff-view"] .d2h-emptyplaceholder { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-code-linenumber, -.workspace-leaf-content[data-type="diff-view"] .d2h-code-side-linenumber { - direction: rtl; -} - -.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-del { - background-color: #fee8e9; - border-color: #e9aeae; -} - -.theme-light .workspace-leaf-content[data-type="diff-view"] .d2h-ins { - background-color: #dfd; - border-color: #b4e2b4; -} - -.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-del { - background-color: #521b1d83; - border-color: #691d1d73; -} - -.theme-dark .workspace-leaf-content[data-type="diff-view"] .d2h-ins { - background-color: rgba(30, 71, 30, 0.5); - border-color: #13501381; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-info { - background-color: var(--background-primary); - border-color: var(--background-modifier-border); - color: var(--text-normal); -} - -.theme-light - .workspace-leaf-content[data-type="diff-view"] - .d2h-file-diff - .d2h-del.d2h-change { - background-color: #fdf2d0; -} - -.theme-dark - .workspace-leaf-content[data-type="diff-view"] - .d2h-file-diff - .d2h-del.d2h-change { - background-color: #55492480; -} - -.theme-light - .workspace-leaf-content[data-type="diff-view"] - .d2h-file-diff - .d2h-ins.d2h-change { - background-color: #ded; -} - -.theme-dark - .workspace-leaf-content[data-type="diff-view"] - .d2h-file-diff - .d2h-ins.d2h-change { - background-color: rgba(37, 78, 37, 0.418); -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper { - margin-bottom: 10px; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-wrapper a { - color: #3572b0; - text-decoration: none; -} - -.workspace-leaf-content[data-type="diff-view"] - .d2h-file-list-wrapper - a:visited { - color: #3572b0; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-header { - text-align: left; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-title { - font-weight: 700; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list-line { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - text-align: left; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list { - display: block; - list-style: none; - margin: 0; - padding: 0; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li { - border-bottom: 1px solid var(--background-modifier-border); - margin: 0; - padding: 5px 10px; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-list > li:last-child { - border-bottom: none; -} - -.workspace-leaf-content[data-type="diff-view"] .d2h-file-switch { - cursor: pointer; - display: none; - font-size: 10px; -} +/* ====== 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: -.workspace-leaf-content[data-type="diff-view"] .d2h-icon { - fill: currentColor; - margin-right: 10px; - vertical-align: middle; -} + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md -.workspace-leaf-content[data-type="diff-view"] .d2h-deleted { - color: #c33; -} + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ -.workspace-leaf-content[data-type="diff-view"] .d2h-added { - color: #399839; -} + 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: -.workspace-leaf-content[data-type="diff-view"] .d2h-changed { - color: #d0b44c; -} + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. -.workspace-leaf-content[data-type="diff-view"] .d2h-moved { - color: #3572b0; -} + 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. +*/ -.workspace-leaf-content[data-type="diff-view"] .d2h-tag { - background-color: var(--background-primary); - display: -webkit-box; - display: -ms-flexbox; - display: flex; - font-size: 10px; - margin-left: 5px; - padding: 0 2px; -} +.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; -.workspace-leaf-content[data-type="diff-view"] .d2h-deleted-tag { - border: 2px solid #c33; + --git-delete: #c33; + --git-insert: #399839; + --git-change: #d0b44c; + --git-move: #3572b0; } -.workspace-leaf-content[data-type="diff-view"] .d2h-added-tag { - border: 1px solid #399839; -} +.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); + } -.workspace-leaf-content[data-type="diff-view"] .d2h-changed-tag { - border: 1px solid #d0b44c; -} + /* needed for line-by-line*/ -.workspace-leaf-content[data-type="diff-view"] .d2h-moved-tag { - border: 1px solid #3572b0; + .d2h-diff-tbody { + position: relative; + } } /* ====================== Line Authoring Information ====================== */ @@ -575,14 +573,6 @@ background-color: #22bb2230; } -/* Limits the scrollbar to the view body */ -.git-view { - display: flex; - flex-direction: column; - position: relative; - height: 100%; -} - .git-obscure-prompt[git-is-obscured="true"] #git-show-password:after { -webkit-mask-image: url('data:image/svg+xml,'); } @@ -603,3 +593,113 @@ background: var(--interactive-hover); color: var(--text-accent-hover); } + +.git-signs-gutter { + .cm-gutterElement { + display: grid; + } +} + +.git-gutter-marker:hover { + border-radius: 2px; +} + +.git-gutter-marker.git-add { + background-color: var(--color-green); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-change { + background-color: var(--color-yellow); + justify-self: center; + height: inherit; + width: 0.2rem; +} + +.git-gutter-marker.git-changedelete { + color: var(--color-yellow); + font-weight: var(--font-bold); + font-size: 1rem; + justify-self: center; + height: inherit; +} + +.git-gutter-marker.git-delete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: end; +} + +.git-gutter-marker.git-topdelete { + background-color: var(--color-red); + height: 0.2rem; + width: 0.8rem; + align-self: start; +} + +div:hover > .git-gutter-marker.git-change { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-add { + width: 0.6rem; +} + +div:hover > .git-gutter-marker.git-delete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-topdelete { + height: 0.6rem; +} + +div:hover > .git-gutter-marker.git-changedelete { + font-weight: var(--font-bold); +} + +.git-gutter-marker.staged { + opacity: 0.5; +} + +.git-diff { + .cm-merge-revert { + width: 4em; + } + /* Ensure that merge revert markers are positioned correctly */ + .cm-merge-revert > * { + position: absolute; + background-color: var(--background-secondary); + display: flex; + } +} + +/* Prevent shifting of the editor when git signs gutter is the only gutter present */ +.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) { + margin-inline-end: 0; + .git-signs-gutter { + margin-inline-start: -1rem; + } +} + +.git-changes-status-bar-colored { + .git-add { + color: var(--color-green); + } + .git-change { + color: var(--color-yellow); + } + .git-delete { + color: var(--color-red); + } +} + +.git-changes-status-bar .git-add { + margin-right: 0.3em; +} + +.git-changes-status-bar .git-change { + margin-right: 0.3em; +} diff --git a/Editor/AssetProcessor/ExcludeFromBuild.cs b/Editor/AssetProcessor/ExcludeFromBuild.cs index 0071e61..8a6741c 100644 --- a/Editor/AssetProcessor/ExcludeFromBuild.cs +++ b/Editor/AssetProcessor/ExcludeFromBuild.cs @@ -1,4 +1,4 @@ -// using System.Collections.Generic; +// using System.Collections.Generic; // using System.IO; // using UnityEditor; // using UnityEditor.Build; diff --git a/Editor/CustomGUISample/CustomFooter.cs b/Editor/CustomGUISample/CustomFooter.cs index 1364ce9..e27b959 100644 --- a/Editor/CustomGUISample/CustomFooter.cs +++ b/Editor/CustomGUISample/CustomFooter.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using UnityEditor; namespace LWGUI.CustomGUISample diff --git a/Editor/Helper/ContextMenuHelper.cs b/Editor/Helper/ContextMenuHelper.cs index 8b1ddda..71f6af3 100644 --- a/Editor/Helper/ContextMenuHelper.cs +++ b/Editor/Helper/ContextMenuHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System.Collections.Generic; using UnityEditor; diff --git a/Editor/Helper/GUIStyles.cs b/Editor/Helper/GUIStyles.cs index b5577c3..c5f8f16 100644 --- a/Editor/Helper/GUIStyles.cs +++ b/Editor/Helper/GUIStyles.cs @@ -1,4 +1,4 @@ -using UnityEditor; +using UnityEditor; using UnityEngine; namespace LWGUI @@ -11,6 +11,7 @@ public static class GUIStyles private static GUIStyle _foldout; private static GUIStyle _helpbox; private static GUIStyle _rampSelectButton; + private static GUIStyle _objectFieldButton; private static GUIStyle _toolbarSearchTextFieldPopup; private static GUIStyle _label_monospace; @@ -35,8 +36,20 @@ public static class GUIStyles fontSize = EditorStyles.boldLabel.fontSize + 1 }; - public static GUIStyle helpbox => _helpbox ?? new GUIStyle(EditorStyles.helpBox) { fontSize = 12 }; - public static GUIStyle rampSelectButton => _rampSelectButton ?? new GUIStyle(EditorStyles.miniButton) { alignment = TextAnchor.MiddleLeft }; + public static GUIStyle helpbox => _helpbox ?? new GUIStyle(EditorStyles.helpBox) { fontSize = 12 }; + + public static GUIStyle rampSelectButton => _rampSelectButton ?? new GUIStyle(EditorStyles.miniButton) + { + fixedHeight = 0, + stretchHeight = true, + alignment = TextAnchor.MiddleLeft + }; + + public static GUIStyle objectFieldButton => _objectFieldButton ?? new GUIStyle("ObjectFieldButton") + { + fixedHeight = 0, + stretchHeight = true + }; public static GUIStyle toolbarSearchTextFieldPopup { diff --git a/Editor/Helper/IOHelper.cs b/Editor/Helper/IOHelper.cs index 700d0bd..ca7d393 100644 --- a/Editor/Helper/IOHelper.cs +++ b/Editor/Helper/IOHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Diagnostics; diff --git a/Editor/Helper/MetaDataHelper.cs b/Editor/Helper/MetaDataHelper.cs index 67b6e35..7b82285 100644 --- a/Editor/Helper/MetaDataHelper.cs +++ b/Editor/Helper/MetaDataHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; diff --git a/Editor/Helper/RampHelper.cs b/Editor/Helper/RampHelper.cs index bf19146..2e8e62a 100644 --- a/Editor/Helper/RampHelper.cs +++ b/Editor/Helper/RampHelper.cs @@ -1,12 +1,10 @@ -// Copyright (c) Jason Ma -using System; +// Copyright (c) Jason Ma using System.IO; using System.Linq; using LWGUI.LwguiGradientEditor; using LWGUI.Runtime.LwguiGradient; using UnityEditor; using UnityEngine; -using Object = UnityEngine.Object; namespace LWGUI { @@ -260,33 +258,40 @@ public static void RampMapSelectorOverride(Rect rect, MaterialProperty prop, str } } - public static void RampIndexSelectorOverride(Rect rect, MaterialProperty prop, LwguiRampAtlas rampAtlas, RampSelectorWindow.SwitchRampMapCallback switchRampMapEvent) - { - if (!rampAtlas) - return; - - var e = Event.current; - if (e.type == UnityEngine.EventType.MouseDown && rect.Contains(e.mousePosition)) - { - e.Use(); - RampSelectorWindow.ShowWindow(prop, rampAtlas.GetTexture2Ds(LwguiGradient.ChannelMask.RGB), switchRampMapEvent); - } - } #endregion } public class RampSelectorWindow : EditorWindow { public delegate void SwitchRampMapCallback(MaterialProperty prop, Texture2D newRampMap, int index); - + public delegate void SwitchRampCallback(MaterialProperty prop, int rampIndex); + + private LwguiRampAtlas _rampAtlas; private Texture2D[] _rampMaps; private Vector2 _scrollPosition; private MaterialProperty _prop; + private SwitchRampCallback _switchRampEvent; private SwitchRampMapCallback _switchRampMapEvent; + private const float RowHeight = 18f; + private const float RowSpacing = 2f; + + public static void ShowWindow(MaterialProperty prop, LwguiRampAtlas rampAtlas, SwitchRampCallback switchRampEvent) + { + LwguiGradientWindow.CloseWindow(); + var window = CreateInstance(); + window.titleContent = new GUIContent("Ramp Selector (Atlas)"); + window.minSize = new Vector2(400, 500); + window._rampAtlas = rampAtlas; + window._prop = prop; + window._switchRampEvent = switchRampEvent; + window.ShowAuxWindow(); + } + public static void ShowWindow(MaterialProperty prop, Texture2D[] rampMaps, SwitchRampMapCallback switchRampMapEvent) { - RampSelectorWindow window = ScriptableObject.CreateInstance(); + LwguiGradientWindow.CloseWindow(); + var window = CreateInstance(); window.titleContent = new GUIContent("Ramp Selector"); window.minSize = new Vector2(400, 500); window._rampMaps = rampMaps; @@ -296,33 +301,89 @@ public static void ShowWindow(MaterialProperty prop, Texture2D[] rampMaps, Switc } private void OnGUI() + { + if (_rampAtlas != null) + DrawRampAtlasSelector(); + else if (_rampMaps != null) + DrawRampMapSelector(); + else + EditorGUILayout.HelpBox("No Ramp data available", MessageType.Error); + } + + private void DrawRampAtlasSelector() { EditorGUILayout.BeginVertical(); _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); - for (int i = 0; i < _rampMaps.Length; i++) + for (int i = 0; i < _rampAtlas.RampCount; i++) { - var rampMap = _rampMaps[i]; - EditorGUILayout.BeginHorizontal(); - if (rampMap != null) + var ramp = _rampAtlas.GetRamp(i); + if (ramp == null) continue; + + var previewTextures = ramp.GetPreviewTexturesForRampSelector(_rampAtlas.rampAtlasWidth); + var textureCount = previewTextures?.Length ?? 0; + var totalHeight = Mathf.Max(1, textureCount) * RowHeight + Mathf.Max(0, textureCount - 1) * RowSpacing; + + var rect = EditorGUILayout.GetControlRect(GUILayout.Height(totalHeight)); + var guiContent = new GUIContent($"{i}. {ramp.Name}"); + var buttonWidth = Mathf.Min(300f, Mathf.Max(GUI.skin.button.CalcSize(guiContent).x, rect.width * 0.35f)); + var buttonRect = new Rect(rect.x + rect.width - buttonWidth, rect.y, buttonWidth, totalHeight); + var previewWidth = rect.width - buttonWidth - 3.0f; + + // Draw preview textures vertically + if (previewTextures != null) { - var guiContent = new GUIContent($"{ i }. { rampMap.name }"); - var rect = EditorGUILayout.GetControlRect(); - var buttonWidth = Mathf.Min(300f, Mathf.Max(GUI.skin.button.CalcSize(guiContent).x, rect.width * 0.35f)); - var buttonRect = new Rect(rect.x + rect.width - buttonWidth, rect.y, buttonWidth, rect.height); - var previewRect = new Rect(rect.x, rect.y, rect.width - buttonWidth - 3.0f, rect.height); - - if (GUI.Button(buttonRect, guiContent, GUIStyles.rampSelectButton) && _switchRampMapEvent != null) + for (int j = 0; j < previewTextures.Length; j++) { - _switchRampMapEvent(_prop, rampMap, i); - LwguiGradientWindow.CloseWindow(); - Close(); + if (previewTextures[j] == null) continue; + var previewRect = new Rect(rect.x, rect.y + j * (RowHeight + RowSpacing), previewWidth, RowHeight); + EditorGUI.DrawPreviewTexture(previewRect, previewTextures[j]); } - EditorGUI.DrawPreviewTexture(previewRect, rampMap); } - EditorGUILayout.EndHorizontal(); + + // Draw button (stretches to cover all preview rows) + if (GUI.Button(buttonRect, guiContent, GUIStyles.rampSelectButton) && _switchRampEvent != null) + { + _switchRampEvent(_prop, i); + LwguiGradientWindow.CloseWindow(); + Close(); + } + + GUILayout.Space(RowSpacing); } - + + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndVertical(); + } + + private void DrawRampMapSelector() + { + EditorGUILayout.BeginVertical(); + _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); + + for (int i = 0; i < _rampMaps.Length; i++) + { + var rampMap = _rampMaps[i]; + if (rampMap == null) continue; + + var rect = EditorGUILayout.GetControlRect(GUILayout.Height(RowHeight)); + var guiContent = new GUIContent($"{i}. {rampMap.name}"); + var buttonWidth = Mathf.Min(300f, Mathf.Max(GUI.skin.button.CalcSize(guiContent).x, rect.width * 0.35f)); + var buttonRect = new Rect(rect.x + rect.width - buttonWidth, rect.y, buttonWidth, RowHeight); + var previewRect = new Rect(rect.x, rect.y, rect.width - buttonWidth - 3.0f, RowHeight); + + EditorGUI.DrawPreviewTexture(previewRect, rampMap); + + if (GUI.Button(buttonRect, guiContent, GUIStyles.rampSelectButton) && _switchRampMapEvent != null) + { + _switchRampMapEvent(_prop, rampMap, i); + LwguiGradientWindow.CloseWindow(); + Close(); + } + + GUILayout.Space(RowSpacing); + } + EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); } diff --git a/Editor/Helper/ToolbarHelper.cs b/Editor/Helper/ToolbarHelper.cs index 60c1d26..40df550 100644 --- a/Editor/Helper/ToolbarHelper.cs +++ b/Editor/Helper/ToolbarHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Linq; diff --git a/Editor/LWGUI.cs b/Editor/LWGUI.cs index b03baa6..662a984 100644 --- a/Editor/LWGUI.cs +++ b/Editor/LWGUI.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using UnityEditor; using UnityEngine; diff --git a/Editor/MetaData/PerShaderData.cs b/Editor/MetaData/PerShaderData.cs index 2f30540..661a538 100644 --- a/Editor/MetaData/PerShaderData.cs +++ b/Editor/MetaData/PerShaderData.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma // Per Shader > Per Material > Per Inspector using System; diff --git a/Editor/PerformanceMonitor/ShaderCompiler/Fxc/ShaderCompilerDefaultFxc.cs b/Editor/PerformanceMonitor/ShaderCompiler/Fxc/ShaderCompilerDefaultFxc.cs index 97d330d..37bf6c4 100644 --- a/Editor/PerformanceMonitor/ShaderCompiler/Fxc/ShaderCompilerDefaultFxc.cs +++ b/Editor/PerformanceMonitor/ShaderCompiler/Fxc/ShaderCompilerDefaultFxc.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; diff --git a/Editor/PerformanceMonitor/ShaderPerfMonitor.cs b/Editor/PerformanceMonitor/ShaderPerfMonitor.cs index c5aced0..6a1424d 100644 --- a/Editor/PerformanceMonitor/ShaderPerfMonitor.cs +++ b/Editor/PerformanceMonitor/ShaderPerfMonitor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; diff --git a/Editor/ScriptableObject/GradientObject.cs b/Editor/ScriptableObject/GradientObject.cs index 5c0da2e..515f073 100644 --- a/Editor/ScriptableObject/GradientObject.cs +++ b/Editor/ScriptableObject/GradientObject.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using UnityEngine; diff --git a/Editor/ScriptableObject/LwguiRampAtlas.cs b/Editor/ScriptableObject/LwguiRampAtlas.cs index 40700fb..bb72152 100644 --- a/Editor/ScriptableObject/LwguiRampAtlas.cs +++ b/Editor/ScriptableObject/LwguiRampAtlas.cs @@ -8,418 +8,646 @@ using LWGUI.Runtime.LwguiGradient; using UnityEngine; using UnityEditor; -using UnityEngine.Serialization; namespace LWGUI { - [Serializable] - public class Ramp - { - public string name = "New Ramp"; - public LwguiGradient gradient = LwguiGradient.white; - public ColorSpace colorSpace = ColorSpace.Gamma; - public LwguiGradient.ChannelMask channelMask = LwguiGradient.ChannelMask.All; - public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; - } - - [CreateAssetMenu(fileName = "LWGUI_RampAtlas.asset", menuName = "LWGUI/Ramp Atlas", order = 84)] - public class LwguiRampAtlas : ScriptableObject - { - public const string RampAtlasSOExtensionName = "asset"; - public const string RampAtlasTextureExtensionName = "tga"; - - public int rampAtlasWidth = 256; - public int rampAtlasHeight = 4; - public bool rampAtlasSRGB = true; - [SerializeField] private bool _saveTextureToggle; - - [NonSerialized] public Texture2D rampAtlasTexture = null; - - [SerializeField] private List _ramps = new List(); - - public List ramps - { - get => _ramps ?? new List(); - - set => _ramps = value ?? new List(); - } - - private string _rampAtlasSOPath = string.Empty; - private string _rampAtlasTexturePath = string.Empty; - - public void InitData() - { - if (AssetDatabase.Contains(this)) - { - _rampAtlasSOPath = AssetDatabase.GetAssetPath(this); - _rampAtlasTexturePath = Path.ChangeExtension(_rampAtlasSOPath, RampAtlasTextureExtensionName); - } - } - - public bool LoadTexture() - { - if (!AssetDatabase.Contains(this)) - return false; - - // Try to load - rampAtlasTexture = AssetDatabase.LoadAssetAtPath(_rampAtlasTexturePath); - - // Create - if (!rampAtlasTexture - || rampAtlasTexture.width != rampAtlasWidth - || rampAtlasTexture.height != rampAtlasHeight - || rampAtlasTexture.isDataSRGB != rampAtlasSRGB - ) - { - CreateRampAtlasTexture(); - rampAtlasTexture = AssetDatabase.LoadAssetAtPath(_rampAtlasTexturePath); - } - - if (!rampAtlasTexture) - { - Debug.LogError($"LWGUI: Can NOT create a Ramp Atlas Texture at path: {_rampAtlasTexturePath}"); - return false; - } - - return true; - } - - public Color[] GetPixels() - { - Color[] pixels = Enumerable.Repeat(Color.white, rampAtlasWidth * rampAtlasHeight).ToArray(); - int currentIndex = 0; - foreach (var ramp in ramps) - { - ramp.gradient.GetPixels(ref pixels, ref currentIndex, rampAtlasWidth, 1, ramp.channelMask); - } - - return pixels; - } - - public Texture2D[] GetTexture2Ds(LwguiGradient.ChannelMask channelMask = LwguiGradient.ChannelMask.All) - { - Texture2D[] textures = new Texture2D[ramps.Count]; - for (int i = 0; i < ramps.Count; i++) - { - var ramp = ramps[i]; - textures[i] = Instantiate(ramp.gradient?.GetPreviewRampTexture(rampAtlasWidth, 1, ramp.colorSpace, ramp.channelMask & channelMask)); - textures[i].name = ramp.name; - } - - return textures; - } - - public Ramp GetRamp(int index) - { - if (index < ramps.Count && index >= 0) - { - return ramps[index] ?? new Ramp(); - } - return null; - } - - public void CreateRampAtlasTexture() - { - var rampAtlasTexture = new Texture2D(rampAtlasWidth, rampAtlasHeight, TextureFormat.RGBA32, false, !rampAtlasSRGB); - rampAtlasTexture.SetPixels(GetPixels()); - rampAtlasTexture.wrapMode = TextureWrapMode.Clamp; - rampAtlasTexture.name = Path.GetFileName(_rampAtlasTexturePath); - rampAtlasTexture.Apply(); - - SaveTexture(rampAtlasTexture, checkoutAndForceWrite:true); - - AssetDatabase.ImportAsset(_rampAtlasTexturePath); - RampHelper.SetRampTextureImporter(_rampAtlasTexturePath, true, !rampAtlasSRGB, EditorJsonUtility.ToJson(this)); - } - - public void SaveTexture(Texture2D rampAtlasTexture = null, string targetRelativePath = null, bool checkoutAndForceWrite = false) - { - targetRelativePath ??= _rampAtlasTexturePath; - rampAtlasTexture ??= this.rampAtlasTexture; - if (!rampAtlasTexture || string.IsNullOrEmpty(targetRelativePath)) - return; - - var absPath = IOHelper.GetAbsPath(targetRelativePath); - if (File.Exists(absPath)) - { - var existRampTexture = AssetDatabase.LoadAssetAtPath(targetRelativePath); - if (!VersionControlHelper.IsWriteable(existRampTexture)) - { - if (checkoutAndForceWrite) - { - if (!VersionControlHelper.Checkout(targetRelativePath)) - { - Debug.LogError($"LWGUI: Can NOT write the Ramp Atlas Texture to path: {absPath}"); - return; - } - } - else - { - return; - } - } - } - - try - { - File.WriteAllBytes(absPath, rampAtlasTexture.EncodeToTGA()); - SaveTextureUserData(targetRelativePath); - - Debug.Log($"LWGUI: Saved the Ramp Atlas Texture at path: {absPath}"); - } - catch (Exception e) - { - Debug.LogError(e); - } - } - - public void SaveTextureUserData(string targetRelativePath = null) - { - targetRelativePath ??= _rampAtlasTexturePath; - if (!string.IsNullOrEmpty(targetRelativePath)) - { - var importer = AssetImporter.GetAtPath(targetRelativePath); - if (importer) - { - importer.userData = EditorJsonUtility.ToJson(this); - importer.SaveAndReimport(); - } - } - } - - public void SaveRampAtlasSO() - { - AssetDatabase.SaveAssetIfDirty(this); - } - - public void UpdateTexturePixels() - { - if (!rampAtlasTexture) - return; - - LwguiGradientWindow.RegisterSerializedObjectUndo(this); - rampAtlasTexture.Reinitialize(rampAtlasWidth, rampAtlasHeight); - rampAtlasTexture.SetPixels(GetPixels()); - rampAtlasTexture.Apply(); - } - - public void DiscardChanges() - { - var importer = AssetImporter.GetAtPath(_rampAtlasTexturePath); - if (!importer) - return; - - EditorJsonUtility.FromJsonOverwrite(importer.userData, this); - InitData(); - AssetDatabase.ImportAsset(_rampAtlasTexturePath, ImportAssetOptions.ForceUpdate); - LoadTexture(); - EditorUtility.ClearDirty(this); - } - - public void ConvertColorSpace(ColorSpace targetColorSpace) - { - foreach (var ramp in ramps) - { - if (ramp.colorSpace != targetColorSpace) - { - ramp.colorSpace = targetColorSpace; - ramp.gradient.ConvertColorSpaceWithoutCopy( - targetColorSpace != ColorSpace.Gamma - ? ColorSpace.Linear - : ColorSpace.Gamma); - } - } - - rampAtlasSRGB = targetColorSpace == ColorSpace.Gamma; - RampHelper.SetRampTextureImporter(_rampAtlasTexturePath, true, !rampAtlasSRGB, EditorJsonUtility.ToJson(this)); - UpdateTexturePixels(); - SaveTexture(checkoutAndForceWrite:true); - } - - [ContextMenu("Convert Gamma To Linear")] - public void ConvertGammaToLinear() - { - ConvertColorSpace(ColorSpace.Linear); - } - - [ContextMenu("Convert Linear To Gamma")] - public void ConvertLinearToGamma() - { - ConvertColorSpace(ColorSpace.Gamma); - } - - private void OnEnable() - { - InitData(); - LoadTexture(); - } - - private void OnValidate() - { - // Skip at the end of compilation - if (Event.current == null - // Skip when editing Text Field - || EditorGUIUtility.editingTextField) - return; - - InitData(); - - if (!LoadTexture()) - return; - - UpdateTexturePixels(); - SaveTexture(checkoutAndForceWrite:_saveTextureToggle); - _saveTextureToggle = false; - } - - public static Texture LoadRampAtlasTexture(LwguiRampAtlas rampAtlasSO) - { - if (!rampAtlasSO || !AssetDatabase.Contains(rampAtlasSO)) - { - return null; - } - - var soPath = Path.ChangeExtension(AssetDatabase.GetAssetPath(rampAtlasSO), RampAtlasTextureExtensionName); - return AssetDatabase.LoadAssetAtPath(soPath); - } - - public static LwguiRampAtlas LoadRampAtlasSO(Texture texture) - { - if (!texture || !AssetDatabase.Contains(texture)) - { - return null; - } - - var soPath = Path.ChangeExtension(AssetDatabase.GetAssetPath(texture), RampAtlasSOExtensionName); - return AssetDatabase.LoadAssetAtPath(soPath); - } - - public static LwguiRampAtlas CreateRampAtlasSO(MaterialProperty rampAtlasProp, LWGUIMetaDatas metaDatas) - { - if (rampAtlasProp == null || metaDatas == null) - return null; - - var shader = metaDatas.GetShader(); - - // Get default ramps - RampAtlasDrawer targetRampAtlasDrawer = null; - List<(int defaultIndex, RampAtlasIndexerDrawer indexerDrawer)> defaultRampAtlasIndexerDrawers = new(); - // Unity Bug: The cache of MaterialPropertyHandler must be cleared first, otherwise the default value cannot be obtained correctly. - ReflectionHelper.InvalidatePropertyCache(shader); - for (int i = 0; i < metaDatas.perMaterialData.defaultPropertiesWithPresetOverride.Length; i++) - { - var prop = metaDatas.perMaterialData.defaultPropertiesWithPresetOverride[i]; - var drawer = ReflectionHelper.GetPropertyDrawer(shader, prop); - if (drawer == null) - continue; - - if (drawer is RampAtlasDrawer rampAtlasDrawer && prop.name == rampAtlasProp.name) - targetRampAtlasDrawer = rampAtlasDrawer; - - if (drawer is RampAtlasIndexerDrawer rampAtlasIndexerDrawer && rampAtlasIndexerDrawer.rampAtlasPropName == rampAtlasProp.name) - defaultRampAtlasIndexerDrawers.Add(((int)prop.GetNumericValue(), rampAtlasIndexerDrawer)); - } - - if (targetRampAtlasDrawer == null) - { - Debug.LogError($"LWGUI: Can NOT find RampAtlasDrawer {rampAtlasProp.name} in Shader {shader}"); - return null; - } - - // Init Ramp Atlas - var newRampAtlasSO = ScriptableObject.CreateInstance(); - newRampAtlasSO.name = targetRampAtlasDrawer.defaultFileName; - newRampAtlasSO.rampAtlasWidth = targetRampAtlasDrawer.defaultAtlasWidth; - newRampAtlasSO.rampAtlasHeight = targetRampAtlasDrawer.defaultAtlasHeight; - newRampAtlasSO.rampAtlasSRGB = targetRampAtlasDrawer.defaultAtlasSRGB; - - if (defaultRampAtlasIndexerDrawers.Count > 0) - { - defaultRampAtlasIndexerDrawers.Sort(((x, y) => x.defaultIndex.CompareTo(y.defaultIndex))); - - // Set Ramps Count - var maxIndex = defaultRampAtlasIndexerDrawers.Max((tuple => tuple.defaultIndex)); - for (int i = 0; i < maxIndex + 1; i++) - { - newRampAtlasSO.ramps.Add(new Ramp()); - if (newRampAtlasSO.ramps.Count >= newRampAtlasSO.rampAtlasHeight) - newRampAtlasSO.rampAtlasHeight *= 2; - } - - // Set Ramps Default Value - for (int i = 0; i < defaultRampAtlasIndexerDrawers.Count; i++) - { - var defaultRampAtlasIndexerDrawer = defaultRampAtlasIndexerDrawers[i]; - var ramp = newRampAtlasSO.ramps[defaultRampAtlasIndexerDrawer.defaultIndex]; - var drawer = defaultRampAtlasIndexerDrawer.indexerDrawer; - ramp.name = drawer.defaultRampName; - ramp.colorSpace = drawer.colorSpace; - ramp.channelMask = drawer.viewChannelMask; - ramp.timeRange = drawer.timeRange; - } - } - - return SaveRampAtlasSOToAsset(newRampAtlasSO, targetRampAtlasDrawer.rootPath, targetRampAtlasDrawer.defaultFileName); - } - - public static LwguiRampAtlas CloneRampAtlasSO(LwguiRampAtlas rampAtlasSO) - { - if (!rampAtlasSO) - return null; - - var newRampAtlasSO = Instantiate(rampAtlasSO); - var rootPath = Path.GetDirectoryName(rampAtlasSO._rampAtlasSOPath); - var defaultFileName = Path.GetFileName(rampAtlasSO._rampAtlasSOPath); - - if (SaveRampAtlasSOToAsset(newRampAtlasSO, rootPath, defaultFileName)) - { - newRampAtlasSO.InitData(); - newRampAtlasSO.LoadTexture(); - return newRampAtlasSO; - } - - return null; - } - - public static LwguiRampAtlas SaveRampAtlasSOToAsset(LwguiRampAtlas rampAtlasSO, string rootPath, string defaultFileName) - { - if (!rampAtlasSO) - return null; - - // Save Ramp Atlas - string createdFileRelativePath = string.Empty; - while (true) - { - // TODO: Warning: - // PropertiesGUI() is being called recursively. If you want to render the default gui for shader properties then call PropertiesDefaultGUI() instead - var absPath = EditorUtility.SaveFilePanel("Create a Ramp Atlas SO", rootPath, defaultFileName, "asset"); - - if (absPath.StartsWith(IOHelper.ProjectPath)) - { - createdFileRelativePath = IOHelper.GetRelativePath(absPath); - break; - } - else if (absPath != string.Empty) - { - var retry = EditorUtility.DisplayDialog("Invalid Path", $"Please select the subdirectory of '{IOHelper.ProjectPath}'", "Retry", "Cancel"); - if (!retry) break; - } - else - { - break; - } - } - - if (!string.IsNullOrEmpty(createdFileRelativePath)) - { - AssetDatabase.CreateAsset(rampAtlasSO, createdFileRelativePath); - rampAtlasSO.InitData(); - rampAtlasSO.LoadTexture(); - return rampAtlasSO; - } - - return null; - } - } -} \ No newline at end of file + public interface IRamp + { + string Name { get; set; } + ColorSpace ColorSpace { get; set; } + LwguiGradient.ChannelMask ChannelMask { get; set; } + LwguiGradient.GradientTimeRange TimeRange { get; set; } + + /// + /// Ramp contains at least one Gradient. + /// You can add more custom Gradients by overriding the virtual functions in LwguiRampAtlas. + /// + LwguiGradient Gradient { get; set; } + + /// + /// Get All Gradients. + /// + LwguiGradient[] GetGradients(); + + /// + /// Fill pixels for this Ramp into the output array. + /// + /// The output pixel array to fill + /// Current index in the output array, will be updated after filling + /// Width of each row in pixels + void GetPixelsForAtlas(ref Color[] outputPixels, ref int currentIndex, int width); + + /// + /// Get preview textures for this Ramp in Ramp Selector Window. + /// Returns multiple textures if the Ramp contains multiple gradients. + /// + /// Width of the preview texture + /// Array of preview textures + Texture2D[] GetPreviewTexturesForRampSelector(int width); + + /// + /// Copy properties from another Ramp. + /// + /// The source Ramp to copy from + void CopyFrom(IRamp source); + } + + [Serializable] + public class Ramp : IRamp + { + public string name = "New Ramp"; + public ColorSpace colorSpace = ColorSpace.Gamma; + public LwguiGradient.ChannelMask channelMask = LwguiGradient.ChannelMask.All; + public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; + public LwguiGradient gradient = LwguiGradient.white; + + // IRamp interface implementation using explicit properties that wrap the fields + string IRamp.Name { get => name; set => name = value; } + ColorSpace IRamp.ColorSpace { get => colorSpace; set => colorSpace = value; } + LwguiGradient.ChannelMask IRamp.ChannelMask { get => channelMask; set => channelMask = value; } + LwguiGradient.GradientTimeRange IRamp.TimeRange { get => timeRange; set => timeRange = value; } + LwguiGradient IRamp.Gradient { get => gradient; set => gradient = value; } + + /// + /// The number of rows this Ramp type occupies in the Ramp Atlas Texture. + /// This is a static value bound to the type. Derived classes can hide this with 'new static'. + /// + public static int RowCount => 1; + + public virtual LwguiGradient[] GetGradients() => new[] { gradient }; + + public virtual void GetPixelsForAtlas(ref Color[] outputPixels, ref int currentIndex, int width) + { + var gradients = GetGradients(); + for (int i = 0; i < gradients.Length; i++) + { + gradients[i]?.GetPixels(ref outputPixels, ref currentIndex, width, 1, channelMask); + } + } + + public virtual Texture2D[] GetPreviewTexturesForRampSelector(int width) + { + var gradients = GetGradients(); + var textures = new Texture2D[gradients.Length]; + for (int i = 0; i < gradients.Length; i++) + { + textures[i] = gradients[i]?.GetPreviewRampTexture(width, 1, colorSpace, channelMask); + } + return textures; + } + + public virtual void CopyFrom(IRamp source) + { + if (source == null) return; + + name = source.Name; + colorSpace = source.ColorSpace; + channelMask = source.ChannelMask; + timeRange = source.TimeRange; + gradient = new LwguiGradient(source.Gradient); + + var gradients = GetGradients(); + for (int i = 1; i < gradients.Length; i++) + { + if (gradients[i] == null) + continue; + + gradients[i].DeepCopyFrom(source.Gradient); + } + } + } + + [CreateAssetMenu(fileName = "LWGUI_RampAtlas.asset", menuName = "LWGUI/Ramp Atlas", order = 84)] + public partial class LwguiRampAtlas : ScriptableObject + { + public const string RampAtlasSOExtensionName = "asset"; + public const string RampAtlasTextureExtensionName = "tga"; + + public int rampAtlasWidth = 256; + public int rampAtlasHeight = 4; + public bool rampAtlasSRGB = true; + + private string _rampAtlasSOPath = string.Empty; + private string _rampAtlasTexturePath = string.Empty; + + [SerializeField] private bool _saveTextureToggle; + [SerializeField] private List _ramps = new List(); + + [NonSerialized] public Texture2D rampAtlasTexture = null; + + #region Ramp Operate + + /// + /// Access the list of Ramps as IRamp interface. This property uses covariance (IReadOnlyList), + /// allowing derived classes to directly return their strongly-typed lists without type conversion. + /// Override this property in derived classes to return a custom Ramp list. + /// + public virtual IReadOnlyList Ramps => _ramps ??= new List(); + + public virtual int RowCountPerRamp => Ramp.RowCount; + + public int RampCount => Ramps.Count; + + public int TotalRowCount => RampCount * RowCountPerRamp; + + public virtual IRamp CreateRamp() + { + return new Ramp(); + } + + public virtual IRamp AddRamp() + { + _ramps ??= new List(); + var newRamp = CreateRamp(); + _ramps.Add(newRamp as Ramp); + return newRamp; + } + + public virtual IRamp GetRamp(int index) + { + if (index < RampCount && index >= 0) + { + return Ramps[index]; + } + return null; + } + + public virtual void ClearRamps() + { + _ramps?.Clear(); + } + + public void CheckRampRowCount() + { + if (TotalRowCount > rampAtlasHeight) + Debug.LogError($"LWGUI: Ramp Atlas does NOT have enough height ({rampAtlasHeight} < {TotalRowCount}):\n{_rampAtlasSOPath}"); + } + + #endregion + + public void InitData() + { + if (AssetDatabase.Contains(this)) + { + _rampAtlasSOPath = AssetDatabase.GetAssetPath(this); + _rampAtlasTexturePath = Path.ChangeExtension(_rampAtlasSOPath, RampAtlasTextureExtensionName); + } + } + + public bool LoadTexture() + { + if (!AssetDatabase.Contains(this)) + return false; + + // Try to load + rampAtlasTexture = AssetDatabase.LoadAssetAtPath(_rampAtlasTexturePath); + + // Create + if (!rampAtlasTexture + || rampAtlasTexture.width != rampAtlasWidth + || rampAtlasTexture.height != rampAtlasHeight + || rampAtlasTexture.isDataSRGB != rampAtlasSRGB + ) + { + CreateRampAtlasTexture(); + rampAtlasTexture = AssetDatabase.LoadAssetAtPath(_rampAtlasTexturePath); + } + + if (!rampAtlasTexture) + { + Debug.LogError($"LWGUI: Can NOT create a Ramp Atlas Texture at path: {_rampAtlasTexturePath}"); + return false; + } + + CheckRampRowCount(); + + return true; + } + + public virtual Color[] GetPixels() + { + var pixels = Enumerable.Repeat(Color.white, rampAtlasWidth * rampAtlasHeight).ToArray(); + int currentIndex = 0; + foreach (var ramp in Ramps) + { + ramp?.GetPixelsForAtlas(ref pixels, ref currentIndex, rampAtlasWidth); + } + + return pixels; + } + + public void CreateRampAtlasTexture() + { + var rampAtlas = new Texture2D(rampAtlasWidth, rampAtlasHeight, TextureFormat.RGBA32, false, !rampAtlasSRGB); + rampAtlas.SetPixels(GetPixels()); + rampAtlas.wrapMode = TextureWrapMode.Clamp; + rampAtlas.name = Path.GetFileName(_rampAtlasTexturePath); + rampAtlas.Apply(); + + SaveTexture(rampAtlas, checkoutAndForceWrite:true); + + AssetDatabase.ImportAsset(_rampAtlasTexturePath); + RampHelper.SetRampTextureImporter(_rampAtlasTexturePath, true, !rampAtlasSRGB, EditorJsonUtility.ToJson(this)); + } + + public void SaveTexture(Texture2D rampAtlas = null, string targetRelativePath = null, bool checkoutAndForceWrite = false) + { + targetRelativePath ??= _rampAtlasTexturePath; + rampAtlas ??= rampAtlasTexture; + if (!rampAtlas || string.IsNullOrEmpty(targetRelativePath)) + return; + + CheckRampRowCount(); + + var absPath = IOHelper.GetAbsPath(targetRelativePath); + if (File.Exists(absPath)) + { + var existRampTexture = AssetDatabase.LoadAssetAtPath(targetRelativePath); + if (!VersionControlHelper.IsWriteable(existRampTexture)) + { + if (checkoutAndForceWrite) + { + if (!VersionControlHelper.Checkout(targetRelativePath)) + { + Debug.LogError($"LWGUI: Can NOT write the Ramp Atlas Texture to path: {absPath}"); + return; + } + } + else + { + return; + } + } + } + + try + { + File.WriteAllBytes(absPath, rampAtlas.EncodeToTGA()); + SaveTextureUserData(targetRelativePath); + + Debug.Log($"LWGUI: Saved the Ramp Atlas Texture at path: {absPath}"); + } + catch (Exception e) + { + Debug.LogError(e); + } + } + + public void SaveTextureUserData(string targetRelativePath = null) + { + targetRelativePath ??= _rampAtlasTexturePath; + if (!string.IsNullOrEmpty(targetRelativePath)) + { + var importer = AssetImporter.GetAtPath(targetRelativePath); + if (importer) + { + importer.userData = EditorJsonUtility.ToJson(this); + importer.SaveAndReimport(); + } + } + } + + public void SaveRampAtlasSO() + { + AssetDatabase.SaveAssetIfDirty(this); + } + + public void UpdateTexturePixels() + { + if (!rampAtlasTexture) + return; + + LwguiGradientWindow.RegisterSerializedObjectUndo(this); + rampAtlasTexture.Reinitialize(rampAtlasWidth, rampAtlasHeight); + rampAtlasTexture.SetPixels(GetPixels()); + rampAtlasTexture.Apply(); + } + + public void DiscardChanges() + { + var importer = AssetImporter.GetAtPath(_rampAtlasTexturePath); + if (!importer) + return; + + EditorJsonUtility.FromJsonOverwrite(importer.userData, this); + InitData(); + AssetDatabase.ImportAsset(_rampAtlasTexturePath, ImportAssetOptions.ForceUpdate); + LoadTexture(); + EditorUtility.ClearDirty(this); + } + + private void OnEnable() + { + InitData(); + LoadTexture(); + } + + private void OnValidate() + { + // Skip at the end of compilation + if (Event.current == null + // Skip when editing Text Field + || EditorGUIUtility.editingTextField) + return; + + InitData(); + + if (!LoadTexture()) + return; + + UpdateTexturePixels(); + SaveTexture(checkoutAndForceWrite:_saveTextureToggle); + _saveTextureToggle = false; + } + + #region Static + + public static Texture LoadRampAtlasTexture(LwguiRampAtlas rampAtlasSO) + { + if (!rampAtlasSO || !AssetDatabase.Contains(rampAtlasSO)) + { + return null; + } + + var soPath = Path.ChangeExtension(AssetDatabase.GetAssetPath(rampAtlasSO), RampAtlasTextureExtensionName); + return AssetDatabase.LoadAssetAtPath(soPath); + } + + public static LwguiRampAtlas LoadRampAtlasSO(Texture texture) + { + if (!texture || !AssetDatabase.Contains(texture)) + { + return null; + } + + var soPath = Path.ChangeExtension(AssetDatabase.GetAssetPath(texture), RampAtlasSOExtensionName); + return AssetDatabase.LoadAssetAtPath(soPath); + } + + public static LwguiRampAtlas CreateRampAtlasSO(MaterialProperty rampAtlasProp, LWGUIMetaDatas metaDatas, Type rampAtlasType = null) + { + if (rampAtlasProp == null || metaDatas == null) + return null; + + var shader = metaDatas.GetShader(); + + // Get default ramps + RampAtlasDrawer targetRampAtlasDrawer = null; + List<(int defaultIndex, RampAtlasIndexerDrawer indexerDrawer)> defaultRampAtlasIndexerDrawers = new(); + // Unity Bug: The cache of MaterialPropertyHandler must be cleared first, otherwise the default value cannot be obtained correctly. + ReflectionHelper.InvalidatePropertyCache(shader); + for (int i = 0; i < metaDatas.perMaterialData.defaultPropertiesWithPresetOverride.Length; i++) + { + var prop = metaDatas.perMaterialData.defaultPropertiesWithPresetOverride[i]; + var drawer = ReflectionHelper.GetPropertyDrawer(shader, prop); + if (drawer == null) + continue; + + if (drawer is RampAtlasDrawer rampAtlasDrawer && prop.name == rampAtlasProp.name) + targetRampAtlasDrawer = rampAtlasDrawer; + + if (drawer is RampAtlasIndexerDrawer rampAtlasIndexerDrawer && rampAtlasIndexerDrawer.rampAtlasPropName == rampAtlasProp.name) + defaultRampAtlasIndexerDrawers.Add(((int)prop.GetNumericValue(), rampAtlasIndexerDrawer)); + } + + if (targetRampAtlasDrawer == null) + { + Debug.LogError($"LWGUI: Can NOT find RampAtlasDrawer {rampAtlasProp.name} in Shader {shader}"); + return null; + } + + // Init Ramp Atlas with custom type or default type + rampAtlasType ??= typeof(LwguiRampAtlas); + var newRampAtlasSO = ScriptableObject.CreateInstance(rampAtlasType) as LwguiRampAtlas; + if (newRampAtlasSO == null) + { + Debug.LogError($"LWGUI: Failed to create RampAtlas of type '{rampAtlasType.Name}'"); + return null; + } + newRampAtlasSO.name = targetRampAtlasDrawer.defaultFileName; + newRampAtlasSO.rampAtlasWidth = targetRampAtlasDrawer.defaultAtlasWidth; + newRampAtlasSO.rampAtlasHeight = targetRampAtlasDrawer.defaultAtlasHeight; + newRampAtlasSO.rampAtlasSRGB = targetRampAtlasDrawer.defaultAtlasSRGB; + + if (defaultRampAtlasIndexerDrawers.Count > 0) + { + defaultRampAtlasIndexerDrawers.Sort(((x, y) => x.defaultIndex.CompareTo(y.defaultIndex))); + + // Set Ramps Count + var maxIndex = defaultRampAtlasIndexerDrawers.Max((tuple => tuple.defaultIndex)); + for (int i = 0; i < maxIndex + 1; i++) + { + newRampAtlasSO.AddRamp(); + if (newRampAtlasSO.TotalRowCount > newRampAtlasSO.rampAtlasHeight) + newRampAtlasSO.rampAtlasHeight *= 2; + } + + // Set Ramps Default Value + for (int i = 0; i < defaultRampAtlasIndexerDrawers.Count; i++) + { + var defaultRampAtlasIndexerDrawer = defaultRampAtlasIndexerDrawers[i]; + var ramp = newRampAtlasSO.GetRamp(defaultRampAtlasIndexerDrawer.defaultIndex); + var drawer = defaultRampAtlasIndexerDrawer.indexerDrawer; + ramp.Name = drawer.defaultRampName; + ramp.ColorSpace = drawer.colorSpace; + ramp.ChannelMask = drawer.viewChannelMask; + ramp.TimeRange = drawer.timeRange; + } + } + + return SaveRampAtlasSOToAsset(newRampAtlasSO, targetRampAtlasDrawer.rootPath, targetRampAtlasDrawer.defaultFileName); + } + + public static LwguiRampAtlas CloneRampAtlasSO(LwguiRampAtlas rampAtlasSO, Type targetType = null) + { + if (!rampAtlasSO) + return null; + + var rootPath = Path.GetDirectoryName(rampAtlasSO._rampAtlasSOPath); + var defaultFileName = Path.GetFileName(rampAtlasSO._rampAtlasSOPath); + + LwguiRampAtlas newRampAtlasSO; + + // If target type is specified and different from source type, use ConvertToType + if (targetType != null && targetType != rampAtlasSO.GetType()) + { + // Use ConvertToType for type conversion + newRampAtlasSO = ConvertToType(rampAtlasSO, targetType, false); + return newRampAtlasSO; + } + else + { + // Same type, use Instantiate for direct clone + newRampAtlasSO = Instantiate(rampAtlasSO); + } + + if (SaveRampAtlasSOToAsset(newRampAtlasSO, rootPath, defaultFileName)) + { + newRampAtlasSO.InitData(); + newRampAtlasSO.LoadTexture(); + return newRampAtlasSO; + } + + return null; + } + + public static LwguiRampAtlas SaveRampAtlasSOToAsset(LwguiRampAtlas rampAtlasSO, string rootPath, string defaultFileName) + { + if (!rampAtlasSO) + return null; + + // Save Ramp Atlas + string createdFileRelativePath = string.Empty; + while (true) + { + // TODO: Warning: + // PropertiesGUI() is being called recursively. If you want to render the default gui for shader properties then call PropertiesDefaultGUI() instead + var absPath = EditorUtility.SaveFilePanel("Create a Ramp Atlas SO", rootPath, defaultFileName, "asset"); + + if (absPath.StartsWith(IOHelper.ProjectPath)) + { + createdFileRelativePath = IOHelper.GetRelativePath(absPath); + break; + } + else if (absPath != string.Empty) + { + var retry = EditorUtility.DisplayDialog("Invalid Path", $"Please select the subdirectory of '{IOHelper.ProjectPath}'", "Retry", "Cancel"); + if (!retry) break; + } + else + { + break; + } + } + + if (!string.IsNullOrEmpty(createdFileRelativePath)) + { + AssetDatabase.CreateAsset(rampAtlasSO, createdFileRelativePath); + rampAtlasSO.InitData(); + rampAtlasSO.LoadTexture(); + return rampAtlasSO; + } + + return null; + } + #endregion + + #region Context Menu + + public void ConvertColorSpace(ColorSpace targetColorSpace) + { + foreach (var ramp in Ramps) + { + if (ramp.ColorSpace != targetColorSpace) + { + ramp.ColorSpace = targetColorSpace; + foreach (var gradient in ramp.GetGradients()) + { + gradient?.ConvertColorSpaceWithoutCopy( + targetColorSpace != ColorSpace.Gamma + ? ColorSpace.Linear + : ColorSpace.Gamma); + } + } + } + + rampAtlasSRGB = targetColorSpace == ColorSpace.Gamma; + RampHelper.SetRampTextureImporter(_rampAtlasTexturePath, true, !rampAtlasSRGB, EditorJsonUtility.ToJson(this)); + UpdateTexturePixels(); + SaveTexture(checkoutAndForceWrite:true); + } + + [ContextMenu("Convert Gamma To Linear")] + public void ConvertGammaToLinear() + { + ConvertColorSpace(ColorSpace.Linear); + } + + [ContextMenu("Convert Linear To Gamma")] + public void ConvertLinearToGamma() + { + ConvertColorSpace(ColorSpace.Gamma); + } + + #endregion + + + #region Conversion Utilities + + /// + /// Convert an existing LwguiRampAtlas asset to a custom derived type. + /// The new asset will be created at the same location with a suffix. + /// For custom Ramp types with additional Gradients, the extra Gradients will be copied from the default Gradient. + /// + public static LwguiRampAtlas ConvertToType(LwguiRampAtlas source, Type targetType, bool saveToAsset = true, string suffix = "_Converted") + { + if (source == null) + { + Debug.LogError("LWGUI: Source RampAtlas is null"); + return null; + } + + if (targetType == null || !typeof(LwguiRampAtlas).IsAssignableFrom(targetType)) + { + Debug.LogError($"LWGUI: Target type must be derived from LwguiRampAtlas"); + return null; + } + + // Create new instance of target type + var newAtlas = ScriptableObject.CreateInstance(targetType) as LwguiRampAtlas; + if (newAtlas == null) + { + Debug.LogError($"LWGUI: Failed to create instance of type '{targetType.Name}'"); + return null; + } + + // Copy basic properties + newAtlas.rampAtlasWidth = source.rampAtlasWidth; + newAtlas.rampAtlasHeight = source.rampAtlasHeight; + newAtlas.rampAtlasSRGB = source.rampAtlasSRGB; + + // Convert each Ramp using CopyFrom interface + foreach (var sourceRamp in source.Ramps) + { + if (sourceRamp == null) continue; + + var newRamp = newAtlas.AddRamp(); + newRamp?.CopyFrom(sourceRamp); + } + + // Adjust height if needed + while (newAtlas.TotalRowCount > newAtlas.rampAtlasHeight) + { + newAtlas.rampAtlasHeight *= 2; + } + + if (!saveToAsset) + return newAtlas; + + // Save as new asset + var sourcePath = AssetDatabase.GetAssetPath(source); + if (string.IsNullOrEmpty(sourcePath)) + { + Debug.LogWarning("LWGUI: Source RampAtlas is not a saved asset"); + return newAtlas; + } + + var directory = Path.GetDirectoryName(sourcePath); + var fileName = Path.GetFileNameWithoutExtension(sourcePath); + var newPath = Path.Combine(directory, fileName + suffix + "." + RampAtlasSOExtensionName); + newPath = AssetDatabase.GenerateUniqueAssetPath(newPath); + + var result = SaveRampAtlasSOToAsset(newAtlas, directory, Path.GetFileNameWithoutExtension(newPath)); + + if (result != null) + Debug.Log($"LWGUI: Successfully converted RampAtlas to '{targetType.Name}' at: {newPath}"); + else + Debug.LogError($"LWGUI: Conversion of RampAtlas to '{targetType.Name}' failed at: {newPath}"); + + return result; + } + + #endregion + } +} diff --git a/Editor/ShaderDrawer.cs b/Editor/ShaderDrawer.cs index e13ae2e..95340ee 100644 --- a/Editor/ShaderDrawer.cs +++ b/Editor/ShaderDrawer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; @@ -966,27 +966,39 @@ public class RampAtlasIndexerDrawer : RampDrawer public string rampAtlasPropName = string.Empty; public string defaultRampName = "Ramp"; - private LwguiRampAtlas _rampAtlasSO; - public LwguiRampAtlas rampAtlasSO + private MaterialProperty _rampAtlasProp; + public MaterialProperty rampAtlasProp { get { - if (!_rampAtlasSO) + if (_rampAtlasProp == null) { - var rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); - if (rampAtlasProp != null && rampAtlasProp.GetPropertyType() == ShaderPropertyType.Texture) - { - _rampAtlasSO = LwguiRampAtlas.LoadRampAtlasSO(rampAtlasProp.textureValue); - } - } - return _rampAtlasSO; + var prop = metaDatas?.GetProperty(rampAtlasPropName); + if (prop != null && prop.GetPropertyType() == ShaderPropertyType.Texture) + _rampAtlasProp = prop; + } + return _rampAtlasProp; } + set => _rampAtlasProp = value; + } + private LwguiRampAtlas _rampAtlasSO; + public LwguiRampAtlas rampAtlasSO + { + get => _rampAtlasSO ??= LwguiRampAtlas.LoadRampAtlasSO(rampAtlasProp?.textureValue); set => _rampAtlasSO = value; } - private Ramp _currentRamp; + private IRamp _currentRamp; private bool _rampAtlasSOHasMixedValue; + private bool _isOutOfRange; + + private static readonly float _previewRowHeight = EditorGUIUtility.singleLineHeight; + private static readonly float _previewRowSpacing = 2f; + + private int currentRowCount => rampAtlasSO?.RowCountPerRamp ?? 1; + + protected override float rampPreviewHeight => currentRowCount * _previewRowHeight + Mathf.Max(0, currentRowCount - 1) * _previewRowSpacing; public RampAtlasIndexerDrawer(string group, string rampAtlasPropName) : this(group, rampAtlasPropName, "Ramp") {} @@ -1030,12 +1042,11 @@ protected override void OnRampPropUpdate(Rect position, MaterialProperty prop, G protected override void OnGradientEditorChange(LwguiGradient gradient) { - LwguiGradientWindow.RegisterSerializedObjectUndo(rampAtlasSO); + rampAtlasSO?.UpdateTexturePixels(); } protected override void OnEditRampMap(MaterialProperty prop, LwguiGradient gradient) - { - rampAtlasSO?.UpdateTexturePixels(); + { OnGradientEditorChange(null); } @@ -1048,17 +1059,17 @@ protected override void OnSaveRampMap(MaterialProperty prop, LwguiGradient gradi protected override LwguiGradient GetLwguiGradient(MaterialProperty prop, out bool isDirty) { isDirty = false; - if (rampAtlasSO && (int)prop.GetNumericValue() < rampAtlasSO.ramps.Count) + if (rampAtlasSO && (int)prop.GetNumericValue() < rampAtlasSO.RampCount) { _currentRamp = rampAtlasSO.GetRamp((int)prop.GetNumericValue()); if (_currentRamp == null) return null; - + isDirty = EditorUtility.IsDirty(rampAtlasSO); - colorSpace = _currentRamp.colorSpace; - viewChannelMask = _currentRamp.channelMask; - timeRange = _currentRamp.timeRange; - return _currentRamp.gradient; + colorSpace = _currentRamp.ColorSpace; + viewChannelMask = _currentRamp.ChannelMask; + timeRange = _currentRamp.TimeRange; + return _currentRamp.Gradient; } else return null; @@ -1069,38 +1080,36 @@ protected override void CreateNewRampMap(MaterialProperty prop, MaterialEditor e // Create a Ramp if (rampAtlasSO) { - var newIndex = rampAtlasSO.ramps.Count; - - rampAtlasSO.ramps.Add(new Ramp() - { - name = defaultRampName, - colorSpace = colorSpace, - channelMask = viewChannelMask, - timeRange = timeRange - }); - + var newIndex = rampAtlasSO.RampCount; + + var newRamp = rampAtlasSO.AddRamp(); + newRamp.Name = defaultRampName; + newRamp.ColorSpace = colorSpace; + newRamp.ChannelMask = viewChannelMask; + newRamp.TimeRange = timeRange; + prop.SetNumericValue(newIndex); - if (newIndex >= rampAtlasSO.rampAtlasHeight) + + if (rampAtlasSO.TotalRowCount > rampAtlasSO.rampAtlasHeight) rampAtlasSO.rampAtlasHeight *= 2; + rampAtlasSO.UpdateTexturePixels(); } // Create a Ramp Atlas SO else { - var rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); var newRampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(rampAtlasProp, metaDatas); if (newRampAtlasSO) { rampAtlasSO = newRampAtlasSO; - rampAtlasProp.textureValue = rampAtlasSO?.rampAtlasTexture; + rampAtlasProp.textureValue = rampAtlasSO.rampAtlasTexture; } } } - protected override void SwitchRampMap(MaterialProperty prop, Texture2D newRampMap, int index) + protected void SwitchRamp(MaterialProperty prop, int index) { prop.SetNumericValue(index); - OnSwitchRampMap(prop, newRampMap, index); LWGUI.OnValidate(metaDatas); } @@ -1108,20 +1117,18 @@ protected override LwguiGradient DiscardRampMap(MaterialProperty prop, LwguiGrad { rampAtlasSO?.DiscardChanges(); _currentRamp = rampAtlasSO?.GetRamp((int)prop.GetNumericValue()); - return _currentRamp?.gradient; + return _currentRamp?.Gradient; } - protected override void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) - { - if (!_rampAtlasSOHasMixedValue) - RampHelper.RampIndexSelectorOverride(selectButtonRect, prop, rampAtlasSO, SwitchRampMap); - } + // Selector button is drawn together with preview in DrawRampObjectField + protected override void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) { } + /// + /// Draw rampAtlasSO Fallback Field + /// protected override void DrawRampObjectField(Rect rampFieldRect, MaterialProperty prop, LwguiGradient gradient) { - if (rampAtlasSO && !_rampAtlasSOHasMixedValue) - EditorGUI.ObjectField(rampFieldRect, gradient?.GetPreviewRampTexture(), typeof(Texture2D), false); - else + if (!rampAtlasSO || _rampAtlasSOHasMixedValue) { EditorGUI.BeginChangeCheck(); var newRampAtlasSO = EditorGUI.ObjectField(rampFieldRect, rampAtlasSO, typeof(LwguiRampAtlas), false) as LwguiRampAtlas; @@ -1133,15 +1140,71 @@ protected override void DrawRampObjectField(Rect rampFieldRect, MaterialProperty } } - protected override void DrawPreviewTextureOverride(Rect previewRect, MaterialProperty prop, LwguiGradient gradient) + /// + /// Draw Ramp Preview And Selector + /// + protected override void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) { - if (gradient != null && !EditorGUI.showMixedValue) - LwguiGradientEditorHelper.DrawGradientWithSeparateAlphaChannel(previewRect, gradient, colorSpace, viewChannelMask); + if (!rampAtlasSO || _rampAtlasSOHasMixedValue) + return; + + var previewWidth = previewRect.width; + var selectorButtonWidth = EditorGUIUtility.singleLineHeight; + + if (_currentRamp == null || _isOutOfRange || EditorGUI.showMixedValue) + { + // Draw Invalid Ramp Fallback + // Draw border + GUI.Box(fieldRect, "None", EditorStyles.objectField); + + // Draw button + var buttonRect = new Rect(previewRect.xMax - 1, fieldRect.y + 1, selectorButtonWidth - 0, rampPreviewHeight - 2); + if (GUI.Button(buttonRect, GUIContent.none, GUIStyles.objectFieldButton)) + { + RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); + } + } + else + { + var gradients = _currentRamp.GetGradients(); + var gradientCount = gradients?.Length ?? 0; + if (gradientCount == 0) return; + + // Draw gradient previews (clickable to edit) + for (int i = 0; i < gradientCount; i++) + { + if (gradients[i] == null) continue; + + var rowY = fieldRect.y + i * (_previewRowHeight + _previewRowSpacing); + var rowRect = new Rect(fieldRect.x, rowY, previewWidth, _previewRowHeight); + + // Draw border + GUI.Box(rowRect, GUIContent.none, EditorStyles.objectField); + + // Draw gradient with alpha channel (clickable to edit) + var innerRect = new Rect(rowRect.x + 1, rowRect.y + 1, rowRect.width - 2, rowRect.height - 2); + LwguiGradientEditorHelper.GradientPreviewField(innerRect, gradients[i], colorSpace, viewChannelMask, timeRange, OnGradientEditorChange); + } + + // Draw selector button (ObjectField picker style, stretches to cover all preview rows) + { + // Draw border + var selectButtonRect = new Rect(previewRect.xMax - 2, fieldRect.y, selectorButtonWidth + 2, rampPreviewHeight); + GUI.Box(selectButtonRect, GUIContent.none, EditorStyles.objectField); + + // Draw button + var innerRect = new Rect(selectButtonRect.x + 0, selectButtonRect.y + 1, selectButtonRect.width - 1, selectButtonRect.height - 2); + if (GUI.Button(innerRect, GUIContent.none, GUIStyles.objectFieldButton)) + { + RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); + } + } + } } public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { - var rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); + rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); if (rampAtlasProp == null || rampAtlasProp.GetPropertyType() != ShaderPropertyType.Texture) { Helper.DrawShaderPropertyWithErrorLabel(position, prop, label, editor, "Invalid rampAtlasPropName"); @@ -1154,12 +1217,15 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l label.tooltip += $"\nCurrent Value: {currentIndex}"; if (rampAtlasSO) { - var isOutOfRange = currentIndex >= rampAtlasSO.ramps.Count; - var info = isOutOfRange ? "OUT OF RANGE!" : rampAtlasSO.ramps[currentIndex].name; - label.text += $" ({ currentIndex }: { info } - { rampAtlasSO.ramps.Count })"; + _isOutOfRange = currentIndex >= rampAtlasSO.RampCount; + var info = _isOutOfRange ? "OUT OF RANGE!" : rampAtlasSO.GetRamp(currentIndex)?.Name ?? "NULL"; + label.text += $" ({ currentIndex }: { info } - { rampAtlasSO.RampCount })"; } else + { + _isOutOfRange = false; label.text += $" ({ currentIndex } - NULL)"; + } // Handle Mixed Value _rampAtlasSOHasMixedValue = rampAtlasProp.hasMixedValue; @@ -1171,6 +1237,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l // Clear + _rampAtlasProp = null; _rampAtlasSO = null; _currentRamp = null; EditorGUI.showMixedValue = showMixedValue; @@ -1291,12 +1358,11 @@ public class RampDrawer : SubDrawer public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; public bool doRegisterUndo; - private static readonly GUIContent _iconMixImage = EditorGUIUtility.IconContent("darkviewbackground"); - - private static readonly float _rampPreviewHeight = EditorGUIUtility.singleLineHeight; private static readonly float _rampButtonsHeight = EditorGUIUtility.singleLineHeight; - - protected override float GetVisibleHeight(MaterialProperty prop) { return _rampPreviewHeight + _rampButtonsHeight; } + + protected virtual float rampPreviewHeight => EditorGUIUtility.singleLineHeight; + + protected override float GetVisibleHeight(MaterialProperty prop) { return rampPreviewHeight + _rampButtonsHeight; } public RampDrawer() : this(String.Empty) { } @@ -1455,7 +1521,7 @@ protected virtual void DrawRampObjectField(Rect rampFieldRect, MaterialProperty } } - protected virtual void DrawPreviewTextureOverride(Rect previewRect, MaterialProperty prop, LwguiGradient gradient) + protected virtual void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) { if (!prop.hasMixedValue && gradient != null) { @@ -1475,7 +1541,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l // Draw Label var labelRect = new Rect(position); { - labelRect.height = _rampPreviewHeight; + labelRect.height = rampPreviewHeight; EditorGUI.PrefixLabel(labelRect, label); } @@ -1484,7 +1550,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l { EditorGUIUtility.labelWidth = 0; EditorGUI.indentLevel = 0; - buttonRect.yMin = buttonRect.yMax - _rampPreviewHeight; + buttonRect.yMin = buttonRect.yMax - EditorGUIUtility.singleLineHeight; buttonRect = MaterialEditor.GetRectAfterLabelWidth(buttonRect); if (buttonRect.width < 50f) return; } @@ -1538,6 +1604,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l // Texture Object Field, handle switch texture event var rampFieldRect = MaterialEditor.GetRectAfterLabelWidth(labelRect); + rampFieldRect.height = labelRect.height; var previewRect = new Rect(rampFieldRect.x + 0.5f, rampFieldRect.y + 0.5f, rampFieldRect.width - 18, rampFieldRect.height - 0.5f); { var selectButtonRect = new Rect(previewRect.xMax, rampFieldRect.y, rampFieldRect.width - previewRect.width, rampFieldRect.height); @@ -1547,7 +1614,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l } // Preview texture override (larger preview, hides texture name) - DrawPreviewTextureOverride(previewRect, prop, gradient); + DrawPreviewTextureOverride(previewRect, rampFieldRect, prop, gradient); EditorGUIUtility.labelWidth = labelWidth; EditorGUI.indentLevel = indentLevel; @@ -1566,7 +1633,9 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l /// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) /// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) /// defaultWidth: default Ramp Atlas Texture width (Default: 256) + /// defaultHeight: default Ramp Atlas Texture height (Default: 4) /// showAtlasPreview: Draw the preview of Ramp Atlas below (True/False) (Default: True) + /// rampAtlasTypeName: custom RampAtlas type name for user-defined RampAtlas classes (Default: LwguiRampAtlas) /// Target Property Type: Texture2D /// public class RampAtlasDrawer : SubDrawer @@ -1577,6 +1646,7 @@ public class RampAtlasDrawer : SubDrawer public int defaultAtlasWidth = 256; public int defaultAtlasHeight = 2; public bool showAtlasPreview = true; + public Type rampAtlasType = typeof(LwguiRampAtlas); protected LwguiRampAtlas _rampAtlasSO; @@ -1594,7 +1664,9 @@ public RampAtlasDrawer(string group, string defaultFileName, string rootPath, st public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, "true") { } - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, showAtlasPreview, "") { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview, string rampAtlasTypeName) { if (!rootPath.StartsWith(this.rootPath)) { @@ -1608,6 +1680,20 @@ public RampAtlasDrawer(string group, string defaultFileName, string rootPath, st this.defaultAtlasWidth = (int)Mathf.Max(2, defaultWidth); this.defaultAtlasHeight = (int)Mathf.Max(2, defaultHeight); this.showAtlasPreview = Helper.StringToBool(showAtlasPreview); + + // Resolve custom RampAtlas type + if (!string.IsNullOrEmpty(rampAtlasTypeName)) + { + var customType = ReflectionHelper.GetTypeByName(rampAtlasTypeName); + if (customType != null && typeof(LwguiRampAtlas).IsAssignableFrom(customType)) + { + rampAtlasType = customType; + } + else + { + Debug.LogError($"LWGUI: RampAtlas type '{rampAtlasTypeName}' not found or not derived from LwguiRampAtlas!"); + } + } } protected override bool IsMatchPropType(MaterialProperty property) => property.GetPropertyType() == ShaderPropertyType.Texture; @@ -1621,7 +1707,7 @@ public override void GetCustomContextMenus(GenericMenu menu, Rect rect, Material menu.AddSeparator(""); menu.AddItem(new GUIContent("Create Ramp Atlas"), false, () => { - _rampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(prop, metaDatas); + _rampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(prop, metaDatas, rampAtlasType); if (_rampAtlasSO) { prop.textureValue = _rampAtlasSO.rampAtlasTexture; @@ -1633,7 +1719,7 @@ public override void GetCustomContextMenus(GenericMenu menu, Rect rect, Material { menu.AddItem(new GUIContent("Clone Ramp Atlas"), false, () => { - var newRampAtlasSO = LwguiRampAtlas.CloneRampAtlasSO(_rampAtlasSO); + var newRampAtlasSO = LwguiRampAtlas.CloneRampAtlasSO(_rampAtlasSO, rampAtlasType); if (newRampAtlasSO) { _rampAtlasSO = newRampAtlasSO; @@ -1668,7 +1754,7 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l } EditorGUI.BeginChangeCheck(); - _rampAtlasSO = (LwguiRampAtlas)EditorGUI.ObjectField(rampAtlasSORect, GUIContent.none, _rampAtlasSO, typeof(LwguiRampAtlas), false); + _rampAtlasSO = (LwguiRampAtlas)EditorGUI.ObjectField(rampAtlasSORect, GUIContent.none, _rampAtlasSO, rampAtlasType, false); if (EditorGUI.EndChangeCheck()) { prop.textureValue = LwguiRampAtlas.LoadRampAtlasTexture(_rampAtlasSO); @@ -1686,6 +1772,9 @@ public override void DrawProp(Rect position, MaterialProperty prop, GUIContent l EditorGUI.DrawPreviewTexture(rampAtlasTextureRect, prop.textureValue); prop.textureValue.filterMode = filter; } + + EditorGUIUtility.labelWidth = labelWidth; + EditorGUI.indentLevel = indentLevel; } } diff --git a/README.md b/README.md index 30f9126..4b889d7 100644 --- a/README.md +++ b/README.md @@ -578,12 +578,14 @@ The new LWGUI Gradient Editor integrates with Unity's built-in [Gradient Editor] /// Note: Currently, the material only saves Texture reference and Int value, /// if you manually modify the Ramp Atlas, the references will not update automatically! /// -/// group: parent group name (Default: none) -/// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) -/// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) -/// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) -/// defaultWidth: default Ramp Atlas Texture width (Default: 256) +/// group: parent group name (Default: none) +/// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) +/// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) +/// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) +/// defaultWidth: default Ramp Atlas Texture width (Default: 256) +/// defaultHeight: default Ramp Atlas Texture height (Default: 4) /// showAtlasPreview: Draw the preview of Ramp Atlas below (True/False) (Default: True) +/// rampAtlasTypeName: custom RampAtlas type name for user-defined RampAtlas classes (Default: LwguiRampAtlas) /// Target Property Type: Texture2D public RampAtlasDrawer() : this(string.Empty) { } public RampAtlasDrawer(string group) : this(group, "RampAtlas") { } @@ -591,8 +593,9 @@ public RampAtlasDrawer(string group, string defaultFileName) : this(group, defau public RampAtlasDrawer(string group, string defaultFileName, string rootPath) : this(group, defaultFileName, rootPath, "sRGB") { } public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace) : this(group, defaultFileName, rootPath, colorSpace, 256) { } public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, 4) { } -public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) -public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) +public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, "true") { } +public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, showAtlasPreview, "") { } +public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview, string rampAtlasTypeName) ``` Example: ```c# diff --git a/README_CN.md b/README_CN.md index 12a793d..af57524 100644 --- a/README_CN.md +++ b/README_CN.md @@ -573,12 +573,14 @@ Result: /// 与RampAtlasIndexer()一起使用, 以在Shader中使用Index采样特定Ramp, 类似于UE的Curve Atlas. /// 注意: 目前材质球仅保存Texture引用和Int值, 如果你手动修改了Ramp Atlas则不会自动更新引用! /// -/// group: parent group name (Default: none) -/// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) -/// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) -/// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) -/// defaultWidth: default Ramp Atlas Texture width (Default: 256) +/// group: parent group name (Default: none) +/// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) +/// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) +/// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) +/// defaultWidth: default Ramp Atlas Texture width (Default: 256) +/// defaultHeight: default Ramp Atlas Texture height (Default: 4) /// showAtlasPreview: Draw the preview of Ramp Atlas below (True/False) (Default: True) +/// rampAtlasTypeName: custom RampAtlas type name for user-defined RampAtlas classes (Default: LwguiRampAtlas) /// Target Property Type: Texture2D public RampAtlasDrawer() : this(string.Empty) { } public RampAtlasDrawer(string group) : this(group, "RampAtlas") { } @@ -587,7 +589,8 @@ public RampAtlasDrawer(string group, string defaultFileName, string rootPath) : public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace) : this(group, defaultFileName, rootPath, colorSpace, 256) { } public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, 4) { } public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, "true") { } -public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) +public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, showAtlasPreview, "") { } +public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview, string rampAtlasTypeName) ``` Example: ```c# diff --git a/Runtime/LwguiGradient/LwguiGradient.cs b/Runtime/LwguiGradient/LwguiGradient.cs index 5a242db..0498fac 100644 --- a/Runtime/LwguiGradient/LwguiGradient.cs +++ b/Runtime/LwguiGradient/LwguiGradient.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; diff --git a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientDrawer.cs b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientDrawer.cs index 28ff550..b4bd801 100644 --- a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientDrawer.cs +++ b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientDrawer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using UnityEngine; diff --git a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditorHelper.cs b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditorHelper.cs index 0989b40..47fa8e1 100644 --- a/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditorHelper.cs +++ b/UnityEditorExtension/LwguiGradientEditor/LwguiGradientEditorHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; @@ -11,6 +11,7 @@ namespace LWGUI.LwguiGradientEditor public static class LwguiGradientEditorHelper { private static readonly int s_LwguiGradientHash = "s_LwguiGradientHash".GetHashCode(); + private static readonly int s_LwguiGradientPreviewHash = "s_LwguiGradientPreviewHash".GetHashCode(); private static int s_LwguiGradientID; // GradientEditor.DrawGradientWithBackground() @@ -154,6 +155,57 @@ public static void GradientField(Rect position, GUIContent label, SerializedProp } EditorGUI.EndProperty(); } + + /// + /// Draw a clickable gradient preview that opens the gradient editor when clicked. + /// This method handles change detection and Undo/Redo like GradientEditButton. + /// + public static bool GradientPreviewField(Rect rect, LwguiGradient gradient, + ColorSpace colorSpace, + LwguiGradient.ChannelMask viewChannelMask, + LwguiGradient.GradientTimeRange timeRange, + LwguiGradientWindow.ChangeGradientCallback onChange = null) + { + int id = GUIUtility.GetControlID(s_LwguiGradientPreviewHash, FocusType.Keyboard, rect); + var evt = Event.current; + + // When drawing the modifying Gradient Field and it has changed + if ((GUIUtility.keyboardControl == id || s_LwguiGradientID == id) + && evt.GetTypeForControl(id) == EventType.ExecuteCommand + && evt.commandName == LwguiGradientWindow.LwguiGradientChangedCommand) + { + GUI.changed = true; + HandleUtility.Repaint(); + } + + // Sync Undo/Redo result to editor window + if (s_LwguiGradientID == id + && evt.commandName == "UndoRedoPerformed") + { + LwguiGradientWindow.UpdateCurrentGradient(gradient); + } + + // Draw gradient preview + if (evt.type == EventType.Repaint) + { + DrawGradientWithSeparateAlphaChannel(rect, gradient, colorSpace, viewChannelMask); + } + + // Handle click to open editor + bool clicked = false; + if (evt.type == EventType.MouseDown && evt.button == 0 && rect.Contains(evt.mousePosition)) + { + clicked = true; + evt.Use(); + + s_LwguiGradientID = id; + GUIUtility.keyboardControl = id; + LwguiGradientWindow.Show(gradient, colorSpace, viewChannelMask, timeRange, GUIView.current, onChange); + GUIUtility.ExitGUI(); + } + + return clicked; + } public static bool GradientEditButton(Rect position, GUIContent icon, LwguiGradient gradient, ColorSpace colorSpace = ColorSpace.Gamma, diff --git a/UnityEditorExtension/ReflectionHelper.cs b/UnityEditorExtension/ReflectionHelper.cs index b6e1cb1..9d949d5 100644 --- a/UnityEditorExtension/ReflectionHelper.cs +++ b/UnityEditorExtension/ReflectionHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Jason Ma +// Copyright (c) Jason Ma using System; using System.Collections.Generic; @@ -269,5 +269,57 @@ internal static CurveSelection AddKeyAtTime(this CurveEditor curveEditor, CurveW } #endregion + + + #region Type Lookup + + private static Dictionary _typeCache = new Dictionary(); + + /// + /// Get a Type by its name, searching all loaded assemblies. + /// Supports both full type name (Namespace.ClassName) and simple type name. + /// + public static Type GetTypeByName(string typeName) + { + if (string.IsNullOrEmpty(typeName)) + return null; + + if (_typeCache.TryGetValue(typeName, out var cachedType)) + return cachedType; + + // Try to get type directly + var type = Type.GetType(typeName); + if (type != null) + { + _typeCache[typeName] = type; + return type; + } + + // Search in all loaded assemblies + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) + { + type = assembly.GetType(typeName); + if (type != null) + { + _typeCache[typeName] = type; + return type; + } + + // Try to find by simple name (without namespace) + foreach (var t in assembly.GetTypes()) + { + if (t.Name == typeName || t.FullName == typeName) + { + _typeCache[typeName] = t; + return t; + } + } + } + + _typeCache[typeName] = null; + return null; + } + + #endregion } } \ No newline at end of file diff --git a/package.json b/package.json index 370452e..cb4ab38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.jasonma.lwgui", - "version": "1.30.0", + "version": "1.31.0", "displayName": "LWGUI", "description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.", "keywords": [ From b409119ccdbd9afc5b50d8ea98b332d5dd715d4d Mon Sep 17 00:00:00 2001 From: Jason Ma Date: Sun, 25 Jan 2026 15:17:38 +0800 Subject: [PATCH 4/4] Refactoring: Separate each Drawer into individual files --- .obsidian/workspace.json | 3 +- Editor/ShaderDrawer.cs | 2646 ----------------- Editor/ShaderDrawers.meta | 3 + Editor/ShaderDrawers/BasicDrawers.meta | 8 + .../ShaderDrawers/BasicDrawers/MainDrawer.cs | 109 + .../BasicDrawers/MainDrawer.cs.meta} | 2 +- .../ShaderDrawers/BasicDrawers/SubDrawer.cs | 74 + .../BasicDrawers/SubDrawer.cs.meta | 11 + Editor/ShaderDrawers/ExtraDecorators.meta | 8 + .../ExtraDecorators/Appearance.meta | 8 + .../Appearance/HelpboxDecorator.cs | 41 + .../Appearance/HelpboxDecorator.cs.meta | 11 + .../Appearance/ReadOnlyDecorator.cs | 22 + .../Appearance/ReadOnlyDecorator.cs.meta | 11 + .../Appearance/SubTitleDecorator.cs | 18 + .../Appearance/SubTitleDecorator.cs.meta | 11 + .../Appearance/TitleDecorator.cs | 46 + .../Appearance/TitleDecorator.cs.meta | 11 + .../Appearance/TooltipDecorator.cs | 45 + .../Appearance/TooltipDecorator.cs.meta | 11 + .../ExtraDecorators/ConditionDisplay.meta | 8 + .../ConditionDisplay/HiddenDecorator.cs | 22 + .../ConditionDisplay/HiddenDecorator.cs.meta | 11 + .../ConditionDisplay/ShowIfDecorator.cs | 161 + .../ConditionDisplay/ShowIfDecorator.cs.meta | 11 + .../ShaderDrawers/ExtraDecorators/Logic.meta | 8 + .../Logic/PassSwitchDecorator.cs | 71 + .../Logic/PassSwitchDecorator.cs.meta | 11 + .../ExtraDecorators/Structure.meta | 8 + .../Structure/AdvancedDecorator.cs | 36 + .../Structure/AdvancedDecorator.cs.meta | 11 + .../AdvancedHeaderPropertyDecorator.cs | 24 + .../AdvancedHeaderPropertyDecorator.cs.meta | 11 + Editor/ShaderDrawers/ExtraDrawers.meta | 8 + .../ShaderDrawers/ExtraDrawers/Numeric.meta | 8 + .../ExtraDrawers/Numeric/BitMaskDrawer.cs | 143 + .../Numeric/BitMaskDrawer.cs.meta | 11 + .../ExtraDrawers/Numeric/KWEnumDrawer.cs | 145 + .../ExtraDrawers/Numeric/KWEnumDrawer.cs.meta | 11 + .../Numeric/MinMaxSliderDrawer.cs | 122 + .../Numeric/MinMaxSliderDrawer.cs.meta | 11 + .../ExtraDrawers/Numeric/PresetDrawer.cs | 111 + .../ExtraDrawers/Numeric/PresetDrawer.cs.meta | 11 + .../ExtraDrawers/Numeric/SubEnumDrawer.cs | 57 + .../Numeric/SubEnumDrawer.cs.meta | 11 + .../ExtraDrawers/Numeric/SubIntRangeDrawer.cs | 49 + .../Numeric/SubIntRangeDrawer.cs.meta | 11 + .../Numeric/SubKeywordEnumDrawer.cs | 34 + .../Numeric/SubKeywordEnumDrawer.cs.meta | 11 + .../Numeric/SubPowerSliderDrawer.cs | 71 + .../Numeric/SubPowerSliderDrawer.cs.meta | 11 + .../ExtraDrawers/Numeric/SubToggleDrawer.cs | 82 + .../Numeric/SubToggleDrawer.cs.meta | 11 + Editor/ShaderDrawers/ExtraDrawers/Other.meta | 8 + .../ExtraDrawers/Other/ButtonDrawer.cs | 174 ++ .../ExtraDrawers/Other/ButtonDrawer.cs.meta | 11 + .../ShaderDrawers/ExtraDrawers/Texture.meta | 8 + .../ExtraDrawers/Texture/ImageDrawer.cs | 112 + .../ExtraDrawers/Texture/ImageDrawer.cs.meta | 11 + .../ExtraDrawers/Texture/RampAtlasDrawer.cs | 166 ++ .../Texture/RampAtlasDrawer.cs.meta | 11 + .../Texture/RampAtlasIndexerDrawer.cs | 305 ++ .../Texture/RampAtlasIndexerDrawer.cs.meta | 11 + .../ExtraDrawers/Texture/RampDrawer.cs | 303 ++ .../ExtraDrawers/Texture/RampDrawer.cs.meta | 11 + .../ExtraDrawers/Texture/TexDrawer.cs | 93 + .../ExtraDrawers/Texture/TexDrawer.cs.meta | 11 + Editor/ShaderDrawers/ExtraDrawers/Vector.meta | 8 + .../ExtraDrawers/Vector/ChannelDrawer.cs | 96 + .../ExtraDrawers/Vector/ChannelDrawer.cs.meta | 11 + .../ExtraDrawers/Vector/ColorDrawer.cs | 89 + .../ExtraDrawers/Vector/ColorDrawer.cs.meta | 11 + Editor/ShaderDrawers/ShaderDrawerBase.cs | 40 + Editor/ShaderDrawers/ShaderDrawerBase.cs.meta | 3 + Test/LWGUI_RampAtlas.asset | 46 +- Test/LWGUI_RampAtlas.tga | Bin 4114 -> 4114 bytes Test/LWGUI_RampAtlas.tga.meta | 2 +- Test/RampMap_sRGB.png | Bin 312 -> 314 bytes Test/RampMap_sRGB.png.meta | 4 +- 79 files changed, 3292 insertions(+), 2674 deletions(-) delete mode 100644 Editor/ShaderDrawer.cs create mode 100644 Editor/ShaderDrawers.meta create mode 100644 Editor/ShaderDrawers/BasicDrawers.meta create mode 100644 Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs rename Editor/{ShaderDrawer.cs.meta => ShaderDrawers/BasicDrawers/MainDrawer.cs.meta} (83%) create mode 100644 Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs create mode 100644 Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Logic.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Structure.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs create mode 100644 Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Other.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Vector.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs create mode 100644 Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs.meta create mode 100644 Editor/ShaderDrawers/ShaderDrawerBase.cs create mode 100644 Editor/ShaderDrawers/ShaderDrawerBase.cs.meta diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 0d52ba3..54e7cde 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -206,6 +206,8 @@ }, "active": "d93ffc2d4e7b14bd", "lastOpenFiles": [ + "Editor/ShaderDrawers.meta", + "Editor/ShaderDrawers", "README.md", "README_CN.md", "Editor/ShaderDrawer.cs~", @@ -217,7 +219,6 @@ "Editor/ScriptableObject/GradientObject.cs.meta", "Editor/ScriptableObject/LwguiRampAtlas.cs", "Editor/ScriptableObject/GradientObject.cs", - "Editor/ScriptableObject", "assets~/Pasted image 20250523120309.png", "assets~/Pasted image 20250522183200.png", "assets~/Pasted image 20250321174432.png", diff --git a/Editor/ShaderDrawer.cs b/Editor/ShaderDrawer.cs deleted file mode 100644 index 95340ee..0000000 --- a/Editor/ShaderDrawer.cs +++ /dev/null @@ -1,2646 +0,0 @@ -// Copyright (c) Jason Ma - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using LWGUI.LwguiGradientEditor; -using LWGUI.Runtime; -using LWGUI.Runtime.LwguiGradient; -using LWGUI.Timeline; -using UnityEditor; -using UnityEngine; -using UnityEngine.Rendering; -using Object = UnityEngine.Object; - -namespace LWGUI -{ - #region Interfaces - public interface IBaseDrawer - { - public void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) {} - - public void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) {} - - public void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) {} - } - - public interface IPresetDrawer - { - public string GetPresetFileName(); - - public LwguiShaderPropertyPreset.Preset GetActivePreset(MaterialProperty inProp, LwguiShaderPropertyPreset lwguiShaderPropertyPreset) => - lwguiShaderPropertyPreset?.TryGetPreset(inProp?.floatValue ?? -1); - } - #endregion - - #region Metadata - public partial class PropertyStaticData - { - // Image - public Texture2D image; - - // Button - public List buttonDisplayNames = new(); - public List buttonCommands = new(); - public List buttonDisplayNameWidths = new(); - - // You can add more data that is determined during the initialization of the Drawer as a cache here, - // thereby avoiding the need to calculate it every frame in OnGUI(). - // >>>>>>>>>>>>>>>>>>>>>>>> Add new data here <<<<<<<<<<<<<<<<<<<<<<< - } - #endregion - - #region Basic Drawers - /// - /// Create a Folding Group - /// - /// group: group name (Default: Property Name) - /// keyword: keyword used for toggle, "_" = ignore, none or "__" = Property Name + "_ON", always Upper (Default: none) - /// default Folding State: "on" or "off" (Default: off) - /// default Toggle Displayed: "on" or "off" (Default: on) - /// preset File Name: "Shader Property Preset" asset name, see Preset() for detail (Default: none) - /// Target Property Type: Float, express Toggle value - /// - public class MainDrawer : MaterialPropertyDrawer, IBaseDrawer, IPresetDrawer - { - protected LWGUIMetaDatas metaDatas; - - private static readonly float _height = 28f; - - private bool _isFolding; - private string _group; - private string _keyword; - private bool _defaultFoldingState; - private bool _defaultToggleDisplayed; - private string _presetFileName; - - public MainDrawer() : this(String.Empty) { } - - public MainDrawer(string group) : this(group, String.Empty) { } - - public MainDrawer(string group, string keyword) : this(group, keyword, "off") { } - - public MainDrawer(string group, string keyword, string defaultFoldingState) : this(group, keyword, defaultFoldingState, "on") { } - - public MainDrawer(string group, string keyword, string defaultFoldingState, string defaultToggleDisplayed) : this(group, keyword, defaultFoldingState, defaultToggleDisplayed, String.Empty) { } - - public MainDrawer(string group, string keyword, string defaultFoldingState, string defaultToggleDisplayed, string presetFileName) - { - this._group = group; - this._keyword = keyword; - this._defaultFoldingState = Helper.StringToBool(defaultFoldingState); - this._defaultToggleDisplayed = Helper.StringToBool(defaultToggleDisplayed); - this._presetFileName = presetFileName; - } - - public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.groupName = _group; - inoutPropertyStaticData.isMain = true; - inoutPropertyStaticData.isExpanding = _defaultFoldingState; - PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); - PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, _presetFileName); - } - - public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = inDefaultProp.floatValue > 0 ? "On" : "Off"; - } - - public string GetPresetFileName() => _presetFileName; - - public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - metaDatas = Helper.GetLWGUIMetadatas(editor); - - var showMixedValue = EditorGUI.showMixedValue; - EditorGUI.showMixedValue = prop.hasMixedValue; - EditorGUI.BeginChangeCheck(); - - bool toggleResult = Helper.DrawFoldout(position, ref metaDatas.GetPropStaticData(prop).isExpanding, !Helper.Approximately(prop.floatValue, 0), _defaultToggleDisplayed, label); - - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.floatValue = toggleResult ? 1.0f : 0.0f; - var keyword = Helper.GetKeywordName(_keyword, prop.name); - Helper.SetShaderKeywordEnabled(editor.targets, keyword, toggleResult); - PresetHelper.GetPresetAsset(_presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); - TimelineHelper.SetKeywordToggleToTimeline(prop, editor, keyword); - } - EditorGUI.showMixedValue = showMixedValue; - } - - // Call in custom shader gui - public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) - { - return _height; - } - - // Call when create/edit/undo materials. - // Used to set material settings such as Keywords that need to be kept synchronized with the value forever. - // DO NOT modify other properties here!!! Otherwise, manually modified values will be overwritten. - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - Helper.SetShaderKeywordEnabled(prop.targets, Helper.GetKeywordName(_keyword, prop.name), prop.floatValue > 0f); - PresetDrawer.ApplyPresetWithoutPropertyChanges(_presetFileName, prop); - } - } - } - - /// - /// Draw a property with default style in the folding group - /// - /// group: parent group name (Default: none) - /// Target Property Type: Any - /// - public class SubDrawer : MaterialPropertyDrawer, IBaseDrawer - { - public string group = String.Empty; - public LWGUIMetaDatas metaDatas; - - public SubDrawer() { } - - public SubDrawer(string group) - { - this.group = group; - } - - protected virtual bool IsMatchPropType(MaterialProperty property) { return true; } - - protected virtual float GetVisibleHeight(MaterialProperty prop) - { - var height = MaterialEditor.GetDefaultPropertyHeight(prop); - return prop.GetPropertyType() == ShaderPropertyType.Vector ? EditorGUIUtility.singleLineHeight : height; - } - - public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.groupName = group; - PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); - } - - public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) { } - - public virtual void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) { } - - public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - metaDatas = Helper.GetLWGUIMetadatas(editor); - - if (IsMatchPropType(prop)) - { - DrawProp(position, prop, label, editor); - } - else - { - Debug.LogWarning("LWGUI: Property:'" + prop.name + "' Type:'" + prop.GetPropertyType() + "' mismatch!"); - editor.DefaultShaderProperty(position, prop, label.text); - } - } - - public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) - { - return GetVisibleHeight(prop); - } - - // Draws a custom style property - public virtual void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); - editor.DefaultShaderPropertyInternal(position, prop, label); - } - } - #endregion - - #region Extra Drawers - - #region Numeric - /// - /// Similar to builtin Toggle() - /// - /// group: parent group name (Default: none) - /// keyword: keyword used for toggle, "_" = ignore, none or "__" = Property Name + "_ON", always Upper (Default: none) - /// preset File Name: "Shader Property Preset" asset name, see Preset() for detail (Default: none) - /// Target Property Type: Float - /// - public class SubToggleDrawer : SubDrawer, IPresetDrawer - { - private string _keyWord = String.Empty; - private string _presetFileName = String.Empty; - - public SubToggleDrawer() { } - - public SubToggleDrawer(string group) : this(group, String.Empty, String.Empty) { } - - public SubToggleDrawer(string group, string keyWord) : this(group, keyWord, String.Empty) { } - - public SubToggleDrawer(string group, string keyWord, string presetFileName) - { - this.group = group; - this._keyWord = keyWord; - this._presetFileName = presetFileName; - } - - protected override bool IsMatchPropType(MaterialProperty property) - { - return property.GetPropertyType() is ShaderPropertyType.Float; - } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, _presetFileName); - } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = inDefaultProp.floatValue > 0 ? "On" : "Off"; - } - - public string GetPresetFileName() => _presetFileName; - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - var value = EditorGUI.Toggle(position, label, !Helper.Approximately(prop.floatValue, 0)); - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.floatValue = value ? 1.0f : 0.0f; - var keyword = Helper.GetKeywordName(_keyWord, prop.name); - Helper.SetShaderKeywordEnabled(editor.targets, keyword, value); - PresetHelper.GetPresetAsset(_presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); - TimelineHelper.SetKeywordToggleToTimeline(prop, editor, keyword); - } - EditorGUI.showMixedValue = false; - } - - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - Helper.SetShaderKeywordEnabled(prop.targets, Helper.GetKeywordName(_keyWord, prop.name), prop.floatValue > 0f); - PresetDrawer.ApplyPresetWithoutPropertyChanges(_presetFileName, prop); - } - } - } - - /// - /// Similar to builtin PowerSlider() - /// - /// group: parent group name (Default: none) - /// power: power of slider (Default: 1) - /// presetFileName: "Shader Property Preset" asset name, it rounds up the float to choose which Preset to use. - /// You can create new Preset by - /// "Right Click > Create > LWGUI > Shader Property Preset" in Project window, - /// *any Preset in the entire project cannot have the same name* - /// Target Property Type: Range - /// - public class SubPowerSliderDrawer : SubDrawer, IPresetDrawer - { - public string presetFileName; - - private float _power = 1; - - public SubPowerSliderDrawer(float power) : this("_", power) { } - - public SubPowerSliderDrawer(string group, float power) : this(group, power, string.Empty) { } - - public SubPowerSliderDrawer(string group, float power, string presetFileName) - { - this.group = group; - this._power = Mathf.Clamp(power, 0, float.MaxValue); - this.presetFileName = presetFileName; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, presetFileName); - } - - public string GetPresetFileName() => presetFileName; - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); - EditorGUI.showMixedValue = prop.hasMixedValue; - var rect = position; - var oldValue = prop.floatValue; - ReflectionHelper.DoPowerRangeProperty(rect, prop, label, _power); - if (prop.floatValue != oldValue) - { - PresetHelper.GetPresetAsset(presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); - } - EditorGUI.showMixedValue = false; - } - - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - PresetDrawer.ApplyPresetWithoutPropertyChanges(presetFileName, prop); - } - } - } - - /// - /// Similar to builtin IntRange() - /// - /// group: parent group name (Default: none) - /// Target Property Type: Range - /// - public class SubIntRangeDrawer : SubDrawer - { - public SubIntRangeDrawer(string group) - { - this.group = group; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); - - if (prop.GetPropertyType() != ShaderPropertyType.Range) - { - EditorGUI.LabelField(position, "IntRange used on a non-range property: " + prop.name, EditorStyles.helpBox); - } - else - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 0.0f; - int num = EditorGUI.IntSlider(position, label, (int)prop.floatValue, (int)prop.rangeLimits.x, (int)prop.rangeLimits.y); - EditorGUI.showMixedValue = false; - EditorGUIUtility.labelWidth = labelWidth; - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.floatValue = num; - } - } - } - } - - /// - /// Draw a min max slider - /// - /// group: parent group name (Default: none) - /// minPropName: Output Min Property Name - /// maxPropName: Output Max Property Name - /// Target Property Type: Range, range limits express the MinMaxSlider value range - /// Output Min/Max Property Type: Range, it's value is limited by it's range - /// - public class MinMaxSliderDrawer : SubDrawer - { - private string _minPropName; - private string _maxPropName; - - public MinMaxSliderDrawer(string minPropName, string maxPropName) : this("_", minPropName, maxPropName) { } - - public MinMaxSliderDrawer(string group, string minPropName, string maxPropName) - { - this.group = group; - this._minPropName = minPropName; - this._maxPropName = maxPropName; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - inoutPropertyStaticData.AddExtraProperty(_minPropName); - inoutPropertyStaticData.AddExtraProperty(_maxPropName); - } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - if (string.IsNullOrEmpty(_minPropName) - || string.IsNullOrEmpty(_maxPropName) - || !inoutPerMaterialData.propDynamicDatas.ContainsKey(_minPropName) - || !inoutPerMaterialData.propDynamicDatas.ContainsKey(_maxPropName) - ) - { - Debug.LogError("LWGUI: " + inProp.name + " has no available min/max properties!"); - return; - } - - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = - inoutPerMaterialData.propDynamicDatas[_minPropName].defaultProperty.floatValue - + " - " - + inoutPerMaterialData.propDynamicDatas[_maxPropName].defaultProperty.floatValue; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - // read min max - MaterialProperty minProp = metaDatas.GetProperty(_minPropName); - MaterialProperty maxProp = metaDatas.GetProperty(_maxPropName); - if (minProp == null || maxProp == null) - { - Debug.LogError("LWGUI: MinMaxSliderDrawer: minProp: " + (minProp == null ? "null" : minProp.name) + " or maxProp: " + (maxProp == null ? "null" : maxProp.name) + " not found!"); - return; - } - float minf = minProp.floatValue; - float maxf = maxProp.floatValue; - - // define draw area - Rect controlRect = position; // this is the full length rect area - var w = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 0; - Rect inputRect = MaterialEditor.GetRectAfterLabelWidth(controlRect); // this is the remaining rect area after label's area - - // draw label - EditorGUI.PrefixLabel(controlRect, label); - - // draw min max slider - var indentLevel = EditorGUI.indentLevel; - EditorGUI.indentLevel = 0; - Rect[] splittedRect = Helper.SplitRect(inputRect, 3); - - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = minProp.hasMixedValue; - var newMinf = EditorGUI.FloatField(splittedRect[0], minf); - if (Helper.EndChangeCheck(metaDatas, minProp)) - { - minf = Mathf.Clamp(newMinf, minProp.rangeLimits.x, minProp.rangeLimits.y); - minProp.floatValue = minf; - } - - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = maxProp.hasMixedValue; - var newMaxf = EditorGUI.FloatField(splittedRect[2], maxf); - if (Helper.EndChangeCheck(metaDatas, maxProp)) - { - maxf = Mathf.Clamp(newMaxf, maxProp.rangeLimits.x, maxProp.rangeLimits.y); - maxProp.floatValue = maxf; - } - - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - if (splittedRect[1].width > 50f) - EditorGUI.MinMaxSlider(splittedRect[1], ref minf, ref maxf, prop.rangeLimits.x, prop.rangeLimits.y); - EditorGUI.showMixedValue = false; - - // write back min max if changed - if (EditorGUI.EndChangeCheck()) - { - minProp.floatValue = Mathf.Clamp(minf, minProp.rangeLimits.x, minProp.rangeLimits.y); - maxProp.floatValue = Mathf.Clamp(maxf, maxProp.rangeLimits.x, maxProp.rangeLimits.y); - } - - EditorGUI.indentLevel = indentLevel; - EditorGUIUtility.labelWidth = w; - } - } - - /// - /// Similar to builtin Enum() / KeywordEnum() - /// - /// group: parent group name (Default: none) - /// n(s): display name - /// k(s): keyword - /// v(s): value - /// Target Property Type: Float, express current keyword index - /// - public class KWEnumDrawer : SubDrawer - { - private GUIContent[] _names; - private string[] _keyWords; - private float[] _values; - - - #region - - public KWEnumDrawer(string n1, string k1) - : this("_", new string[1] { n1 }, new string[1] { k1 }) { } - - public KWEnumDrawer(string n1, string k1, string n2, string k2) - : this("_", new string[2] { n1, n2 }, new string[2] { k1, k2 }) { } - - public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3) - : this("_", new string[3] { n1, n2, n3 }, new string[3] { k1, k2, k3 }) { } - - public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4) - : this("_", new string[4] { n1, n2, n3, n4 }, new string[4] { k1, k2, k3, k4 }) { } - - public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4, string n5, string k5) - : this("_", new string[5] { n1, n2, n3, n4, n5 }, new string[5] { k1, k2, k3, k4, k5 }) { } - - public KWEnumDrawer(string group, string n1, string k1) - : this(group, new string[1] { n1 }, new string[1] { k1 }) { } - - public KWEnumDrawer(string group, string n1, string k1, string n2, string k2) - : this(group, new string[2] { n1, n2 }, new string[2] { k1, k2 }) { } - - public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3) - : this(group, new string[3] { n1, n2, n3 }, new string[3] { k1, k2, k3 }) { } - - public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4) - : this(group, new string[4] { n1, n2, n3, n4 }, new string[4] { k1, k2, k3, k4 }) { } - - public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4, string n5, string k5) - : this(group, new string[5] { n1, n2, n3, n4, n5 }, new string[5] { k1, k2, k3, k4, k5 }) { } - - #endregion - - - public KWEnumDrawer(string group, string[] names, string[] keyWords = null, float[] values = null) - { - Init(group, names, keyWords, values); - } - - protected void Init(string group, string[] names, string[] keyWords, float[] values) - { - this.group = group; - - this._names = new GUIContent[names.Length]; - for (int index = 0; index < names.Length; ++index) - this._names[index] = new GUIContent(names[index]); - - if (keyWords == null) - { - keyWords = new string[names.Length]; - for (int i = 0; i < names.Length; i++) - keyWords[i] = String.Empty; - } - this._keyWords = keyWords; - - if (values == null) - { - values = new float[names.Length]; - for (int index = 0; index < names.Length; ++index) - values[index] = index; - } - this._values = values; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() is ShaderPropertyType.Float; } - - protected virtual string GetKeywordName(string propName, string name) { return (name).Replace(' ', '_').ToUpperInvariant(); } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - var index = Array.IndexOf(_values, (int)inDefaultProp.floatValue); - if (index < _names.Length && index >= 0) - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = _names[index].text; - } - - private string[] GetKeywords(MaterialProperty property) - { - string[] keyWords = new string[_keyWords.Length]; - for (int i = 0; i < keyWords.Length; i++) - keyWords[i] = GetKeywordName(property.name, _keyWords[i]); - return keyWords; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - - var rect = position; - - string[] keyWords = GetKeywords(prop); - int index = Array.IndexOf(_values, prop.floatValue); - if (index < 0) - { - Debug.LogError("LWGUI: Property: " + prop.name + " has unknown Enum Value: '" + prop.floatValue + "' !\n"); - return; - } - - Helper.AdaptiveFieldWidth(EditorStyles.popup, _names[index]); - int newIndex = EditorGUI.Popup(rect, label, index, _names); - EditorGUI.showMixedValue = false; - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.floatValue = _values[newIndex]; - Helper.SelectShaderKeyword(editor.targets, keyWords, newIndex); - } - } - - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - Helper.SelectShaderKeyword(prop.targets, GetKeywords(prop), (int)prop.floatValue); - } - } - } - - public class SubEnumDrawer : KWEnumDrawer - { - // UnityEditor.MaterialEnumDrawer(string enumName) - // enumName: like "UnityEngine.Rendering.BlendMode" - public SubEnumDrawer(string group, string enumName) : base(group, enumName) - { - var array = ReflectionHelper.GetAllTypes(); - try - { - Type enumType = array.FirstOrDefault(x => x.IsSubclassOf(typeof(Enum)) && (x.Name == enumName || x.FullName == enumName)); - string[] names = Enum.GetNames(enumType); - Array valuesArray = Enum.GetValues(enumType); - var values = new float[valuesArray.Length]; - for (int index = 0; index < valuesArray.Length; ++index) - values[index] = (int)valuesArray.GetValue(index); - Init(group, names, null, values); - } - catch (Exception ex) - { - Debug.LogWarningFormat("LWGUI: Failed to create SubEnum, enum {0} not found, {1}.", enumName, ex); - throw; - } - } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2) - : base(group, new[] { n1, n2 }, null, new[] { v1, v2 }) { } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3) - : base(group, new[] { n1, n2, n3 }, null, new[] { v1, v2, v3 }) { } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4) - : base(group, new[] { n1, n2, n3, n4 }, null, new[] { v1, v2, v3, v4 }) { } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5) - : base(group, new[] { n1, n2, n3, n4, n5 }, null, new[] { v1, v2, v3, v4, v5 }) { } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5, string n6, float v6) - : base(group, new[] { n1, n2, n3, n4, n5, n6 }, null, new[] { v1, v2, v3, v4, v5, v6 }) { } - - public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5, string n6, float v6, string n7, float v7) - : base(group, new[] { n1, n2, n3, n4, n5, n6, n7 }, null, new[] { v1, v2, v3, v4, v5, v6, v7 }) { } - - protected override string GetKeywordName(string propName, string name) { return "_"; } - - public override void Apply(MaterialProperty prop) { } - } - - public class SubKeywordEnumDrawer : KWEnumDrawer - { - public SubKeywordEnumDrawer(string group, string kw1, string kw2) - : base(group, new[] { kw1, kw2 }, new[] { kw1, kw2 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3) - : base(group, new[] { kw1, kw2, kw3 }, new[] { kw1, kw2, kw3 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4) - : base(group, new[] { kw1, kw2, kw3, kw4 }, new[] { kw1, kw2, kw3, kw4 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5) - : base(group, new[] { kw1, kw2, kw3, kw4, kw5 }, new[] { kw1, kw2, kw3, kw4, kw5 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6) - : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7) - : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7, string kw8) - : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8 }) { } - - public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7, string kw8, string kw9) - : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8, kw9 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8, kw9 }) { } - - protected override string GetKeywordName(string propName, string name) { return (propName + "_" + name).Replace(' ', '_').ToUpperInvariant(); } - } - - /// - /// Popping a menu, you can select the Shader Property Preset, the Preset values will replaces the default values - /// - /// group: parent group name (Default: none) - /// presetFileName: "Shader Property Preset" asset name, you can create new Preset by - /// "Right Click > Create > LWGUI > Shader Property Preset" in Project window, - /// *any Preset in the entire project cannot have the same name* - /// Target Property Type: Float, express current keyword index - /// - public class PresetDrawer : SubDrawer, IPresetDrawer - { - public string presetFileName; - - public PresetDrawer(string presetFileName) : this("_", presetFileName) { } - - public PresetDrawer(string group, string presetFileName) - { - this.group = group; - this.presetFileName = presetFileName; - } - - public static void SetPresetAssetToStaticData(PropertyStaticData inoutPropertyStaticData, string presetFileName) - { - inoutPropertyStaticData.propertyPresetAsset = PresetHelper.GetPresetAsset(presetFileName); - } - - // Apply Keywords and Passes in presets without modifying other property values - // Used to call in MaterialPropertyDrawer.Apply() - public static void ApplyPresetWithoutPropertyChanges(string presetFileName, MaterialProperty prop) - { - var presetFile = PresetHelper.GetPresetAsset(presetFileName); - if (presetFile && ShowIfDecorator.GetShowIfResultToFilterDrawerApplying(prop)) - { - presetFile.TryGetPreset(prop.floatValue)?.ApplyKeywordsAndPassesToMaterials(prop.targets); - } - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Float; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - SetPresetAssetToStaticData(inoutPropertyStaticData, presetFileName); - } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - var propertyPreset = inPerShaderData.propStaticDatas[inProp.name].propertyPresetAsset; - if (propertyPreset) - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = propertyPreset.TryGetPreset(inDefaultProp.floatValue)?.presetName; - } - - public string GetPresetFileName() => presetFileName; - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - - var rect = position; - - int index = (int)Mathf.Max(0, prop.floatValue); - var presetFile = PresetHelper.GetPresetAsset(presetFileName); - if (!presetFile || presetFile.GetPresetCount() == 0) - { - Helper.DrawShaderPropertyWithErrorLabel(rect, prop, label, editor, $"Invalid Preset File: {presetFileName}"); - return; - } - - if (index < presetFile.GetPresetCount()) - { - var presetNames = presetFile.GetPresets().Select((inPreset) => new GUIContent(inPreset.presetName)).ToArray(); - if (EditorGUI.showMixedValue) - index = -1; - else - Helper.AdaptiveFieldWidth(EditorStyles.popup, presetNames[index]); - int newIndex = EditorGUI.Popup(rect, label, index, presetNames); - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.floatValue = newIndex; - presetFile.TryGetPreset(newIndex)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); - } - EditorGUI.showMixedValue = false; - } - else - { - Helper.DrawShaderPropertyWithErrorLabel(position, prop, label, editor, $"Out of Index Range"); - Debug.LogError($"LWGUI: { prop.name } out of Preset index range!"); - } - } - - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - ApplyPresetWithoutPropertyChanges(presetFileName, prop); - } - } - } - - /// - /// Draw the Int value as a Bit Mask. - /// Note: - /// - Currently only 8 bits are supported. - /// - /// Warning 1: If used to set Stencil, it will conflict with SRP Batcher! - /// (Reproduced in Unity 2022) - /// SRP Batcher does not correctly handle multiple materials with different Stencil Ref values, - /// mistakenly merging them into a single Batch and randomly selecting one material's Stencil Ref value for the entire Batch. - /// In theory, if different materials have different Stencil Ref values, they should not be merged into a single Batch due to differing Render States. - /// Solution: - /// - Force disable SRP Batcher by setting the Material Property Block - /// - Place materials with the same Stencil Ref value in a separate Render Queue to ensure the Batch's Render State is correct - /// - /// Warning 2: Once in use, do not change the Target Property Type! - /// The underlying type of Int Property is Float Property, and in Materials, Int and Integer are stored separately. - /// Once a Material is saved, the Property Type is determined. - /// If you change the Property Type at this point (such as switching between Int/Integer), some strange bugs may occur. - /// If you must change the Property Type, it is recommended to modify the Property Name as well or delete the saved Property in the material. - /// - /// group: parent group name (Default: none) - /// bitDescription 7-0: Description of each Bit. (Default: none) - /// Target Property Type: Int/Integer - /// - public class BitMaskDrawer : SubDrawer - { - public int bitCount = 8; - - public float maxHeight = EditorGUIUtility.singleLineHeight; - - public List buttonLables = new (); - - public List buttonWidths = new(); - - public List buttonStyles = new(); - - public float totalButtonWidth; - - private static readonly int _hint = "BitMask".GetHashCode(); - - private static readonly float _minButtonWidth = 25; - - private static readonly float _buttonPadding = 1.0f; - - public BitMaskDrawer() : this(string.Empty, null) { } - - public BitMaskDrawer(string group) : this(group, null) { } - - public BitMaskDrawer(string group, string bitDescription7, string bitDescription6, string bitDescription5, string bitDescription4, string bitDescription3, string bitDescription2, string bitDescription1, string bitDescription0) - : this(group, new List() { bitDescription0, bitDescription1, bitDescription2, bitDescription3, bitDescription4, bitDescription5, bitDescription6, bitDescription7 }) { } - - public BitMaskDrawer(string group, List bitDescriptions) - { - this.group = group; - - bitCount = Mathf.Clamp(bitCount, 1, 16); - - for (int i = 0; i < bitCount; i++) - { - var description = bitDescriptions != null && bitDescriptions.Count > i ? bitDescriptions[i] : string.Empty; - buttonLables.Add(new GUIContent( - string.IsNullOrEmpty(description) ? i.ToString() : i + "\n" + description)); - buttonWidths.Add(Mathf.Max(_minButtonWidth, EditorStyles.miniButton.CalcSize(buttonLables[i]).x)); - - if (!string.IsNullOrEmpty(description)) - maxHeight = EditorGUIUtility.singleLineHeight * 2; - } - - for (int i = 0; i < bitCount; i++) - { - if (i == 0) - buttonStyles.Add(new GUIStyle(EditorStyles.miniButtonRight)); - else if (i == bitCount - 1) - buttonStyles.Add(new GUIStyle(EditorStyles.miniButtonLeft)); - else - buttonStyles.Add(new GUIStyle(EditorStyles.miniButton)); - - buttonStyles[i].fixedHeight = maxHeight; - } - - totalButtonWidth = buttonWidths.Sum(); - } - - protected override bool IsMatchPropType(MaterialProperty property) - => property.GetPropertyType() is ShaderPropertyType.Float or ShaderPropertyType.Int; - - protected override float GetVisibleHeight(MaterialProperty prop) { return maxHeight; } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - label.tooltip += $"\nCurrent Value: { prop.GetNumericValue() }"; - - int controlId = GUIUtility.GetControlID(_hint, FocusType.Keyboard, position); - var fieldRect = EditorGUI.PrefixLabel(position, controlId, label); - - if (position.width < totalButtonWidth) - return; - - fieldRect.xMin = fieldRect.xMax; - - for (int i = 0; i < bitCount; i++) - { - fieldRect.xMin = fieldRect.xMax - buttonWidths[i]; - var buttonLable = buttonLables[i]; - var active = RuntimeHelper.IsBitEnabled((int)prop.GetNumericValue(), i); - var style = buttonStyles[i]; - var buttonRect = fieldRect; - - if (i > 0 && i < bitCount - 1) - { - buttonRect.xMin -= _buttonPadding; - buttonRect.xMax += _buttonPadding * 2; - } - - if (prop.hasMixedValue) - { - style.richText = true; - // https://docs.unity3d.com/2021.3/Documentation/Manual/StyledText.html - buttonLable = new GUIContent($"{ buttonLable.text }"); - } - - if (Helper.ToggleButton(buttonRect, buttonLable, active, style, _buttonPadding * 1.5f)) - { - prop.SetNumericValue(RuntimeHelper.SetBitEnabled((int)prop.GetNumericValue(), i, !active)); - } - - fieldRect.xMax = fieldRect.xMin; - } - } - } - - /// - /// Visually similar to Ramp(), but RampAtlasIndexer() must be used together with RampAtlas(). - /// The actual stored value is the index of the current Ramp in the Ramp Atlas SO, used for sampling the Ramp Atlas Texture in the Shader. - /// - /// group: parent group name. - /// rampAtlasPropName: RampAtlas() property name. - /// defaultRampName: default ramp name. (Default: Ramp) - /// colorSpace: default ramp color space. (sRGB/Linear) (Default: sRGB) - /// viewChannelMask: editable channels. (Default: RGBA) - /// timeRange: the abscissa display range (1/24/2400), is used to optimize the editing experience when the abscissa is time of day. (Default: 1) - /// Target Property Type: Float - /// - public class RampAtlasIndexerDrawer : RampDrawer - { - public string rampAtlasPropName = string.Empty; - public string defaultRampName = "Ramp"; - - private MaterialProperty _rampAtlasProp; - public MaterialProperty rampAtlasProp - { - get - { - if (_rampAtlasProp == null) - { - var prop = metaDatas?.GetProperty(rampAtlasPropName); - if (prop != null && prop.GetPropertyType() == ShaderPropertyType.Texture) - _rampAtlasProp = prop; - } - return _rampAtlasProp; - } - set => _rampAtlasProp = value; - } - - private LwguiRampAtlas _rampAtlasSO; - public LwguiRampAtlas rampAtlasSO - { - get => _rampAtlasSO ??= LwguiRampAtlas.LoadRampAtlasSO(rampAtlasProp?.textureValue); - set => _rampAtlasSO = value; - } - - private IRamp _currentRamp; - private bool _rampAtlasSOHasMixedValue; - private bool _isOutOfRange; - - private static readonly float _previewRowHeight = EditorGUIUtility.singleLineHeight; - private static readonly float _previewRowSpacing = 2f; - - private int currentRowCount => rampAtlasSO?.RowCountPerRamp ?? 1; - - protected override float rampPreviewHeight => currentRowCount * _previewRowHeight + Mathf.Max(0, currentRowCount - 1) * _previewRowSpacing; - - public RampAtlasIndexerDrawer(string group, string rampAtlasPropName) : this(group, rampAtlasPropName, "Ramp") {} - - public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName) : this(group, rampAtlasPropName, defaultRampName, "sRGB") {} - - public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace) : this(group, rampAtlasPropName, defaultRampName, colorSpace, "RGBA") {} - - public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace, string viewChannelMask) : this(group, rampAtlasPropName, defaultRampName, colorSpace, viewChannelMask, 1) {} - - public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace, string viewChannelMask, float timeRange) - { - this.group = group; - this.rampAtlasPropName = rampAtlasPropName; - this.defaultRampName = defaultRampName; - this.colorSpace = colorSpace.ToLower() == "linear" ? ColorSpace.Linear : ColorSpace.Gamma; - this.viewChannelMask = LwguiGradient.ChannelMask.None; - { - viewChannelMask = viewChannelMask.ToLower(); - for (int c = 0; c < (int)LwguiGradient.Channel.Num; c++) - { - if (viewChannelMask.Contains(LwguiGradient.channelNames[c])) - this.viewChannelMask |= LwguiGradient.ChannelIndexToMask(c); - } - } - this.timeRange = LwguiGradient.GradientTimeRange.One; - { - if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFour) - this.timeRange = LwguiGradient.GradientTimeRange.TwentyFour; - else if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFourHundred) - this.timeRange = LwguiGradient.GradientTimeRange.TwentyFourHundred; - } - } - - protected override bool IsMatchPropType(MaterialProperty property) => property.GetPropertyType() is ShaderPropertyType.Float or ShaderPropertyType.Int; - - protected override void OnRampPropUpdate(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - if (doRegisterUndo) - OnGradientEditorChange(null); - } - - protected override void OnGradientEditorChange(LwguiGradient gradient) - { - rampAtlasSO?.UpdateTexturePixels(); - } - - protected override void OnEditRampMap(MaterialProperty prop, LwguiGradient gradient) - { - OnGradientEditorChange(null); - } - - protected override void OnSaveRampMap(MaterialProperty prop, LwguiGradient gradient) - { - rampAtlasSO?.SaveTexture(checkoutAndForceWrite:true); - rampAtlasSO?.SaveRampAtlasSO(); - } - - protected override LwguiGradient GetLwguiGradient(MaterialProperty prop, out bool isDirty) - { - isDirty = false; - if (rampAtlasSO && (int)prop.GetNumericValue() < rampAtlasSO.RampCount) - { - _currentRamp = rampAtlasSO.GetRamp((int)prop.GetNumericValue()); - if (_currentRamp == null) - return null; - - isDirty = EditorUtility.IsDirty(rampAtlasSO); - colorSpace = _currentRamp.ColorSpace; - viewChannelMask = _currentRamp.ChannelMask; - timeRange = _currentRamp.TimeRange; - return _currentRamp.Gradient; - } - else - return null; - } - - protected override void CreateNewRampMap(MaterialProperty prop, MaterialEditor editor) - { - // Create a Ramp - if (rampAtlasSO) - { - var newIndex = rampAtlasSO.RampCount; - - var newRamp = rampAtlasSO.AddRamp(); - newRamp.Name = defaultRampName; - newRamp.ColorSpace = colorSpace; - newRamp.ChannelMask = viewChannelMask; - newRamp.TimeRange = timeRange; - - prop.SetNumericValue(newIndex); - - if (rampAtlasSO.TotalRowCount > rampAtlasSO.rampAtlasHeight) - rampAtlasSO.rampAtlasHeight *= 2; - - rampAtlasSO.UpdateTexturePixels(); - } - // Create a Ramp Atlas SO - else - { - var newRampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(rampAtlasProp, metaDatas); - if (newRampAtlasSO) - { - rampAtlasSO = newRampAtlasSO; - rampAtlasProp.textureValue = rampAtlasSO.rampAtlasTexture; - } - } - } - - protected void SwitchRamp(MaterialProperty prop, int index) - { - prop.SetNumericValue(index); - LWGUI.OnValidate(metaDatas); - } - - protected override LwguiGradient DiscardRampMap(MaterialProperty prop, LwguiGradient gradient) - { - rampAtlasSO?.DiscardChanges(); - _currentRamp = rampAtlasSO?.GetRamp((int)prop.GetNumericValue()); - return _currentRamp?.Gradient; - } - - // Selector button is drawn together with preview in DrawRampObjectField - protected override void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) { } - - /// - /// Draw rampAtlasSO Fallback Field - /// - protected override void DrawRampObjectField(Rect rampFieldRect, MaterialProperty prop, LwguiGradient gradient) - { - if (!rampAtlasSO || _rampAtlasSOHasMixedValue) - { - EditorGUI.BeginChangeCheck(); - var newRampAtlasSO = EditorGUI.ObjectField(rampFieldRect, rampAtlasSO, typeof(LwguiRampAtlas), false) as LwguiRampAtlas; - if (EditorGUI.EndChangeCheck()) - { - rampAtlasSO = newRampAtlasSO; - metaDatas.GetProperty(rampAtlasPropName).textureValue = rampAtlasSO?.rampAtlasTexture; - } - } - } - - /// - /// Draw Ramp Preview And Selector - /// - protected override void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) - { - if (!rampAtlasSO || _rampAtlasSOHasMixedValue) - return; - - var previewWidth = previewRect.width; - var selectorButtonWidth = EditorGUIUtility.singleLineHeight; - - if (_currentRamp == null || _isOutOfRange || EditorGUI.showMixedValue) - { - // Draw Invalid Ramp Fallback - // Draw border - GUI.Box(fieldRect, "None", EditorStyles.objectField); - - // Draw button - var buttonRect = new Rect(previewRect.xMax - 1, fieldRect.y + 1, selectorButtonWidth - 0, rampPreviewHeight - 2); - if (GUI.Button(buttonRect, GUIContent.none, GUIStyles.objectFieldButton)) - { - RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); - } - } - else - { - var gradients = _currentRamp.GetGradients(); - var gradientCount = gradients?.Length ?? 0; - if (gradientCount == 0) return; - - // Draw gradient previews (clickable to edit) - for (int i = 0; i < gradientCount; i++) - { - if (gradients[i] == null) continue; - - var rowY = fieldRect.y + i * (_previewRowHeight + _previewRowSpacing); - var rowRect = new Rect(fieldRect.x, rowY, previewWidth, _previewRowHeight); - - // Draw border - GUI.Box(rowRect, GUIContent.none, EditorStyles.objectField); - - // Draw gradient with alpha channel (clickable to edit) - var innerRect = new Rect(rowRect.x + 1, rowRect.y + 1, rowRect.width - 2, rowRect.height - 2); - LwguiGradientEditorHelper.GradientPreviewField(innerRect, gradients[i], colorSpace, viewChannelMask, timeRange, OnGradientEditorChange); - } - - // Draw selector button (ObjectField picker style, stretches to cover all preview rows) - { - // Draw border - var selectButtonRect = new Rect(previewRect.xMax - 2, fieldRect.y, selectorButtonWidth + 2, rampPreviewHeight); - GUI.Box(selectButtonRect, GUIContent.none, EditorStyles.objectField); - - // Draw button - var innerRect = new Rect(selectButtonRect.x + 0, selectButtonRect.y + 1, selectButtonRect.width - 1, selectButtonRect.height - 2); - if (GUI.Button(innerRect, GUIContent.none, GUIStyles.objectFieldButton)) - { - RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); - } - } - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); - if (rampAtlasProp == null || rampAtlasProp.GetPropertyType() != ShaderPropertyType.Texture) - { - Helper.DrawShaderPropertyWithErrorLabel(position, prop, label, editor, "Invalid rampAtlasPropName"); - Debug.LogError($"LWGUI: Property { prop.name } has invalid rampAtlasPropName: { rampAtlasPropName }"); - return; - } - - // Add Info to label - var currentIndex = (int)prop.GetNumericValue(); - label.tooltip += $"\nCurrent Value: {currentIndex}"; - if (rampAtlasSO) - { - _isOutOfRange = currentIndex >= rampAtlasSO.RampCount; - var info = _isOutOfRange ? "OUT OF RANGE!" : rampAtlasSO.GetRamp(currentIndex)?.Name ?? "NULL"; - label.text += $" ({ currentIndex }: { info } - { rampAtlasSO.RampCount })"; - } - else - { - _isOutOfRange = false; - label.text += $" ({ currentIndex } - NULL)"; - } - - // Handle Mixed Value - _rampAtlasSOHasMixedValue = rampAtlasProp.hasMixedValue; - var showMixedValue = EditorGUI.showMixedValue; - EditorGUI.showMixedValue = prop.hasMixedValue || _rampAtlasSOHasMixedValue; - - - base.DrawProp(position, prop, label, editor); - - - // Clear - _rampAtlasProp = null; - _rampAtlasSO = null; - _currentRamp = null; - EditorGUI.showMixedValue = showMixedValue; - } - } - - #endregion - - #region Texture - /// - /// Draw a Texture property in single line with a extra property - /// - /// group: parent group name (Default: none) - /// extraPropName: extra property name (Default: none) - /// Target Property Type: Texture - /// Extra Property Type: Color, Vector - /// Target Property Type: Texture2D - /// - public class TexDrawer : SubDrawer - { - private string _extraPropName = String.Empty; - private ChannelDrawer _channelDrawer = new ChannelDrawer(); - - public TexDrawer() { } - - public TexDrawer(string group) : this(group, String.Empty) { } - - public TexDrawer(string group, string extraPropName) - { - this.group = group; - this._extraPropName = extraPropName; - } - - protected override float GetVisibleHeight(MaterialProperty prop) { return EditorGUIUtility.singleLineHeight; } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Texture; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - inoutPropertyStaticData.AddExtraProperty(_extraPropName); - } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - var defaultExtraProp = inoutPerMaterialData.GetPropDynamicData(_extraPropName)?.defaultProperty; - if (defaultExtraProp != null) - { - var text = string.Empty; - if (defaultExtraProp.GetPropertyType() == ShaderPropertyType.Vector) - text = ChannelDrawer.GetChannelName(defaultExtraProp); - else - text = RevertableHelper.GetPropertyDefaultValueText(defaultExtraProp); - - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = - RevertableHelper.GetPropertyDefaultValueText(inDefaultProp) + ", " + text; - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.showMixedValue = prop.hasMixedValue; - var rect = position; - - MaterialProperty extraProp = metaDatas.GetProperty(_extraPropName); - if (extraProp != null - // && ( - // extraProp.type == MaterialProperty.PropType.Color - // || extraProp.type == MaterialProperty.PropType.Vector - // ) - ) - { - var i = EditorGUI.indentLevel; - EditorGUI.indentLevel = 0; - - var extraRect = MaterialEditor.GetRightAlignedFieldRect(rect); - extraRect.height = rect.height; - - if (extraProp.GetPropertyType() == ShaderPropertyType.Vector) - _channelDrawer.OnGUI(extraRect, extraProp, GUIContent.none, editor); - else - editor.ShaderProperty(extraRect, extraProp, GUIContent.none); - - EditorGUI.indentLevel = i; - } - - editor.TexturePropertyMiniThumbnail(rect, prop, label.text, label.tooltip); - - EditorGUI.showMixedValue = false; - } - } - - /// - /// Draw an unreal style Ramp Map Editor (Default Ramp Map Resolution: 256 * 2) - /// NEW: The new LwguiGradient type has both the Gradient and Curve editors, and can be used in C# scripts and runtime, and is intended to replace UnityEngine.Gradient - /// - /// group: parent group name (Default: none) - /// defaultFileName: default Ramp Map file name when create a new one (Default: RampMap) - /// rootPath: the path where ramp is stored, replace '/' with '.' (for example: Assets.Art.Ramps). when selecting ramp, it will also be filtered according to the path (Default: Assets) - /// colorSpace: switch sRGB / Linear in ramp texture import setting (Default: sRGB) - /// defaultWidth: default Ramp Width. (Default: 256) - /// viewChannelMask: editable channels. (Default: RGBA) - /// timeRange: the abscissa display range (1/24/2400), is used to optimize the editing experience when the abscissa is time of day. (Default: 1) - /// Target Property Type: Texture2D - /// - public class RampDrawer : SubDrawer - { - public static readonly string DefaultRootPath = "Assets"; - - public string rootPath = "Assets"; - public string saveFilePanelTitle = "Create New Ramp Texture"; - public string defaultFileName = "RampMap"; - public string fileExtension = "png"; - public int defaultWidth = 256; - public int defaultHeight = 2; - public ColorSpace colorSpace = ColorSpace.Gamma; - public LwguiGradient.ChannelMask viewChannelMask = LwguiGradient.ChannelMask.All; - public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; - public bool doRegisterUndo; - - private static readonly float _rampButtonsHeight = EditorGUIUtility.singleLineHeight; - - protected virtual float rampPreviewHeight => EditorGUIUtility.singleLineHeight; - - protected override float GetVisibleHeight(MaterialProperty prop) { return rampPreviewHeight + _rampButtonsHeight; } - - public RampDrawer() : this(String.Empty) { } - - public RampDrawer(string group) : this(group, "RampMap") { } - - public RampDrawer(string group, string defaultFileName) : this(group, defaultFileName, DefaultRootPath, 256) { } - - public RampDrawer(string group, string defaultFileName, float defaultWidth) : this(group, defaultFileName, DefaultRootPath, defaultWidth) { } - - public RampDrawer(string group, string defaultFileName, string rootPath, float defaultWidth) : this(group, defaultFileName, rootPath, "sRGB", defaultWidth) { } - - public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, "RGBA") { } - - public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, string viewChannelMask) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, viewChannelMask, 1) { } - - public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, string viewChannelMask, float timeRange) - { - if (!rootPath.StartsWith(DefaultRootPath)) - { - Debug.LogError("LWGUI: Ramp Root Path: '" + rootPath + "' must start with 'Assets'!"); - rootPath = DefaultRootPath; - } - this.group = group; - this.defaultFileName = defaultFileName; - this.rootPath = rootPath.Replace('.', '/'); - this.colorSpace = colorSpace.ToLower() == "linear" ? ColorSpace.Linear : ColorSpace.Gamma; - this.defaultWidth = (int)Mathf.Max(2, defaultWidth); - this.viewChannelMask = LwguiGradient.ChannelMask.None; - { - viewChannelMask = viewChannelMask.ToLower(); - for (int c = 0; c < (int)LwguiGradient.Channel.Num; c++) - { - if (viewChannelMask.Contains(LwguiGradient.channelNames[c])) - this.viewChannelMask |= LwguiGradient.ChannelIndexToMask(c); - } - - if (this.viewChannelMask == (LwguiGradient.ChannelMask.RGB | LwguiGradient.ChannelMask.Alpha)) - this.viewChannelMask = LwguiGradient.ChannelMask.All; - } - this.timeRange = LwguiGradient.GradientTimeRange.One; - { - if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFour) - this.timeRange = LwguiGradient.GradientTimeRange.TwentyFour; - else if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFourHundred) - this.timeRange = LwguiGradient.GradientTimeRange.TwentyFourHundred; - } - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Texture; } - - protected virtual void OnRampPropUpdate(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - - protected virtual void OnCreateNewRampMap(MaterialProperty prop) { } - - protected virtual void OnGradientEditorChange(LwguiGradient gradient) { } - - protected virtual void OnEditRampMap(MaterialProperty prop, LwguiGradient gradient) { } - - protected virtual void OnSaveRampMap(MaterialProperty prop, LwguiGradient gradient) { } - - protected virtual void OnDiscardRampMap(MaterialProperty prop, LwguiGradient gradient) { } - - protected virtual void OnSwitchRampMap(MaterialProperty prop, Texture2D newRampMap, int index) { } - - protected virtual LwguiGradient GetLwguiGradient(MaterialProperty prop, out bool isDirty) - { - return RampHelper.GetGradientFromTexture(prop.textureValue, out isDirty, false, doRegisterUndo); - } - - protected virtual void EditWhenNoRampMap(MaterialProperty prop, MaterialEditor editor) - { - LwguiGradientWindow.CloseWindow(); - CreateNewRampMap(prop, editor); - OnCreateNewRampMap(prop); - LWGUI.OnValidate(metaDatas); - } - - protected virtual void CreateNewRampMap(MaterialProperty prop, MaterialEditor editor) - { - string createdFileRelativePath = string.Empty; - while (true) - { - var absRootPath = IOHelper.GetAbsPath(rootPath); - if (!Directory.Exists(absRootPath)) - Directory.CreateDirectory(absRootPath); - - // TODO: Warning: - // PropertiesGUI() is being called recursively. If you want to render the default gui for shader properties then call PropertiesDefaultGUI() instead - var absPath = EditorUtility.SaveFilePanel(saveFilePanelTitle, rootPath, defaultFileName, fileExtension); - - if (absPath.StartsWith(absRootPath)) - { - createdFileRelativePath = IOHelper.GetRelativePath(absPath); - break; - } - else if (absPath != string.Empty) - { - var retry = EditorUtility.DisplayDialog("Invalid Path", $"Please select the subdirectory of '{absRootPath}'", "Retry", "Cancel"); - if (!retry) break; - } - else - { - break; - } - } - - if (!string.IsNullOrEmpty(createdFileRelativePath)) - { - RampHelper.CreateAndSaveNewGradientTexture(defaultWidth, defaultHeight, createdFileRelativePath, colorSpace == ColorSpace.Linear); - prop.textureValue = AssetDatabase.LoadAssetAtPath(createdFileRelativePath); - } - } - - protected virtual void ChangeRampMap(MaterialProperty prop, LwguiGradient gradient) - { - RampHelper.SetGradientToTexture(prop.textureValue, gradient, false); - } - - protected virtual void SaveRampMap(MaterialProperty prop, LwguiGradient gradient) - { - RampHelper.SetGradientToTexture(prop.textureValue, gradient, true); - } - - protected virtual void SwitchRampMap(MaterialProperty prop, Texture2D newRampMap, int index) - { - prop.textureValue = newRampMap; - OnSwitchRampMap(prop, newRampMap, index); - LWGUI.OnValidate(metaDatas); - } - - protected virtual LwguiGradient DiscardRampMap(MaterialProperty prop, LwguiGradient gradient) - { - // Tex > Gradient - gradient = RampHelper.GetGradientFromTexture(prop.textureValue, out _, true); - // GradientObject > Tex - RampHelper.SetGradientToTexture(prop.textureValue, gradient, true); - return gradient; - } - - protected virtual void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) - { - RampHelper.RampMapSelectorOverride(selectButtonRect, prop, rootPath, SwitchRampMap); - } - - // Manual replace ramp map - protected virtual void DrawRampObjectField(Rect rampFieldRect, MaterialProperty prop, LwguiGradient gradient) - { - EditorGUI.BeginChangeCheck(); - var newManualSelectedTexture = (Texture2D)EditorGUI.ObjectField(rampFieldRect, prop.textureValue, typeof(Texture2D), false); - if (Helper.EndChangeCheck(metaDatas, prop)) - { - if (newManualSelectedTexture && !AssetDatabase.GetAssetPath(newManualSelectedTexture).StartsWith(rootPath)) - EditorUtility.DisplayDialog("Invalid Path", "Please select the subdirectory of '" + rootPath + "'", "OK"); - else - SwitchRampMap(prop, newManualSelectedTexture, 0); - } - } - - protected virtual void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) - { - if (!prop.hasMixedValue && gradient != null) - { - LwguiGradientEditorHelper.DrawGradientWithSeparateAlphaChannel(previewRect, gradient, colorSpace, viewChannelMask); - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - var labelWidth = EditorGUIUtility.labelWidth; - var indentLevel = EditorGUI.indentLevel; - - OnRampPropUpdate(position, prop, label, editor); - - var gradient = GetLwguiGradient(prop, out var isDirty); - - // Draw Label - var labelRect = new Rect(position); - { - labelRect.height = rampPreviewHeight; - EditorGUI.PrefixLabel(labelRect, label); - } - - // Ramp buttons Rect - var buttonRect = new Rect(position); - { - EditorGUIUtility.labelWidth = 0; - EditorGUI.indentLevel = 0; - buttonRect.yMin = buttonRect.yMax - EditorGUIUtility.singleLineHeight; - buttonRect = MaterialEditor.GetRectAfterLabelWidth(buttonRect); - if (buttonRect.width < 50f) return; - } - - // Draw Ramp Editor - RampHelper.RampEditor(buttonRect, ref gradient, colorSpace, viewChannelMask, timeRange, isDirty, - out bool hasGradientChanges, - out bool doEditWhenNoGradient, - out doRegisterUndo, - out bool doCreate, - out bool doSaveGradient, - out bool doDiscardGradient, - OnGradientEditorChange); - - // Edit When No Gradient - if (doEditWhenNoGradient) - { - EditWhenNoRampMap(prop, editor); - } - - // Create - if (doCreate) - { - LwguiGradientWindow.CloseWindow(); - CreateNewRampMap(prop, editor); - OnCreateNewRampMap(prop); - LWGUI.OnValidate(metaDatas); - } - - // Change - if (hasGradientChanges && gradient != null) - { - ChangeRampMap(prop, gradient); - OnEditRampMap(prop, gradient); - } - - // Save - if (doSaveGradient && gradient != null) - { - SaveRampMap(prop, gradient); - OnSaveRampMap(prop, gradient); - } - - // Discard - if (doDiscardGradient) - { - LwguiGradientWindow.CloseWindow(); - gradient = DiscardRampMap(prop, gradient); - OnDiscardRampMap(prop, gradient); - } - - // Texture Object Field, handle switch texture event - var rampFieldRect = MaterialEditor.GetRectAfterLabelWidth(labelRect); - rampFieldRect.height = labelRect.height; - var previewRect = new Rect(rampFieldRect.x + 0.5f, rampFieldRect.y + 0.5f, rampFieldRect.width - 18, rampFieldRect.height - 0.5f); - { - var selectButtonRect = new Rect(previewRect.xMax, rampFieldRect.y, rampFieldRect.width - previewRect.width, rampFieldRect.height); - DrawRampSelector(selectButtonRect, prop, gradient); - - DrawRampObjectField(rampFieldRect, prop, gradient); - } - - // Preview texture override (larger preview, hides texture name) - DrawPreviewTextureOverride(previewRect, rampFieldRect, prop, gradient); - - EditorGUIUtility.labelWidth = labelWidth; - EditorGUI.indentLevel = indentLevel; - } - } - - /// - /// Draw a "Ramp Atlas Scriptable Object" selector and texture preview. - /// The Ramp Atlas SO is responsible for storing multiple ramps and generating the corresponding Ramp Atlas Texture. - /// Use it together with RampAtlasIndexer() to sample specific ramps in Shader using Index, similar to UE's Curve Atlas. - /// Note: Currently, the material only saves Texture reference and Int value, - /// if you manually modify the Ramp Atlas, the references will not update automatically! - /// - /// group: parent group name (Default: none) - /// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) - /// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) - /// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) - /// defaultWidth: default Ramp Atlas Texture width (Default: 256) - /// defaultHeight: default Ramp Atlas Texture height (Default: 4) - /// showAtlasPreview: Draw the preview of Ramp Atlas below (True/False) (Default: True) - /// rampAtlasTypeName: custom RampAtlas type name for user-defined RampAtlas classes (Default: LwguiRampAtlas) - /// Target Property Type: Texture2D - /// - public class RampAtlasDrawer : SubDrawer - { - public string rootPath = "Assets"; - public string defaultFileName = "RampAtlas"; - public bool defaultAtlasSRGB = true; - public int defaultAtlasWidth = 256; - public int defaultAtlasHeight = 2; - public bool showAtlasPreview = true; - public Type rampAtlasType = typeof(LwguiRampAtlas); - - protected LwguiRampAtlas _rampAtlasSO; - - public RampAtlasDrawer() : this(string.Empty) { } - - public RampAtlasDrawer(string group) : this(group, "RampAtlas") { } - - public RampAtlasDrawer(string group, string defaultFileName) : this(group, defaultFileName, "Assets") { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath) : this(group, defaultFileName, rootPath, "sRGB") { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace) : this(group, defaultFileName, rootPath, colorSpace, 256) { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, 4) { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, "true") { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, showAtlasPreview, "") { } - - public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview, string rampAtlasTypeName) - { - if (!rootPath.StartsWith(this.rootPath)) - { - Debug.LogError("LWGUI: Ramp Atlas Root Path: '" + rootPath + "' must start with 'Assets'!"); - rootPath = this.rootPath; - } - this.group = group; - this.defaultFileName = defaultFileName; - this.rootPath = rootPath.Replace('.', '/'); - this.defaultAtlasSRGB = colorSpace.ToLower() == "srgb"; - this.defaultAtlasWidth = (int)Mathf.Max(2, defaultWidth); - this.defaultAtlasHeight = (int)Mathf.Max(2, defaultHeight); - this.showAtlasPreview = Helper.StringToBool(showAtlasPreview); - - // Resolve custom RampAtlas type - if (!string.IsNullOrEmpty(rampAtlasTypeName)) - { - var customType = ReflectionHelper.GetTypeByName(rampAtlasTypeName); - if (customType != null && typeof(LwguiRampAtlas).IsAssignableFrom(customType)) - { - rampAtlasType = customType; - } - else - { - Debug.LogError($"LWGUI: RampAtlas type '{rampAtlasTypeName}' not found or not derived from LwguiRampAtlas!"); - } - } - } - - protected override bool IsMatchPropType(MaterialProperty property) => property.GetPropertyType() == ShaderPropertyType.Texture; - - protected override float GetVisibleHeight(MaterialProperty prop) => - EditorGUIUtility.singleLineHeight + - (prop.textureValue && showAtlasPreview ? MaterialEditor.GetDefaultPropertyHeight(prop) + 2.0f : 0); - - public override void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) - { - menu.AddSeparator(""); - menu.AddItem(new GUIContent("Create Ramp Atlas"), false, () => - { - _rampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(prop, metaDatas, rampAtlasType); - if (_rampAtlasSO) - { - prop.textureValue = _rampAtlasSO.rampAtlasTexture; - LWGUI.OnValidate(metaDatas); - } - }); - - if (_rampAtlasSO) - { - menu.AddItem(new GUIContent("Clone Ramp Atlas"), false, () => - { - var newRampAtlasSO = LwguiRampAtlas.CloneRampAtlasSO(_rampAtlasSO, rampAtlasType); - if (newRampAtlasSO) - { - _rampAtlasSO = newRampAtlasSO; - prop.textureValue = _rampAtlasSO.rampAtlasTexture; - LWGUI.OnValidate(metaDatas); - } - }); - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.PrefixLabel(position, label); - - var labelWidth = EditorGUIUtility.labelWidth; - var indentLevel = EditorGUI.indentLevel; - EditorGUIUtility.labelWidth = 0; - EditorGUI.indentLevel = 0; - - var fieldRect = MaterialEditor.GetRectAfterLabelWidth(position); - var rampAtlasSORect = new Rect(fieldRect.x, fieldRect.y, fieldRect.width, EditorGUIUtility.singleLineHeight); - var rampAtlasTextureRect = new Rect(fieldRect.x, rampAtlasSORect.yMax + 2.0f, fieldRect.width, MaterialEditor.GetDefaultPropertyHeight(prop)); - - _rampAtlasSO = LwguiRampAtlas.LoadRampAtlasSO(prop.textureValue); - - // Disable ObjectField's Context Menu - var e = Event.current; - if (e?.type == EventType.MouseDown && Event.current.button == 1 - && (rampAtlasSORect.Contains(e.mousePosition))) - { - e.Use(); - } - - EditorGUI.BeginChangeCheck(); - _rampAtlasSO = (LwguiRampAtlas)EditorGUI.ObjectField(rampAtlasSORect, GUIContent.none, _rampAtlasSO, rampAtlasType, false); - if (EditorGUI.EndChangeCheck()) - { - prop.textureValue = LwguiRampAtlas.LoadRampAtlasTexture(_rampAtlasSO); - - if (_rampAtlasSO && !prop.textureValue) - { - Debug.LogError($"LWGUI: Can NOT load the Ramp Atlas Texture from: { _rampAtlasSO.name }"); - } - } - - if (showAtlasPreview && prop.textureValue && !prop.hasMixedValue) - { - var filter = prop.textureValue.filterMode; - prop.textureValue.filterMode = FilterMode.Point; - EditorGUI.DrawPreviewTexture(rampAtlasTextureRect, prop.textureValue); - prop.textureValue.filterMode = filter; - } - - EditorGUIUtility.labelWidth = labelWidth; - EditorGUI.indentLevel = indentLevel; - } - } - - /// - /// Draw an image preview. - /// display name: The path of the image file relative to the Unity project, such as: "Assets/test.png", "Doc/test.png", "../test.png" - /// - /// group: parent group name (Default: none) - /// Target Property Type: Any - /// - public class ImageDrawer : SubDrawer - { - public ImageDrawer() { } - - public ImageDrawer(string group) - { - this.group = group; - } - - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - var inputPath = (inProp.displayName ?? string.Empty).Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar); - string imageAbsPath = null; - - try - { - // If the display path already starts with Assets (project-relative), resolve from project root - if (inputPath.StartsWith("Assets")) - { - imageAbsPath = IOHelper.GetAbsPath(inputPath); - } - // If it's an absolute path, use it directly - else if (Path.IsPathRooted(inputPath)) - { - imageAbsPath = inputPath; - } - else - { - // Try resolving relative to the shader file location - var shaderAssetPath = AssetDatabase.GetAssetPath(inShader); - if (!string.IsNullOrEmpty(shaderAssetPath)) - { - var shaderFullPath = IOHelper.GetAbsPath(shaderAssetPath); - var shaderDir = Path.GetDirectoryName(shaderFullPath); - if (!string.IsNullOrEmpty(shaderDir)) - { - // Combine and normalize to resolve ../ segments - var candidate = Path.GetFullPath(Path.Combine(shaderDir, inputPath)); - if (File.Exists(candidate)) - { - imageAbsPath = candidate; - } - } - } - // Fallback: try project-root relative resolution - if (imageAbsPath == null) - { - var candidate2 = IOHelper.GetAbsPath(inputPath); - if (File.Exists(candidate2)) imageAbsPath = candidate2; - } - } - - if (!string.IsNullOrEmpty(imageAbsPath) && File.Exists(imageAbsPath)) - { - var fileData = File.ReadAllBytes(imageAbsPath); - Texture2D texture = new Texture2D(2, 2); - - // LoadImage will auto-resize the texture dimensions - if (texture.LoadImage(fileData)) - { - inoutPropertyStaticData.image = texture; - } - else - { - Debug.LogError($"LWGUI: Failed to load image data into texture: { imageAbsPath }"); - } - } - else - { - Debug.LogError($"LWGUI: Image path not found: { inputPath }"); - } - } - catch (Exception ex) - { - Debug.LogError($"LWGUI: Exception while resolving image path '{inputPath}': {ex.Message}"); - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - var image = metaDatas.GetPropStaticData(prop).image; - if (image) - { - var scaledheight = Mathf.Max(0, image.height / (image.width / Helper.GetCurrentPropertyLayoutWidth())); - var rect = EditorGUILayout.GetControlRect(true, scaledheight); - rect = RevertableHelper.IndentRect(EditorGUI.IndentedRect(rect)); - EditorGUI.DrawPreviewTexture(rect, image); - - if (GUI.enabled) - prop.textureValue = null; - } - } - } - #endregion - - #region Vector - /// - /// Display up to 4 colors in a single line - /// - /// group: parent group name (Default: none) - /// color2-4: extra color property name - /// Target Property Type: Color - /// - public class ColorDrawer : SubDrawer - { - private string[] _colorStrings = new string[3]; - - public ColorDrawer(string group, string color2) : this(group, color2, String.Empty, String.Empty) { } - - public ColorDrawer(string group, string color2, string color3) : this(group, color2, color3, String.Empty) { } - - public ColorDrawer(string group, string color2, string color3, string color4) - { - this.group = group; - this._colorStrings[0] = color2; - this._colorStrings[1] = color3; - this._colorStrings[2] = color4; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Color; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); - foreach (var colorPropName in _colorStrings) - { - inoutPropertyStaticData.AddExtraProperty(colorPropName); - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - var cProps = new Stack(); - for (int i = 0; i < 4; i++) - { - if (i == 0) - { - cProps.Push(prop); - continue; - } - - var p = metaDatas.GetProperty(_colorStrings[i - 1]); - if (p != null && IsMatchPropType(p)) - cProps.Push(p); - } - - var count = cProps.Count; - var colorArray = cProps.ToArray(); - - EditorGUI.PrefixLabel(position, label); - - for (int i = 0; i < count; i++) - { - EditorGUI.BeginChangeCheck(); - var cProp = colorArray[i]; - EditorGUI.showMixedValue = cProp.hasMixedValue; - var r = new Rect(position); - var interval = 13 * i * (-0.25f + EditorGUI.indentLevel * 1.25f); - var w = EditorGUIUtility.fieldWidth * (0.8f + EditorGUI.indentLevel * 0.2f); - r.xMin += r.width - w * (i + 1) + interval; - r.xMax -= w * i - interval; - - var src = cProp.colorValue; - var isHdr = (colorArray[i].GetPropertyFlags() & ShaderPropertyFlags.HDR) != ShaderPropertyFlags.None; - var dst = EditorGUI.ColorField(r, GUIContent.none, src, true, true, isHdr); - if (Helper.EndChangeCheck(metaDatas, cProp)) - { - cProp.colorValue = dst; - } - } - - EditorGUI.showMixedValue = false; - } - } - - /// - /// Draw a R/G/B/A drop menu: - /// R = (1, 0, 0, 0) - /// G = (0, 1, 0, 0) - /// B = (0, 0, 1, 0) - /// A = (0, 0, 0, 1) - /// RGB Average = (1f / 3f, 1f / 3f, 1f / 3f, 0) - /// RGB Luminance = (0.2126f, 0.7152f, 0.0722f, 0) - /// None = (0, 0, 0, 0) - /// - /// group: parent group name (Default: none) - /// Target Property Type: Vector, used to dot() with Texture Sample Value - /// - public class ChannelDrawer : SubDrawer - { - private static GUIContent[] _names = new[] - { - new GUIContent("R"), - new GUIContent("G"), - new GUIContent("B"), - new GUIContent("A"), - new GUIContent("RGB Average"), - new GUIContent("RGB Luminance"), - new GUIContent("None") - }; - private static int[] _intValues = new int[] { 0, 1, 2, 3, 4, 5, 6 }; - private static Vector4[] _vector4Values = new[] - { - new Vector4(1, 0, 0, 0), - new Vector4(0, 1, 0, 0), - new Vector4(0, 0, 1, 0), - new Vector4(0, 0, 0, 1), - new Vector4(1f / 3f, 1f / 3f, 1f / 3f, 0), - new Vector4(0.2126f, 0.7152f, 0.0722f, 0), - new Vector4(0, 0, 0, 0) - }; - - public ChannelDrawer() { } - - public ChannelDrawer(string group) - { - this.group = group; - } - - protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Vector; } - - private static int GetChannelIndex(MaterialProperty prop) - { - int index = -1; - for (int i = 0; i < _vector4Values.Length; i++) - { - if (prop.vectorValue == _vector4Values[i]) - index = i; - } - if (index == -1) - { - Debug.LogError("LWGUI: Channel Property: " + prop.name + " invalid vector found, reset to A"); - prop.vectorValue = _vector4Values[3]; - index = 3; - } - return index; - } - - public static string GetChannelName(MaterialProperty prop) - { - return _names[GetChannelIndex(prop)].text; - } - - public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) - { - inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = GetChannelName(inDefaultProp); - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - EditorGUI.BeginChangeCheck(); - - EditorGUI.showMixedValue = prop.hasMixedValue; - var index = GetChannelIndex(prop); - int num = EditorGUI.IntPopup(position, label, index, _names, _intValues); - EditorGUI.showMixedValue = false; - if (Helper.EndChangeCheck(metaDatas, prop)) - { - prop.vectorValue = _vector4Values[num]; - } - } - } - #endregion - - #region Other - /// - /// Draw one or more Buttons within the same row, using the Display Name to control the appearance and behavior of the buttons - /// - /// Declaring a set of Button Name and Button Command in Display Name generates a Button, separated by '@': - /// ButtonName0@ButtonCommand0@ButtonName1@ButtonCommand1 - /// - /// Button Name can be any other string, the format of Button Command is: - /// TYPE:Argument - /// - /// The following TYPEs are currently supported: - /// - URL: Open the URL, Argument is the URL - /// - C#: Call the public static C# function, Argument is NameSpace.Class.Method(arg0, arg1, ...), - /// for target function signatures, see: LWGUI.ButtonDrawer.TestMethod(). - /// - /// The full example: - /// [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 - /// - /// group: parent group name (Default: none) - /// Target Property Type: Any - /// - public class ButtonDrawer : SubDrawer - { - private const string _urlPrefix = "URL:"; - private const string _csPrefix = "C#:"; - private const string _separator = "@"; - - public ButtonDrawer() { } - - public ButtonDrawer(string group) - { - this.group = group; - } - - protected override float GetVisibleHeight(MaterialProperty prop) => 24; - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.groupName = group; - - // Display Name: ButtonName@URL:XXX@ButtonName@CS:NameSpace.Class.Method(arg0, arg1, ...)@... - var buttonNameAndCommands = inProp.displayName.Split(_separator); - if (buttonNameAndCommands != null && buttonNameAndCommands.Length > 0 && buttonNameAndCommands.Length % 2 == 0) - { - for (int i = 0; i < buttonNameAndCommands.Length; i++) - { - if (i % 2 == 0) - { - inoutPropertyStaticData.buttonDisplayNames.Add(buttonNameAndCommands[i]); - inoutPropertyStaticData.buttonDisplayNameWidths.Add(EditorStyles.label.CalcSize(new GUIContent(buttonNameAndCommands[i])).x); - } - else - { - inoutPropertyStaticData.buttonCommands.Add(buttonNameAndCommands[i]); - } - } - } - else - { - Debug.LogError($"LWGUI: ButtonDrawer with invalid Display Name Commands: { buttonNameAndCommands } ! prop: { inProp.name }"); - } - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - var buttonDisplayNames = metaDatas.GetPropStaticData(prop).buttonDisplayNames; - var buttonDisplayNameWidths = metaDatas.GetPropStaticData(prop).buttonDisplayNameWidths; - var buttonCommands = metaDatas.GetPropStaticData(prop).buttonCommands; - if (buttonDisplayNames == null || buttonCommands == null || buttonDisplayNames.Count == 0 || buttonCommands.Count == 0 - || buttonDisplayNames.Count != buttonCommands.Count) - { - return; - } - - var enbaled = GUI.enabled; - GUI.enabled = true; - - position = EditorGUI.IndentedRect(position); - var rect = new Rect(position.x, position.y, 0, position.height); - var spaceWidth = (position.width - buttonDisplayNameWidths.Sum()) / buttonDisplayNames.Count; - - for (int i = 0; i < buttonDisplayNames.Count; i++) - { - var displayName = buttonDisplayNames[i]; - var displayNameRelativeWidth = buttonDisplayNameWidths[i]; - var command = buttonCommands[i]; - rect.xMax = rect.xMin + displayNameRelativeWidth + spaceWidth; - - if (GUI.Button(rect, new GUIContent(displayName, command))) - { - if (command.StartsWith(_urlPrefix)) - { - Application.OpenURL(command.Substring(_urlPrefix.Length, command.Length - _urlPrefix.Length)); - } - else if (command.StartsWith(_csPrefix)) - { - var csCommand = command.Substring(_csPrefix.Length, command.Length - _csPrefix.Length); - - // Get method name and args - string className = null, methodName = null; - string[] args = null; - { - var lastPointIndex = csCommand.LastIndexOf('.'); - if (lastPointIndex != -1) - { - className = csCommand.Substring(0, lastPointIndex); - var leftBracketIndex = csCommand.IndexOf('('); - if (leftBracketIndex != -1) - { - methodName = csCommand.Substring(lastPointIndex + 1, leftBracketIndex - lastPointIndex - 1); - args = csCommand.Substring(leftBracketIndex + 1, csCommand.Length - leftBracketIndex - 2) - ?.Split(',').Select(s => s.TrimStart()).ToArray(); - } - } - } - - // Find and call method - if (!string.IsNullOrEmpty(className) && !string.IsNullOrEmpty(methodName) && args != null) - { - Type type = ReflectionHelper.GetAllTypes().FirstOrDefault((type1 => type1.Name == className || type1.FullName == className)); - if (type != null) - { - var methodInfo = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public); - if (methodInfo != null) - { - methodInfo.Invoke(null, new object[]{ prop, editor, metaDatas, args }); - } - else - { - Debug.LogError($"LWGUI: Method {methodName} not found in {className}"); - } - } - else - { - Debug.LogError($"LWGUI: Class {className} not found"); - } - } - else - { - Debug.LogError($"LWGUI: Invalid C# command: {csCommand}"); - } - } - else - { - Debug.LogError($"LWGUI: Unknown command type: {command}"); - } - } - - rect.xMin = rect.xMax; - } - - GUI.enabled = enbaled; - } - - public static void TestMethod(MaterialProperty prop, MaterialEditor editor, LWGUIMetaDatas metaDatas, string[] args) - { - Debug.Log($"LWGUI: ButtonDrawer.TestMethod({prop}, {editor}, {metaDatas}, {args})"); - - foreach (var arg in args) - { - Debug.Log(arg); - } - } - } - #endregion - - #endregion - - #region Extra Decorators - - #region Appearance - /// - /// Similar to Header() - /// - /// group: parent group name (Default: none) - /// header: string to display, "SpaceLine" or "_" = none (Default: none) - /// height: line height (Default: 22) - /// - public class TitleDecorator : SubDrawer - { - private string _header; - private float _height; - - public static readonly float DefaultHeight = EditorGUIUtility.singleLineHeight + 6f; - - protected override float GetVisibleHeight(MaterialProperty prop) { return _height; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { } - - public TitleDecorator(string header) : this("_", header, DefaultHeight) { } - - public TitleDecorator(string header, float height) : this("_", header, height) { } - - public TitleDecorator(string group, string header) : this(group, header, DefaultHeight) { } - - public TitleDecorator(string group, string header, float height) - { - this.group = group; - this._header = header == "SpaceLine" || header == "_" ? String.Empty : header; - this._height = height; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - position = EditorGUI.IndentedRect(position); - GUI.Label(position, _header, GUIStyles.title); - } - } - - /// - /// Similar to Title() - /// - /// group: parent group name (Default: none) - /// header: string to display, "SpaceLine" or "_" = none (Default: none) - /// height: line height (Default: 22) - /// - public class SubTitleDecorator : TitleDecorator - { - public SubTitleDecorator(string group, string header) : base(group, header, DefaultHeight) { } - - public SubTitleDecorator(string group, string header, float height) : base(group, header, height) { } - } - - /// - /// Tooltip, describes the details of the property. (Default: property.name and property default value) - /// You can also use "#Text" in DisplayName to add Tooltip that supports Multi-Language. - /// - /// tooltip: a single-line string to display, support up to 4 ','. (Default: Newline) - /// - public class TooltipDecorator : SubDrawer - { - private string _tooltip; - - - #region - - public TooltipDecorator() : this(string.Empty) { } - - public TooltipDecorator(string tooltip) { this._tooltip = tooltip; } - - public TooltipDecorator(string s1, string s2) : this(s1 + ", " + s2) { } - - public TooltipDecorator(string s1, string s2, string s3) : this(s1 + ", " + s2 + ", " + s3) { } - - public TooltipDecorator(string s1, string s2, string s3, string s4) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4) { } - - public TooltipDecorator(string s1, string s2, string s3, string s4, string s5) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4 + ", " + s5) { } - - #endregion - - - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.tooltipMessages += _tooltip + "\n"; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - - /// - /// Display a Helpbox on the property - /// You can also use "%Text" in DisplayName to add Helpbox that supports Multi-Language. - /// - /// message: a single-line string to display, support up to 4 ','. (Default: Newline) - /// - public class HelpboxDecorator : TooltipDecorator - { - private string _message; - - - #region - - public HelpboxDecorator() : this(string.Empty) { } - - public HelpboxDecorator(string message) { this._message = message; } - - public HelpboxDecorator(string s1, string s2) : this(s1 + ", " + s2) { } - - public HelpboxDecorator(string s1, string s2, string s3) : this(s1 + ", " + s2 + ", " + s3) { } - - public HelpboxDecorator(string s1, string s2, string s3, string s4) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4) { } - - public HelpboxDecorator(string s1, string s2, string s3, string s4, string s5) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4 + ", " + s5) { } - - #endregion - - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.helpboxMessages += _message + "\n"; - } - } - - /// - /// Set the property to read-only. - /// - public class ReadOnlyDecorator : SubDrawer - { - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.isReadOnly = true; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - #endregion - - #region Logic - /// - /// Cooperate with Toggle to switch certain Passes. - /// - /// lightModeName(s): Light Mode in Shader Pass (https://docs.unity3d.com/2017.4/Documentation/Manual/SL-PassTags.html) - /// - public class PassSwitchDecorator : SubDrawer - { - private string[] _lightModeNames; - - - #region - - public PassSwitchDecorator(string lightModeName1) - : this(new[] { lightModeName1 }) { } - - public PassSwitchDecorator(string lightModeName1, string lightModeName2) - : this(new[] { lightModeName1, lightModeName2 }) { } - - public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3) - : this(new[] { lightModeName1, lightModeName2, lightModeName3 }) { } - - public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4) - : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4 }) { } - - public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4, string lightModeName5) - : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4, lightModeName5 }) { } - - public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4, string lightModeName5, string lightModeName6) - : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4, lightModeName5, lightModeName6 }) { } - - public PassSwitchDecorator(string[] lightModeNames) { _lightModeNames = lightModeNames.Select((s => s.ToUpper())).ToArray(); } - - #endregion - - - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - protected override bool IsMatchPropType(MaterialProperty property) - { - return property.GetPropertyType() == ShaderPropertyType.Float - || property.GetPropertyType() == ShaderPropertyType.Int; - } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) - { - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - Helper.SetShaderPassEnabled(prop.targets, _lightModeNames, prop.floatValue > 0); - } - - public override void Apply(MaterialProperty prop) - { - base.Apply(prop); - if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) - { - if (ShowIfDecorator.GetShowIfResultToFilterDrawerApplying(prop)) - Helper.SetShaderPassEnabled(prop.targets, _lightModeNames, prop.floatValue > 0); - } - } - } - #endregion - - #region Structure - /// - /// Collapse the current Property into an Advanced Block. - /// Specify the Header String to create a new Advanced Block. - /// All Properties using Advanced() will be collapsed into the nearest Advanced Block. - /// - /// headerString: The title of the Advanced Block. Default: "Advanced" - /// - public class AdvancedDecorator : SubDrawer - { - private string headerString; - - public AdvancedDecorator() : this(string.Empty) { } - - public AdvancedDecorator(string headerString) - { - this.headerString = headerString; - } - - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.isAdvanced = true; - inoutPropertyStaticData.advancedHeaderString = headerString; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - - /// - /// Create an Advanced Block using the current Property as the Header. - /// - public class AdvancedHeaderPropertyDecorator : SubDrawer - { - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.isAdvanced = true; - inoutPropertyStaticData.isAdvancedHeader = true; - inoutPropertyStaticData.isAdvancedHeaderProperty = true; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - #endregion - - #region Condition Display - /// - /// Similar to HideInInspector(), the difference is that Hidden() can be unhidden through the Display Mode button. - /// - public class HiddenDecorator : SubDrawer - { - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.isHidden = true; - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - - /// - /// Control the show or hide of a single or a group of properties based on multiple conditions. - /// - /// logicalOperator: And | Or (Default: And). - /// propName: Target Property Name used for comparison. - /// compareFunction: Less (L) | Equal (E) | LessEqual (LEqual / LE) | Greater (G) | NotEqual (NEqual / NE) | GreaterEqual (GEqual / GE). - /// value: Target Property Value used for comparison. - /// - public class ShowIfDecorator : SubDrawer - { - public enum LogicalOperator - { - And, - Or - } - - public class ShowIfData - { - public LogicalOperator logicalOperator = LogicalOperator.And; - public string targetPropertyName = string.Empty; - public CompareFunction compareFunction = CompareFunction.Equal; - public float value = 0; - } - - public ShowIfData showIfData = new(); - - private readonly Dictionary _compareFunctionLUT = new() - { - { "Less", "Less" }, - { "L", "Less" }, - { "Equal", "Equal" }, - { "E", "Equal" }, - { "LessEqual", "LessEqual" }, - { "LEqual", "LessEqual" }, - { "LE", "LessEqual" }, - { "Greater", "Greater" }, - { "G", "Greater" }, - { "NotEqual", "NotEqual" }, - { "NEqual", "NotEqual" }, - { "NE", "NotEqual" }, - { "GreaterEqual", "GreaterEqual" }, - { "GEqual", "GreaterEqual" }, - { "GE", "GreaterEqual" }, - }; - - public ShowIfDecorator(string propName, string comparisonMethod, float value) : this("And", propName, comparisonMethod, value) { } - - public ShowIfDecorator(string logicalOperator, string propName, string compareFunction, float value) - { - showIfData.logicalOperator = logicalOperator.ToLower() == "or" ? LogicalOperator.Or : LogicalOperator.And; - showIfData.targetPropertyName = propName; - if (!_compareFunctionLUT.ContainsKey(compareFunction) || !Enum.IsDefined(typeof(CompareFunction), _compareFunctionLUT[compareFunction])) - Debug.LogError("LWGUI: Invalid compareFunction: '" - + compareFunction - + "', Must be one of the following: Less (L) | Equal (E) | LessEqual (LEqual / LE) | Greater (G) | NotEqual (NEqual / NE) | GreaterEqual (GEqual / GE)."); - else - showIfData.compareFunction = (CompareFunction)Enum.Parse(typeof(CompareFunction), _compareFunctionLUT[compareFunction]); - showIfData.value = value; - } - - private static void Compare(ShowIfData showIfData, float targetValue, ref bool result) - { - bool compareResult; - - switch (showIfData.compareFunction) - { - case CompareFunction.Less: - compareResult = targetValue < showIfData.value; - break; - case CompareFunction.LessEqual: - compareResult = targetValue <= showIfData.value; - break; - case CompareFunction.Greater: - compareResult = targetValue > showIfData.value; - break; - case CompareFunction.NotEqual: - compareResult = targetValue != showIfData.value; - break; - case CompareFunction.GreaterEqual: - compareResult = targetValue >= showIfData.value; - break; - default: - compareResult = targetValue == showIfData.value; - break; - } - - switch (showIfData.logicalOperator) - { - case LogicalOperator.And: - result &= compareResult; - break; - case LogicalOperator.Or: - result |= compareResult; - break; - } - } - - public static bool GetShowIfResultToFilterDrawerApplying(MaterialProperty prop) - { - var material = prop.targets[0] as Material; - var showIfDatas = new List(); - { - var drawer = ReflectionHelper.GetPropertyDrawer(material.shader, prop, out var decoratorDrawers); - if (decoratorDrawers != null && decoratorDrawers.Count > 0) - { - foreach (ShowIfDecorator showIfDecorator in decoratorDrawers.Where(drawer => drawer is ShowIfDecorator)) - { - showIfDatas.Add(showIfDecorator.showIfData); - } - } - else - { - return true; - } - } - - return GetShowIfResultFromMaterial(showIfDatas, material); - } - - public static bool GetShowIfResultFromMaterial(List showIfDatas, Material material) - { - bool result = true; - foreach (var showIfData in showIfDatas) - { - var targetValue = material.GetFloat(showIfData.targetPropertyName); - Compare(showIfData, targetValue, ref result); - } - - return result; - } - - public static void GetShowIfResult(PropertyStaticData propStaticData, PropertyDynamicData propDynamicData, PerMaterialData perMaterialData) - { - foreach (var showIfData in propStaticData.showIfDatas) - { - var targetValue = perMaterialData.propDynamicDatas[showIfData.targetPropertyName].property.floatValue; - Compare(showIfData, targetValue, ref propDynamicData.isShowing); - } - } - - protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } - - public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) - { - inoutPropertyStaticData.showIfDatas.Add(showIfData); - } - - public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } - } - #endregion - - #endregion - -} \ No newline at end of file diff --git a/Editor/ShaderDrawers.meta b/Editor/ShaderDrawers.meta new file mode 100644 index 0000000..8ed7ded --- /dev/null +++ b/Editor/ShaderDrawers.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 799ea78c6ec34670ac45e915a967b2cc +timeCreated: 1769096897 \ No newline at end of file diff --git a/Editor/ShaderDrawers/BasicDrawers.meta b/Editor/ShaderDrawers/BasicDrawers.meta new file mode 100644 index 0000000..b46d45d --- /dev/null +++ b/Editor/ShaderDrawers/BasicDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0087db252163ae340b69ec11fcd1e28a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs b/Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs new file mode 100644 index 0000000..f98241e --- /dev/null +++ b/Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs @@ -0,0 +1,109 @@ +// Copyright (c) Jason Ma + +using System; +using LWGUI.Timeline; +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Create a Folding Group + /// + /// group: group name (Default: Property Name) + /// keyword: keyword used for toggle, "_" = ignore, none or "__" = Property Name + "_ON", always Upper (Default: none) + /// default Folding State: "on" or "off" (Default: off) + /// default Toggle Displayed: "on" or "off" (Default: on) + /// preset File Name: "Shader Property Preset" asset name, see Preset() for detail (Default: none) + /// Target Property Type: Float, express Toggle value + /// + public class MainDrawer : MaterialPropertyDrawer, IBaseDrawer, IPresetDrawer + { + protected LWGUIMetaDatas metaDatas; + + private static readonly float _height = 28f; + + private bool _isFolding; + private string _group; + private string _keyword; + private bool _defaultFoldingState; + private bool _defaultToggleDisplayed; + private string _presetFileName; + + public MainDrawer() : this(String.Empty) { } + + public MainDrawer(string group) : this(group, String.Empty) { } + + public MainDrawer(string group, string keyword) : this(group, keyword, "off") { } + + public MainDrawer(string group, string keyword, string defaultFoldingState) : this(group, keyword, defaultFoldingState, "on") { } + + public MainDrawer(string group, string keyword, string defaultFoldingState, string defaultToggleDisplayed) : this(group, keyword, defaultFoldingState, defaultToggleDisplayed, String.Empty) { } + + public MainDrawer(string group, string keyword, string defaultFoldingState, string defaultToggleDisplayed, string presetFileName) + { + this._group = group; + this._keyword = keyword; + this._defaultFoldingState = Helper.StringToBool(defaultFoldingState); + this._defaultToggleDisplayed = Helper.StringToBool(defaultToggleDisplayed); + this._presetFileName = presetFileName; + } + + public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.groupName = _group; + inoutPropertyStaticData.isMain = true; + inoutPropertyStaticData.isExpanding = _defaultFoldingState; + PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); + PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, _presetFileName); + } + + public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = inDefaultProp.floatValue > 0 ? "On" : "Off"; + } + + public string GetPresetFileName() => _presetFileName; + + public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + metaDatas = Helper.GetLWGUIMetadatas(editor); + + var showMixedValue = EditorGUI.showMixedValue; + EditorGUI.showMixedValue = prop.hasMixedValue; + EditorGUI.BeginChangeCheck(); + + bool toggleResult = Helper.DrawFoldout(position, ref metaDatas.GetPropStaticData(prop).isExpanding, !Helper.Approximately(prop.floatValue, 0), _defaultToggleDisplayed, label); + + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.floatValue = toggleResult ? 1.0f : 0.0f; + var keyword = Helper.GetKeywordName(_keyword, prop.name); + Helper.SetShaderKeywordEnabled(editor.targets, keyword, toggleResult); + PresetHelper.GetPresetAsset(_presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); + TimelineHelper.SetKeywordToggleToTimeline(prop, editor, keyword); + } + EditorGUI.showMixedValue = showMixedValue; + } + + // Call in custom shader gui + public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) + { + return _height; + } + + // Call when create/edit/undo materials. + // Used to set material settings such as Keywords that need to be kept synchronized with the value forever. + // DO NOT modify other properties here!!! Otherwise, manually modified values will be overwritten. + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + Helper.SetShaderKeywordEnabled(prop.targets, Helper.GetKeywordName(_keyword, prop.name), prop.floatValue > 0f); + PresetDrawer.ApplyPresetWithoutPropertyChanges(_presetFileName, prop); + } + } + } +} + diff --git a/Editor/ShaderDrawer.cs.meta b/Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs.meta similarity index 83% rename from Editor/ShaderDrawer.cs.meta rename to Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs.meta index 3663a9d..ad87a33 100644 --- a/Editor/ShaderDrawer.cs.meta +++ b/Editor/ShaderDrawers/BasicDrawers/MainDrawer.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b7661dfeec673f340b66ac769fa42d18 +guid: 80bd09bde334c2c439f7374bb2ba821c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs b/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs new file mode 100644 index 0000000..469c6c5 --- /dev/null +++ b/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs @@ -0,0 +1,74 @@ +// Copyright (c) Jason Ma + +using System; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw a property with default style in the folding group + /// + /// group: parent group name (Default: none) + /// Target Property Type: Any + /// + public class SubDrawer : MaterialPropertyDrawer, IBaseDrawer + { + public string group = String.Empty; + public LWGUIMetaDatas metaDatas; + + public SubDrawer() { } + + public SubDrawer(string group) + { + this.group = group; + } + + protected virtual bool IsMatchPropType(MaterialProperty property) { return true; } + + protected virtual float GetVisibleHeight(MaterialProperty prop) + { + var height = MaterialEditor.GetDefaultPropertyHeight(prop); + return prop.GetPropertyType() == ShaderPropertyType.Vector ? EditorGUIUtility.singleLineHeight : height; + } + + public virtual void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.groupName = group; + PerShaderData.DecodeMetaDataFromDisplayName(inProp, inoutPropertyStaticData); + } + + public virtual void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) { } + + public virtual void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) { } + + public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + metaDatas = Helper.GetLWGUIMetadatas(editor); + + if (IsMatchPropType(prop)) + { + DrawProp(position, prop, label, editor); + } + else + { + Debug.LogWarning("LWGUI: Property:'" + prop.name + "' Type:'" + prop.GetPropertyType() + "' mismatch!"); + editor.DefaultShaderProperty(position, prop, label.text); + } + } + + public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) + { + return GetVisibleHeight(prop); + } + + // Draws a custom style property + public virtual void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); + editor.DefaultShaderPropertyInternal(position, prop, label); + } + } +} + diff --git a/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs.meta b/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs.meta new file mode 100644 index 0000000..96e964f --- /dev/null +++ b/Editor/ShaderDrawers/BasicDrawers/SubDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1018092e809fcf448a004c21f19c56cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators.meta b/Editor/ShaderDrawers/ExtraDecorators.meta new file mode 100644 index 0000000..bd16ddb --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d88e9b9124470694db30ecb3c7da26c2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance.meta new file mode 100644 index 0000000..f98deeb --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5e5aaa8816648ca4eaed701110c637d4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs new file mode 100644 index 0000000..8754d68 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs @@ -0,0 +1,41 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Display a Helpbox on the property + /// You can also use "%Text" in DisplayName to add Helpbox that supports Multi-Language. + /// + /// message: a single-line string to display, support up to 4 ','. (Default: Newline) + /// + public class HelpboxDecorator : TooltipDecorator + { + private string _message; + + + #region + + public HelpboxDecorator() : this(string.Empty) { } + + public HelpboxDecorator(string message) { this._message = message; } + + public HelpboxDecorator(string s1, string s2) : this(s1 + ", " + s2) { } + + public HelpboxDecorator(string s1, string s2, string s3) : this(s1 + ", " + s2 + ", " + s3) { } + + public HelpboxDecorator(string s1, string s2, string s3, string s4) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4) { } + + public HelpboxDecorator(string s1, string s2, string s3, string s4, string s5) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4 + ", " + s5) { } + + #endregion + + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.helpboxMessages += _message + "\n"; + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs.meta new file mode 100644 index 0000000..87a9275 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/HelpboxDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c60e1921fd5b285489b55fa3650c40a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs new file mode 100644 index 0000000..89b9672 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs @@ -0,0 +1,22 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Set the property to read-only. + /// + public class ReadOnlyDecorator : SubDrawer + { + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.isReadOnly = true; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs.meta new file mode 100644 index 0000000..eda9247 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/ReadOnlyDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e86854765f20f184185f804b18f4bd1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs new file mode 100644 index 0000000..d02b781 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs @@ -0,0 +1,18 @@ +// Copyright (c) Jason Ma + +namespace LWGUI +{ + /// + /// Similar to Title() + /// + /// group: parent group name (Default: none) + /// header: string to display, "SpaceLine" or "_" = none (Default: none) + /// height: line height (Default: 22) + /// + public class SubTitleDecorator : TitleDecorator + { + public SubTitleDecorator(string group, string header) : base(group, header, DefaultHeight) { } + + public SubTitleDecorator(string group, string header, float height) : base(group, header, height) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs.meta new file mode 100644 index 0000000..22be5ae --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/SubTitleDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59dc6bb7a17b4da4c9ea5d75aed10b7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs new file mode 100644 index 0000000..5b0787e --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs @@ -0,0 +1,46 @@ +// Copyright (c) Jason Ma + +using System; +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Similar to Header() + /// + /// group: parent group name (Default: none) + /// header: string to display, "SpaceLine" or "_" = none (Default: none) + /// height: line height (Default: 22) + /// + public class TitleDecorator : SubDrawer + { + private string _header; + private float _height; + + public static readonly float DefaultHeight = EditorGUIUtility.singleLineHeight + 6f; + + protected override float GetVisibleHeight(MaterialProperty prop) { return _height; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { } + + public TitleDecorator(string header) : this("_", header, DefaultHeight) { } + + public TitleDecorator(string header, float height) : this("_", header, height) { } + + public TitleDecorator(string group, string header) : this(group, header, DefaultHeight) { } + + public TitleDecorator(string group, string header, float height) + { + this.group = group; + this._header = header == "SpaceLine" || header == "_" ? String.Empty : header; + this._height = height; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + position = EditorGUI.IndentedRect(position); + GUI.Label(position, _header, GUIStyles.title); + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs.meta new file mode 100644 index 0000000..3896b27 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TitleDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 09b3118ef6d65ec49bdd423f20f09f09 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs new file mode 100644 index 0000000..3579134 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs @@ -0,0 +1,45 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Tooltip, describes the details of the property. (Default: property.name and property default value) + /// You can also use "#Text" in DisplayName to add Tooltip that supports Multi-Language. + /// + /// tooltip: a single-line string to display, support up to 4 ','. (Default: Newline) + /// + public class TooltipDecorator : SubDrawer + { + private string _tooltip; + + + #region + + public TooltipDecorator() : this(string.Empty) { } + + public TooltipDecorator(string tooltip) { this._tooltip = tooltip; } + + public TooltipDecorator(string s1, string s2) : this(s1 + ", " + s2) { } + + public TooltipDecorator(string s1, string s2, string s3) : this(s1 + ", " + s2 + ", " + s3) { } + + public TooltipDecorator(string s1, string s2, string s3, string s4) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4) { } + + public TooltipDecorator(string s1, string s2, string s3, string s4, string s5) : this(s1 + ", " + s2 + ", " + s3 + ", " + s4 + ", " + s5) { } + + #endregion + + + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.tooltipMessages += _tooltip + "\n"; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs.meta new file mode 100644 index 0000000..59e8c3c --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Appearance/TooltipDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5934a4eb43f5b3b48b5396a2cb653f76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay.meta b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay.meta new file mode 100644 index 0000000..18d4978 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 921ffaf8b8533bf42983cf1189a4ad45 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs new file mode 100644 index 0000000..507985f --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs @@ -0,0 +1,22 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Similar to HideInInspector(), the difference is that Hidden() can be unhidden through the Display Mode button. + /// + public class HiddenDecorator : SubDrawer + { + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.isHidden = true; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs.meta new file mode 100644 index 0000000..ff8920b --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/HiddenDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b730963b9bced7f418f78f2502b39607 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs new file mode 100644 index 0000000..3656997 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs @@ -0,0 +1,161 @@ +// Copyright (c) Jason Ma + +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Control the show or hide of a single or a group of properties based on multiple conditions. + /// + /// logicalOperator: And | Or (Default: And). + /// propName: Target Property Name used for comparison. + /// compareFunction: Less (L) | Equal (E) | LessEqual (LEqual / LE) | Greater (G) | NotEqual (NEqual / NE) | GreaterEqual (GEqual / GE). + /// value: Target Property Value used for comparison. + /// + public class ShowIfDecorator : SubDrawer + { + public enum LogicalOperator + { + And, + Or + } + + public class ShowIfData + { + public LogicalOperator logicalOperator = LogicalOperator.And; + public string targetPropertyName = string.Empty; + public CompareFunction compareFunction = CompareFunction.Equal; + public float value = 0; + } + + public ShowIfData showIfData = new(); + + private readonly Dictionary _compareFunctionLUT = new() + { + { "Less", "Less" }, + { "L", "Less" }, + { "Equal", "Equal" }, + { "E", "Equal" }, + { "LessEqual", "LessEqual" }, + { "LEqual", "LessEqual" }, + { "LE", "LessEqual" }, + { "Greater", "Greater" }, + { "G", "Greater" }, + { "NotEqual", "NotEqual" }, + { "NEqual", "NotEqual" }, + { "NE", "NotEqual" }, + { "GreaterEqual", "GreaterEqual" }, + { "GEqual", "GreaterEqual" }, + { "GE", "GreaterEqual" }, + }; + + public ShowIfDecorator(string propName, string comparisonMethod, float value) : this("And", propName, comparisonMethod, value) { } + + public ShowIfDecorator(string logicalOperator, string propName, string compareFunction, float value) + { + showIfData.logicalOperator = logicalOperator.ToLower() == "or" ? LogicalOperator.Or : LogicalOperator.And; + showIfData.targetPropertyName = propName; + if (!_compareFunctionLUT.ContainsKey(compareFunction) || !Enum.IsDefined(typeof(CompareFunction), _compareFunctionLUT[compareFunction])) + Debug.LogError("LWGUI: Invalid compareFunction: '" + + compareFunction + + "', Must be one of the following: Less (L) | Equal (E) | LessEqual (LEqual / LE) | Greater (G) | NotEqual (NEqual / NE) | GreaterEqual (GEqual / GE)."); + else + showIfData.compareFunction = (CompareFunction)Enum.Parse(typeof(CompareFunction), _compareFunctionLUT[compareFunction]); + showIfData.value = value; + } + + private static void Compare(ShowIfData showIfData, float targetValue, ref bool result) + { + bool compareResult; + + switch (showIfData.compareFunction) + { + case CompareFunction.Less: + compareResult = targetValue < showIfData.value; + break; + case CompareFunction.LessEqual: + compareResult = targetValue <= showIfData.value; + break; + case CompareFunction.Greater: + compareResult = targetValue > showIfData.value; + break; + case CompareFunction.NotEqual: + compareResult = targetValue != showIfData.value; + break; + case CompareFunction.GreaterEqual: + compareResult = targetValue >= showIfData.value; + break; + default: + compareResult = targetValue == showIfData.value; + break; + } + + switch (showIfData.logicalOperator) + { + case LogicalOperator.And: + result &= compareResult; + break; + case LogicalOperator.Or: + result |= compareResult; + break; + } + } + + public static bool GetShowIfResultToFilterDrawerApplying(MaterialProperty prop) + { + var material = prop.targets[0] as Material; + var showIfDatas = new List(); + { + var drawer = ReflectionHelper.GetPropertyDrawer(material.shader, prop, out var decoratorDrawers); + if (decoratorDrawers != null && decoratorDrawers.Count > 0) + { + foreach (ShowIfDecorator showIfDecorator in decoratorDrawers.Where(drawer => drawer is ShowIfDecorator)) + { + showIfDatas.Add(showIfDecorator.showIfData); + } + } + else + { + return true; + } + } + + return GetShowIfResultFromMaterial(showIfDatas, material); + } + + public static bool GetShowIfResultFromMaterial(List showIfDatas, Material material) + { + bool result = true; + foreach (var showIfData in showIfDatas) + { + var targetValue = material.GetFloat(showIfData.targetPropertyName); + Compare(showIfData, targetValue, ref result); + } + + return result; + } + + public static void GetShowIfResult(PropertyStaticData propStaticData, PropertyDynamicData propDynamicData, PerMaterialData perMaterialData) + { + foreach (var showIfData in propStaticData.showIfDatas) + { + var targetValue = perMaterialData.propDynamicDatas[showIfData.targetPropertyName].property.floatValue; + Compare(showIfData, targetValue, ref propDynamicData.isShowing); + } + } + + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.showIfDatas.Add(showIfData); + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs.meta new file mode 100644 index 0000000..5823279 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/ConditionDisplay/ShowIfDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f391774ca908ee42abfa5b95dea3b8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Logic.meta b/Editor/ShaderDrawers/ExtraDecorators/Logic.meta new file mode 100644 index 0000000..d863a4f --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Logic.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39a1eac873eb3a04a8bd4ad4805745b9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs new file mode 100644 index 0000000..c6c8403 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs @@ -0,0 +1,71 @@ +// Copyright (c) Jason Ma + +using System.Linq; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Cooperate with Toggle to switch certain Passes. + /// + /// lightModeName(s): Light Mode in Shader Pass (https://docs.unity3d.com/2017.4/Documentation/Manual/SL-PassTags.html) + /// + public class PassSwitchDecorator : SubDrawer + { + private string[] _lightModeNames; + + + #region + + public PassSwitchDecorator(string lightModeName1) + : this(new[] { lightModeName1 }) { } + + public PassSwitchDecorator(string lightModeName1, string lightModeName2) + : this(new[] { lightModeName1, lightModeName2 }) { } + + public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3) + : this(new[] { lightModeName1, lightModeName2, lightModeName3 }) { } + + public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4) + : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4 }) { } + + public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4, string lightModeName5) + : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4, lightModeName5 }) { } + + public PassSwitchDecorator(string lightModeName1, string lightModeName2, string lightModeName3, string lightModeName4, string lightModeName5, string lightModeName6) + : this(new[] { lightModeName1, lightModeName2, lightModeName3, lightModeName4, lightModeName5, lightModeName6 }) { } + + public PassSwitchDecorator(string[] lightModeNames) { _lightModeNames = lightModeNames.Select((s => s.ToUpper())).ToArray(); } + + #endregion + + + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + protected override bool IsMatchPropType(MaterialProperty property) + { + return property.GetPropertyType() == ShaderPropertyType.Float + || property.GetPropertyType() == ShaderPropertyType.Int; + } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) { } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + Helper.SetShaderPassEnabled(prop.targets, _lightModeNames, prop.floatValue > 0); + } + + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + if (ShowIfDecorator.GetShowIfResultToFilterDrawerApplying(prop)) + Helper.SetShaderPassEnabled(prop.targets, _lightModeNames, prop.floatValue > 0); + } + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs.meta new file mode 100644 index 0000000..8385d69 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Logic/PassSwitchDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ce1e6b3dcc10bf4d904506b5427dd62 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Structure.meta b/Editor/ShaderDrawers/ExtraDecorators/Structure.meta new file mode 100644 index 0000000..2e68edc --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Structure.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a3d4d8d42a6cdcf4280e9f094d31280c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs new file mode 100644 index 0000000..f7c2b4e --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs @@ -0,0 +1,36 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Collapse the current Property into an Advanced Block. + /// Specify the Header String to create a new Advanced Block. + /// All Properties using Advanced() will be collapsed into the nearest Advanced Block. + /// + /// headerString: The title of the Advanced Block. Default: "Advanced" + /// + public class AdvancedDecorator : SubDrawer + { + private string headerString; + + public AdvancedDecorator() : this(string.Empty) { } + + public AdvancedDecorator(string headerString) + { + this.headerString = headerString; + } + + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.isAdvanced = true; + inoutPropertyStaticData.advancedHeaderString = headerString; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs.meta new file mode 100644 index 0000000..e657528 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f94593a3791d98342bcf7e2ce8a434ac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs new file mode 100644 index 0000000..8b6f907 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs @@ -0,0 +1,24 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Create an Advanced Block using the current Property as the Header. + /// + public class AdvancedHeaderPropertyDecorator : SubDrawer + { + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.isAdvanced = true; + inoutPropertyStaticData.isAdvancedHeader = true; + inoutPropertyStaticData.isAdvancedHeaderProperty = true; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + } +} diff --git a/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs.meta b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs.meta new file mode 100644 index 0000000..ad6bfb4 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDecorators/Structure/AdvancedHeaderPropertyDecorator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eda92ad2828dbbf4b8ad1ceec6a203bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers.meta b/Editor/ShaderDrawers/ExtraDrawers.meta new file mode 100644 index 0000000..6b588e7 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f91db697c82843841ac35226be10a332 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric.meta new file mode 100644 index 0000000..8b91169 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b9ac04b03bfd1b6458e0821d6c79a3f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs new file mode 100644 index 0000000..1322ad9 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs @@ -0,0 +1,143 @@ +// Copyright (c) Jason Ma + +using System.Collections.Generic; +using System.Linq; +using LWGUI.Runtime; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw the Int value as a Bit Mask. + /// Note: + /// - Currently only 8 bits are supported. + /// + /// Warning 1: If used to set Stencil, it will conflict with SRP Batcher! + /// (Reproduced in Unity 2022) + /// SRP Batcher does not correctly handle multiple materials with different Stencil Ref values, + /// mistakenly merging them into a single Batch and randomly selecting one material's Stencil Ref value for the entire Batch. + /// In theory, if different materials have different Stencil Ref values, they should not be merged into a single Batch due to differing Render States. + /// Solution: + /// - Force disable SRP Batcher by setting the Material Property Block + /// - Place materials with the same Stencil Ref value in a separate Render Queue to ensure the Batch's Render State is correct + /// + /// Warning 2: Once in use, do not change the Target Property Type! + /// The underlying type of Int Property is Float Property, and in Materials, Int and Integer are stored separately. + /// Once a Material is saved, the Property Type is determined. + /// If you change the Property Type at this point (such as switching between Int/Integer), some strange bugs may occur. + /// If you must change the Property Type, it is recommended to modify the Property Name as well or delete the saved Property in the material. + /// + /// group: parent group name (Default: none) + /// bitDescription 7-0: Description of each Bit. (Default: none) + /// Target Property Type: Int/Integer + /// + public class BitMaskDrawer : SubDrawer + { + public int bitCount = 8; + + public float maxHeight = EditorGUIUtility.singleLineHeight; + + public List buttonLables = new (); + + public List buttonWidths = new(); + + public List buttonStyles = new(); + + public float totalButtonWidth; + + private static readonly int _hint = "BitMask".GetHashCode(); + + private static readonly float _minButtonWidth = 25; + + private static readonly float _buttonPadding = 1.0f; + + public BitMaskDrawer() : this(string.Empty, null) { } + + public BitMaskDrawer(string group) : this(group, null) { } + + public BitMaskDrawer(string group, string bitDescription7, string bitDescription6, string bitDescription5, string bitDescription4, string bitDescription3, string bitDescription2, string bitDescription1, string bitDescription0) + : this(group, new List() { bitDescription0, bitDescription1, bitDescription2, bitDescription3, bitDescription4, bitDescription5, bitDescription6, bitDescription7 }) { } + + public BitMaskDrawer(string group, List bitDescriptions) + { + this.group = group; + + bitCount = Mathf.Clamp(bitCount, 1, 16); + + for (int i = 0; i < bitCount; i++) + { + var description = bitDescriptions != null && bitDescriptions.Count > i ? bitDescriptions[i] : string.Empty; + buttonLables.Add(new GUIContent( + string.IsNullOrEmpty(description) ? i.ToString() : i + "\n" + description)); + buttonWidths.Add(Mathf.Max(_minButtonWidth, EditorStyles.miniButton.CalcSize(buttonLables[i]).x)); + + if (!string.IsNullOrEmpty(description)) + maxHeight = EditorGUIUtility.singleLineHeight * 2; + } + + for (int i = 0; i < bitCount; i++) + { + if (i == 0) + buttonStyles.Add(new GUIStyle(EditorStyles.miniButtonRight)); + else if (i == bitCount - 1) + buttonStyles.Add(new GUIStyle(EditorStyles.miniButtonLeft)); + else + buttonStyles.Add(new GUIStyle(EditorStyles.miniButton)); + + buttonStyles[i].fixedHeight = maxHeight; + } + + totalButtonWidth = buttonWidths.Sum(); + } + + protected override bool IsMatchPropType(MaterialProperty property) + => property.GetPropertyType() is ShaderPropertyType.Float or ShaderPropertyType.Int; + + protected override float GetVisibleHeight(MaterialProperty prop) { return maxHeight; } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + label.tooltip += $"\nCurrent Value: { prop.GetNumericValue() }"; + + int controlId = GUIUtility.GetControlID(_hint, FocusType.Keyboard, position); + var fieldRect = EditorGUI.PrefixLabel(position, controlId, label); + + if (position.width < totalButtonWidth) + return; + + fieldRect.xMin = fieldRect.xMax; + + for (int i = 0; i < bitCount; i++) + { + fieldRect.xMin = fieldRect.xMax - buttonWidths[i]; + var buttonLable = buttonLables[i]; + var active = RuntimeHelper.IsBitEnabled((int)prop.GetNumericValue(), i); + var style = buttonStyles[i]; + var buttonRect = fieldRect; + + if (i > 0 && i < bitCount - 1) + { + buttonRect.xMin -= _buttonPadding; + buttonRect.xMax += _buttonPadding * 2; + } + + if (prop.hasMixedValue) + { + style.richText = true; + // https://docs.unity3d.com/2021.3/Documentation/Manual/StyledText.html + buttonLable = new GUIContent($"{ buttonLable.text }"); + } + + if (Helper.ToggleButton(buttonRect, buttonLable, active, style, _buttonPadding * 1.5f)) + { + prop.SetNumericValue(RuntimeHelper.SetBitEnabled((int)prop.GetNumericValue(), i, !active)); + } + + fieldRect.xMax = fieldRect.xMin; + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs.meta new file mode 100644 index 0000000..37d3a3d --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/BitMaskDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69a1cc36b3afcad49bab404c303589f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs new file mode 100644 index 0000000..70f9210 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs @@ -0,0 +1,145 @@ +// Copyright (c) Jason Ma + +using System; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Similar to builtin Enum() / KeywordEnum() + /// + /// group: parent group name (Default: none) + /// n(s): display name + /// k(s): keyword + /// v(s): value + /// Target Property Type: Float, express current keyword index + /// + public class KWEnumDrawer : SubDrawer + { + private GUIContent[] _names; + private string[] _keyWords; + private float[] _values; + + + #region + + public KWEnumDrawer(string n1, string k1) + : this("_", new string[1] { n1 }, new string[1] { k1 }) { } + + public KWEnumDrawer(string n1, string k1, string n2, string k2) + : this("_", new string[2] { n1, n2 }, new string[2] { k1, k2 }) { } + + public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3) + : this("_", new string[3] { n1, n2, n3 }, new string[3] { k1, k2, k3 }) { } + + public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4) + : this("_", new string[4] { n1, n2, n3, n4 }, new string[4] { k1, k2, k3, k4 }) { } + + public KWEnumDrawer(string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4, string n5, string k5) + : this("_", new string[5] { n1, n2, n3, n4, n5 }, new string[5] { k1, k2, k3, k4, k5 }) { } + + public KWEnumDrawer(string group, string n1, string k1) + : this(group, new string[1] { n1 }, new string[1] { k1 }) { } + + public KWEnumDrawer(string group, string n1, string k1, string n2, string k2) + : this(group, new string[2] { n1, n2 }, new string[2] { k1, k2 }) { } + + public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3) + : this(group, new string[3] { n1, n2, n3 }, new string[3] { k1, k2, k3 }) { } + + public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4) + : this(group, new string[4] { n1, n2, n3, n4 }, new string[4] { k1, k2, k3, k4 }) { } + + public KWEnumDrawer(string group, string n1, string k1, string n2, string k2, string n3, string k3, string n4, string k4, string n5, string k5) + : this(group, new string[5] { n1, n2, n3, n4, n5 }, new string[5] { k1, k2, k3, k4, k5 }) { } + + #endregion + + + public KWEnumDrawer(string group, string[] names, string[] keyWords = null, float[] values = null) + { + Init(group, names, keyWords, values); + } + + protected void Init(string group, string[] names, string[] keyWords, float[] values) + { + this.group = group; + + this._names = new GUIContent[names.Length]; + for (int index = 0; index < names.Length; ++index) + this._names[index] = new GUIContent(names[index]); + + if (keyWords == null) + { + keyWords = new string[names.Length]; + for (int i = 0; i < names.Length; i++) + keyWords[i] = String.Empty; + } + this._keyWords = keyWords; + + if (values == null) + { + values = new float[names.Length]; + for (int index = 0; index < names.Length; ++index) + values[index] = index; + } + this._values = values; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() is ShaderPropertyType.Float; } + + protected virtual string GetKeywordName(string propName, string name) { return (name).Replace(' ', '_').ToUpperInvariant(); } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + var index = Array.IndexOf(_values, (int)inDefaultProp.floatValue); + if (index < _names.Length && index >= 0) + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = _names[index].text; + } + + private string[] GetKeywords(MaterialProperty property) + { + string[] keyWords = new string[_keyWords.Length]; + for (int i = 0; i < keyWords.Length; i++) + keyWords[i] = GetKeywordName(property.name, _keyWords[i]); + return keyWords; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + + var rect = position; + + string[] keyWords = GetKeywords(prop); + int index = Array.IndexOf(_values, prop.floatValue); + if (index < 0) + { + Debug.LogError("LWGUI: Property: " + prop.name + " has unknown Enum Value: '" + prop.floatValue + "' !\n"); + return; + } + + Helper.AdaptiveFieldWidth(EditorStyles.popup, _names[index]); + int newIndex = EditorGUI.Popup(rect, label, index, _names); + EditorGUI.showMixedValue = false; + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.floatValue = _values[newIndex]; + Helper.SelectShaderKeyword(editor.targets, keyWords, newIndex); + } + } + + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + Helper.SelectShaderKeyword(prop.targets, GetKeywords(prop), (int)prop.floatValue); + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs.meta new file mode 100644 index 0000000..41bc5ec --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/KWEnumDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6efec1ff74c201940bfb8b2ed76cc759 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs new file mode 100644 index 0000000..4b5369b --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs @@ -0,0 +1,122 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw a min max slider + /// + /// group: parent group name (Default: none) + /// minPropName: Output Min Property Name + /// maxPropName: Output Max Property Name + /// Target Property Type: Range, range limits express the MinMaxSlider value range + /// Output Min/Max Property Type: Range, it's value is limited by it's range + /// + public class MinMaxSliderDrawer : SubDrawer + { + private string _minPropName; + private string _maxPropName; + + public MinMaxSliderDrawer(string minPropName, string maxPropName) : this("_", minPropName, maxPropName) { } + + public MinMaxSliderDrawer(string group, string minPropName, string maxPropName) + { + this.group = group; + this._minPropName = minPropName; + this._maxPropName = maxPropName; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + inoutPropertyStaticData.AddExtraProperty(_minPropName); + inoutPropertyStaticData.AddExtraProperty(_maxPropName); + } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + if (string.IsNullOrEmpty(_minPropName) + || string.IsNullOrEmpty(_maxPropName) + || !inoutPerMaterialData.propDynamicDatas.ContainsKey(_minPropName) + || !inoutPerMaterialData.propDynamicDatas.ContainsKey(_maxPropName) + ) + { + Debug.LogError("LWGUI: " + inProp.name + " has no available min/max properties!"); + return; + } + + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = + inoutPerMaterialData.propDynamicDatas[_minPropName].defaultProperty.floatValue + + " - " + + inoutPerMaterialData.propDynamicDatas[_maxPropName].defaultProperty.floatValue; + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + // read min max + MaterialProperty minProp = metaDatas.GetProperty(_minPropName); + MaterialProperty maxProp = metaDatas.GetProperty(_maxPropName); + if (minProp == null || maxProp == null) + { + Debug.LogError("LWGUI: MinMaxSliderDrawer: minProp: " + (minProp == null ? "null" : minProp.name) + " or maxProp: " + (maxProp == null ? "null" : maxProp.name) + " not found!"); + return; + } + float minf = minProp.floatValue; + float maxf = maxProp.floatValue; + + // define draw area + Rect controlRect = position; // this is the full length rect area + var w = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 0; + Rect inputRect = MaterialEditor.GetRectAfterLabelWidth(controlRect); // this is the remaining rect area after label's area + + // draw label + EditorGUI.PrefixLabel(controlRect, label); + + // draw min max slider + var indentLevel = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + Rect[] splittedRect = Helper.SplitRect(inputRect, 3); + + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = minProp.hasMixedValue; + var newMinf = EditorGUI.FloatField(splittedRect[0], minf); + if (Helper.EndChangeCheck(metaDatas, minProp)) + { + minf = Mathf.Clamp(newMinf, minProp.rangeLimits.x, minProp.rangeLimits.y); + minProp.floatValue = minf; + } + + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = maxProp.hasMixedValue; + var newMaxf = EditorGUI.FloatField(splittedRect[2], maxf); + if (Helper.EndChangeCheck(metaDatas, maxProp)) + { + maxf = Mathf.Clamp(newMaxf, maxProp.rangeLimits.x, maxProp.rangeLimits.y); + maxProp.floatValue = maxf; + } + + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + if (splittedRect[1].width > 50f) + EditorGUI.MinMaxSlider(splittedRect[1], ref minf, ref maxf, prop.rangeLimits.x, prop.rangeLimits.y); + EditorGUI.showMixedValue = false; + + // write back min max if changed + if (EditorGUI.EndChangeCheck()) + { + minProp.floatValue = Mathf.Clamp(minf, minProp.rangeLimits.x, minProp.rangeLimits.y); + maxProp.floatValue = Mathf.Clamp(maxf, maxProp.rangeLimits.x, maxProp.rangeLimits.y); + } + + EditorGUI.indentLevel = indentLevel; + EditorGUIUtility.labelWidth = w; + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs.meta new file mode 100644 index 0000000..b3c19fa --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/MinMaxSliderDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07b7eef69a55e7a438e862d05f0a4e82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs new file mode 100644 index 0000000..3197e64 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs @@ -0,0 +1,111 @@ +// Copyright (c) Jason Ma + +using System.Linq; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Popping a menu, you can select the Shader Property Preset, the Preset values will replaces the default values + /// + /// group: parent group name (Default: none) + /// presetFileName: "Shader Property Preset" asset name, you can create new Preset by + /// "Right Click > Create > LWGUI > Shader Property Preset" in Project window, + /// *any Preset in the entire project cannot have the same name* + /// Target Property Type: Float, express current keyword index + /// + public class PresetDrawer : SubDrawer, IPresetDrawer + { + public string presetFileName; + + public PresetDrawer(string presetFileName) : this("_", presetFileName) { } + + public PresetDrawer(string group, string presetFileName) + { + this.group = group; + this.presetFileName = presetFileName; + } + + public static void SetPresetAssetToStaticData(PropertyStaticData inoutPropertyStaticData, string presetFileName) + { + inoutPropertyStaticData.propertyPresetAsset = PresetHelper.GetPresetAsset(presetFileName); + } + + // Apply Keywords and Passes in presets without modifying other property values + // Used to call in MaterialPropertyDrawer.Apply() + public static void ApplyPresetWithoutPropertyChanges(string presetFileName, MaterialProperty prop) + { + var presetFile = PresetHelper.GetPresetAsset(presetFileName); + if (presetFile && ShowIfDecorator.GetShowIfResultToFilterDrawerApplying(prop)) + { + presetFile.TryGetPreset(prop.floatValue)?.ApplyKeywordsAndPassesToMaterials(prop.targets); + } + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Float; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + SetPresetAssetToStaticData(inoutPropertyStaticData, presetFileName); + } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + var propertyPreset = inPerShaderData.propStaticDatas[inProp.name].propertyPresetAsset; + if (propertyPreset) + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = propertyPreset.TryGetPreset(inDefaultProp.floatValue)?.presetName; + } + + public string GetPresetFileName() => presetFileName; + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + + var rect = position; + + int index = (int)Mathf.Max(0, prop.floatValue); + var presetFile = PresetHelper.GetPresetAsset(presetFileName); + if (!presetFile || presetFile.GetPresetCount() == 0) + { + Helper.DrawShaderPropertyWithErrorLabel(rect, prop, label, editor, $"Invalid Preset File: {presetFileName}"); + return; + } + + if (index < presetFile.GetPresetCount()) + { + var presetNames = presetFile.GetPresets().Select((inPreset) => new GUIContent(inPreset.presetName)).ToArray(); + if (EditorGUI.showMixedValue) + index = -1; + else + Helper.AdaptiveFieldWidth(EditorStyles.popup, presetNames[index]); + int newIndex = EditorGUI.Popup(rect, label, index, presetNames); + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.floatValue = newIndex; + presetFile.TryGetPreset(newIndex)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); + } + EditorGUI.showMixedValue = false; + } + else + { + Helper.DrawShaderPropertyWithErrorLabel(position, prop, label, editor, $"Out of Index Range"); + Debug.LogError($"LWGUI: { prop.name } out of Preset index range!"); + } + } + + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + ApplyPresetWithoutPropertyChanges(presetFileName, prop); + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs.meta new file mode 100644 index 0000000..e096417 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/PresetDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6ce051a8eefac7c4698c3d242f5984ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs new file mode 100644 index 0000000..1993908 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs @@ -0,0 +1,57 @@ +// Copyright (c) Jason Ma + +using System; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + public class SubEnumDrawer : KWEnumDrawer + { + // UnityEditor.MaterialEnumDrawer(string enumName) + // enumName: like "UnityEngine.Rendering.BlendMode" + public SubEnumDrawer(string group, string enumName) : base(group, enumName) + { + var array = ReflectionHelper.GetAllTypes(); + try + { + Type enumType = array.FirstOrDefault(x => x.IsSubclassOf(typeof(Enum)) && (x.Name == enumName || x.FullName == enumName)); + string[] names = Enum.GetNames(enumType); + Array valuesArray = Enum.GetValues(enumType); + var values = new float[valuesArray.Length]; + for (int index = 0; index < valuesArray.Length; ++index) + values[index] = (int)valuesArray.GetValue(index); + Init(group, names, null, values); + } + catch (Exception ex) + { + Debug.LogWarningFormat("LWGUI: Failed to create SubEnum, enum {0} not found, {1}.", enumName, ex); + throw; + } + } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2) + : base(group, new[] { n1, n2 }, null, new[] { v1, v2 }) { } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3) + : base(group, new[] { n1, n2, n3 }, null, new[] { v1, v2, v3 }) { } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4) + : base(group, new[] { n1, n2, n3, n4 }, null, new[] { v1, v2, v3, v4 }) { } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5) + : base(group, new[] { n1, n2, n3, n4, n5 }, null, new[] { v1, v2, v3, v4, v5 }) { } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5, string n6, float v6) + : base(group, new[] { n1, n2, n3, n4, n5, n6 }, null, new[] { v1, v2, v3, v4, v5, v6 }) { } + + public SubEnumDrawer(string group, string n1, float v1, string n2, float v2, string n3, float v3, string n4, float v4, string n5, float v5, string n6, float v6, string n7, float v7) + : base(group, new[] { n1, n2, n3, n4, n5, n6, n7 }, null, new[] { v1, v2, v3, v4, v5, v6, v7 }) { } + + protected override string GetKeywordName(string propName, string name) { return "_"; } + + public override void Apply(MaterialProperty prop) { } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs.meta new file mode 100644 index 0000000..d1b190e --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubEnumDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 013f548c15894ab42baddf9d7889a502 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs new file mode 100644 index 0000000..41ba29d --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs @@ -0,0 +1,49 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Similar to builtin IntRange() + /// + /// group: parent group name (Default: none) + /// Target Property Type: Range + /// + public class SubIntRangeDrawer : SubDrawer + { + public SubIntRangeDrawer(string group) + { + this.group = group; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); + + if (prop.GetPropertyType() != ShaderPropertyType.Range) + { + EditorGUI.LabelField(position, "IntRange used on a non-range property: " + prop.name, EditorStyles.helpBox); + } + else + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + float labelWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = 0.0f; + int num = EditorGUI.IntSlider(position, label, (int)prop.floatValue, (int)prop.rangeLimits.x, (int)prop.rangeLimits.y); + EditorGUI.showMixedValue = false; + EditorGUIUtility.labelWidth = labelWidth; + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.floatValue = num; + } + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs.meta new file mode 100644 index 0000000..20981f6 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubIntRangeDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cad3b7cf3502fb6469a84d3bbc650fe3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs new file mode 100644 index 0000000..43067df --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs @@ -0,0 +1,34 @@ +// Copyright (c) Jason Ma + +namespace LWGUI +{ + public class SubKeywordEnumDrawer : KWEnumDrawer + { + public SubKeywordEnumDrawer(string group, string kw1, string kw2) + : base(group, new[] { kw1, kw2 }, new[] { kw1, kw2 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3) + : base(group, new[] { kw1, kw2, kw3 }, new[] { kw1, kw2, kw3 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4) + : base(group, new[] { kw1, kw2, kw3, kw4 }, new[] { kw1, kw2, kw3, kw4 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5) + : base(group, new[] { kw1, kw2, kw3, kw4, kw5 }, new[] { kw1, kw2, kw3, kw4, kw5 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6) + : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7) + : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7, string kw8) + : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8 }) { } + + public SubKeywordEnumDrawer(string group, string kw1, string kw2, string kw3, string kw4, string kw5, string kw6, string kw7, string kw8, string kw9) + : base(group, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8, kw9 }, new[] { kw1, kw2, kw3, kw4, kw5, kw6, kw7, kw8, kw9 }) { } + + protected override string GetKeywordName(string propName, string name) { return (propName + "_" + name).Replace(' ', '_').ToUpperInvariant(); } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs.meta new file mode 100644 index 0000000..d5e3e49 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubKeywordEnumDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb8756df640ae7340aecbd9bd5b69cd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs new file mode 100644 index 0000000..279bc4f --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs @@ -0,0 +1,71 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Similar to builtin PowerSlider() + /// + /// group: parent group name (Default: none) + /// power: power of slider (Default: 1) + /// presetFileName: "Shader Property Preset" asset name, it rounds up the float to choose which Preset to use. + /// You can create new Preset by + /// "Right Click > Create > LWGUI > Shader Property Preset" in Project window, + /// *any Preset in the entire project cannot have the same name* + /// Target Property Type: Range + /// + public class SubPowerSliderDrawer : SubDrawer, IPresetDrawer + { + public string presetFileName; + + private float _power = 1; + + public SubPowerSliderDrawer(float power) : this("_", power) { } + + public SubPowerSliderDrawer(string group, float power) : this(group, power, string.Empty) { } + + public SubPowerSliderDrawer(string group, float power, string presetFileName) + { + this.group = group; + this._power = Mathf.Clamp(power, 0, float.MaxValue); + this.presetFileName = presetFileName; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Range; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, presetFileName); + } + + public string GetPresetFileName() => presetFileName; + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + RevertableHelper.FixGUIWidthMismatch(prop.GetPropertyType(), editor); + EditorGUI.showMixedValue = prop.hasMixedValue; + var rect = position; + var oldValue = prop.floatValue; + ReflectionHelper.DoPowerRangeProperty(rect, prop, label, _power); + if (prop.floatValue != oldValue) + { + PresetHelper.GetPresetAsset(presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); + } + EditorGUI.showMixedValue = false; + } + + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + PresetDrawer.ApplyPresetWithoutPropertyChanges(presetFileName, prop); + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs.meta new file mode 100644 index 0000000..e11f910 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubPowerSliderDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: add135b9cec858a4594cb70c27996b4c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs new file mode 100644 index 0000000..050106a --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs @@ -0,0 +1,82 @@ +// Copyright (c) Jason Ma + +using System; +using LWGUI.Timeline; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Similar to builtin Toggle() + /// + /// group: parent group name (Default: none) + /// keyword: keyword used for toggle, "_" = ignore, none or "__" = Property Name + "_ON", always Upper (Default: none) + /// preset File Name: "Shader Property Preset" asset name, see Preset() for detail (Default: none) + /// Target Property Type: Float + /// + public class SubToggleDrawer : SubDrawer, IPresetDrawer + { + private string _keyWord = String.Empty; + private string _presetFileName = String.Empty; + + public SubToggleDrawer() { } + + public SubToggleDrawer(string group) : this(group, String.Empty, String.Empty) { } + + public SubToggleDrawer(string group, string keyWord) : this(group, keyWord, String.Empty) { } + + public SubToggleDrawer(string group, string keyWord, string presetFileName) + { + this.group = group; + this._keyWord = keyWord; + this._presetFileName = presetFileName; + } + + protected override bool IsMatchPropType(MaterialProperty property) + { + return property.GetPropertyType() is ShaderPropertyType.Float; + } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + PresetDrawer.SetPresetAssetToStaticData(inoutPropertyStaticData, _presetFileName); + } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = inDefaultProp.floatValue > 0 ? "On" : "Off"; + } + + public string GetPresetFileName() => _presetFileName; + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = prop.hasMixedValue; + var value = EditorGUI.Toggle(position, label, !Helper.Approximately(prop.floatValue, 0)); + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.floatValue = value ? 1.0f : 0.0f; + var keyword = Helper.GetKeywordName(_keyWord, prop.name); + Helper.SetShaderKeywordEnabled(editor.targets, keyword, value); + PresetHelper.GetPresetAsset(_presetFileName)?.TryGetPreset(prop.floatValue)?.ApplyToEditingMaterial(editor, metaDatas.perMaterialData); + TimelineHelper.SetKeywordToggleToTimeline(prop, editor, keyword); + } + EditorGUI.showMixedValue = false; + } + + public override void Apply(MaterialProperty prop) + { + base.Apply(prop); + if (!prop.hasMixedValue && VersionControlHelper.IsWriteable(prop.targets)) + { + Helper.SetShaderKeywordEnabled(prop.targets, Helper.GetKeywordName(_keyWord, prop.name), prop.floatValue > 0f); + PresetDrawer.ApplyPresetWithoutPropertyChanges(_presetFileName, prop); + } + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs.meta new file mode 100644 index 0000000..4026c85 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Numeric/SubToggleDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 331ebf4a8183cf3449c56f96443ec24b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Other.meta b/Editor/ShaderDrawers/ExtraDrawers/Other.meta new file mode 100644 index 0000000..a6d3bc2 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Other.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6bd503fc2f476ef43a556f98bba549b5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs new file mode 100644 index 0000000..85c5844 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs @@ -0,0 +1,174 @@ +// Copyright (c) Jason Ma + +using System; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Draw one or more Buttons within the same row, using the Display Name to control the appearance and behavior of the buttons + /// + /// Declaring a set of Button Name and Button Command in Display Name generates a Button, separated by '@': + /// ButtonName0@ButtonCommand0@ButtonName1@ButtonCommand1 + /// + /// Button Name can be any other string, the format of Button Command is: + /// TYPE:Argument + /// + /// The following TYPEs are currently supported: + /// - URL: Open the URL, Argument is the URL + /// - C#: Call the public static C# function, Argument is NameSpace.Class.Method(arg0, arg1, ...), + /// for target function signatures, see: LWGUI.ButtonDrawer.TestMethod(). + /// + /// The full example: + /// [Button(_)] _button0 ("URL Button@URL:https://github.com/JasonMa0012/LWGUI@C#:LWGUI.ButtonDrawer.TestMethod(1234, abcd)", Float) = 0 + /// + /// group: parent group name (Default: none) + /// Target Property Type: Any + /// + public class ButtonDrawer : SubDrawer + { + private const string _urlPrefix = "URL:"; + private const string _csPrefix = "C#:"; + private const string _separator = "@"; + + public ButtonDrawer() { } + + public ButtonDrawer(string group) + { + this.group = group; + } + + protected override float GetVisibleHeight(MaterialProperty prop) => 24; + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + inoutPropertyStaticData.groupName = group; + + // Display Name: ButtonName@URL:XXX@ButtonName@CS:NameSpace.Class.Method(arg0, arg1, ...)@... + var buttonNameAndCommands = inProp.displayName.Split(_separator); + if (buttonNameAndCommands != null && buttonNameAndCommands.Length > 0 && buttonNameAndCommands.Length % 2 == 0) + { + for (int i = 0; i < buttonNameAndCommands.Length; i++) + { + if (i % 2 == 0) + { + inoutPropertyStaticData.buttonDisplayNames.Add(buttonNameAndCommands[i]); + inoutPropertyStaticData.buttonDisplayNameWidths.Add(EditorStyles.label.CalcSize(new GUIContent(buttonNameAndCommands[i])).x); + } + else + { + inoutPropertyStaticData.buttonCommands.Add(buttonNameAndCommands[i]); + } + } + } + else + { + Debug.LogError($"LWGUI: ButtonDrawer with invalid Display Name Commands: { buttonNameAndCommands } ! prop: { inProp.name }"); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + var buttonDisplayNames = metaDatas.GetPropStaticData(prop).buttonDisplayNames; + var buttonDisplayNameWidths = metaDatas.GetPropStaticData(prop).buttonDisplayNameWidths; + var buttonCommands = metaDatas.GetPropStaticData(prop).buttonCommands; + if (buttonDisplayNames == null || buttonCommands == null || buttonDisplayNames.Count == 0 || buttonCommands.Count == 0 + || buttonDisplayNames.Count != buttonCommands.Count) + { + return; + } + + var enbaled = GUI.enabled; + GUI.enabled = true; + + position = EditorGUI.IndentedRect(position); + var rect = new Rect(position.x, position.y, 0, position.height); + var spaceWidth = (position.width - buttonDisplayNameWidths.Sum()) / buttonDisplayNames.Count; + + for (int i = 0; i < buttonDisplayNames.Count; i++) + { + var displayName = buttonDisplayNames[i]; + var displayNameRelativeWidth = buttonDisplayNameWidths[i]; + var command = buttonCommands[i]; + rect.xMax = rect.xMin + displayNameRelativeWidth + spaceWidth; + + if (GUI.Button(rect, new GUIContent(displayName, command))) + { + if (command.StartsWith(_urlPrefix)) + { + Application.OpenURL(command.Substring(_urlPrefix.Length, command.Length - _urlPrefix.Length)); + } + else if (command.StartsWith(_csPrefix)) + { + var csCommand = command.Substring(_csPrefix.Length, command.Length - _csPrefix.Length); + + // Get method name and args + string className = null, methodName = null; + string[] args = null; + { + var lastPointIndex = csCommand.LastIndexOf('.'); + if (lastPointIndex != -1) + { + className = csCommand.Substring(0, lastPointIndex); + var leftBracketIndex = csCommand.IndexOf('('); + if (leftBracketIndex != -1) + { + methodName = csCommand.Substring(lastPointIndex + 1, leftBracketIndex - lastPointIndex - 1); + args = csCommand.Substring(leftBracketIndex + 1, csCommand.Length - leftBracketIndex - 2) + ?.Split(',').Select(s => s.TrimStart()).ToArray(); + } + } + } + + // Find and call method + if (!string.IsNullOrEmpty(className) && !string.IsNullOrEmpty(methodName) && args != null) + { + Type type = ReflectionHelper.GetAllTypes().FirstOrDefault((type1 => type1.Name == className || type1.FullName == className)); + if (type != null) + { + var methodInfo = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public); + if (methodInfo != null) + { + methodInfo.Invoke(null, new object[]{ prop, editor, metaDatas, args }); + } + else + { + Debug.LogError($"LWGUI: Method {methodName} not found in {className}"); + } + } + else + { + Debug.LogError($"LWGUI: Class {className} not found"); + } + } + else + { + Debug.LogError($"LWGUI: Invalid C# command: {csCommand}"); + } + } + else + { + Debug.LogError($"LWGUI: Unknown command type: {command}"); + } + } + + rect.xMin = rect.xMax; + } + + GUI.enabled = enbaled; + } + + public static void TestMethod(MaterialProperty prop, MaterialEditor editor, LWGUIMetaDatas metaDatas, string[] args) + { + Debug.Log($"LWGUI: ButtonDrawer.TestMethod({prop}, {editor}, {metaDatas}, {args})"); + + foreach (var arg in args) + { + Debug.Log(arg); + } + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs.meta new file mode 100644 index 0000000..64cad04 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Other/ButtonDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1dcbe4f8b78506748993e7cf6ba90335 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture.meta new file mode 100644 index 0000000..5a23941 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0fa359403898274583e7d3f33c1e381 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs new file mode 100644 index 0000000..e4498cb --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs @@ -0,0 +1,112 @@ +// Copyright (c) Jason Ma + +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace LWGUI +{ + /// + /// Draw an image preview. + /// display name: The path of the image file relative to the Unity project, such as: "Assets/test.png", "Doc/test.png", "../test.png" + /// + /// group: parent group name (Default: none) + /// Target Property Type: Any + /// + public class ImageDrawer : SubDrawer + { + public ImageDrawer() { } + + public ImageDrawer(string group) + { + this.group = group; + } + + protected override float GetVisibleHeight(MaterialProperty prop) { return 0; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + var inputPath = (inProp.displayName ?? string.Empty).Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar); + string imageAbsPath = null; + + try + { + // If the display path already starts with Assets (project-relative), resolve from project root + if (inputPath.StartsWith("Assets")) + { + imageAbsPath = IOHelper.GetAbsPath(inputPath); + } + // If it's an absolute path, use it directly + else if (Path.IsPathRooted(inputPath)) + { + imageAbsPath = inputPath; + } + else + { + // Try resolving relative to the shader file location + var shaderAssetPath = AssetDatabase.GetAssetPath(inShader); + if (!string.IsNullOrEmpty(shaderAssetPath)) + { + var shaderFullPath = IOHelper.GetAbsPath(shaderAssetPath); + var shaderDir = Path.GetDirectoryName(shaderFullPath); + if (!string.IsNullOrEmpty(shaderDir)) + { + // Combine and normalize to resolve ../ segments + var candidate = Path.GetFullPath(Path.Combine(shaderDir, inputPath)); + if (File.Exists(candidate)) + { + imageAbsPath = candidate; + } + } + } + // Fallback: try project-root relative resolution + if (imageAbsPath == null) + { + var candidate2 = IOHelper.GetAbsPath(inputPath); + if (File.Exists(candidate2)) imageAbsPath = candidate2; + } + } + + if (!string.IsNullOrEmpty(imageAbsPath) && File.Exists(imageAbsPath)) + { + var fileData = File.ReadAllBytes(imageAbsPath); + Texture2D texture = new Texture2D(2, 2); + + // LoadImage will auto-resize the texture dimensions + if (texture.LoadImage(fileData)) + { + inoutPropertyStaticData.image = texture; + } + else + { + Debug.LogError($"LWGUI: Failed to load image data into texture: { imageAbsPath }"); + } + } + else + { + Debug.LogError($"LWGUI: Image path not found: { inputPath }"); + } + } + catch (Exception ex) + { + Debug.LogError($"LWGUI: Exception while resolving image path '{inputPath}': {ex.Message}"); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + var image = metaDatas.GetPropStaticData(prop).image; + if (image) + { + var scaledheight = Mathf.Max(0, image.height / (image.width / Helper.GetCurrentPropertyLayoutWidth())); + var rect = EditorGUILayout.GetControlRect(true, scaledheight); + rect = RevertableHelper.IndentRect(EditorGUI.IndentedRect(rect)); + EditorGUI.DrawPreviewTexture(rect, image); + + if (GUI.enabled) + prop.textureValue = null; + } + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs.meta new file mode 100644 index 0000000..1127d5d --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/ImageDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 343ef9dd839214847b6a04dad67bca69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs new file mode 100644 index 0000000..f9346d1 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs @@ -0,0 +1,166 @@ +// Copyright (c) Jason Ma + +using System; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw a "Ramp Atlas Scriptable Object" selector and texture preview. + /// The Ramp Atlas SO is responsible for storing multiple ramps and generating the corresponding Ramp Atlas Texture. + /// Use it together with RampAtlasIndexer() to sample specific ramps in Shader using Index, similar to UE's Curve Atlas. + /// Note: Currently, the material only saves Texture reference and Int value, + /// if you manually modify the Ramp Atlas, the references will not update automatically! + /// + /// group: parent group name (Default: none) + /// defaultFileName: the default file name when creating a Ramp Atlas SO (Default: RampAtlas) + /// rootPath: the default directory when creating a Ramp Atlas SO, replace '/' with '.' (for example: Assets.Art.RampAtlas). (Default: Assets) + /// colorSpace: the Color Space of Ramp Atlas Texture. (sRGB/Linear) (Default: sRGB) + /// defaultWidth: default Ramp Atlas Texture width (Default: 256) + /// defaultHeight: default Ramp Atlas Texture height (Default: 4) + /// showAtlasPreview: Draw the preview of Ramp Atlas below (True/False) (Default: True) + /// rampAtlasTypeName: custom RampAtlas type name for user-defined RampAtlas classes (Default: LwguiRampAtlas) + /// Target Property Type: Texture2D + /// + public class RampAtlasDrawer : SubDrawer + { + public string rootPath = "Assets"; + public string defaultFileName = "RampAtlas"; + public bool defaultAtlasSRGB = true; + public int defaultAtlasWidth = 256; + public int defaultAtlasHeight = 2; + public bool showAtlasPreview = true; + public Type rampAtlasType = typeof(LwguiRampAtlas); + + protected LwguiRampAtlas _rampAtlasSO; + + public RampAtlasDrawer() : this(string.Empty) { } + + public RampAtlasDrawer(string group) : this(group, "RampAtlas") { } + + public RampAtlasDrawer(string group, string defaultFileName) : this(group, defaultFileName, "Assets") { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath) : this(group, defaultFileName, rootPath, "sRGB") { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace) : this(group, defaultFileName, rootPath, colorSpace, 256) { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, 4) { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, "true") { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, defaultHeight, showAtlasPreview, "") { } + + public RampAtlasDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, float defaultHeight, string showAtlasPreview, string rampAtlasTypeName) + { + if (!rootPath.StartsWith(this.rootPath)) + { + Debug.LogError("LWGUI: Ramp Atlas Root Path: '" + rootPath + "' must start with 'Assets'!"); + rootPath = this.rootPath; + } + this.group = group; + this.defaultFileName = defaultFileName; + this.rootPath = rootPath.Replace('.', '/'); + this.defaultAtlasSRGB = colorSpace.ToLower() == "srgb"; + this.defaultAtlasWidth = (int)Mathf.Max(2, defaultWidth); + this.defaultAtlasHeight = (int)Mathf.Max(2, defaultHeight); + this.showAtlasPreview = Helper.StringToBool(showAtlasPreview); + + // Resolve custom RampAtlas type + if (!string.IsNullOrEmpty(rampAtlasTypeName)) + { + var customType = ReflectionHelper.GetTypeByName(rampAtlasTypeName); + if (customType != null && typeof(LwguiRampAtlas).IsAssignableFrom(customType)) + { + rampAtlasType = customType; + } + else + { + Debug.LogError($"LWGUI: RampAtlas type '{rampAtlasTypeName}' not found or not derived from LwguiRampAtlas!"); + } + } + } + + protected override bool IsMatchPropType(MaterialProperty property) => property.GetPropertyType() == ShaderPropertyType.Texture; + + protected override float GetVisibleHeight(MaterialProperty prop) => + EditorGUIUtility.singleLineHeight + + (prop.textureValue && showAtlasPreview ? MaterialEditor.GetDefaultPropertyHeight(prop) + 2.0f : 0); + + public override void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) + { + menu.AddSeparator(""); + menu.AddItem(new GUIContent("Create Ramp Atlas"), false, () => + { + _rampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(prop, metaDatas, rampAtlasType); + if (_rampAtlasSO) + { + prop.textureValue = _rampAtlasSO.rampAtlasTexture; + LWGUI.OnValidate(metaDatas); + } + }); + + if (_rampAtlasSO) + { + menu.AddItem(new GUIContent("Clone Ramp Atlas"), false, () => + { + var newRampAtlasSO = LwguiRampAtlas.CloneRampAtlasSO(_rampAtlasSO, rampAtlasType); + if (newRampAtlasSO) + { + _rampAtlasSO = newRampAtlasSO; + prop.textureValue = _rampAtlasSO.rampAtlasTexture; + LWGUI.OnValidate(metaDatas); + } + }); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.PrefixLabel(position, label); + + var labelWidth = EditorGUIUtility.labelWidth; + var indentLevel = EditorGUI.indentLevel; + EditorGUIUtility.labelWidth = 0; + EditorGUI.indentLevel = 0; + + var fieldRect = MaterialEditor.GetRectAfterLabelWidth(position); + var rampAtlasSORect = new Rect(fieldRect.x, fieldRect.y, fieldRect.width, EditorGUIUtility.singleLineHeight); + var rampAtlasTextureRect = new Rect(fieldRect.x, rampAtlasSORect.yMax + 2.0f, fieldRect.width, MaterialEditor.GetDefaultPropertyHeight(prop)); + + _rampAtlasSO = LwguiRampAtlas.LoadRampAtlasSO(prop.textureValue); + + // Disable ObjectField's Context Menu + var e = Event.current; + if (e?.type == EventType.MouseDown && Event.current.button == 1 + && (rampAtlasSORect.Contains(e.mousePosition))) + { + e.Use(); + } + + EditorGUI.BeginChangeCheck(); + _rampAtlasSO = (LwguiRampAtlas)EditorGUI.ObjectField(rampAtlasSORect, GUIContent.none, _rampAtlasSO, rampAtlasType, false); + if (EditorGUI.EndChangeCheck()) + { + prop.textureValue = LwguiRampAtlas.LoadRampAtlasTexture(_rampAtlasSO); + + if (_rampAtlasSO && !prop.textureValue) + { + Debug.LogError($"LWGUI: Can NOT load the Ramp Atlas Texture from: { _rampAtlasSO.name }"); + } + } + + if (showAtlasPreview && prop.textureValue && !prop.hasMixedValue) + { + var filter = prop.textureValue.filterMode; + prop.textureValue.filterMode = FilterMode.Point; + EditorGUI.DrawPreviewTexture(rampAtlasTextureRect, prop.textureValue); + prop.textureValue.filterMode = filter; + } + + EditorGUIUtility.labelWidth = labelWidth; + EditorGUI.indentLevel = indentLevel; + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs.meta new file mode 100644 index 0000000..8fc956a --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 122a05b8239d8484abbafc922575270b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs new file mode 100644 index 0000000..b29efd1 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs @@ -0,0 +1,305 @@ +// Copyright (c) Jason Ma + +using LWGUI.LwguiGradientEditor; +using LWGUI.Runtime.LwguiGradient; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Visually similar to Ramp(), but RampAtlasIndexer() must be used together with RampAtlas(). + /// The actual stored value is the index of the current Ramp in the Ramp Atlas SO, used for sampling the Ramp Atlas Texture in the Shader. + /// + /// group: parent group name. + /// rampAtlasPropName: RampAtlas() property name. + /// defaultRampName: default ramp name. (Default: Ramp) + /// colorSpace: default ramp color space. (sRGB/Linear) (Default: sRGB) + /// viewChannelMask: editable channels. (Default: RGBA) + /// timeRange: the abscissa display range (1/24/2400), is used to optimize the editing experience when the abscissa is time of day. (Default: 1) + /// Target Property Type: Float + /// + public class RampAtlasIndexerDrawer : RampDrawer + { + public string rampAtlasPropName = string.Empty; + public string defaultRampName = "Ramp"; + + private MaterialProperty _rampAtlasProp; + public MaterialProperty rampAtlasProp + { + get + { + if (_rampAtlasProp == null) + { + var prop = metaDatas?.GetProperty(rampAtlasPropName); + if (prop != null && prop.GetPropertyType() == ShaderPropertyType.Texture) + _rampAtlasProp = prop; + } + return _rampAtlasProp; + } + set => _rampAtlasProp = value; + } + + private LwguiRampAtlas _rampAtlasSO; + public LwguiRampAtlas rampAtlasSO + { + get => _rampAtlasSO ??= LwguiRampAtlas.LoadRampAtlasSO(rampAtlasProp?.textureValue); + set => _rampAtlasSO = value; + } + + private IRamp _currentRamp; + private bool _rampAtlasSOHasMixedValue; + private bool _isOutOfRange; + + private static readonly float _previewRowHeight = EditorGUIUtility.singleLineHeight; + private static readonly float _previewRowSpacing = 2f; + + private int currentRowCount => rampAtlasSO?.RowCountPerRamp ?? 1; + + protected override float rampPreviewHeight => currentRowCount * _previewRowHeight + Mathf.Max(0, currentRowCount - 1) * _previewRowSpacing; + + public RampAtlasIndexerDrawer(string group, string rampAtlasPropName) : this(group, rampAtlasPropName, "Ramp") {} + + public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName) : this(group, rampAtlasPropName, defaultRampName, "sRGB") {} + + public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace) : this(group, rampAtlasPropName, defaultRampName, colorSpace, "RGBA") {} + + public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace, string viewChannelMask) : this(group, rampAtlasPropName, defaultRampName, colorSpace, viewChannelMask, 1) {} + + public RampAtlasIndexerDrawer(string group, string rampAtlasPropName, string defaultRampName, string colorSpace, string viewChannelMask, float timeRange) + { + this.group = group; + this.rampAtlasPropName = rampAtlasPropName; + this.defaultRampName = defaultRampName; + this.colorSpace = colorSpace.ToLower() == "linear" ? ColorSpace.Linear : ColorSpace.Gamma; + this.viewChannelMask = LwguiGradient.ChannelMask.None; + { + viewChannelMask = viewChannelMask.ToLower(); + for (int c = 0; c < (int)LwguiGradient.Channel.Num; c++) + { + if (viewChannelMask.Contains(LwguiGradient.channelNames[c])) + this.viewChannelMask |= LwguiGradient.ChannelIndexToMask(c); + } + } + this.timeRange = LwguiGradient.GradientTimeRange.One; + { + if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFour) + this.timeRange = LwguiGradient.GradientTimeRange.TwentyFour; + else if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFourHundred) + this.timeRange = LwguiGradient.GradientTimeRange.TwentyFourHundred; + } + } + + protected override bool IsMatchPropType(MaterialProperty property) => property.GetPropertyType() is ShaderPropertyType.Float or ShaderPropertyType.Int; + + protected override void OnRampPropUpdate(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + if (doRegisterUndo) + OnGradientEditorChange(null); + } + + protected override void OnGradientEditorChange(LwguiGradient gradient) + { + rampAtlasSO?.UpdateTexturePixels(); + } + + protected override void OnEditRampMap(MaterialProperty prop, LwguiGradient gradient) + { + OnGradientEditorChange(null); + } + + protected override void OnSaveRampMap(MaterialProperty prop, LwguiGradient gradient) + { + rampAtlasSO?.SaveTexture(checkoutAndForceWrite:true); + rampAtlasSO?.SaveRampAtlasSO(); + } + + protected override LwguiGradient GetLwguiGradient(MaterialProperty prop, out bool isDirty) + { + isDirty = false; + if (rampAtlasSO && (int)prop.GetNumericValue() < rampAtlasSO.RampCount) + { + _currentRamp = rampAtlasSO.GetRamp((int)prop.GetNumericValue()); + if (_currentRamp == null) + return null; + + isDirty = EditorUtility.IsDirty(rampAtlasSO); + colorSpace = _currentRamp.ColorSpace; + viewChannelMask = _currentRamp.ChannelMask; + timeRange = _currentRamp.TimeRange; + return _currentRamp.Gradient; + } + else + return null; + } + + protected override void CreateNewRampMap(MaterialProperty prop, MaterialEditor editor) + { + // Create a Ramp + if (rampAtlasSO) + { + var newIndex = rampAtlasSO.RampCount; + + var newRamp = rampAtlasSO.AddRamp(); + newRamp.Name = defaultRampName; + newRamp.ColorSpace = colorSpace; + newRamp.ChannelMask = viewChannelMask; + newRamp.TimeRange = timeRange; + + prop.SetNumericValue(newIndex); + + if (rampAtlasSO.TotalRowCount > rampAtlasSO.rampAtlasHeight) + rampAtlasSO.rampAtlasHeight *= 2; + + rampAtlasSO.UpdateTexturePixels(); + } + // Create a Ramp Atlas SO + else + { + var newRampAtlasSO = LwguiRampAtlas.CreateRampAtlasSO(rampAtlasProp, metaDatas); + if (newRampAtlasSO) + { + rampAtlasSO = newRampAtlasSO; + rampAtlasProp.textureValue = rampAtlasSO.rampAtlasTexture; + } + } + } + + protected void SwitchRamp(MaterialProperty prop, int index) + { + prop.SetNumericValue(index); + LWGUI.OnValidate(metaDatas); + } + + protected override LwguiGradient DiscardRampMap(MaterialProperty prop, LwguiGradient gradient) + { + rampAtlasSO?.DiscardChanges(); + _currentRamp = rampAtlasSO?.GetRamp((int)prop.GetNumericValue()); + return _currentRamp?.Gradient; + } + + // Selector button is drawn together with preview in DrawRampObjectField + protected override void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) { } + + /// + /// Draw rampAtlasSO Fallback Field + /// + protected override void DrawRampObjectField(Rect rampFieldRect, MaterialProperty prop, LwguiGradient gradient) + { + if (!rampAtlasSO || _rampAtlasSOHasMixedValue) + { + EditorGUI.BeginChangeCheck(); + var newRampAtlasSO = EditorGUI.ObjectField(rampFieldRect, rampAtlasSO, typeof(LwguiRampAtlas), false) as LwguiRampAtlas; + if (EditorGUI.EndChangeCheck()) + { + rampAtlasSO = newRampAtlasSO; + metaDatas.GetProperty(rampAtlasPropName).textureValue = rampAtlasSO?.rampAtlasTexture; + } + } + } + + /// + /// Draw Ramp Preview And Selector + /// + protected override void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) + { + if (!rampAtlasSO || _rampAtlasSOHasMixedValue) + return; + + var previewWidth = previewRect.width; + var selectorButtonWidth = EditorGUIUtility.singleLineHeight; + + if (_currentRamp == null || _isOutOfRange || EditorGUI.showMixedValue) + { + // Draw Invalid Ramp Fallback + // Draw border + GUI.Box(fieldRect, "None", EditorStyles.objectField); + + // Draw button + var buttonRect = new Rect(previewRect.xMax - 1, fieldRect.y + 1, selectorButtonWidth - 0, rampPreviewHeight - 2); + if (GUI.Button(buttonRect, GUIContent.none, GUIStyles.objectFieldButton)) + { + RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); + } + } + else + { + var gradients = _currentRamp.GetGradients(); + var gradientCount = gradients?.Length ?? 0; + if (gradientCount == 0) return; + + // Draw gradient previews (clickable to edit) + for (int i = 0; i < gradientCount; i++) + { + if (gradients[i] == null) continue; + + var rowY = fieldRect.y + i * (_previewRowHeight + _previewRowSpacing); + var rowRect = new Rect(fieldRect.x, rowY, previewWidth, _previewRowHeight); + + // Draw border + GUI.Box(rowRect, GUIContent.none, EditorStyles.objectField); + + // Draw gradient with alpha channel (clickable to edit) + var innerRect = new Rect(rowRect.x + 1, rowRect.y + 1, rowRect.width - 2, rowRect.height - 2); + LwguiGradientEditorHelper.GradientPreviewField(innerRect, gradients[i], colorSpace, viewChannelMask, timeRange, OnGradientEditorChange); + } + + // Draw selector button (ObjectField picker style, stretches to cover all preview rows) + { + // Draw border + var selectButtonRect = new Rect(previewRect.xMax - 2, fieldRect.y, selectorButtonWidth + 2, rampPreviewHeight); + GUI.Box(selectButtonRect, GUIContent.none, EditorStyles.objectField); + + // Draw button + var innerRect = new Rect(selectButtonRect.x + 0, selectButtonRect.y + 1, selectButtonRect.width - 1, selectButtonRect.height - 2); + if (GUI.Button(innerRect, GUIContent.none, GUIStyles.objectFieldButton)) + { + RampSelectorWindow.ShowWindow(prop, rampAtlasSO, SwitchRamp); + } + } + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + rampAtlasProp = metaDatas.GetProperty(rampAtlasPropName); + if (rampAtlasProp == null || rampAtlasProp.GetPropertyType() != ShaderPropertyType.Texture) + { + Helper.DrawShaderPropertyWithErrorLabel(position, prop, label, editor, "Invalid rampAtlasPropName"); + Debug.LogError($"LWGUI: Property { prop.name } has invalid rampAtlasPropName: { rampAtlasPropName }"); + return; + } + + // Add Info to label + var currentIndex = (int)prop.GetNumericValue(); + label.tooltip += $"\nCurrent Value: {currentIndex}"; + if (rampAtlasSO) + { + _isOutOfRange = currentIndex >= rampAtlasSO.RampCount; + var info = _isOutOfRange ? "OUT OF RANGE!" : rampAtlasSO.GetRamp(currentIndex)?.Name ?? "NULL"; + label.text += $" ({ currentIndex }: { info } - { rampAtlasSO.RampCount })"; + } + else + { + _isOutOfRange = false; + label.text += $" ({ currentIndex } - NULL)"; + } + + // Handle Mixed Value + _rampAtlasSOHasMixedValue = rampAtlasProp.hasMixedValue; + var showMixedValue = EditorGUI.showMixedValue; + EditorGUI.showMixedValue = prop.hasMixedValue || _rampAtlasSOHasMixedValue; + + + base.DrawProp(position, prop, label, editor); + + + // Clear + _rampAtlasProp = null; + _rampAtlasSO = null; + _currentRamp = null; + EditorGUI.showMixedValue = showMixedValue; + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs.meta new file mode 100644 index 0000000..ce22f6e --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampAtlasIndexerDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4fd29490f9fb904680cb50a2f83ceb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs new file mode 100644 index 0000000..7ffeb13 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs @@ -0,0 +1,303 @@ +// Copyright (c) Jason Ma + +using System; +using System.IO; +using LWGUI.LwguiGradientEditor; +using LWGUI.Runtime.LwguiGradient; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw an unreal style Ramp Map Editor (Default Ramp Map Resolution: 256 * 2) + /// NEW: The new LwguiGradient type has both the Gradient and Curve editors, and can be used in C# scripts and runtime, and is intended to replace UnityEngine.Gradient + /// + /// group: parent group name (Default: none) + /// defaultFileName: default Ramp Map file name when create a new one (Default: RampMap) + /// rootPath: the path where ramp is stored, replace '/' with '.' (for example: Assets.Art.Ramps). when selecting ramp, it will also be filtered according to the path (Default: Assets) + /// colorSpace: switch sRGB / Linear in ramp texture import setting (Default: sRGB) + /// defaultWidth: default Ramp Width. (Default: 256) + /// viewChannelMask: editable channels. (Default: RGBA) + /// timeRange: the abscissa display range (1/24/2400), is used to optimize the editing experience when the abscissa is time of day. (Default: 1) + /// Target Property Type: Texture2D + /// + public class RampDrawer : SubDrawer + { + public static readonly string DefaultRootPath = "Assets"; + + public string rootPath = "Assets"; + public string saveFilePanelTitle = "Create New Ramp Texture"; + public string defaultFileName = "RampMap"; + public string fileExtension = "png"; + public int defaultWidth = 256; + public int defaultHeight = 2; + public ColorSpace colorSpace = ColorSpace.Gamma; + public LwguiGradient.ChannelMask viewChannelMask = LwguiGradient.ChannelMask.All; + public LwguiGradient.GradientTimeRange timeRange = LwguiGradient.GradientTimeRange.One; + public bool doRegisterUndo; + + private static readonly float _rampButtonsHeight = EditorGUIUtility.singleLineHeight; + + protected virtual float rampPreviewHeight => EditorGUIUtility.singleLineHeight; + + protected override float GetVisibleHeight(MaterialProperty prop) { return rampPreviewHeight + _rampButtonsHeight; } + + public RampDrawer() : this(String.Empty) { } + + public RampDrawer(string group) : this(group, "RampMap") { } + + public RampDrawer(string group, string defaultFileName) : this(group, defaultFileName, DefaultRootPath, 256) { } + + public RampDrawer(string group, string defaultFileName, float defaultWidth) : this(group, defaultFileName, DefaultRootPath, defaultWidth) { } + + public RampDrawer(string group, string defaultFileName, string rootPath, float defaultWidth) : this(group, defaultFileName, rootPath, "sRGB", defaultWidth) { } + + public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, "RGBA") { } + + public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, string viewChannelMask) : this(group, defaultFileName, rootPath, colorSpace, defaultWidth, viewChannelMask, 1) { } + + public RampDrawer(string group, string defaultFileName, string rootPath, string colorSpace, float defaultWidth, string viewChannelMask, float timeRange) + { + if (!rootPath.StartsWith(DefaultRootPath)) + { + Debug.LogError("LWGUI: Ramp Root Path: '" + rootPath + "' must start with 'Assets'!"); + rootPath = DefaultRootPath; + } + this.group = group; + this.defaultFileName = defaultFileName; + this.rootPath = rootPath.Replace('.', '/'); + this.colorSpace = colorSpace.ToLower() == "linear" ? ColorSpace.Linear : ColorSpace.Gamma; + this.defaultWidth = (int)Mathf.Max(2, defaultWidth); + this.viewChannelMask = LwguiGradient.ChannelMask.None; + { + viewChannelMask = viewChannelMask.ToLower(); + for (int c = 0; c < (int)LwguiGradient.Channel.Num; c++) + { + if (viewChannelMask.Contains(LwguiGradient.channelNames[c])) + this.viewChannelMask |= LwguiGradient.ChannelIndexToMask(c); + } + + if (this.viewChannelMask == (LwguiGradient.ChannelMask.RGB | LwguiGradient.ChannelMask.Alpha)) + this.viewChannelMask = LwguiGradient.ChannelMask.All; + } + this.timeRange = LwguiGradient.GradientTimeRange.One; + { + if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFour) + this.timeRange = LwguiGradient.GradientTimeRange.TwentyFour; + else if ((int)timeRange == (int)LwguiGradient.GradientTimeRange.TwentyFourHundred) + this.timeRange = LwguiGradient.GradientTimeRange.TwentyFourHundred; + } + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Texture; } + + protected virtual void OnRampPropUpdate(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { } + + protected virtual void OnCreateNewRampMap(MaterialProperty prop) { } + + protected virtual void OnGradientEditorChange(LwguiGradient gradient) { } + + protected virtual void OnEditRampMap(MaterialProperty prop, LwguiGradient gradient) { } + + protected virtual void OnSaveRampMap(MaterialProperty prop, LwguiGradient gradient) { } + + protected virtual void OnDiscardRampMap(MaterialProperty prop, LwguiGradient gradient) { } + + protected virtual void OnSwitchRampMap(MaterialProperty prop, Texture2D newRampMap, int index) { } + + protected virtual LwguiGradient GetLwguiGradient(MaterialProperty prop, out bool isDirty) + { + return RampHelper.GetGradientFromTexture(prop.textureValue, out isDirty, false, doRegisterUndo); + } + + protected virtual void EditWhenNoRampMap(MaterialProperty prop, MaterialEditor editor) + { + LwguiGradientWindow.CloseWindow(); + CreateNewRampMap(prop, editor); + OnCreateNewRampMap(prop); + LWGUI.OnValidate(metaDatas); + } + + protected virtual void CreateNewRampMap(MaterialProperty prop, MaterialEditor editor) + { + string createdFileRelativePath = string.Empty; + while (true) + { + var absRootPath = IOHelper.GetAbsPath(rootPath); + if (!Directory.Exists(absRootPath)) + Directory.CreateDirectory(absRootPath); + + // TODO: Warning: + // PropertiesGUI() is being called recursively. If you want to render the default gui for shader properties then call PropertiesDefaultGUI() instead + var absPath = EditorUtility.SaveFilePanel(saveFilePanelTitle, rootPath, defaultFileName, fileExtension); + + if (absPath.StartsWith(absRootPath)) + { + createdFileRelativePath = IOHelper.GetRelativePath(absPath); + break; + } + else if (absPath != string.Empty) + { + var retry = EditorUtility.DisplayDialog("Invalid Path", $"Please select the subdirectory of '{absRootPath}'", "Retry", "Cancel"); + if (!retry) break; + } + else + { + break; + } + } + + if (!string.IsNullOrEmpty(createdFileRelativePath)) + { + RampHelper.CreateAndSaveNewGradientTexture(defaultWidth, defaultHeight, createdFileRelativePath, colorSpace == ColorSpace.Linear); + prop.textureValue = AssetDatabase.LoadAssetAtPath(createdFileRelativePath); + } + } + + protected virtual void ChangeRampMap(MaterialProperty prop, LwguiGradient gradient) + { + RampHelper.SetGradientToTexture(prop.textureValue, gradient, false); + } + + protected virtual void SaveRampMap(MaterialProperty prop, LwguiGradient gradient) + { + RampHelper.SetGradientToTexture(prop.textureValue, gradient, true); + } + + protected virtual void SwitchRampMap(MaterialProperty prop, Texture2D newRampMap, int index) + { + prop.textureValue = newRampMap; + OnSwitchRampMap(prop, newRampMap, index); + LWGUI.OnValidate(metaDatas); + } + + protected virtual LwguiGradient DiscardRampMap(MaterialProperty prop, LwguiGradient gradient) + { + // Tex > Gradient + gradient = RampHelper.GetGradientFromTexture(prop.textureValue, out _, true); + // GradientObject > Tex + RampHelper.SetGradientToTexture(prop.textureValue, gradient, true); + return gradient; + } + + protected virtual void DrawRampSelector(Rect selectButtonRect, MaterialProperty prop, LwguiGradient gradient) + { + RampHelper.RampMapSelectorOverride(selectButtonRect, prop, rootPath, SwitchRampMap); + } + + // Manual replace ramp map + protected virtual void DrawRampObjectField(Rect rampFieldRect, MaterialProperty prop, LwguiGradient gradient) + { + EditorGUI.BeginChangeCheck(); + var newManualSelectedTexture = (Texture2D)EditorGUI.ObjectField(rampFieldRect, prop.textureValue, typeof(Texture2D), false); + if (Helper.EndChangeCheck(metaDatas, prop)) + { + if (newManualSelectedTexture && !AssetDatabase.GetAssetPath(newManualSelectedTexture).StartsWith(rootPath)) + EditorUtility.DisplayDialog("Invalid Path", "Please select the subdirectory of '" + rootPath + "'", "OK"); + else + SwitchRampMap(prop, newManualSelectedTexture, 0); + } + } + + protected virtual void DrawPreviewTextureOverride(Rect previewRect, Rect fieldRect, MaterialProperty prop, LwguiGradient gradient) + { + if (!prop.hasMixedValue && gradient != null) + { + LwguiGradientEditorHelper.DrawGradientWithSeparateAlphaChannel(previewRect, gradient, colorSpace, viewChannelMask); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + var labelWidth = EditorGUIUtility.labelWidth; + var indentLevel = EditorGUI.indentLevel; + + OnRampPropUpdate(position, prop, label, editor); + + var gradient = GetLwguiGradient(prop, out var isDirty); + + // Draw Label + var labelRect = new Rect(position); + { + labelRect.height = rampPreviewHeight; + EditorGUI.PrefixLabel(labelRect, label); + } + + // Ramp buttons Rect + var buttonRect = new Rect(position); + { + EditorGUIUtility.labelWidth = 0; + EditorGUI.indentLevel = 0; + buttonRect.yMin = buttonRect.yMax - EditorGUIUtility.singleLineHeight; + buttonRect = MaterialEditor.GetRectAfterLabelWidth(buttonRect); + if (buttonRect.width < 50f) return; + } + + // Draw Ramp Editor + RampHelper.RampEditor(buttonRect, ref gradient, colorSpace, viewChannelMask, timeRange, isDirty, + out bool hasGradientChanges, + out bool doEditWhenNoGradient, + out doRegisterUndo, + out bool doCreate, + out bool doSaveGradient, + out bool doDiscardGradient, + OnGradientEditorChange); + + // Edit When No Gradient + if (doEditWhenNoGradient) + { + EditWhenNoRampMap(prop, editor); + } + + // Create + if (doCreate) + { + LwguiGradientWindow.CloseWindow(); + CreateNewRampMap(prop, editor); + OnCreateNewRampMap(prop); + LWGUI.OnValidate(metaDatas); + } + + // Change + if (hasGradientChanges && gradient != null) + { + ChangeRampMap(prop, gradient); + OnEditRampMap(prop, gradient); + } + + // Save + if (doSaveGradient && gradient != null) + { + SaveRampMap(prop, gradient); + OnSaveRampMap(prop, gradient); + } + + // Discard + if (doDiscardGradient) + { + LwguiGradientWindow.CloseWindow(); + gradient = DiscardRampMap(prop, gradient); + OnDiscardRampMap(prop, gradient); + } + + // Texture Object Field, handle switch texture event + var rampFieldRect = MaterialEditor.GetRectAfterLabelWidth(labelRect); + rampFieldRect.height = labelRect.height; + var previewRect = new Rect(rampFieldRect.x + 0.5f, rampFieldRect.y + 0.5f, rampFieldRect.width - 18, rampFieldRect.height - 0.5f); + { + var selectButtonRect = new Rect(previewRect.xMax, rampFieldRect.y, rampFieldRect.width - previewRect.width, rampFieldRect.height); + DrawRampSelector(selectButtonRect, prop, gradient); + + DrawRampObjectField(rampFieldRect, prop, gradient); + } + + // Preview texture override (larger preview, hides texture name) + DrawPreviewTextureOverride(previewRect, rampFieldRect, prop, gradient); + + EditorGUIUtility.labelWidth = labelWidth; + EditorGUI.indentLevel = indentLevel; + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs.meta new file mode 100644 index 0000000..acc9619 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/RampDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f4cae92fbbe1b44b984adee7caea5a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs new file mode 100644 index 0000000..9d5f723 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs @@ -0,0 +1,93 @@ +// Copyright (c) Jason Ma + +using System; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw a Texture property in single line with a extra property + /// + /// group: parent group name (Default: none) + /// extraPropName: extra property name (Default: none) + /// Target Property Type: Texture + /// Extra Property Type: Color, Vector + /// Target Property Type: Texture2D + /// + public class TexDrawer : SubDrawer + { + private string _extraPropName = String.Empty; + private ChannelDrawer _channelDrawer = new ChannelDrawer(); + + public TexDrawer() { } + + public TexDrawer(string group) : this(group, String.Empty) { } + + public TexDrawer(string group, string extraPropName) + { + this.group = group; + this._extraPropName = extraPropName; + } + + protected override float GetVisibleHeight(MaterialProperty prop) { return EditorGUIUtility.singleLineHeight; } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Texture; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + inoutPropertyStaticData.AddExtraProperty(_extraPropName); + } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + var defaultExtraProp = inoutPerMaterialData.GetPropDynamicData(_extraPropName)?.defaultProperty; + if (defaultExtraProp != null) + { + var text = string.Empty; + if (defaultExtraProp.GetPropertyType() == ShaderPropertyType.Vector) + text = ChannelDrawer.GetChannelName(defaultExtraProp); + else + text = RevertableHelper.GetPropertyDefaultValueText(defaultExtraProp); + + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = + RevertableHelper.GetPropertyDefaultValueText(inDefaultProp) + ", " + text; + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.showMixedValue = prop.hasMixedValue; + var rect = position; + + MaterialProperty extraProp = metaDatas.GetProperty(_extraPropName); + if (extraProp != null + // && ( + // extraProp.type == MaterialProperty.PropType.Color + // || extraProp.type == MaterialProperty.PropType.Vector + // ) + ) + { + var i = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + + var extraRect = MaterialEditor.GetRightAlignedFieldRect(rect); + extraRect.height = rect.height; + + if (extraProp.GetPropertyType() == ShaderPropertyType.Vector) + _channelDrawer.OnGUI(extraRect, extraProp, GUIContent.none, editor); + else + editor.ShaderProperty(extraRect, extraProp, GUIContent.none); + + EditorGUI.indentLevel = i; + } + + editor.TexturePropertyMiniThumbnail(rect, prop, label.text, label.tooltip); + + EditorGUI.showMixedValue = false; + } + } +} + diff --git a/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs.meta new file mode 100644 index 0000000..8485db0 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Texture/TexDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 01d437464f05cec4c94a6d090d664a62 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Vector.meta b/Editor/ShaderDrawers/ExtraDrawers/Vector.meta new file mode 100644 index 0000000..e66d768 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Vector.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65fd85b7ea5b45c49891bdc4c027d8cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs new file mode 100644 index 0000000..f6a0f95 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs @@ -0,0 +1,96 @@ +// Copyright (c) Jason Ma + +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Draw a R/G/B/A drop menu: + /// R = (1, 0, 0, 0) + /// G = (0, 1, 0, 0) + /// B = (0, 0, 1, 0) + /// A = (0, 0, 0, 1) + /// RGB Average = (1f / 3f, 1f / 3f, 1f / 3f, 0) + /// RGB Luminance = (0.2126f, 0.7152f, 0.0722f, 0) + /// None = (0, 0, 0, 0) + /// + /// group: parent group name (Default: none) + /// Target Property Type: Vector, used to dot() with Texture Sample Value + /// + public class ChannelDrawer : SubDrawer + { + private static GUIContent[] _names = new[] + { + new GUIContent("R"), + new GUIContent("G"), + new GUIContent("B"), + new GUIContent("A"), + new GUIContent("RGB Average"), + new GUIContent("RGB Luminance"), + new GUIContent("None") + }; + private static int[] _intValues = new int[] { 0, 1, 2, 3, 4, 5, 6 }; + private static Vector4[] _vector4Values = new[] + { + new Vector4(1, 0, 0, 0), + new Vector4(0, 1, 0, 0), + new Vector4(0, 0, 1, 0), + new Vector4(0, 0, 0, 1), + new Vector4(1f / 3f, 1f / 3f, 1f / 3f, 0), + new Vector4(0.2126f, 0.7152f, 0.0722f, 0), + new Vector4(0, 0, 0, 0) + }; + + public ChannelDrawer() { } + + public ChannelDrawer(string group) + { + this.group = group; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Vector; } + + private static int GetChannelIndex(MaterialProperty prop) + { + int index = -1; + for (int i = 0; i < _vector4Values.Length; i++) + { + if (prop.vectorValue == _vector4Values[i]) + index = i; + } + if (index == -1) + { + Debug.LogError("LWGUI: Channel Property: " + prop.name + " invalid vector found, reset to A"); + prop.vectorValue = _vector4Values[3]; + index = 3; + } + return index; + } + + public static string GetChannelName(MaterialProperty prop) + { + return _names[GetChannelIndex(prop)].text; + } + + public override void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) + { + inoutPerMaterialData.propDynamicDatas[inProp.name].defaultValueDescription = GetChannelName(inDefaultProp); + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + EditorGUI.BeginChangeCheck(); + + EditorGUI.showMixedValue = prop.hasMixedValue; + var index = GetChannelIndex(prop); + int num = EditorGUI.IntPopup(position, label, index, _names, _intValues); + EditorGUI.showMixedValue = false; + if (Helper.EndChangeCheck(metaDatas, prop)) + { + prop.vectorValue = _vector4Values[num]; + } + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs.meta new file mode 100644 index 0000000..c55342d --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Vector/ChannelDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 339426a90d6e874498d6f906e064d12a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs b/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs new file mode 100644 index 0000000..e6a6727 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs @@ -0,0 +1,89 @@ +// Copyright (c) Jason Ma + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; + +namespace LWGUI +{ + /// + /// Display up to 4 colors in a single line + /// + /// group: parent group name (Default: none) + /// color2-4: extra color property name + /// Target Property Type: Color + /// + public class ColorDrawer : SubDrawer + { + private string[] _colorStrings = new string[3]; + + public ColorDrawer(string group, string color2) : this(group, color2, String.Empty, String.Empty) { } + + public ColorDrawer(string group, string color2, string color3) : this(group, color2, color3, String.Empty) { } + + public ColorDrawer(string group, string color2, string color3, string color4) + { + this.group = group; + this._colorStrings[0] = color2; + this._colorStrings[1] = color3; + this._colorStrings[2] = color4; + } + + protected override bool IsMatchPropType(MaterialProperty property) { return property.GetPropertyType() == ShaderPropertyType.Color; } + + public override void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) + { + base.BuildStaticMetaData(inShader, inProp, inProps, inoutPropertyStaticData); + foreach (var colorPropName in _colorStrings) + { + inoutPropertyStaticData.AddExtraProperty(colorPropName); + } + } + + public override void DrawProp(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) + { + var cProps = new Stack(); + for (int i = 0; i < 4; i++) + { + if (i == 0) + { + cProps.Push(prop); + continue; + } + + var p = metaDatas.GetProperty(_colorStrings[i - 1]); + if (p != null && IsMatchPropType(p)) + cProps.Push(p); + } + + var count = cProps.Count; + var colorArray = cProps.ToArray(); + + EditorGUI.PrefixLabel(position, label); + + for (int i = 0; i < count; i++) + { + EditorGUI.BeginChangeCheck(); + var cProp = colorArray[i]; + EditorGUI.showMixedValue = cProp.hasMixedValue; + var r = new Rect(position); + var interval = 13 * i * (-0.25f + EditorGUI.indentLevel * 1.25f); + var w = EditorGUIUtility.fieldWidth * (0.8f + EditorGUI.indentLevel * 0.2f); + r.xMin += r.width - w * (i + 1) + interval; + r.xMax -= w * i - interval; + + var src = cProp.colorValue; + var isHdr = (colorArray[i].GetPropertyFlags() & ShaderPropertyFlags.HDR) != ShaderPropertyFlags.None; + var dst = EditorGUI.ColorField(r, GUIContent.none, src, true, true, isHdr); + if (Helper.EndChangeCheck(metaDatas, cProp)) + { + cProp.colorValue = dst; + } + } + + EditorGUI.showMixedValue = false; + } + } +} diff --git a/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs.meta b/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs.meta new file mode 100644 index 0000000..93f43e8 --- /dev/null +++ b/Editor/ShaderDrawers/ExtraDrawers/Vector/ColorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a05aca16f43d8d844840af6e1bb5468a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ShaderDrawers/ShaderDrawerBase.cs b/Editor/ShaderDrawers/ShaderDrawerBase.cs new file mode 100644 index 0000000..0a46ba3 --- /dev/null +++ b/Editor/ShaderDrawers/ShaderDrawerBase.cs @@ -0,0 +1,40 @@ +// Copyright (c) Jason Ma + +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace LWGUI +{ + public interface IBaseDrawer + { + public void BuildStaticMetaData(Shader inShader, MaterialProperty inProp, MaterialProperty[] inProps, PropertyStaticData inoutPropertyStaticData) {} + + public void GetDefaultValueDescription(Shader inShader, MaterialProperty inProp, MaterialProperty inDefaultProp, PerShaderData inPerShaderData, PerMaterialData inoutPerMaterialData) {} + + public void GetCustomContextMenus(GenericMenu menu, Rect rect, MaterialProperty prop, LWGUIMetaDatas metaDatas) {} + } + + public interface IPresetDrawer + { + public string GetPresetFileName(); + + public LwguiShaderPropertyPreset.Preset GetActivePreset(MaterialProperty inProp, LwguiShaderPropertyPreset lwguiShaderPropertyPreset) => + lwguiShaderPropertyPreset?.TryGetPreset(inProp?.floatValue ?? -1); + } + + public partial class PropertyStaticData + { + // Image + public Texture2D image; + + // Button + public List buttonDisplayNames = new(); + public List buttonCommands = new(); + public List buttonDisplayNameWidths = new(); + + // You can add more data that is determined during the initialization of the Drawer as a cache here, + // thereby avoiding the need to calculate it every frame in OnGUI(). + // >>>>>>>>>>>>>>>>>>>>>>>> Add new data here <<<<<<<<<<<<<<<<<<<<<<< + } +} \ No newline at end of file diff --git a/Editor/ShaderDrawers/ShaderDrawerBase.cs.meta b/Editor/ShaderDrawers/ShaderDrawerBase.cs.meta new file mode 100644 index 0000000..003ed54 --- /dev/null +++ b/Editor/ShaderDrawers/ShaderDrawerBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 188168c425384e21a48826d921aedfd5 +timeCreated: 1769324944 \ No newline at end of file diff --git a/Test/LWGUI_RampAtlas.asset b/Test/LWGUI_RampAtlas.asset index ba4db56..dc4fa34 100644 --- a/Test/LWGUI_RampAtlas.asset +++ b/Test/LWGUI_RampAtlas.asset @@ -15,8 +15,12 @@ MonoBehaviour: rampAtlasWidth: 256 rampAtlasHeight: 4 rampAtlasSRGB: 1 + _saveTextureToggle: 0 _ramps: - name: 0 + colorSpace: 1 + channelMask: -1 + timeRange: 1 gradient: _curves: - serializedVersion: 2 @@ -111,10 +115,10 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 + - name: 1 colorSpace: 1 channelMask: -1 timeRange: 1 - - name: 1 gradient: _curves: - serializedVersion: 2 @@ -123,16 +127,16 @@ MonoBehaviour: time: 0 value: 0 inSlope: 0 - outSlope: 0.18938056 + outSlope: 1.8975205 tangentMode: 69 weightedMode: 0 inWeight: 0 outWeight: 0 - serializedVersion: 3 - time: 0.5522972 - value: 0.10459435 - inSlope: 0.18938056 - outSlope: 2 + time: 0.40370455 + value: 0.7660377 + inSlope: 1.8975205 + outSlope: 0.39235967 tangentMode: 69 weightedMode: 0 inWeight: 0.33333334 @@ -140,7 +144,7 @@ MonoBehaviour: - serializedVersion: 3 time: 1 value: 1 - inSlope: 2 + inSlope: 0.39235967 outSlope: 0 tangentMode: 69 weightedMode: 0 @@ -155,16 +159,16 @@ MonoBehaviour: time: 0 value: 0 inSlope: 0 - outSlope: 0.18938056 + outSlope: 0.5978979 tangentMode: 69 weightedMode: 0 inWeight: 0 outWeight: 0 - serializedVersion: 3 - time: 0.5522972 - value: 0.10459435 - inSlope: 0.18938056 - outSlope: 2 + time: 0.40370455 + value: 0.2413741 + inSlope: 0.5978979 + outSlope: 1.2722315 tangentMode: 69 weightedMode: 0 inWeight: 0.33333334 @@ -172,7 +176,7 @@ MonoBehaviour: - serializedVersion: 3 time: 1 value: 1 - inSlope: 2 + inSlope: 1.2722315 outSlope: 0 tangentMode: 69 weightedMode: 0 @@ -187,16 +191,16 @@ MonoBehaviour: time: 0 value: 0 inSlope: 0 - outSlope: 0.18938056 + outSlope: 0.5978979 tangentMode: 69 weightedMode: 0 inWeight: 0 outWeight: 0 - serializedVersion: 3 - time: 0.5522972 - value: 0.10459435 - inSlope: 0.18938056 - outSlope: 2 + time: 0.40370455 + value: 0.2413741 + inSlope: 0.5978979 + outSlope: 1.2722315 tangentMode: 69 weightedMode: 0 inWeight: 0.33333334 @@ -204,7 +208,7 @@ MonoBehaviour: - serializedVersion: 3 time: 1 value: 1 - inSlope: 2 + inSlope: 1.2722315 outSlope: 0 tangentMode: 69 weightedMode: 0 @@ -245,7 +249,3 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - colorSpace: 1 - channelMask: -1 - timeRange: 1 - _saveTextureToggle: 0 diff --git a/Test/LWGUI_RampAtlas.tga b/Test/LWGUI_RampAtlas.tga index b8bb06be8e0989d80fa4abc66dad18392ad5937c..61c7d0840b64bede662c0480370b0149a30a149e 100644 GIT binary patch delta 1040 zcmWN=2T&7M002-kNeD^EP7pByBC_{}LsV3xj4}$8p~xXBDo{olCCZRdMu9_ARaP!x&*O2E))Ntmdp6v%{OFw&qbOiWA;j>XD@3UC}w5mbib@u~`#V%it!YU}lfG@C$it%6~R!J!d ztE`-YQ&#>9r=pS$X5ds+GjVEaS$H+I*LZdHY%m9}p^=N%)XW1vh-+!(gN5SS+C}0z zIwjyg1YO;7u#%vsS4Gg*uOaBO^lJ$Q26aROgLpSXy>atgJdH*4Au_ zjSZV>Ys;qE*>zIw?K`Os4jihZBZunb#GyGmchOv2x@fMh-87b)TQ|+!y_@dg(L=v` zw}0>;2(9d}EsGs5MJ0S7+@qonBrvs9HeuGl} z{)5bbfFbF?z#-Y7pdq>7;9>cYkYR<;&=IAuuo0E;@Da6$h*6Em$Wbj8YfR_avoXD> zs4;`+=y9W%m~oa#Z0xvcT-=0NeEh_v^4I| z>FHeijErf=%*<)0moH~rva)7eU%i@ffAi-1o$T!Io^RjsymE4Q-nqFvpLg$OALixF z`o4cZ`y@Yq&aa?gE}*b*KCq~0KDfAe{`ZoSg|O1ng^02;)?#FN`68>LV)1!pSQI&2mC*?ed>>bt}mqKdz+K*RQ5EG^}QP`m~za*tnMU`SaTAuV2@)o0`^h zzI|KIZEoi0wYKsmd!m6d(&+S90lOnm)Y6b+1c6I+1c6IO;(a5Ns=TuKP9o8qsA+0V4Ama-Pvc&onO53p zr-M$q=%$BW`sinXQH*AYF^pv#;I&Vb-vgb*yIt8`;EWwy>3LY-a~M+07pIvXA{7;2?)M%n^=qjN_c(B&Rsd z8P0N!^IYH}m$=Lou5yj*+~6j+xXm5za*z8w;31EA%oCpSjOV=IC9inR8{YDc_k7?Z zpZLrdzVeOl{NN|Q2)Dke4%KK1`VrMqhYGa>Jqk-EldbX(RZ9ka3rnR^Z8Cy7rm6|5 zS(8qu+hqi`O;_Vnk;!B_s`05%?Mx^^)&I(7vz^uWRG2_E6u(_vxm+$B&k9q?g%V7s zJD<;oDC;QZywKj;6m{F4s%h)T0>~ g931>__P>ip-v94de1Z4^@de@w#21J!&~O*{1NSQpEC2ui diff --git a/Test/LWGUI_RampAtlas.tga.meta b/Test/LWGUI_RampAtlas.tga.meta index 46655a3..097e5c2 100644 --- a/Test/LWGUI_RampAtlas.tga.meta +++ b/Test/LWGUI_RampAtlas.tga.meta @@ -122,6 +122,6 @@ TextureImporter: nameFileIdTable: {} mipmapLimitGroupName: pSDRemoveMatte: 0 - userData: '{"MonoBehaviour":{"m_Enabled":true,"m_EditorHideFlags":0,"m_Name":"LWGUI_RampAtlas","m_EditorClassIdentifier":"","rampAtlasWidth":256,"rampAtlasHeight":4,"rampAtlasSRGB":true,"_saveTextureToggle":false,"_ramps":[{"name":"0","gradient":{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]},"colorSpace":1,"channelMask":-1,"timeRange":1},{"name":"1","gradient":{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.18938055634498597,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.5522971749305725,"value":0.10459434986114502,"inSlope":0.18938055634498597,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.18938055634498597,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.5522971749305725,"value":0.10459434986114502,"inSlope":0.18938055634498597,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.18938055634498597,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.5522971749305725,"value":0.10459434986114502,"inSlope":0.18938055634498597,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.1829485297203064,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.5503421425819397,"value":0.1006842851638794,"inSlope":0.1829485297203064,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]},"colorSpace":1,"channelMask":-1,"timeRange":1}]}}' + userData: '{"MonoBehaviour":{"m_Enabled":true,"m_EditorHideFlags":0,"m_Name":"LWGUI_RampAtlas","m_EditorClassIdentifier":"","rampAtlasWidth":256,"rampAtlasHeight":4,"rampAtlasSRGB":true,"_saveTextureToggle":false,"_ramps":[{"name":"0","colorSpace":1,"channelMask":-1,"timeRange":1,"gradient":{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.5,"value":0.0,"inSlope":0.0,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}},{"name":"1","colorSpace":1,"channelMask":-1,"timeRange":1,"gradient":{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":1.8975205421447755,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.40370455384254458,"value":0.7660377025604248,"inSlope":1.8975205421447755,"outSlope":0.3923596739768982,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":0.3923596739768982,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.5978978872299194,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.40370455384254458,"value":0.24137410521507264,"inSlope":0.5978978872299194,"outSlope":1.2722314596176148,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":1.2722314596176148,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.5978978872299194,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.40370455384254458,"value":0.24137410521507264,"inSlope":0.5978978872299194,"outSlope":1.2722314596176148,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":1.2722314596176148,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.0,"value":0.0,"inSlope":0.0,"outSlope":0.1829485297203064,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0},{"serializedVersion":"3","time":0.5503421425819397,"value":0.1006842851638794,"inSlope":0.1829485297203064,"outSlope":2.0,"tangentMode":69,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":1.0,"value":1.0,"inSlope":2.0,"outSlope":0.0,"tangentMode":69,"weightedMode":0,"inWeight":0.0,"outWeight":0.0}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}}]}}' assetBundleName: assetBundleVariant: diff --git a/Test/RampMap_sRGB.png b/Test/RampMap_sRGB.png index 026b5a963282cf729266e8a651c61de7dbae2dea..b522060aae4f92e4248fa1ead74ac2bb70c1f605 100644 GIT binary patch delta 288 zcmV+*0pI?(0=fc_BYyz_Nkl3{T<9q4UZ>&i$f+d`Iy zMO&_u{;`ZWQUwKh`&wcE=p2tqjIhA7EX1Ql>h($ diff --git a/Test/RampMap_sRGB.png.meta b/Test/RampMap_sRGB.png.meta index 9e8f6d7..b02ee70 100644 --- a/Test/RampMap_sRGB.png.meta +++ b/Test/RampMap_sRGB.png.meta @@ -3,7 +3,7 @@ guid: fad186cbfd0faf2488e2edb774c6d08f TextureImporter: internalIDToNameTable: [] externalObjects: {} - serializedVersion: 12 + serializedVersion: 13 mipmaps: mipMapMode: 0 enableMipMap: 0 @@ -122,6 +122,6 @@ TextureImporter: nameFileIdTable: {} mipmapLimitGroupName: pSDRemoveMatte: 0 - userData: '{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.9137465953826904,"inSlope":-1.1610162258148194,"outSlope":-1.1610162258148194,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.4040227234363556,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.711692214012146,"inSlope":1.9705389738082886,"outSlope":1.9705389738082886,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.740675151348114,"inSlope":-0.3736116290092468,"outSlope":-0.3736116290092468,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7129190564155579,"inSlope":-0.38241732120513918,"outSlope":-0.38241732120513918,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.46618008613586428,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.24506132304668427,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7358490228652954,"inSlope":1.559748649597168,"outSlope":1.559748649597168,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.849056601524353,"inSlope":0.8733886480331421,"outSlope":0.8733886480331421,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.20000000298023225,"value":0.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3499511182308197,"value":0.13333334028720857,"inSlope":1.2060123682022095,"outSlope":1.2060123682022095,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}#{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.9137465953826904,"inSlope":-1.1610162258148194,"outSlope":-1.1610162258148194,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.4040227234363556,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.711692214012146,"inSlope":1.9705389738082886,"outSlope":1.9705389738082886,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.740675151348114,"inSlope":-0.3736116290092468,"outSlope":-0.3736116290092468,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7129190564155579,"inSlope":-0.38241732120513918,"outSlope":-0.38241732120513918,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.46618008613586428,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3519061505794525,"value":0.24506132304668427,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7358490228652954,"inSlope":1.559748649597168,"outSlope":1.559748649597168,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.849056601524353,"inSlope":0.8733886480331421,"outSlope":0.8733886480331421,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.20000000298023225,"value":0.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3499511182308197,"value":0.13333334028720857,"inSlope":1.2060123682022095,"outSlope":1.2060123682022095,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}' + userData: '{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.9137465953826904,"inSlope":-1.1610162258148194,"outSlope":-1.1610162258148194,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.4040227234363556,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.711692214012146,"inSlope":1.9705389738082886,"outSlope":1.9705389738082886,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.740675151348114,"inSlope":-0.3736116290092468,"outSlope":-0.3736116290092468,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7129190564155579,"inSlope":-0.36756616830825808,"outSlope":-0.36756616830825808,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.46618008613586428,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.24506132304668427,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7358490228652954,"inSlope":1.499176025390625,"outSlope":1.499176025390625,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.849056601524353,"inSlope":0.8733886480331421,"outSlope":0.8733886480331421,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.20000000298023225,"value":0.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3499511182308197,"value":0.13333334028720857,"inSlope":1.2060123682022095,"outSlope":1.2060123682022095,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}#{"_curves":[{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.9137465953826904,"inSlope":-1.1610162258148194,"outSlope":-1.1610162258148194,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.4040227234363556,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.711692214012146,"inSlope":1.9705389738082886,"outSlope":1.9705389738082886,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.740675151348114,"inSlope":-0.3736116290092468,"outSlope":-0.3736116290092468,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7129190564155579,"inSlope":-0.36756616830825808,"outSlope":-0.36756616830825808,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.46618008613586428,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.2003910094499588,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.34017595648765566,"value":0.24506132304668427,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.497556209564209,"value":0.7358490228652954,"inSlope":1.499176025390625,"outSlope":1.499176025390625,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":0.849056601524353,"inSlope":0.8733886480331421,"outSlope":0.8733886480331421,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4},{"serializedVersion":"2","m_Curve":[{"serializedVersion":"3","time":0.20000000298023225,"value":0.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.3499511182308197,"value":0.13333334028720857,"inSlope":1.2060123682022095,"outSlope":1.2060123682022095,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.6422287225723267,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408},{"serializedVersion":"3","time":0.800000011920929,"value":1.0,"inSlope":0.0,"outSlope":0.0,"tangentMode":136,"weightedMode":0,"inWeight":0.3333333432674408,"outWeight":0.3333333432674408}],"m_PreInfinity":2,"m_PostInfinity":2,"m_RotationOrder":4}]}' assetBundleName: assetBundleVariant: