From d2c1407c65c870447720f25cef308adacbcecbe4 Mon Sep 17 00:00:00 2001 From: Sascha Date: Wed, 8 Jul 2026 15:36:23 -0400 Subject: [PATCH] First commit --- .obsidian/community-plugins.json | 3 + .obsidian/graph.json | 22 + .obsidian/plugins/obsidian-git/data.json | 67 ++ .obsidian/plugins/obsidian-git/main.js | 415 +++++++++++ .obsidian/plugins/obsidian-git/manifest.json | 10 + .obsidian/plugins/obsidian-git/styles.css | 705 +++++++++++++++++++ .obsidian/workspace.json | 49 +- Arc 1 - Heirs of Sundering.md | 85 +++ Arc 2 - The Gilded War.md | 97 +++ Arc 3 - Heart of the Mountain.md | 114 +++ Arc 4 - Tide of Ruin.md | 130 ++++ Arcs/Arc 1/Overview.md | 45 ++ Arcs/Arc 2/Overview.md | 45 ++ Arcs/Arc 3/Overview.md | 45 ++ Arcs/Arc 4/Overview.md | 45 ++ Campaign Overview.md | 60 ++ Factions/Crown Concordat.md | 46 ++ Factions/Dragon Lords.md | 48 ++ Factions/Pirate Lords of the Salt Reach.md | 14 + Factions/The Hand of Ruin.md | 54 ++ Factions/The Iron Concord.md | 44 ++ Factions/The Silent College.md | 29 + Factions/The Verdant Circle.md | 47 ++ History/War of the Five Thrones.md | 14 + Items/Cloak of the Mountebank.md | 21 + Items/Crown of the Sundered.md | 22 + Items/Cult Cipher.md | 21 + Items/Dragonfang Vault.md | 14 + Items/Emberheart.md | 34 + Items/Favor of the Verdant Wing.md | 15 + Items/Primordial Heart Shard.md | 26 + Items/Ring of the Verdant Eye.md | 25 + Items/Scale of the Dragonsworn.md | 21 + Items/Seal-Warden's Blessing.md | 15 + Items/Sunder.md | 21 + Items/Tideheart Pearl.md | 25 + Items/Verdant Wing Token.md | 20 + Locations/Ashpeak Caldera.md | 39 + Locations/Ashveil Caldera.md | 37 + Locations/Boralis.md | 16 + Locations/Citadel of Sundering.md | 78 ++ Locations/Crucible of Ash.md | 63 ++ Locations/Eastmarch.md | 53 ++ Locations/Freehold.md | 44 ++ Locations/Gate of Stone.md | 12 + Locations/Heart of the Mountain.md | 36 + Locations/Ironheart Mine.md | 88 +++ Locations/Keth's Landing.md | 26 + Locations/Kethra.md | 36 + Locations/Old Salt Road.md | 36 + Locations/Seal Anchor.md | 53 ++ Locations/Silverwood.md | 16 + Locations/Spire of Silence.md | 41 ++ Locations/Sunken Spire.md | 59 ++ Locations/The Sinking Chapel.md | 53 ++ Locations/Thornwall.md | 16 + Locations/Thronewood.md | 34 + Locations/Valdris.md | 37 + Locations/Valhold.md | 53 ++ Locations/World Council.md | 14 + Maps/Eastmarch (Grid).md | 10 + Maps/Eastmarch Map (Regional).md | 10 + Maps/Freehold Map (Regional).md | 10 + Maps/Ironheart Mine (Grid).md | 10 + Maps/Keth's Landing Map (Regional).md | 10 + Maps/Sunken Spire (Grid).md | 10 + Maps/The Sinking Chapel (Grid).md | 10 + Maps/Thronewood Map (Regional).md | 10 + Maps/Valhold Map (Regional).md | 10 + NPCs/Ambassador Kael Vess.md | 54 ++ NPCs/Archdruid Thalindor.md | 45 ++ NPCs/Aurathrax, the Stormbreaker.md | 26 + NPCs/Captain Vara Holt.md | 59 ++ NPCs/Duke Edric Blackthorn.md | 41 ++ NPCs/Elder Ylara Moongrove.md | 40 ++ NPCs/General Markus Crane.md | 60 ++ NPCs/High Pontiff Vosseth.md | 47 ++ NPCs/Ignivar, the Betrayer.md | 54 ++ NPCs/Keeper Malachar.md | 56 ++ NPCs/Keeper Valdrek.md | 56 ++ NPCs/Khalyraxis, the Verdant Wing.md | 44 ++ NPCs/Librarian Thessa.md | 60 ++ NPCs/Lythrendor, the Crystal Seer.md | 50 ++ NPCs/Marshal Aldren Voss.md | 51 ++ NPCs/Mira Thorne.md | 50 ++ NPCs/Mistress Veyla.md | 58 ++ NPCs/Morgra, the Ashen Matron.md | 54 ++ NPCs/Primordial Wrath.md | 83 +++ NPCs/Queen Selara IV.md | 40 ++ NPCs/Scorchmaw.md | 33 + NPCs/Silvos, the Shifting Wind.md | 25 + NPCs/Stonewarden.md | 30 + NPCs/Vornak, the Deep-Root.md | 26 + Quests/Bandits & Wilderness Encounters.md | 58 ++ Rules/Pact of Seven Flames.md | 21 + Templates/Faction Template.md | 27 + Templates/Item Template.md | 17 + Templates/Location Template.md | 29 + Templates/NPC Template.md | 24 + Templates/Quest Template.md | 36 + Templates/Session Template.md | 33 + logseq/config.edn | 421 ----------- logseq/custom.css | 0 pages/Campaign Overview.md | 12 - pages/Campaign Timeline.md | 8 - pages/Encounters and Dungeons.md | 6 - pages/Factions.md | 6 - pages/Key NPCs.md | 6 - pages/Level 5-20 Progression.md | 31 - pages/Major Locations.md | 7 - pages/Session Zero.md | 6 - pages/Treasure and Rewards.md | 5 - pages/World of Ash and Cinders.md | 7 - pages/contents.md | 10 - 114 files changed, 4922 insertions(+), 533 deletions(-) create mode 100644 .obsidian/community-plugins.json create mode 100644 .obsidian/graph.json create mode 100644 .obsidian/plugins/obsidian-git/data.json create mode 100644 .obsidian/plugins/obsidian-git/main.js create mode 100644 .obsidian/plugins/obsidian-git/manifest.json create mode 100644 .obsidian/plugins/obsidian-git/styles.css create mode 100644 Arc 1 - Heirs of Sundering.md create mode 100644 Arc 2 - The Gilded War.md create mode 100644 Arc 3 - Heart of the Mountain.md create mode 100644 Arc 4 - Tide of Ruin.md create mode 100644 Arcs/Arc 1/Overview.md create mode 100644 Arcs/Arc 2/Overview.md create mode 100644 Arcs/Arc 3/Overview.md create mode 100644 Arcs/Arc 4/Overview.md create mode 100644 Campaign Overview.md create mode 100644 Factions/Crown Concordat.md create mode 100644 Factions/Dragon Lords.md create mode 100644 Factions/Pirate Lords of the Salt Reach.md create mode 100644 Factions/The Hand of Ruin.md create mode 100644 Factions/The Iron Concord.md create mode 100644 Factions/The Silent College.md create mode 100644 Factions/The Verdant Circle.md create mode 100644 History/War of the Five Thrones.md create mode 100644 Items/Cloak of the Mountebank.md create mode 100644 Items/Crown of the Sundered.md create mode 100644 Items/Cult Cipher.md create mode 100644 Items/Dragonfang Vault.md create mode 100644 Items/Emberheart.md create mode 100644 Items/Favor of the Verdant Wing.md create mode 100644 Items/Primordial Heart Shard.md create mode 100644 Items/Ring of the Verdant Eye.md create mode 100644 Items/Scale of the Dragonsworn.md create mode 100644 Items/Seal-Warden's Blessing.md create mode 100644 Items/Sunder.md create mode 100644 Items/Tideheart Pearl.md create mode 100644 Items/Verdant Wing Token.md create mode 100644 Locations/Ashpeak Caldera.md create mode 100644 Locations/Ashveil Caldera.md create mode 100644 Locations/Boralis.md create mode 100644 Locations/Citadel of Sundering.md create mode 100644 Locations/Crucible of Ash.md create mode 100644 Locations/Eastmarch.md create mode 100644 Locations/Freehold.md create mode 100644 Locations/Gate of Stone.md create mode 100644 Locations/Heart of the Mountain.md create mode 100644 Locations/Ironheart Mine.md create mode 100644 Locations/Keth's Landing.md create mode 100644 Locations/Kethra.md create mode 100644 Locations/Old Salt Road.md create mode 100644 Locations/Seal Anchor.md create mode 100644 Locations/Silverwood.md create mode 100644 Locations/Spire of Silence.md create mode 100644 Locations/Sunken Spire.md create mode 100644 Locations/The Sinking Chapel.md create mode 100644 Locations/Thornwall.md create mode 100644 Locations/Thronewood.md create mode 100644 Locations/Valdris.md create mode 100644 Locations/Valhold.md create mode 100644 Locations/World Council.md create mode 100644 Maps/Eastmarch (Grid).md create mode 100644 Maps/Eastmarch Map (Regional).md create mode 100644 Maps/Freehold Map (Regional).md create mode 100644 Maps/Ironheart Mine (Grid).md create mode 100644 Maps/Keth's Landing Map (Regional).md create mode 100644 Maps/Sunken Spire (Grid).md create mode 100644 Maps/The Sinking Chapel (Grid).md create mode 100644 Maps/Thronewood Map (Regional).md create mode 100644 Maps/Valhold Map (Regional).md create mode 100644 NPCs/Ambassador Kael Vess.md create mode 100644 NPCs/Archdruid Thalindor.md create mode 100644 NPCs/Aurathrax, the Stormbreaker.md create mode 100644 NPCs/Captain Vara Holt.md create mode 100644 NPCs/Duke Edric Blackthorn.md create mode 100644 NPCs/Elder Ylara Moongrove.md create mode 100644 NPCs/General Markus Crane.md create mode 100644 NPCs/High Pontiff Vosseth.md create mode 100644 NPCs/Ignivar, the Betrayer.md create mode 100644 NPCs/Keeper Malachar.md create mode 100644 NPCs/Keeper Valdrek.md create mode 100644 NPCs/Khalyraxis, the Verdant Wing.md create mode 100644 NPCs/Librarian Thessa.md create mode 100644 NPCs/Lythrendor, the Crystal Seer.md create mode 100644 NPCs/Marshal Aldren Voss.md create mode 100644 NPCs/Mira Thorne.md create mode 100644 NPCs/Mistress Veyla.md create mode 100644 NPCs/Morgra, the Ashen Matron.md create mode 100644 NPCs/Primordial Wrath.md create mode 100644 NPCs/Queen Selara IV.md create mode 100644 NPCs/Scorchmaw.md create mode 100644 NPCs/Silvos, the Shifting Wind.md create mode 100644 NPCs/Stonewarden.md create mode 100644 NPCs/Vornak, the Deep-Root.md create mode 100644 Quests/Bandits & Wilderness Encounters.md create mode 100644 Rules/Pact of Seven Flames.md create mode 100644 Templates/Faction Template.md create mode 100644 Templates/Item Template.md create mode 100644 Templates/Location Template.md create mode 100644 Templates/NPC Template.md create mode 100644 Templates/Quest Template.md create mode 100644 Templates/Session Template.md delete mode 100644 logseq/config.edn delete mode 100644 logseq/custom.css delete mode 100644 pages/Campaign Overview.md delete mode 100644 pages/Campaign Timeline.md delete mode 100644 pages/Encounters and Dungeons.md delete mode 100644 pages/Factions.md delete mode 100644 pages/Key NPCs.md delete mode 100644 pages/Level 5-20 Progression.md delete mode 100644 pages/Major Locations.md delete mode 100644 pages/Session Zero.md delete mode 100644 pages/Treasure and Rewards.md delete mode 100644 pages/World of Ash and Cinders.md delete mode 100644 pages/contents.md diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json new file mode 100644 index 0000000..d3f66fa --- /dev/null +++ b/.obsidian/community-plugins.json @@ -0,0 +1,3 @@ +[ + "obsidian-git" +] \ No newline at end of file diff --git a/.obsidian/graph.json b/.obsidian/graph.json new file mode 100644 index 0000000..0c2fb44 --- /dev/null +++ b/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 0.6666666666666666, + "close": false +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/data.json b/.obsidian/plugins/obsidian-git/data.json new file mode 100644 index 0000000..d2fc3ee --- /dev/null +++ b/.obsidian/plugins/obsidian-git/data.json @@ -0,0 +1,67 @@ +{ + "commitMessage": "vault backup: {{date}}", + "autoCommitMessage": "vault backup: {{date}}", + "commitMessageScript": "", + "commitDateFormat": "YYYY-MM-DD HH:mm:ss", + "autoSaveInterval": 0, + "autoPushInterval": 0, + "autoPullInterval": 0, + "autoPullOnBoot": true, + "autoCommitOnlyStaged": false, + "disablePush": false, + "pullBeforePush": true, + "disablePopups": false, + "showErrorNotices": true, + "disablePopupsForNoChanges": false, + "listChangedFilesInMessageBody": false, + "showStatusBar": true, + "updateSubmodules": false, + "syncMethod": "merge", + "mergeStrategy": "none", + "customMessageOnAutoBackup": false, + "autoBackupAfterFileChange": false, + "treeStructure": false, + "refreshSourceControl": true, + "basePath": "", + "differentIntervalCommitAndPush": false, + "changedFilesInStatusBar": false, + "showedMobileNotice": true, + "refreshSourceControlTimer": 7000, + "showBranchStatusBar": true, + "setLastSaveToLastCommit": false, + "submoduleRecurseCheckout": false, + "gitDir": "", + "showFileMenu": true, + "authorInHistoryView": "hide", + "dateInHistoryView": false, + "diffStyle": "split", + "hunks": { + "showSigns": false, + "hunkCommands": false, + "statusBar": "disabled" + }, + "lineAuthor": { + "show": false, + "followMovement": "inactive", + "authorDisplay": "initials", + "showCommitHash": false, + "dateTimeFormatOptions": "date", + "dateTimeFormatCustomString": "YYYY-MM-DD HH:mm", + "dateTimeTimezone": "viewer-local", + "coloringMaxAge": "1y", + "colorNew": { + "r": 255, + "g": 150, + "b": 150 + }, + "colorOld": { + "r": 120, + "g": 160, + "b": 255 + }, + "textColorCss": "var(--text-muted)", + "ignoreWhitespace": false, + "lastShownAuthorDisplay": "initials", + "lastShownDateTimeFormatOptions": "date" + } +} \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js new file mode 100644 index 0000000..3efd1dd --- /dev/null +++ b/.obsidian/plugins/obsidian-git/main.js @@ -0,0 +1,415 @@ +/* +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 TF=Object.create;var vc=Object.defineProperty;var PF=Object.getOwnPropertyDescriptor;var RF=Object.getOwnPropertyNames;var $F=Object.getPrototypeOf,FF=Object.prototype.hasOwnProperty;var yb=t=>{throw TypeError(t)};var IF=(t,e,r)=>e in t?vc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var MF=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var U=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},DF=(t,e)=>{for(var r in e)vc(t,r,{get:e[r],enumerable:!0})},xb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of RF(e))!FF.call(t,n)&&n!==r&&vc(t,n,{get:()=>e[n],enumerable:!(i=PF(e,n))||i.enumerable});return t};var Gt=(t,e,r)=>(r=t!=null?TF($F(t)):{},xb(e||!t||!t.__esModule?vc(r,"default",{value:t,enumerable:!0}):r,t)),OF=t=>xb(vc({},"__esModule",{value:!0}),t);var He=(t,e,r)=>IF(t,typeof e!="symbol"?e+"":e,r),Yp=(t,e,r)=>e.has(t)||yb("Cannot "+r);var F=(t,e,r)=>(Yp(t,e,"read from private field"),r?r.call(t):e.get(t)),ge=(t,e,r)=>e.has(t)?yb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),pe=(t,e,r,i)=>(Yp(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Ae=(t,e,r)=>(Yp(t,e,"access private method"),r);var kb=U(Cf=>{"use strict";m();Cf.byteLength=NF;Cf.toByteArray=HF;Cf.fromByteArray=jF;var on=[],pi=[],LF=typeof Uint8Array!="undefined"?Uint8Array:Array,Zp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ia=0,Eb=Zp.length;ia0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function NF(t){var e=Sb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function BF(t,e,r){return(e+r)*3/4-r}function HF(t){var e,r=Sb(t),i=r[0],n=r[1],s=new LF(BF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=pi[t.charCodeAt(l)]<<2|pi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=pi[t.charCodeAt(l)]<<10|pi[t.charCodeAt(l+1)]<<4|pi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function UF(t){return on[t>>18&63]+on[t>>12&63]+on[t>>6&63]+on[t&63]}function GF(t,e,r){for(var i,n=[],s=e;so?o:a+s));return i===1?(e=t[r-1],n.push(on[e>>2]+on[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(on[e>>10]+on[e>>4&63]+on[e<<2&63]+"=")),n.join("")}});var Ab=U(Kp=>{m();Kp.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};Kp.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var sm=U(So=>{"use strict";m();var Xp=kb(),xo=Ab(),Cb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=O;So.SlowBuffer=ZF;So.INSPECT_MAX_BYTES=50;var Tf=2147483647;So.kMaxLength=Tf;O.TYPED_ARRAY_SUPPORT=VF();!O.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function VF(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}});Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}});function Bn(t){if(t>Tf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return tm(t)}return $b(t,e,r)}O.poolSize=8192;function $b(t,e,r){if(typeof t=="string")return WF(t,e);if(ArrayBuffer.isView(t))return qF(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 Jp(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return O.from(i,e,r);let n=YF(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return O.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)}O.from=function(t,e,r){return $b(t,e,r)};Object.setPrototypeOf(O.prototype,Uint8Array.prototype);Object.setPrototypeOf(O,Uint8Array);function Fb(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 zF(t,e,r){return Fb(t),t<=0?Bn(t):e!==void 0?typeof r=="string"?Bn(t).fill(e,r):Bn(t).fill(e):Bn(t)}O.alloc=function(t,e,r){return zF(t,e,r)};function tm(t){return Fb(t),Bn(t<0?0:rm(t)|0)}O.allocUnsafe=function(t){return tm(t)};O.allocUnsafeSlow=function(t){return tm(t)};function WF(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!O.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Ib(t,e)|0,i=Bn(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Qp(t){let e=t.length<0?0:rm(t.length)|0,r=Bn(e);for(let i=0;i=Tf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Tf.toString(16)+" bytes");return t|0}function ZF(t){return+t!=t&&(t=0),O.alloc(+t)}O.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==O.prototype};O.compare=function(e,r){if(ln(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),ln(r,Uint8Array)&&(r=O.from(r,r.offset,r.byteLength)),!O.isBuffer(e)||!O.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,a=Math.min(i,n);sn.length?(O.isBuffer(a)||(a=O.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(O.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n};function Ib(t,e){if(O.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,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return em(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Gb(t).length;default:if(n)return i?-1:em(t).length;e=(""+e).toLowerCase(),n=!0}}O.byteLength=Ib;function KF(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return aI(this,e,r);case"utf8":case"utf-8":return Db(this,e,r);case"ascii":return nI(this,e,r);case"latin1":case"binary":return sI(this,e,r);case"base64":return rI(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oI(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}O.prototype._isBuffer=!0;function na(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}O.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+=" ... "),""};Cb&&(O.prototype[Cb]=O.prototype.inspect);O.prototype.compare=function(e,r,i,n,s){if(ln(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),!O.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,o=i-r,l=Math.min(a,o),c=this.slice(n,s),u=e.slice(r,i);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nm(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=O.from(e,i)),O.isBuffer(e))return e.length===0?-1:Tb(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Tb(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Tb(t,e,r,i,n){let s=1,a=t.length,o=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(n){let u=-1;for(c=r;ca&&(r=a-o),c=r;c>=0;c--){let u=!0;for(let f=0;fn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let a;for(a=0;a>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return XF(this,e,r,i);case"utf8":case"utf-8":return QF(this,e,r,i);case"ascii":case"latin1":case"binary":return JF(this,e,r,i);case"base64":return eI(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return tI(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rI(t,e,r){return e===0&&r===t.length?Xp.fromByteArray(t):Xp.fromByteArray(t.slice(e,r))}function Db(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+o<=r){let l,c,u,f;switch(o){case 1:s<128&&(a=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(a=f));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:l=t[n+1],c=t[n+2],u=t[n+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=o}return iI(i)}var Pb=4096;function iI(t){let e=t.length;if(e<=Pb)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii)&&(r=i);let n="";for(let s=e;si&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),rr)throw new RangeError("Trying to access beyond buffer length")}O.prototype.readUintLE=O.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};O.prototype.readUint8=O.prototype.readUInt8=function(e,r){return e=e>>>0,r||jt(e,1,this.length),this[e]};O.prototype.readUint16LE=O.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||jt(e,2,this.length),this[e]|this[e+1]<<8};O.prototype.readUint16BE=O.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||jt(e,2,this.length),this[e]<<8|this[e+1]};O.prototype.readUint32LE=O.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};O.prototype.readUint32BE=O.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};O.prototype.readBigUInt64LE=vs(function(e){e=e>>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<>>0,r=r>>>0,i||jt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a=s&&(n-=Math.pow(2,8*r)),n};O.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||jt(e,r,this.length);let n=r,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};O.prototype.readInt8=function(e,r){return e=e>>>0,r||jt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};O.prototype.readInt16LE=function(e,r){e=e>>>0,r||jt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};O.prototype.readInt16BE=function(e,r){e=e>>>0,r||jt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};O.prototype.readInt32LE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};O.prototype.readInt32BE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};O.prototype.readBigInt64LE=vs(function(e){e=e>>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Eo(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&wc(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,r||jt(e,4,this.length),xo.read(this,e,!0,23,4)};O.prototype.readFloatBE=function(e,r){return e=e>>>0,r||jt(e,4,this.length),xo.read(this,e,!1,23,4)};O.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||jt(e,8,this.length),xo.read(this,e,!0,52,8)};O.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||jt(e,8,this.length),xo.read(this,e,!1,52,8)};function $r(t,e,r,i,n,s){if(!O.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}O.prototype.writeUintLE=O.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;$r(this,e,r,i,o,0)}let s=1,a=0;for(this[r]=e&255;++a>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;$r(this,e,r,i,o,0)}let s=i-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+i};O.prototype.writeUint8=O.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,1,255,0),this[r]=e&255,r+1};O.prototype.writeUint16LE=O.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};O.prototype.writeUint16BE=O.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};O.prototype.writeUint32LE=O.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(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};O.prototype.writeUint32BE=O.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(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 Ob(t,e,r,i,n){Ub(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function Lb(t,e,r,i,n){Ub(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}O.prototype.writeBigUInt64LE=vs(function(e,r=0){return Ob(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeBigUInt64BE=vs(function(e,r=0){return Lb(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});O.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);$r(this,e,r,i,l-1,-l)}let s=0,a=1,o=0;for(this[r]=e&255;++s>0)-o&255;return r+i};O.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);$r(this,e,r,i,l-1,-l)}let s=i-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+i};O.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};O.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};O.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};O.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||$r(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};O.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||$r(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};O.prototype.writeBigInt64LE=vs(function(e,r=0){return Ob(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});O.prototype.writeBigInt64BE=vs(function(e,r=0){return Lb(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nb(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Bb(t,e,r,i,n){return e=+e,r=r>>>0,n||Nb(t,e,r,4,34028234663852886e22,-34028234663852886e22),xo.write(t,e,r,i,23,4),r+4}O.prototype.writeFloatLE=function(e,r,i){return Bb(this,e,r,!0,i)};O.prototype.writeFloatBE=function(e,r,i){return Bb(this,e,r,!1,i)};function Hb(t,e,r,i,n){return e=+e,r=r>>>0,n||Nb(t,e,r,8,17976931348623157e292,-17976931348623157e292),xo.write(t,e,r,i,52,8),r+8}O.prototype.writeDoubleLE=function(e,r,i){return Hb(this,e,r,!0,i)};O.prototype.writeDoubleBE=function(e,r,i){return Hb(this,e,r,!1,i)};O.prototype.copy=function(e,r,i,n){if(!O.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?n=Rb(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Rb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Rb(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function lI(t,e,r){Eo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&wc(e,t.length-(r+1))}function Ub(t,e,r,i,n,s){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new yo.ERR_OUT_OF_RANGE("value",o,t)}lI(i,n,s)}function Eo(t,e){if(typeof t!="number")throw new yo.ERR_INVALID_ARG_TYPE(e,"number",t)}function wc(t,e,r){throw Math.floor(t)!==t?(Eo(t,r),new yo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new yo.ERR_BUFFER_OUT_OF_BOUNDS:new yo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var cI=/[^+/0-9A-Za-z-_]/g;function uI(t){if(t=t.split("=")[0],t=t.trim().replace(cI,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function em(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function fI(t){let e=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(i);return s}function Gb(t){return Xp.toByteArray(uI(t))}function Pf(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function ln(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function nm(t){return t!==t}var hI=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function vs(t){return typeof BigInt=="undefined"?pI:t}function pI(){throw new Error("BigInt not supported")}});var jb,am,E,m=MF(()=>{jb=require("obsidian");jb.Platform.isMobileApp?am=sm().Buffer:am=global.Buffer;E=am});var zb=U((SG,Vb)=>{"use strict";m();var Yr=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process=="undefined"||typeof process.domain=="undefined")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||Yr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||Yr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||Yr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=Yr.DEFAULT_MAX_PENDING};Yr.DEFAULT_TIMEOUT=0;Yr.DEFAULT_MAX_OCCUPATION_TIME=0;Yr.DEFAULT_MAX_EXECUTION_TIME=0;Yr.DEFAULT_MAX_PENDING=1e3;Yr.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(b,S){n=b,s=S})),i=i||{};var o=!1,l=null,c=null,u=null,f=this,d=function(b,S,C){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(a?S?s(S):n(C):typeof r=="function"&&r(S,C),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 S=i.maxExecutionTime||f.maxExecutionTime;if(S&&(u=setTimeout(function(){f.queues[t]&&d(b,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var C=!1;try{e(function(A,k){C||(C=!0,d(b,A,k))})}catch(A){C||(C=!0,d(b,A))}}else f._promiseTry(function(){return e()}).then(function(A){d(b,void 0,A)},function(A){d(b,A)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=i.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])h(!1);else if(f.queues[t].length>=p)d(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){h(!0)};i.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var w=i.timeout||f.timeout;w&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},w))}var y=i.maxOccupationTime||f.maxOccupationTime;if(y&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},y)),a)return a};Yr.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=function(o,l){return function(c){n.acquire(o,l,c,i)}},a=t.reduceRight(function(o,l){return s(l,o)},e);if(typeof r=="function")a(r);else return new this.Promise(function(o,l){a.length===1?a(function(c,u){c?l(c):o(u)}):o(a())})};Yr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};Yr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};Vb.exports=Yr});var qb=U((AG,Wb)=>{"use strict";m();Wb.exports=zb()});var Yb=U((TG,om)=>{m();typeof Object.create=="function"?om.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:om.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var $f=U((lm,Kb)=>{m();var Rf=sm(),cn=Rf.Buffer;function Zb(t,e){for(var r in t)e[r]=t[r]}cn.from&&cn.alloc&&cn.allocUnsafe&&cn.allocUnsafeSlow?Kb.exports=Rf:(Zb(Rf,lm),lm.Buffer=sa);function sa(t,e,r){return cn(t,e,r)}sa.prototype=Object.create(cn.prototype);Zb(cn,sa);sa.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return cn(t,e,r)};sa.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=cn(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};sa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return cn(t)};sa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Rf.SlowBuffer(t)}});var Qb=U(($G,Xb)=>{m();var mI={}.toString;Xb.exports=Array.isArray||function(t){return mI.call(t)=="[object Array]"}});var ko=U((IG,Jb)=>{"use strict";m();Jb.exports=TypeError});var cm=U((DG,e_)=>{"use strict";m();e_.exports=Object});var r_=U((LG,t_)=>{"use strict";m();t_.exports=Error});var n_=U((BG,i_)=>{"use strict";m();i_.exports=EvalError});var a_=U((UG,s_)=>{"use strict";m();s_.exports=RangeError});var l_=U((jG,o_)=>{"use strict";m();o_.exports=ReferenceError});var um=U((zG,c_)=>{"use strict";m();c_.exports=SyntaxError});var f_=U((qG,u_)=>{"use strict";m();u_.exports=URIError});var h_=U((ZG,d_)=>{"use strict";m();d_.exports=Math.abs});var m_=U((XG,p_)=>{"use strict";m();p_.exports=Math.floor});var v_=U((JG,g_)=>{"use strict";m();g_.exports=Math.max});var b_=U((tj,w_)=>{"use strict";m();w_.exports=Math.min});var y_=U((ij,__)=>{"use strict";m();__.exports=Math.pow});var E_=U((sj,x_)=>{"use strict";m();x_.exports=Math.round});var k_=U((oj,S_)=>{"use strict";m();S_.exports=Number.isNaN||function(e){return e!==e}});var C_=U((cj,A_)=>{"use strict";m();var gI=k_();A_.exports=function(e){return gI(e)||e===0?e:e<0?-1:1}});var P_=U((fj,T_)=>{"use strict";m();T_.exports=Object.getOwnPropertyDescriptor});var Ao=U((hj,R_)=>{"use strict";m();var Ff=P_();if(Ff)try{Ff([],"length")}catch(t){Ff=null}R_.exports=Ff});var bc=U((mj,$_)=>{"use strict";m();var If=Object.defineProperty||!1;if(If)try{If({},"a",{value:1})}catch(t){If=!1}$_.exports=If});var fm=U((vj,F_)=>{"use strict";m();F_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var D_=U((bj,M_)=>{"use strict";m();var I_=typeof Symbol!="undefined"&&Symbol,vI=fm();M_.exports=function(){return typeof I_!="function"||typeof Symbol!="function"||typeof I_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:vI()}});var dm=U((yj,O_)=>{"use strict";m();O_.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var hm=U((Ej,L_)=>{"use strict";m();var wI=cm();L_.exports=wI.getPrototypeOf||null});var H_=U((kj,B_)=>{"use strict";m();var bI="Function.prototype.bind called on incompatible ",_I=Object.prototype.toString,yI=Math.max,xI="[object Function]",N_=function(e,r){for(var i=[],n=0;n{"use strict";m();var kI=H_();U_.exports=Function.prototype.bind||kI});var Mf=U((Pj,G_)=>{"use strict";m();G_.exports=Function.prototype.call});var Df=U(($j,j_)=>{"use strict";m();j_.exports=Function.prototype.apply});var z_=U((Ij,V_)=>{"use strict";m();V_.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var pm=U((Dj,W_)=>{"use strict";m();var AI=Co(),CI=Df(),TI=Mf(),PI=z_();W_.exports=PI||AI.call(TI,CI)});var Of=U((Lj,q_)=>{"use strict";m();var RI=Co(),$I=ko(),FI=Mf(),II=pm();q_.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new $I("a function is required");return II(RI,FI,e)}});var J_=U((Bj,Q_)=>{"use strict";m();var MI=Of(),Y_=Ao(),K_;try{K_=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var mm=!!K_&&Y_&&Y_(Object.prototype,"__proto__"),X_=Object,Z_=X_.getPrototypeOf;Q_.exports=mm&&typeof mm.get=="function"?MI([mm.get]):typeof Z_=="function"?function(e){return Z_(e==null?e:X_(e))}:!1});var gm=U((Uj,iy)=>{"use strict";m();var ey=dm(),ty=hm(),ry=J_();iy.exports=ey?function(e){return ey(e)}:ty?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return ty(e)}:ry?function(e){return ry(e)}:null});var sy=U((jj,ny)=>{"use strict";m();var DI=Function.prototype.call,OI=Object.prototype.hasOwnProperty,LI=Co();ny.exports=LI.call(DI,OI)});var bm=U((zj,fy)=>{"use strict";m();var Te,NI=cm(),BI=r_(),HI=n_(),UI=a_(),GI=l_(),$o=um(),Ro=ko(),jI=f_(),VI=h_(),zI=m_(),WI=v_(),qI=b_(),YI=y_(),ZI=E_(),KI=C_(),cy=Function,vm=function(t){try{return cy('"use strict"; return ('+t+").constructor;")()}catch(e){}},_c=Ao(),XI=bc(),wm=function(){throw new Ro},QI=_c?(function(){try{return arguments.callee,wm}catch(t){try{return _c(arguments,"callee").get}catch(e){return wm}}})():wm,To=D_()(),Vt=gm(),JI=hm(),eM=dm(),uy=Df(),yc=Mf(),Po={},tM=typeof Uint8Array=="undefined"||!Vt?Te:Vt(Uint8Array),aa={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Te:ArrayBuffer,"%ArrayIteratorPrototype%":To&&Vt?Vt([][Symbol.iterator]()):Te,"%AsyncFromSyncIteratorPrototype%":Te,"%AsyncFunction%":Po,"%AsyncGenerator%":Po,"%AsyncGeneratorFunction%":Po,"%AsyncIteratorPrototype%":Po,"%Atomics%":typeof Atomics=="undefined"?Te:Atomics,"%BigInt%":typeof BigInt=="undefined"?Te:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":BI,"%eval%":eval,"%EvalError%":HI,"%Float16Array%":typeof Float16Array=="undefined"?Te:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Te:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Te:FinalizationRegistry,"%Function%":cy,"%GeneratorFunction%":Po,"%Int8Array%":typeof Int8Array=="undefined"?Te:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Te:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":To&&Vt?Vt(Vt([][Symbol.iterator]())):Te,"%JSON%":typeof JSON=="object"?JSON:Te,"%Map%":typeof Map=="undefined"?Te:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!To||!Vt?Te:Vt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":NI,"%Object.getOwnPropertyDescriptor%":_c,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Te:Promise,"%Proxy%":typeof Proxy=="undefined"?Te:Proxy,"%RangeError%":UI,"%ReferenceError%":GI,"%Reflect%":typeof Reflect=="undefined"?Te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Te:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!To||!Vt?Te:Vt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":To&&Vt?Vt(""[Symbol.iterator]()):Te,"%Symbol%":To?Symbol:Te,"%SyntaxError%":$o,"%ThrowTypeError%":QI,"%TypedArray%":tM,"%TypeError%":Ro,"%Uint8Array%":typeof Uint8Array=="undefined"?Te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Te:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Te:Uint32Array,"%URIError%":jI,"%WeakMap%":typeof WeakMap=="undefined"?Te:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Te:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Te:WeakSet,"%Function.prototype.call%":yc,"%Function.prototype.apply%":uy,"%Object.defineProperty%":XI,"%Object.getPrototypeOf%":JI,"%Math.abs%":VI,"%Math.floor%":zI,"%Math.max%":WI,"%Math.min%":qI,"%Math.pow%":YI,"%Math.round%":ZI,"%Math.sign%":KI,"%Reflect.getPrototypeOf%":eM};if(Vt)try{null.error}catch(t){ay=Vt(Vt(t)),aa["%Error.prototype%"]=ay}var ay,rM=function t(e){var r;if(e==="%AsyncFunction%")r=vm("async function () {}");else if(e==="%GeneratorFunction%")r=vm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=vm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&Vt&&(r=Vt(n.prototype))}return aa[e]=r,r},oy={__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"]},xc=Co(),Lf=sy(),iM=xc.call(yc,Array.prototype.concat),nM=xc.call(uy,Array.prototype.splice),ly=xc.call(yc,String.prototype.replace),Nf=xc.call(yc,String.prototype.slice),sM=xc.call(yc,RegExp.prototype.exec),aM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,oM=/\\(\\)?/g,lM=function(e){var r=Nf(e,0,1),i=Nf(e,-1);if(r==="%"&&i!=="%")throw new $o("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new $o("invalid intrinsic syntax, expected opening `%`");var n=[];return ly(e,aM,function(s,a,o,l){n[n.length]=o?ly(l,oM,"$1"):a||s}),n},cM=function(e,r){var i=e,n;if(Lf(oy,i)&&(n=oy[i],i="%"+n[0]+"%"),Lf(aa,i)){var s=aa[i];if(s===Po&&(s=rM(i)),typeof s=="undefined"&&!r)throw new Ro("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new $o("intrinsic "+e+" does not exist!")};fy.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ro("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ro('"allowMissing" argument must be a boolean');if(sM(/^%?[^%]*%?$/,e)===null)throw new $o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=lM(e),n=i.length>0?i[0]:"",s=cM("%"+n+"%",r),a=s.name,o=s.value,l=!1,c=s.alias;c&&(n=c[0],nM(i,iM([0,1],c)));for(var u=1,f=!0;u=i.length){var g=_c(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=Lf(o,d),o=o[d];f&&!l&&(aa[a]=o)}}return o}});var _m=U((qj,py)=>{"use strict";m();var dy=bm(),hy=Of(),uM=hy([dy("%String.prototype.indexOf%")]);py.exports=function(e,r){var i=dy(e,!!r);return typeof i=="function"&&uM(e,".prototype.")>-1?hy([i]):i}});var wy=U((Zj,vy)=>{"use strict";m();var gy=Function.prototype.toString,Fo=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,xm,Bf;if(typeof Fo=="function"&&typeof Object.defineProperty=="function")try{xm=Object.defineProperty({},"length",{get:function(){throw Bf}}),Bf={},Fo(function(){throw 42},null,xm)}catch(t){t!==Bf&&(Fo=null)}else Fo=null;var fM=/^\s*class\b/,Em=function(e){try{var r=gy.call(e);return fM.test(r)}catch(i){return!1}},ym=function(e){try{return Em(e)?!1:(gy.call(e),!0)}catch(r){return!1}},Hf=Object.prototype.toString,dM="[object Object]",hM="[object Function]",pM="[object GeneratorFunction]",mM="[object HTMLAllCollection]",gM="[object HTML document.all class]",vM="[object HTMLCollection]",wM=typeof Symbol=="function"&&!!Symbol.toStringTag,bM=!(0 in[,]),Sm=function(){return!1};typeof document=="object"&&(my=document.all,Hf.call(my)===Hf.call(document.all)&&(Sm=function(e){if((bM||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=Hf.call(e);return(r===mM||r===gM||r===vM||r===dM)&&e("")==null}catch(i){}return!1}));var my;vy.exports=Fo?function(e){if(Sm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Fo(e,null,xm)}catch(r){if(r!==Bf)return!1}return!Em(e)&&ym(e)}:function(e){if(Sm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(wM)return ym(e);if(Em(e))return!1;var r=Hf.call(e);return r!==hM&&r!==pM&&!/^\[object HTML/.test(r)?!1:ym(e)}});var yy=U((Xj,_y)=>{"use strict";m();var _M=wy(),yM=Object.prototype.toString,by=Object.prototype.hasOwnProperty,xM=function(e,r,i){for(var n=0,s=e.length;n=3&&(n=i),kM(e)?xM(e,r,n):typeof e=="string"?EM(e,r,n):SM(e,r,n)}});var Ey=U((Jj,xy)=>{"use strict";m();xy.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var ky=U((tV,Sy)=>{"use strict";m();var km=Ey(),AM=typeof globalThis=="undefined"?global:globalThis;Sy.exports=function(){for(var e=[],r=0;r{"use strict";m();var Ay=bc(),CM=um(),Io=ko(),Cy=Ao();Ty.exports=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Io("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Io("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Io("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Io("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Io("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Io("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Cy&&Cy(e,r);if(Ay)Ay(e,r,{configurable:a===null&&l?l.configurable:!a,enumerable:n===null&&l?l.enumerable:!n,value:i,writable:s===null&&l?l.writable:!s});else if(o||!n&&!s&&!a)e[r]=i;else throw new CM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Fy=U((sV,$y)=>{"use strict";m();var Am=bc(),Ry=function(){return!!Am};Ry.hasArrayLengthDefineBug=function(){if(!Am)return null;try{return Am([],"length",{value:1}).length!==1}catch(e){return!0}};$y.exports=Ry});var Ly=U((oV,Oy)=>{"use strict";m();var TM=bm(),Iy=Py(),PM=Fy()(),My=Ao(),Dy=ko(),RM=TM("%Math.floor%");Oy.exports=function(e,r){if(typeof e!="function")throw new Dy("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||RM(r)!==r)throw new Dy("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&My){var a=My(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(PM?Iy(e,"length",r,!0,!0):Iy(e,"length",r)),e}});var By=U((cV,Ny)=>{"use strict";m();var $M=Co(),FM=Df(),IM=pm();Ny.exports=function(){return IM($M,FM,arguments)}});var Gy=U((fV,Uf)=>{"use strict";m();var MM=Ly(),Hy=bc(),DM=Of(),Uy=By();Uf.exports=function(e){var r=DM(arguments),i=1+e.length-(arguments.length-1);return MM(r,i>0?i:0,!0)};Hy?Hy(Uf.exports,"apply",{value:Uy}):Uf.exports.apply=Uy});var Vy=U((hV,jy)=>{"use strict";m();var OM=fm();jy.exports=function(){return OM()&&!!Symbol.toStringTag}});var Zy=U((mV,Yy)=>{"use strict";m();var Vf=yy(),LM=ky(),zy=Gy(),Tm=_m(),jf=Ao(),Gf=gm(),NM=Tm("Object.prototype.toString"),qy=Vy()(),Wy=typeof globalThis=="undefined"?global:globalThis,Cm=LM(),Pm=Tm("String.prototype.slice"),BM=Tm("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i-1}Yy.exports=function(e){if(!e||typeof e!="object")return!1;if(!qy){var r=Pm(NM(e),8,-1);return GM(r)?r:r!=="Object"?!1:UM(e)}return jf?HM(e):null}});var Xy=U((vV,Ky)=>{"use strict";m();var jM=Zy();Ky.exports=function(e){return!!jM(e)}});var Jy=U((bV,Qy)=>{"use strict";m();var VM=ko(),zM=_m(),WM=zM("TypedArray.prototype.buffer",!0),qM=Xy();Qy.exports=WM||function(e){if(!qM(e))throw new VM("Not a Typed Array");return e.buffer}});var rx=U((yV,tx)=>{"use strict";m();var Ni=$f().Buffer,YM=Qb(),ZM=Jy(),KM=ArrayBuffer.isView||function(e){try{return ZM(e),!0}catch(r){return!1}},XM=typeof Uint8Array!="undefined",ex=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",QM=ex&&(Ni.prototype instanceof Uint8Array||Ni.TYPED_ARRAY_SUPPORT);tx.exports=function(e,r){if(Ni.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Ni.from(e):e;if(typeof e=="string")return Ni.from(e,r);if(ex&&KM(e)){if(e.byteLength===0)return Ni.alloc(0);if(QM){var i=Ni.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Ni.from(n);if(s.length===e.byteLength)return s}if(XM&&e instanceof Uint8Array)return Ni.from(e);var a=YM(e);if(a)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||Ni.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Ni.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var nx=U((EV,ix)=>{"use strict";m();var JM=$f().Buffer,eD=rx();function Wf(t,e){this._block=JM.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Wf.prototype.update=function(t,e){t=eD(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};Wf.prototype._update=function(){throw new Error("_update must be implemented by subclass")};ix.exports=Wf});var ox=U((kV,ax)=>{"use strict";m();var tD=Yb(),sx=nx(),rD=$f().Buffer,iD=[1518500249,1859775393,-1894007588,-899497514],nD=new Array(80);function Ec(){this.init(),this._w=nD,sx.call(this,64,56)}tD(Ec,sx);Ec.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function sD(t){return t<<1|t>>>31}function aD(t){return t<<5|t>>>27}function oD(t){return t<<30|t>>>2}function lD(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}Ec.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=sD(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=aD(r)+lD(c,i,n,s)+a+e[l]+iD[c]|0;a=s,s=n,n=oD(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Ec.prototype._hash=function(){var t=rD.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};ax.exports=Ec});var cx=U(Rm=>{m();var lx;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof Rm=="object"?t(Rm):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(lx={}):t(lx={})})(function(t){t.version="1.2.2";function e(){for(var v=0,x=new Array(256),_=0;_!=256;++_)v=_,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,x[_]=v;return typeof Int32Array!="undefined"?new Int32Array(x):x}var r=e();function i(v){var x=0,_=0,P=0,T=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)T[P]=v[P];for(P=0;P!=256;++P)for(_=v[P],x=256+P;x<4096;x+=256)_=T[x]=_>>>8^v[_&255];var M=[];for(P=1;P!=16;++P)M[P-1]=typeof Int32Array!="undefined"?T.subarray(P*256,P*256+256):T.slice(P*256,P*256+256);return M}var n=i(r),s=n[0],a=n[1],o=n[2],l=n[3],c=n[4],u=n[5],f=n[6],d=n[7],h=n[8],p=n[9],g=n[10],w=n[11],y=n[12],b=n[13],S=n[14];function C(v,x){for(var _=x^-1,P=0,T=v.length;P>>8^r[(_^v.charCodeAt(P++))&255];return~_}function A(v,x){for(var _=x^-1,P=v.length-15,T=0;T>8&255]^y[v[T++]^_>>16&255]^w[v[T++]^_>>>24]^g[v[T++]]^p[v[T++]]^h[v[T++]]^d[v[T++]]^f[v[T++]]^u[v[T++]]^c[v[T++]]^l[v[T++]]^o[v[T++]]^a[v[T++]]^s[v[T++]]^r[v[T++]];for(P+=15;T>>8^r[(_^v[T++])&255];return~_}function k(v,x){for(var _=x^-1,P=0,T=v.length,M=0,$=0;P>>8^r[(_^M)&255]:M<2048?(_=_>>>8^r[(_^(192|M>>6&31))&255],_=_>>>8^r[(_^(128|M&63))&255]):M>=55296&&M<57344?(M=(M&1023)+64,$=v.charCodeAt(P++)&1023,_=_>>>8^r[(_^(240|M>>8&7))&255],_=_>>>8^r[(_^(128|M>>2&63))&255],_=_>>>8^r[(_^(128|$>>6&15|(M&3)<<4))&255],_=_>>>8^r[(_^(128|$&63))&255]):(_=_>>>8^r[(_^(224|M>>12&15))&255],_=_>>>8^r[(_^(128|M>>6&63))&255],_=_>>>8^r[(_^(128|M&63))&255]);return~_}t.table=r,t.bstr=C,t.buf=A,t.str=k})});var Hn=U(wr=>{"use strict";m();var cD=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function uD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}wr.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)uD(r,i)&&(t[i]=r[i])}}return t};wr.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var fD={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s{"use strict";m();var hD=Hn(),pD=4,ux=0,fx=1,mD=2;function Do(t){for(var e=t.length;--e>=0;)t[e]=0}var gD=0,vx=1,vD=2,wD=3,bD=258,Lm=29,Pc=256,kc=Pc+1+Lm,Mo=30,Nm=19,wx=2*kc+1,oa=15,$m=16,_D=7,Bm=256,bx=16,_x=17,yx=18,Dm=[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],qf=[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],yD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],xx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],xD=512,Un=new Array((kc+2)*2);Do(Un);var Sc=new Array(Mo*2);Do(Sc);var Ac=new Array(xD);Do(Ac);var Cc=new Array(bD-wD+1);Do(Cc);var Hm=new Array(Lm);Do(Hm);var Yf=new Array(Mo);Do(Yf);function Fm(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var Ex,Sx,kx;function Im(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Ax(t){return t<256?Ac[t]:Ac[256+(t>>>7)]}function Tc(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Fr(t,e,r){t.bi_valid>$m-r?(t.bi_buf|=e<>$m-t.bi_valid,t.bi_valid+=r-$m):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function ED(t){t.bi_valid===16?(Tc(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 SD(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,g=0;for(d=0;d<=oa;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,g++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,h=0,u>=o&&(h=a[u-o]),p=r[u*2],t.opt_len+=p*(d+h),s&&(t.static_len+=p*(n[u*2+1]+h)));if(g!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>i)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function Tx(t,e,r){var i=new Array(oa+1),n=0,s,a;for(s=1;s<=oa;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var o=t[a*2+1];o!==0&&(t[a*2]=Cx(i[o]++,o))}}function kD(){var t,e,r,i,n,s=new Array(oa+1);for(r=0,i=0;i>=7;i8?Tc(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 AD(t,e,r,i){Rx(t),i&&(Tc(t,r),Tc(t,~r)),hD.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function dx(t,e,r,i){var n=e*2,s=r*2;return t[n]>1;a>=1;a--)Mm(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Mm(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,r[c*2]=r[a*2]+r[o*2],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,r[a*2+1]=r[o*2+1]=c,t.heap[1]=c++,Mm(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],SD(t,e),Tx(r,l,t.bl_count)}function px(t,e,r){var i,n=-1,s,a=e[1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++o=3&&t.bl_tree[xx[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function TD(t,e,r,i){var n;for(Fr(t,e-257,5),Fr(t,r-1,5),Fr(t,i-4,4),n=0;n>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return ux;if(t.dyn_ltree[18]!==0||t.dyn_ltree[20]!==0||t.dyn_ltree[26]!==0)return fx;for(r=32;r0?(t.strm.data_type===mD&&(t.strm.data_type=PD(t)),Om(t,t.l_desc),Om(t,t.d_desc),a=CD(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?$x(t,e,r,i):t.strategy===pD||s===n?(Fr(t,(vx<<1)+(i?1:0),3),hx(t,Un,Sc)):(Fr(t,(vD<<1)+(i?1:0),3),TD(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),hx(t,t.dyn_ltree,t.dyn_dtree)),Px(t),i&&Rx(t)}function ID(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[(Cc[r]+Pc+1)*2]++,t.dyn_dtree[Ax(e)*2]++),t.last_lit===t.lit_bufsize-1}Oo._tr_init=RD;Oo._tr_stored_block=$x;Oo._tr_flush_block=FD;Oo._tr_tally=ID;Oo._tr_align=$D});var Um=U((IV,Ix)=>{"use strict";m();function MD(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}Ix.exports=MD});var Gm=U((DV,Mx)=>{"use strict";m();function DD(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var OD=DD();function LD(t,e,r,i){var n=OD,s=i+r;t^=-1;for(var a=i;a>>8^n[(t^e[a])&255];return t^-1}Mx.exports=LD});var Zf=U((LV,Dx)=>{"use strict";m();Dx.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 Vx=U(hn=>{"use strict";m();var br=Hn(),mi=Fx(),Bx=Um(),ws=Gm(),ND=Zf(),fa=0,BD=1,HD=3,Es=4,Ox=5,dn=0,Lx=1,gi=-2,UD=-3,jm=-5,GD=-1,jD=1,Kf=2,VD=3,zD=4,WD=0,qD=2,td=8,YD=9,ZD=15,KD=8,XD=29,QD=256,zm=QD+1+XD,JD=30,eO=19,tO=2*zm+1,rO=15,$e=3,ys=258,Bi=ys+$e+1,iO=32,rd=42,Wm=69,Xf=73,Qf=91,Jf=103,la=113,$c=666,Ft=1,Fc=2,ca=3,Bo=4,nO=3;function xs(t,e){return t.msg=ND[e],e}function Nx(t){return(t<<1)-(t>4?9:0)}function _s(t){for(var e=t.length;--e>=0;)t[e]=0}function bs(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(br.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 Kt(t,e){mi._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bs(t.strm)}function Oe(t,e){t.pending_buf[t.pending++]=e}function Rc(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function sO(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,br.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=Bx(t.adler,e,n,r):t.state.wrap===2&&(t.adler=ws(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}function Hx(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-Bi?t.strstart-(t.w_size-Bi):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+ys,h=c[i+a-1],p=c[i+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(n=e,!(c[n+a]!==p||c[n+a-1]!==h||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&ia){if(t.match_start=e,a=s,s>=o)break;h=c[i+a-1],p=c[i+a]}}while((e=f[e&u])>l&&--r!==0);return a<=t.lookahead?a:t.lookahead}function ua(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Bi)){br.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=sO(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=$e)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ua(t),t.lookahead===0&&e===fa)return Ft;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,Kt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-Bi&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):(t.strstart>t.block_start&&(Kt(t,!1),t.strm.avail_out===0),Ft)}function Vm(t,e){for(var r,i;;){if(t.lookahead=$e&&(t.ins_h=(t.ins_h<=$e)if(i=mi._tr_tally(t,t.strstart-t.match_start,t.match_length-$e),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=$e){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=$e&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=$e-1)),t.prev_length>=$e&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-$e,i=mi._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-$e),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<=$e&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+ys;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=$e?(r=mi._tr_tally(t,1,t.match_length-$e),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=mi._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):t.last_lit&&(Kt(t,!1),t.strm.avail_out===0)?Ft:Fc}function lO(t,e){for(var r;;){if(t.lookahead===0&&(ua(t),t.lookahead===0)){if(e===fa)return Ft;break}if(t.match_length=0,r=mi._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Kt(t,!1),t.strm.avail_out===0))return Ft}return t.insert=0,e===Es?(Kt(t,!0),t.strm.avail_out===0?ca:Bo):t.last_lit&&(Kt(t,!1),t.strm.avail_out===0)?Ft:Fc}function fn(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var No;No=[new fn(0,0,0,0,aO),new fn(4,4,8,4,Vm),new fn(4,5,16,8,Vm),new fn(4,6,32,32,Vm),new fn(4,4,16,16,Lo),new fn(8,16,32,32,Lo),new fn(8,16,128,128,Lo),new fn(8,32,128,256,Lo),new fn(32,128,258,1024,Lo),new fn(32,258,258,4096,Lo)];function cO(t){t.window_size=2*t.w_size,_s(t.head),t.max_lazy_match=No[t.level].max_lazy,t.good_match=No[t.level].good_length,t.nice_match=No[t.level].nice_length,t.max_chain_length=No[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=$e-1,t.match_available=0,t.ins_h=0}function uO(){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=td,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 br.Buf16(tO*2),this.dyn_dtree=new br.Buf16((2*JD+1)*2),this.bl_tree=new br.Buf16((2*eO+1)*2),_s(this.dyn_ltree),_s(this.dyn_dtree),_s(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new br.Buf16(rO+1),this.heap=new br.Buf16(2*zm+1),_s(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new br.Buf16(2*zm+1),_s(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 Ux(t){var e;return!t||!t.state?xs(t,gi):(t.total_in=t.total_out=0,t.data_type=qD,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?rd:la,t.adler=e.wrap===2?0:1,e.last_flush=fa,mi._tr_init(e),dn)}function Gx(t){var e=Ux(t);return e===dn&&cO(t.state),e}function fO(t,e){return!t||!t.state||t.state.wrap!==2?gi:(t.state.gzhead=e,dn)}function jx(t,e,r,i,n,s){if(!t)return gi;var a=1;if(e===GD&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>YD||r!==td||i<8||i>15||e<0||e>9||s<0||s>zD)return xs(t,gi);i===8&&(i=9);var o=new uO;return t.state=o,o.strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<Ox||e<0)return t?xs(t,gi):gi;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===$c&&e!==Es)return xs(t,t.avail_out===0?jm:gi);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===rd)if(i.wrap===2)t.adler=0,Oe(i,31),Oe(i,139),Oe(i,8),i.gzhead?(Oe(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Oe(i,i.gzhead.time&255),Oe(i,i.gzhead.time>>8&255),Oe(i,i.gzhead.time>>16&255),Oe(i,i.gzhead.time>>24&255),Oe(i,i.level===9?2:i.strategy>=Kf||i.level<2?4:0),Oe(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Oe(i,i.gzhead.extra.length&255),Oe(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=ws(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=Wm):(Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,0),Oe(i,i.level===9?2:i.strategy>=Kf||i.level<2?4:0),Oe(i,nO),i.status=la);else{var a=td+(i.w_bits-8<<4)<<8,o=-1;i.strategy>=Kf||i.level<2?o=0:i.level<6?o=1:i.level===6?o=2:o=3,a|=o<<6,i.strstart!==0&&(a|=iO),a+=31-a%31,i.status=la,Rc(i,a),i.strstart!==0&&(Rc(i,t.adler>>>16),Rc(i,t.adler&65535)),t.adler=1}if(i.status===Wm)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size));)Oe(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Xf)}else i.status=Xf;if(i.status===Xf)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=Qf)}else i.status=Qf;if(i.status===Qf)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),bs(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=ws(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=Jf)}else i.status=Jf;if(i.status===Jf&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&bs(t),i.pending+2<=i.pending_buf_size&&(Oe(i,t.adler&255),Oe(i,t.adler>>8&255),t.adler=0,i.status=la)):i.status=la),i.pending!==0){if(bs(t),t.avail_out===0)return i.last_flush=-1,dn}else if(t.avail_in===0&&Nx(e)<=Nx(r)&&e!==Es)return xs(t,jm);if(i.status===$c&&t.avail_in!==0)return xs(t,jm);if(t.avail_in!==0||i.lookahead!==0||e!==fa&&i.status!==$c){var l=i.strategy===Kf?lO(i,e):i.strategy===VD?oO(i,e):No[i.level].func(i,e);if((l===ca||l===Bo)&&(i.status=$c),l===Ft||l===ca)return t.avail_out===0&&(i.last_flush=-1),dn;if(l===Fc&&(e===BD?mi._tr_align(i):e!==Ox&&(mi._tr_stored_block(i,0,0,!1),e===HD&&(_s(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),bs(t),t.avail_out===0))return i.last_flush=-1,dn}return e!==Es?dn:i.wrap<=0?Lx:(i.wrap===2?(Oe(i,t.adler&255),Oe(i,t.adler>>8&255),Oe(i,t.adler>>16&255),Oe(i,t.adler>>24&255),Oe(i,t.total_in&255),Oe(i,t.total_in>>8&255),Oe(i,t.total_in>>16&255),Oe(i,t.total_in>>24&255)):(Rc(i,t.adler>>>16),Rc(i,t.adler&65535)),bs(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?dn:Lx)}function pO(t){var e;return!t||!t.state?gi:(e=t.state.status,e!==rd&&e!==Wm&&e!==Xf&&e!==Qf&&e!==Jf&&e!==la&&e!==$c?xs(t,gi):(t.state=null,e===la?xs(t,UD):dn))}function mO(t,e){var r=e.length,i,n,s,a,o,l,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==rd||i.lookahead))return gi;for(a===1&&(t.adler=Bx(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(_s(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new br.Buf8(i.w_size),br.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,ua(i);i.lookahead>=$e;){n=i.strstart,s=i.lookahead-($e-1);do i.ins_h=(i.ins_h<{"use strict";m();var id=Hn(),zx=!0,Wx=!0;try{String.fromCharCode.apply(null,[0])}catch(t){zx=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Wx=!1}var Ic=new id.Buf8(256);for(Gn=0;Gn<256;Gn++)Ic[Gn]=Gn>=252?6:Gn>=248?5:Gn>=240?4:Gn>=224?3:Gn>=192?2:1;var Gn;Ic[254]=Ic[254]=1;Ho.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function qx(t,e){if(e<65534&&(t.subarray&&Wx||!t.subarray&&zx))return String.fromCharCode.apply(null,id.shrinkBuf(t,e));for(var r="",i=0;i4){o[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|n&1023)}return qx(o,i)};Ho.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ic[t[r]]>e?r:e}});var Ym=U((jV,Yx)=>{"use strict";m();function gO(){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}Yx.exports=gO});var Qx=U(Oc=>{"use strict";m();var Mc=Vx(),Dc=Hn(),Km=qm(),Xm=Zf(),vO=Ym(),Xx=Object.prototype.toString,wO=0,Zm=4,Uo=0,Zx=1,Kx=2,bO=-1,_O=0,yO=8;function da(t){if(!(this instanceof da))return new da(t);this.options=Dc.assign({level:bO,method:yO,chunkSize:16384,windowBits:15,memLevel:8,strategy:_O,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 vO,this.strm.avail_out=0;var r=Mc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Uo)throw new Error(Xm[r]);if(e.header&&Mc.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=Km.string2buf(e.dictionary):Xx.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Mc.deflateSetDictionary(this.strm,i),r!==Uo)throw new Error(Xm[r]);this._dict_set=!0}}da.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Zm:wO,typeof t=="string"?r.input=Km.string2buf(t):Xx.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Dc.Buf8(i),r.next_out=0,r.avail_out=i),n=Mc.deflate(r,s),n!==Zx&&n!==Uo)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Zm||s===Kx))&&(this.options.to==="string"?this.onData(Km.buf2binstring(Dc.shrinkBuf(r.output,r.next_out))):this.onData(Dc.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==Zx);return s===Zm?(n=Mc.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Uo):(s===Kx&&(this.onEnd(Uo),r.avail_out=0),!0)};da.prototype.onData=function(t){this.chunks.push(t)};da.prototype.onEnd=function(t){t===Uo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Dc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Qm(t,e){var r=new da(e);if(r.push(t,!0),r.err)throw r.msg||Xm[r.err];return r.result}function xO(t,e){return e=e||{},e.raw=!0,Qm(t,e)}function EO(t,e){return e=e||{},e.gzip=!0,Qm(t,e)}Oc.Deflate=da;Oc.deflate=Qm;Oc.deflateRaw=xO;Oc.gzip=EO});var e1=U((qV,Jx)=>{"use strict";m();var nd=30,SO=12;Jx.exports=function(e,r){var i,n,s,a,o,l,c,u,f,d,h,p,g,w,y,b,S,C,A,k,v,x,_,P,T;i=e.state,n=e.next_in,P=e.input,s=n+(e.avail_in-5),a=e.next_out,T=e.output,o=a-(r-e.avail_out),l=a+(e.avail_out-257),c=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,h=i.window,p=i.hold,g=i.bits,w=i.lencode,y=i.distcode,b=(1<>>24,p>>>=A,g-=A,A=C>>>16&255,A===0)T[a++]=C&65535;else if(A&16){k=C&65535,A&=15,A&&(g>>=A,g-=A),g<15&&(p+=P[n++]<>>24,p>>>=A,g-=A,A=C>>>16&255,A&16){if(v=C&65535,A&=15,gc){e.msg="invalid distance too far back",i.mode=nd;break e}if(p>>>=A,g-=A,A=a-o,v>A){if(A=v-A,A>f&&i.sane){e.msg="invalid distance too far back",i.mode=nd;break e}if(x=0,_=h,d===0){if(x+=u-A,A2;)T[a++]=_[x++],T[a++]=_[x++],T[a++]=_[x++],k-=3;k&&(T[a++]=_[x++],k>1&&(T[a++]=_[x++]))}else{x=a-v;do T[a++]=T[x++],T[a++]=T[x++],T[a++]=T[x++],k-=3;while(k>2);k&&(T[a++]=T[x++],k>1&&(T[a++]=T[x++]))}}else if((A&64)===0){C=y[(C&65535)+(p&(1<>3,n-=k,g-=k<<3,p&=(1<{"use strict";m();var t1=Hn(),Go=15,r1=852,i1=592,n1=0,Jm=1,s1=2,kO=[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],AO=[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],CO=[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],TO=[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];a1.exports=function(e,r,i,n,s,a,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,g=0,w=0,y=0,b=0,S=0,C,A,k,v,x,_=null,P=0,T,M=new t1.Buf16(Go+1),$=new t1.Buf16(Go+1),D=null,Q=0,ye,de,J;for(u=0;u<=Go;u++)M[u]=0;for(f=0;f=1&&M[h]===0;h--);if(p>h&&(p=h),h===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===n1||h!==1))return-1;for($[1]=0,u=1;ur1||e===s1&&b>i1)return 1;for(;;){ye=u-w,o[f]T?(de=D[Q+o[f]],J=_[P+o[f]]):(de=96,J=0),C=1<>w)+A]=ye<<24|de<<16|J|0;while(A!==0);for(C=1<>=1;if(C!==0?(S&=C-1,S+=C):S=0,f++,--M[u]===0){if(u===h)break;u=r[i+o[f]]}if(u>p&&(S&v)!==k){for(w===0&&(w=p),x+=d,g=u-w,y=1<r1||e===s1&&b>i1)return 1;k=S&v,s[k]=p<<24|g<<16|x-a|0}}return S!==0&&(s[x+S]=u-w<<24|64<<16|0),l.bits=p,0}});var G1=U(Hi=>{"use strict";m();var Zr=Hn(),sg=Um(),pn=Gm(),PO=e1(),Lc=o1(),RO=0,I1=1,M1=2,l1=4,$O=5,sd=6,ha=0,FO=1,IO=2,vi=-2,D1=-3,ag=-4,MO=-5,c1=8,O1=1,u1=2,f1=3,d1=4,h1=5,p1=6,m1=7,g1=8,v1=9,w1=10,ld=11,jn=12,eg=13,b1=14,tg=15,_1=16,y1=17,x1=18,E1=19,ad=20,od=21,S1=22,k1=23,A1=24,C1=25,T1=26,rg=27,P1=28,R1=29,nt=30,og=31,DO=32,OO=852,LO=592,NO=15,BO=NO;function $1(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function HO(){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 Zr.Buf16(320),this.work=new Zr.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L1(t){var e;return!t||!t.state?vi:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=O1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Zr.Buf32(OO),e.distcode=e.distdyn=new Zr.Buf32(LO),e.sane=1,e.back=-1,ha)}function N1(t){var e;return!t||!t.state?vi:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,L1(t))}function B1(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?vi:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,N1(t))}function H1(t,e){var r,i;return t?(i=new HO,t.state=i,i.window=null,r=B1(t,e),r!==ha&&(t.state=null),r):vi}function UO(t){return H1(t,BO)}var F1=!0,ig,ng;function GO(t){if(F1){var e;for(ig=new Zr.Buf32(512),ng=new Zr.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(Lc(I1,t.lens,0,288,ig,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Lc(M1,t.lens,0,32,ng,0,t.work,{bits:5}),F1=!1}t.lencode=ig,t.lenbits=9,t.distcode=ng,t.distbits=5}function U1(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<=s.wsize?(Zr.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),Zr.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(Zr.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=pn(r.check,_,2,0),c=0,u=0,r.mode=u1;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=nt;break}if((c&15)!==c1){t.msg="unknown compression method",r.mode=nt;break}if(c>>>=4,u-=4,v=(c&15)+8,r.wbits===0)r.wbits=v;else if(v>r.wbits){t.msg="invalid window size",r.mode=nt;break}r.dmax=1<>8&1),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0,r.mode=f1;case f1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>8&255,_[2]=c>>>16&255,_[3]=c>>>24&255,r.check=pn(r.check,_,4,0)),c=0,u=0,r.mode=d1;case d1:for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>8),r.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0,r.mode=h1;case h1:if(r.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>>8&255,r.check=pn(r.check,_,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=p1;case p1:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(v=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Zr.arraySet(r.head.extra,i,s,h,v)),r.flags&512&&(r.check=pn(r.check,i,h,s)),o-=h,s+=h,r.length-=h),r.length))break e;r.length=0,r.mode=m1;case m1:if(r.flags&2048){if(o===0)break e;h=0;do v=i[s+h++],r.head&&v&&r.length<65536&&(r.head.name+=String.fromCharCode(v));while(v&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=jn;break;case w1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>=u&7,u-=u&7,r.mode=rg;break}for(;u<3;){if(o===0)break e;o--,c+=i[s++]<>>=1,u-=1,c&3){case 0:r.mode=b1;break;case 1:if(GO(r),r.mode=ad,e===sd){c>>>=2,u-=2;break e}break;case 2:r.mode=y1;break;case 3:t.msg="invalid block type",r.mode=nt}c>>>=2,u-=2;break;case b1:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=nt;break}if(r.length=c&65535,c=0,u=0,r.mode=tg,e===sd)break e;case tg:r.mode=_1;case _1:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;Zr.arraySet(n,i,s,h,a),o-=h,s+=h,l-=h,a+=h,r.length-=h;break}r.mode=jn;break;case y1:for(;u<14;){if(o===0)break e;o--,c+=i[s++]<>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=nt;break}r.have=0,r.mode=x1;case x1:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[M[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},x=Lc(RO,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,x){t.msg="invalid code lengths set",r.mode=nt;break}r.have=0,r.mode=E1;case E1:for(;r.have>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=y,u-=y,r.lens[r.have++]=S;else{if(S===16){for(T=y+2;u>>=y,u-=y,r.have===0){t.msg="invalid bit length repeat",r.mode=nt;break}v=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(S===17){for(T=y+3;u>>=y,u-=y,v=0,h=3+(c&7),c>>>=3,u-=3}else{for(T=y+7;u>>=y,u-=y,v=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=nt;break}for(;h--;)r.lens[r.have++]=v}}if(r.mode===nt)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=nt;break}if(r.lenbits=9,P={bits:r.lenbits},x=Lc(I1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,x){t.msg="invalid literal/lengths set",r.mode=nt;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},x=Lc(M1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,x){t.msg="invalid distances set",r.mode=nt;break}if(r.mode=ad,e===sd)break e;case ad:r.mode=od;case od:if(o>=6&&l>=258){t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,r.hold=c,r.bits=u,PO(t,d),a=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,c=r.hold,u=r.bits,r.mode===jn&&(r.back=-1);break}for(r.back=0;w=r.lencode[c&(1<>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>C)],y=w>>>24,b=w>>>16&255,S=w&65535,!(C+y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,r.length=S,b===0){r.mode=T1;break}if(b&32){r.back=-1,r.mode=jn;break}if(b&64){t.msg="invalid literal/length code",r.mode=nt;break}r.extra=b&15,r.mode=S1;case S1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=k1;case k1:for(;w=r.distcode[c&(1<>>24,b=w>>>16&255,S=w&65535,!(y<=u);){if(o===0)break e;o--,c+=i[s++]<>C)],y=w>>>24,b=w>>>16&255,S=w&65535,!(C+y<=u);){if(o===0)break e;o--,c+=i[s++]<>>=C,u-=C,r.back+=C}if(c>>>=y,u-=y,r.back+=y,b&64){t.msg="invalid distance code",r.mode=nt;break}r.offset=S,r.extra=b&15,r.mode=A1;case A1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=nt;break}r.mode=C1;case C1: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=nt;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),g=r.window}else g=n,p=a-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do n[a++]=g[p++];while(--h);r.length===0&&(r.mode=od);break;case T1:if(l===0)break e;n[a++]=r.length,l--,r.mode=od;break;case rg:if(r.wrap){for(;u<32;){if(o===0)break e;o--,c|=i[s++]<{"use strict";m();j1.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 z1=U((tz,V1)=>{"use strict";m();function qO(){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}V1.exports=qO});var q1=U(Bc=>{"use strict";m();var jo=G1(),Nc=Hn(),cd=qm(),bt=lg(),cg=Zf(),YO=Ym(),ZO=z1(),W1=Object.prototype.toString;function pa(t){if(!(this instanceof pa))return new pa(t);this.options=Nc.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)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new YO,this.strm.avail_out=0;var r=jo.inflateInit2(this.strm,e.windowBits);if(r!==bt.Z_OK)throw new Error(cg[r]);if(this.header=new ZO,jo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=cd.string2buf(e.dictionary):W1.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=jo.inflateSetDictionary(this.strm,e.dictionary),r!==bt.Z_OK)))throw new Error(cg[r])}pa.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,o,l,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?bt.Z_FINISH:bt.Z_NO_FLUSH,typeof t=="string"?r.input=cd.binstring2buf(t):W1.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 Nc.Buf8(i),r.next_out=0,r.avail_out=i),s=jo.inflate(r,bt.Z_NO_FLUSH),s===bt.Z_NEED_DICT&&n&&(s=jo.inflateSetDictionary(this.strm,n)),s===bt.Z_BUF_ERROR&&u===!0&&(s=bt.Z_OK,u=!1),s!==bt.Z_STREAM_END&&s!==bt.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===bt.Z_STREAM_END||r.avail_in===0&&(a===bt.Z_FINISH||a===bt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=cd.utf8border(r.output,r.next_out),l=r.next_out-o,c=cd.buf2string(r.output,o),r.next_out=l,r.avail_out=i-l,l&&Nc.arraySet(r.output,r.output,o,l,0),this.onData(c)):this.onData(Nc.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==bt.Z_STREAM_END);return s===bt.Z_STREAM_END&&(a=bt.Z_FINISH),a===bt.Z_FINISH?(s=jo.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===bt.Z_OK):(a===bt.Z_SYNC_FLUSH&&(this.onEnd(bt.Z_OK),r.avail_out=0),!0)};pa.prototype.onData=function(t){this.chunks.push(t)};pa.prototype.onEnd=function(t){t===bt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Nc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ug(t,e){var r=new pa(e);if(r.push(t,!0),r.err)throw r.msg||cg[r.err];return r.result}function KO(t,e){return e=e||{},e.raw=!0,ug(t,e)}Bc.Inflate=pa;Bc.inflate=ug;Bc.inflateRaw=KO;Bc.ungzip=ug});var K1=U((sz,Z1)=>{"use strict";m();var XO=Hn().assign,QO=Qx(),JO=q1(),eL=lg(),Y1={};XO(Y1,QO,JO,eL);Z1.exports=Y1});var J1=U((oz,Q1)=>{"use strict";m();var X1=(t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,o)=>{a?s(a):n(o)}):r.push(n),t.apply(this,r)})};Q1.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=s=>{let a=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(a):!e.exclude.some(a)},n;r==="function"?n=function(...s){return e.excludeMain?t(...s):X1(t,e).apply(this,s)}:n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?X1(a,e):a}return n}});var lE=U((cz,oE)=>{m();function eE(t){return Array.isArray(t)?t:[t]}var hg="",tE=" ",fg="\\",tL=/^\s+$/,rL=/(?:[^\\]|^)\\$/,iL=/^\\!/,nL=/^\\#/,sL=/\r?\n/g,aL=/^\.*\/|^\.+$/,dg="/",nE="node-ignore";typeof Symbol!="undefined"&&(nE=Symbol.for("node-ignore"));var rE=nE,oL=(t,e,r)=>Object.defineProperty(t,e,{value:r}),lL=/([0-z])-([0-z])/g,sE=()=>!1,cL=t=>t.replace(lL,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:hg),uL=t=>{let{length:e}=t;return t.slice(0,e-e%2)},fL=[[/^\uFEFF/,()=>hg],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?tE:hg)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+tE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>fg],[/\\\\/g,()=>fg],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===fg?`\\[${r}${uL(i)}${n}`:n==="]"&&i.length%2===0?`[${cL(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],iE=Object.create(null),dL=(t,e)=>{let r=iE[t];return r||(r=fL.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),iE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},gg=t=>typeof t=="string",hL=t=>t&&gg(t)&&!tL.test(t)&&!rL.test(t)&&t.indexOf("#")!==0,pL=t=>t.split(sL),pg=class{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}},mL=(t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(iL,"!").replace(nL,"#");let n=dL(t,e);return new pg(r,t,i,n)},gL=(t,e)=>{throw new e(t)},Vn=(t,e,r)=>gg(t)?t?Vn.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),aE=t=>aL.test(t);Vn.isNotRelative=aE;Vn.convert=t=>t;var mg=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){oL(this,rE,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[rE]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(hL(e)){let r=mL(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,eE(gg(e)?pL(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&Vn.convert(e);return Vn(s,e,this._allowRelativePaths?sE:gL),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(dg)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(dg)+dg,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return eE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},ud=t=>new mg(t),vL=t=>Vn(t&&Vn.convert(t),t,sE);ud.isPathValid=vL;ud.default=ud;oE.exports=ud;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,"/");Vn.convert=t;let e=/^[a-z]:\//i;Vn.isNotRelative=r=>e.test(r)||aE(r)}});var uE=U((fz,cE)=>{"use strict";m();function wL(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mn(t,e,r){return e=e instanceof RegExp?e:new RegExp(wL(e),"g"),t.replace(e,r)}var bL={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=mn(e,"./","/"),e=mn(e,"..","."),e=mn(e," ","-"),e=mn(e,/^[~^:?*\\\-]/g,""),e=mn(e,/[~^:?*\\]/g,"-"),e=mn(e,/[~^:?*\\\-]$/g,""),e=mn(e,"@{","-"),e=mn(e,/\.$/g,""),e=mn(e,/\/$/g,""),e=mn(e,/\.lock$/g,""),e}};cE.exports=bL});var dE=U((hz,fE)=>{m();fE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=null,l=n+1,c=[],u=[],f=[],d="",h=-1,p=0,g=1,w,y,b=function(){n>=s&&(w=r,y=n,r=i,i=w,n=s,s=y,a=!0,l=n+1)},S=function(v,x,_){return{x:v,y:x,k:_}},C=function(v,x){return{elem:v,t:x}},A=function(v,x,_){var P,T,M;for(x>_?P=c[v-1+l]:P=c[v+1+l],M=Math.max(x,_),T=M-v;T=0;--M)for(;PT-P?(a?f[f.length]=new C(i[T],h):f[f.length]=new C(i[T],g),++_,++T):v[M].y-v[M].x=v+1;--D)_[D+l]=A(D,_[D-1+l]+1,_[D+1+l]);_[v+l]=A(v,_[v-1+l]+1,_[v+1+l])}while(_[v+l]!==s);for(o=v+2*P,T=c[v+l],M=[];T!==-1;)M[M.length]=new S(u[T].x,u[T].y,null),T=u[T].k;k(M)}}}});var mE=U((mz,pE)=>{m();var _L=dE();function yL(t,e){var r=new _L(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,o=e.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:o,chain:null},s=s.chain):(n={file1index:a,file2index:o,chain:null},s=n),a--,o--):i[l].t===r.SES_DELETE?a--:i[l].t===r.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}function hE(t,e){for(var r=[],i=t.length,n=e.length,s=yL(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,o=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||o)&&r.push({file1:[i+1,a],file2:[n+1,o]})}return r.reverse(),r}function xL(t,e,r){var i,n=hE(e,t),s=hE(e,r),a=[];function o($,D){a.push([$.file1[0],D,$.file1[1],$.file2[0],$.file2[1]])}for(i=0;ic&&(l.push([1,c,$-c]),c=$)}for(var f=0;fg)break;g=Math.max(g,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var S=h[1],C=b[S],A=h[0],k=A+h[2],v=h[3],x=v+h[4];C[0]=Math.min(v,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(A,C[2]),C[3]=Math.max(k,C[3])}var _=b[0][0]+(p-b[0][2]),P=b[0][1]+(g-b[0][3]),T=b[2][0]+(p-b[2][2]),M=b[2][1]+(g-b[2][3]);l.push([-1,_,P-_,p,g-p,T,M-T])}c=g}return u(e.length),l}function EL(t,e,r){var i=[],n=[t,e,r],s=xL(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{"use strict";m();Object.defineProperty(Z,"__esModule",{value:!0});function Fs(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Uc=Fs(qb()),BE=Fs(ox()),SL=Fs(cx()),Ug=Fs(K1()),fd=Fs(J1()),kL=Fs(lE()),Gc=Fs(uE()),AL=Fs(mE()),Pe=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}},jc=class t extends Pe{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}}};jc.code="UnmergedPathsError";var me=class t extends Pe{constructor(e){super(`An internal error caused this command to fail. + +If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment. + +Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};me.code="InternalError";var zo=class t extends Pe{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};zo.code="UnsafeFilepathError";var wi=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Sd(t,e){return-(te)}function HE(t,e){return Sd(t.path,e.path)}function UE(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 gn=2**32;function gE(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Wo(t){let[e,r]=gE(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=gE(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%gn,ctimeNanoseconds:r%gn,mtimeSeconds:i%gn,mtimeNanoseconds:n%gn,dev:t.dev%gn,ino:t.ino%gn,mode:UE(t.mode%gn),uid:t.uid%gn,gid:t.gid%gn,size:t.size>-1?t.size%gn:0}}function CL(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var vg=null;async function wn(t){return vg===null&&(vg=await PL()),vg?GE(t):TL(t)}function TL(t){return new BE().update(t).digest("hex")}async function GE(t){let e=await crypto.subtle.digest("SHA-1",t);return CL(e)}async function PL(){try{return await GE(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function RL(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function $L(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(E.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Pg=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(E.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new me("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new me("Index file is empty (.git/index)");let r=new t,i=new wi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new me(`Invalid dircache magic file number: ${n}`);let s=await wn(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new me(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new me(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&ce.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Wo(r);let s=E.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` +`)}static async _entryToBuffer(e){let r=E.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=E.alloc(i),s=new wi(n),a=Wo(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE($L(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=E.alloc(12),r=new wi(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=E.concat(i),s=E.concat([e,n]),a=await wn(s);return E.concat([s,E.from(a,"hex")])}};function pd(t,e,r=!0,i=!0){let n=Wo(t),s=Wo(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var wg=null,bg=Symbol("IndexCache");function FL(){return{map:new Map,stats:new Map}}async function IL(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await Pg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function ML(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:pd(i,n)}var dt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[bg]||(i[bg]=FL());let a=`${r}/index`;wg===null&&(wg=new Uc({maxPending:1/0}));let o,l=[];return await wg.acquire(a,async()=>{let c=i[bg];await ML(e,a,c)&&await IL(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new jc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function md(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function va(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function jE(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:md(n),metadata:{},children:[]};e.set(n,s),s.parent=r(va(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:md(n),metadata:s,parent:r(va(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function DL(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 me(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Rg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=dt.acquire({fs:e,gitdir:r,cache:i},async function(s){return jE(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Sd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Wo(i.metadata);e._type=i.type==="tree"?"tree":DL(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},kd=Symbol("GitWalkSymbol");function Ea(){let t=Object.create(null);return Object.defineProperty(t,kd,{value:function({fs:e,gitdir:r,cache:i}){return new Rg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var Ge=class t extends Pe{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Ge.code="NotFoundError";var _r=class t extends Pe{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};_r.code="ObjectTypeError";var As=class t extends Pe{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};As.code="InvalidOidError";var Vc=class t extends Pe{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following: +[remote "${e}"] + fetch = +refs/heads/*:refs/remotes/origin/* +`),this.code=this.name=t.code,this.data={remote:e}}};Vc.code="NoRefspecError";var gd=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(` +`).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` +`)+` +`}},vd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new me("Invalid refspec");return new t({remotePath:i,localPath:s,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},$g=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(vd.from(i));return new t(r)}add(e){let r=vd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function OL(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(ri);return n===0?t.endsWith("^{}")?1:-1:n}function LL(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function NL(t){if(!t.length)return".";let e=t[0]==="/",r=t.at(-1)==="/";return t=LL(t,!e),t.length?(r&&(t+="/"),e?`/${t}`:t):e?"/":r?"./":"."}function H(...t){if(t.length===0)return".";let e;for(let r=0;r0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":NL(e)}var BL=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},Hc=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}`)},vE={core:{filemode:Hc,bare:Hc,logallrefupdates:Hc,symlinks:Hc,ignorecase:Hc,bigFileThreshold:BL}},HL=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,UL=/^[A-Za-z0-9-.]+$/,GL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,jL=/^[A-Za-z][A-Za-z-]*$/,VL=/^(.*?)( *[#;].*)$/,zL=t=>{let e=HL.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},WL=t=>{let e=GL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=qL(i),s=YL(n);return[r,s]}return null},qL=t=>{let e=VL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return wE(r)&&wE(i)?`${r}${i}`:r},wE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,YL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),bE=t=>t!=null?t.toLowerCase():null,Fg=(t,e,r)=>[bE(t),e,bE(r)].filter(i=>i!=null).join("."),_E=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Fg(r,n,i),sectionPath:Fg(r,n,null),isSection:!!r}},ZL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Ig=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(` +`).map(n=>{let s=null,a=null,o=n.trim(),l=zL(o),c=l!=null;if(c)[r,i]=l;else{let f=WL(o);f!=null&&([s,a]=f)}let u=Fg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=_E(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=vE[s]&&vE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=_E(e),u=ZL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(UL.test(n)&&jL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(` +`)}},ht=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Ig.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},dd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],KL=["config","description","index","shallow","commondir"],_g;async function Ss(t,e){return _g===void 0&&(_g=new Uc),_g.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let w of n.values())if(!w.match(/[0-9a-f]{40}/))throw new As(w);let u=await ht.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Vc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=$g.from(o),d=new Map;if(c){let w=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:w.map(y=>`refs/tags/${y}`)})}if(a){for(let w of n.keys())if(w.startsWith("refs/tags")&&!w.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:w})){let y=n.get(w);d.set(w,y)}}let h=f.translate([...n.keys()]);for(let[w,y]of h){let b=n.get(w);d.set(y,b)}let p=f.translate([...s.keys()]);for(let[w,y]of p){let b=s.get(w),S=f.translateOne(b);S&&d.set(y,`ref: ${S}`)}let g=[];if(l){for(let w of f.localNamespaces()){let y=(await t.listRefs({fs:e,gitdir:r,filepath:w})).map(b=>`${w}/${b}`);for(let b of y)d.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[w,y]of d)await Ss(w,async()=>e.write(H(r,w),`${y.trim()} +`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new As(n);await Ss(i,async()=>e.write(H(r,i),`${n.trim()} +`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Ss(i,async()=>e.write(H(r,i),`ref: ${n.trim()} +`,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(H(r,o))));let n=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=gd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.sizee.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let s=await t.packedRefs({fs:e,gitdir:r}),a=dd(i).filter(o=>!KL.includes(o));for(let o of a){let l=await Ss(o,async()=>await e.read(`${r}/${o}`,{encoding:"utf8"})||s.get(o));if(l)return t.resolve({fs:e,gitdir:r,ref:l.trim(),depth:n})}throw new Ge(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=dd(i);for(let a of s)if(await Ss(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new Ge(i)}static async expandAgainstMap({ref:e,map:r}){let i=dd(e);for(let n of i)if(await r.has(n))return n;throw new Ge(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=dd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new Ge(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Ss("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return gd.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(OL),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function XL(t,e){return Sd(yE(t),yE(e))}function yE(t){return t.mode==="040000"?t.path+"/":t.path}function VE(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 me(`Unexpected GitTree entry mode: ${t}`)}function QL(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` +`)}toObject(){let e=[...this._entries];return e.sort(XL),E.concat(e.map(r=>{let i=E.from(r.mode.replace(/^0/,"")),n=E.from(" "),s=E.from(r.path,"utf8"),a=E.from([0]),o=E.from(r.oid,"hex");return E.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Cs=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o>=1,n+=8;return i}function SE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=EE(t,r&n,4),o=EE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function rN(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function WE(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:rN(t)}var wd=class{constructor(e){if(typeof E=="undefined")throw new Error("Missing Buffer dependency");this.stream=WE(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)?E.alloc(0):(r&&(r=E.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>iN(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=E.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 iN(t){return t.reduce((e,r)=>e+r.length,0)}async function nN(t,e){let r=new wd(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new me(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new me(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await sN(r),f=new Ug.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new me(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new me("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function sN(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<n+1<<7|s,-1)}function cN(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<2048*1024*1024)throw new me("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+1020);let a=i.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=C);let A=Math.floor((u-C)*100/u);A!==f&&i&&await i({phase:"Receiving objects",loaded:u-C,total:u}),f=A,y=n[y],["commit","tree","blob","tag"].includes(y)?s[S]={type:y,offset:S}:y==="ofs-delta"?s[S]={type:y,offset:S}:y==="ref-delta"&&(s[S]={type:y,offset:S})});let d=Object.keys(s).map(Number);for(let[w,y]of d.entries()){let b=w+1===d.length?e.byteLength-20:d[w+1],S=s[y],C=SL.buf(e.slice(y,b))>>>0;S.end=b,S.crc=C}let h=new t({pack:Promise.resolve(e),packfileSha:a,crcs:l,hashes:o,offsets:c,getExternalRefDelta:r});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let w in s){w=Number(w);let y=Math.floor(p*100/u);y!==f&&i&&await i({phase:"Resolving deltas",loaded:p,total:u}),p++,f=y;let b=s[w];if(!b.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:S,object:C}=await h.readSlice({start:w});g[h.readDepth]+=1;let A=await wn(Cs.wrap({type:S,object:C}));b.oid=A,o.push(A),c.set(A,w),l[A]=b.crc}catch(S){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(c,u)=>{e.push(E.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let i=new wi(E.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new wi(E.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new wi(E.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=E.concat(e),o=await wn(a),l=E.alloc(20);return l.write(o,"hex"),E.concat([a,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new me(`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"},i=await this.pack;if(!i)throw new me("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let n=i.slice(e),s=new wi(n),a=s.readUInt8(),o=a&112,l=r[o];if(l===void 0)throw new me("Unrecognized type: 0b"+o.toString(2));let c=a&15,u=c;a&128&&(u=cN(s,c));let d=null,h=null;if(l==="ofs_delta"){let g=lN(s),w=e-g;({object:d,type:l}=await this.readSlice({start:w}))}if(l==="ref_delta"){let g=s.slice(20).toString("hex");({object:d,type:l}=await this.read({oid:g}))}let p=n.slice(s.tell());if(h=E.from(await qE(p)),h.byteLength!==u)throw new me(`Packfile told us object would have length ${u} but it had length ${h.byteLength}`);return d&&(h=E.from(tN(h,d))),this.readDepth>3&&(this.offsetCache[e]={type:l,object:h}),{type:l,format:"content",object:h}}},hd=Symbol("PackfileCache");async function uN({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return zc.fromIdx({idx:s,getExternalRefDelta:r})}function Gg({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[hd]||(e[hd]=new Map);let a=e[hd].get(r);return a||(a=uN({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[hd].set(r,a)),a}async function fN({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(H(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Gg({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new me(c.error);if(c.offsets.has(i)){let u=l.replace(/idx$/,"pack");c.pack||(c.pack=t.read(u));let f=await c.pack;if(!f)throw c.pack=null,new me(`Could not read packfile at ${u}. The file may be missing, corrupted, or too large to read into memory.`);if(!c._checksumVerified){let h=c.packfileSha,p=f.subarray(-20),g=Array.from(p).map(b=>b.toString(16).padStart(2,"0")).join("");if(g!==h)throw new me(`Packfile trailer mismatch: expected ${h}, got ${g}. The packfile may be corrupted.`);let w=f.subarray(0,-20),y=await wn(w);if(y!==h)throw new me(`Packfile payload corrupted: calculated ${y} but expected ${h}. The packfile may have been tampered with.`);c._checksumVerified=!0}let d=await c.read({oid:i,getExternalRefDelta:s});return d.format="content",d.source=`objects/pack/${o.replace(/idx$/,"pack")}`,d}}return null}async function et({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u=>et({fs:t,cache:e,gitdir:r,oid:u}),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:E.from("tree 0\0")}),a||(a=await zE({fs:t,gitdir:r,oid:i})),!a){if(a=await fN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new Ge(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=E.from(await qE(a.object)),a.format="wrapped"),n==="wrapped"))return a;let o=await wn(a.object);if(o!==i)throw new me(`SHA check failed! Expected ${i}, computed ${o}`);let{object:l,type:c}=Cs.unwrap(a.object);if(a.type=c,a.object=l,a.format="content",n==="content")return a;throw new me(`invalid requested format "${n}"`)}var Ui=class t extends Pe{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:i}}};Ui.code="AlreadyExistsError";var Wc=class t extends Pe{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:i}}};Wc.code="AmbiguousError";var qc=class t extends Pe{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}}};qc.code="CheckoutConflictError";var Yc=class t extends Pe{constructor(e,r){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${r} parents and require specifying which parent to use as the base.`),this.code=this.name=t.code,this.data={oid:e,parentCount:r}}};Yc.code="CherryPickMergeCommitError";var Zc=class t extends Pe{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=t.code,this.data={oid:e}}};Zc.code="CherryPickRootCommitError";var Kc=class t extends Pe{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}}};Kc.code="CommitNotFetchedError";var Xc=class t extends Pe{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Xc.code="EmptyServerResponseError";var Qc=class t extends Pe{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Qc.code="FastForwardError";var Jc=class t extends Pe{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};Jc.code="GitPushError";var qo=class t extends Pe{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:i}}};qo.code="HttpError";var Ts=class t extends Pe{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}}};Ts.code="InvalidFilepathError";var Gi=class t extends Pe{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}}};Gi.code="InvalidRefNameError";var eu=class t extends Pe{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};eu.code="MaxDepthError";var Yo=class t extends Pe{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Yo.code="MergeNotSupportedError";var wa=class t extends Pe{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};wa.code="MergeConflictError";var Xt=class t extends Pe{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}}};Xt.code="MissingNameError";var Ir=class t extends Pe{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Ir.code="MissingParameterError";var tu=class t extends Pe{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}};tu.code="MultipleGitError";var ba=class t extends Pe{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};ba.code="ParseError";var Zo=class t extends Pe{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Zo.code="PushRejectedError";var ks=class t extends Pe{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}}};ks.code="RemoteCapabilityError";var ru=class t extends Pe{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}}};ru.code="SmartHttpError";var iu=class t extends Pe{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:i}}};iu.code="UnknownTransportError";var nu=class t extends Pe{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};nu.code="UrlParseError";var Ko=class t extends Pe{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Ko.code="UserCanceledError";var su=class t extends Pe{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}}};su.code="IndexResetError";var au=class t extends Pe{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}}};au.code="NoCommitError";var YE=Object.freeze({__proto__:null,AlreadyExistsError:Ui,AmbiguousError:Wc,CheckoutConflictError:qc,CherryPickMergeCommitError:Yc,CherryPickRootCommitError:Zc,CommitNotFetchedError:Kc,EmptyServerResponseError:Xc,FastForwardError:Qc,GitPushError:Jc,HttpError:qo,InternalError:me,InvalidFilepathError:Ts,InvalidOidError:As,InvalidRefNameError:Gi,MaxDepthError:eu,MergeNotSupportedError:Yo,MergeConflictError:wa,MissingNameError:Xt,MissingParameterError:Ir,MultipleGitError:tu,NoRefspecError:Vc,NotFoundError:Ge,ObjectTypeError:_r,ParseError:ba,PushRejectedError:Zo,RemoteCapabilityError:ks,SmartHttpError:ru,UnknownTransportError:iu,UnsafeFilepathError:zo,UrlParseError:nu,UserCanceledError:Ko,UnmergedPathsError:jc,IndexResetError:su,NoCommitError:au});function Mg({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=dN(i),`${t} <${e}> ${r} ${i}`}function dN(t){let e=hN(pN(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}function hN(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function pN(t){return t===0?t:-t}function zn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` +`,t}function bd(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:mN(n)}}function mN(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),gN(i)}function gN(t){return t===0?t:-t}var Xr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(E.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new me("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 ${Mg(e.tagger)} + +${e.message} +${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` + +`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(` + +`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(` +`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=` +`+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=bd(i.tagger)),i.committer&&(i.committer=bd(i.committer)),i}withoutSignature(){let e=zn(this._tag);return e.indexOf(` +-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(` +-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(` +-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return zn(e)}payload(){return this.withoutSignature()+` +`}toObject(){return E.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=zn(s);let a=n+s;return t.from(a)}};function xg(t){return t.trim().split(` +`).map(e=>" "+e).join(` +`)+` +`}function vN(t){return t.split(` +`).map(e=>e.replace(/^ /,"")).join(` +`)}var Dr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(E.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new me("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=zn(i+` +gpgsig`+xg(r)+` +`+n);return new t(s)}static from(e){return new t(e)}toObject(){return E.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 zn(e.slice(e.indexOf(` + +`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` + +`))}parseHeaders(){let e=t.justHeaders(this._commit).split(` +`),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=` +`+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=bd(i.author)),i.committer&&(i.committer=bd(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree} +`:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 +`,e.parent){if(e.parent.length===void 0)throw new me("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s} +`}let i=e.author;r+=`author ${Mg(i)} +`;let n=e.committer||e.author;return r+=`committer ${Mg(n)} +`,e.gpgsig&&(r+="gpgsig"+xg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` +`+zn(e.message)}render(){return this._commit}withoutSignature(){let e=zn(this._commit);if(e.indexOf(` +gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(` +gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE----- +`)+28);return zn(r+` +`+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return vN(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=zn(a);let l=t.justHeaders(e._commit)+` +gpgsig`+xg(a)+` +`+s;return t.from(l)}};async function Xo({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Mr.from([]),oid:i};let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Dr.from(s).parse().tree,Xo({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new _r(i,n,"tree");return{tree:Mr.from(s),oid:i}}var Dg=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await q.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof Ge&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Xo({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await et({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new _r(l,c,o.type);let f=Mr.from(u);for(let d of f)a.set(H(r,d.path),d);return f.entries().map(d=>H(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=UE(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await et({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Kr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,kd,{value:function({fs:r,gitdir:i,cache:n}){return new Dg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var Og=class{constructor({fs:e,dir:r,gitdir:i,cache:n}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.config=null;let s=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(H(n,r));return s===null?null:s.map(a=>H(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Wo(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await dt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||pd(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await wn(Cs.wrap({type:"blob",object:h})),l&&a===l.oid&&(!f||c.mode===l.mode)&&pd(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await ht.get({fs:e,gitdir:r}),this.config)}};function tl(){let t=Object.create(null);return Object.defineProperty(t,kd,{value:function({fs:e,dir:r,gitdir:i,cache:n}){return new Og({fs:e,dir:r,gitdir:i,cache:n})}}),Object.freeze(t),t}function wN(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var ZE=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),Lg=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:a=async(l,c)=>{let u=ZE(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=n.map(h=>h[kd]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(l.length).fill("."),u=wN(0,l.length),f=async h=>{u.forEach(w=>{let y=h[w];h[w]=y&&new l[w].ConstructEntry(y)});let g=(await Promise.all(u.map(w=>{let y=h[w];return y?l[w].readdir(y):[]}))).map(w=>(w===null?[]:w)[Symbol.iterator]());return{entries:h,children:bN(g)}},d=async h=>{let{entries:p,children:g}=await f(h),w=p.find(b=>b&&b._fullpath)._fullpath,y=await s(w,p);if(y!==null){let b=await o(d,g);return b=b.filter(S=>S!==void 0),a(y,b)}};return d(c)}async function Ng(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=H(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?Ng(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function _N(t){return yN(t)&&kE(t.then)&&kE(t.catch)}function yN(t){return t&&typeof t=="object"}function kE(t){return typeof t=="function"}function AE(t){return _N((r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}})(t))}var CE=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function TE(t,e){if(AE(e))for(let r of CE)t[`_${r}`]=e[r].bind(e);else for(let r of CE)t[`_${r}`]=fd(e[r].bind(e));AE(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Ng.bind(null,t)):(e.cp&&(t._cp=fd(e.cp.bind(e))),e.rm?t._rm=fd(e.rm.bind(e)):e.rmdir.length>2?t._rm=fd(e.rmdir.bind(e)):t._rm=Ng.bind(null,t))}var te=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?TE(this,e.promises):TE(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,` +`),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=E.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(va(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=va(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Sd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return E.isBuffer(i)?i:E.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Ir(t)}function xN(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ie({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>xN(i)?i:H(va(e),i)):e}async function _d(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 KE({fs:t,dir:e,gitdir:r=H(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new te(t),a=[Kr({ref:i}),tl(),Ea()],o=[],l=await ie({fsp:s,dotgit:r});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Ps({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await _d(d,h),g=o.includes(u),w=!await _d(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(w)return!1;throw new su(u)}});await dt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Rs=class{static async isIgnored({fs:e,dir:r,gitdir:i=H(r,".git"),filepath:n}){if(md(n)===".git")return!0;if(n===".")return!1;let s="",a=H(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:H(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u{let f=await(await ht.get({fs:o,gitdir:l})).get("core.autocrlf");return Bg({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function Bg({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:o}){i=Array.isArray(i)?i:[i];let l=i.map(async d=>{if(!s&&await Rs.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(H(t,d));if(!h)throw new Ge(d);if(h.isDirectory()){let p=await r.readdir(H(t,d));if(a){let g=p.map(w=>Bg({dir:t,gitdir:e,fs:r,filepath:[H(d,w)],index:n,force:s,parallel:a,autocrlf:o}));await Promise.all(g)}else for(let g of p)await Bg({dir:t,gitdir:e,fs:r,filepath:[H(d,g)],index:n,force:s,parallel:a,autocrlf:o})}else{let p=h.isSymbolicLink()?await r.readlink(H(t,d)).then(QE):await r.read(H(t,d),{autocrlf:o});if(p===null)throw new Ge(d);let g=await Or({fs:r,gitdir:e,type:"blob",object:p});n.insert({filepath:d,stats:h,oid:g})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new tu(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function ou({fs:t,gitdir:e,path:r}){return(await ht.get({fs:t,gitdir:e})).get(r)}function eS(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}async function $s({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await ou({fs:t,gitdir:e,path:"user.name"}),email:await ou({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=eS({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}async function _a({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await ou({fs:t,gitdir:e,path:"user.name"}),email:await ou({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},o=eS({},a,n?n.committer:void 0,r,i);if(o.name!==void 0)return o}async function tS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,tS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new _r(i,n,"commit");return{commit:Dr.from(s),oid:i}}async function vn({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await tS({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}async function cu({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h}){let p=!1,g=!1;f||(g=!(await t.read(`${i}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),f=await q.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let w,y;try{w=await q.resolve({fs:t,gitdir:i,ref:f}),y=await vn({fs:t,gitdir:i,oid:w,cache:{}})}catch(C){p=!0}if(l&&p)throw new au(f);let b=l?await $s({fs:t,gitdir:i,author:s,commit:y.commit}):await $s({fs:t,gitdir:i,author:s});if(!b)throw new Xt("author");let S=l?await _a({fs:t,gitdir:i,author:b,committer:a,commit:y.commit}):await _a({fs:t,gitdir:i,author:b,committer:a});if(!S)throw new Xt("committer");return dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(C){let k=jE(C.entries).get(".");if(h||(h=await rS({fs:t,gitdir:i,inode:k,dryRun:c})),d?d=await Promise.all(d.map(_=>q.resolve({fs:t,gitdir:i,ref:_}))):l?d=y.commit.parent:d=w?[w]:[],!n)if(l)n=y.commit.message;else throw new Ir("message");let v=Dr.from({tree:h,parent:d,author:b,committer:S,message:n});o&&(v=await Dr.sign(v,r,o));let x=await Or({fs:t,gitdir:i,type:"commit",object:v.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:t,gitdir:i,ref:g?"HEAD":f,value:x}),x})}async function rS({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let l of n)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await rS({fs:t,gitdir:e,inode:l,dryRun:i}));let s=n.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),a=Mr.from(s);return await Or({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}async function uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Ts("leading-slash");if(n.endsWith("/"))throw new Ts("trailing-slash");let s=i,a=await Xo({fs:t,cache:e,gitdir:r,oid:i}),o=a.tree;if(n==="")i=a.oid;else{let l=n.split("/");i=await iS({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:s,filepath:n})}return i}async function iS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let o=n.shift();for(let l of i)if(l.path===o){if(n.length===0)return l.oid;{let{type:c,object:u}=await et({fs:t,cache:e,gitdir:r,oid:l.oid});if(c!=="tree")throw new _r(s,c,"tree",a);return i=Mr.from(u),iS({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new Ge(`file or directory found at "${s}:${a}"`)}async function rl({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await Xo({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}async function fu({fs:t,gitdir:e,tree:r}){let i=Mr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}async function AN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:i,fs:t,ref:n})}catch(y){if(!(y instanceof Ge))throw y}let h=(await rl({fs:t,cache:e,gitdir:i,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(y=>y.path!==s);else for(let y of h)if(y.path===s)throw new Ui("note",s);typeof a=="string"&&(a=E.from(a,"utf8"));let p=await Or({fs:t,gitdir:i,type:"blob",object:a,format:"content"});h.push({mode:"100644",path:s,oid:p,type:"blob"});let g=await fu({fs:t,gitdir:i,tree:h});return await cu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' +`,author:l,committer:c,signingKey:u})}async function nS({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",i),R("oid",s),R("note",a),u&&R("onSign",e);let d=new te(t),h=await $s({fs:d,gitdir:i,author:l});if(!h)throw new Xt("author");let p=await _a({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Xt("committer");let g=await ie({fsp:d,dotgit:i});return await AN({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var CN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function lu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!CN.test(t)&&(!!e||t.includes("/"))}async function sS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let s=await ht.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Ui("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await ht.save({fs:t,gitdir:e,config:s})}async function aS({fs:t,dir:e,gitdir:r=H(e,".git"),remote:i,url:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("remote",i),R("url",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await sS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function TN({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await q.exists({fs:t,gitdir:i,ref:n}))throw new Ui("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await et({fs:t,cache:e,gitdir:i,oid:f}),h=Xr.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await Xr.sign(h,r,c));let p=await Or({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function oS({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",i),R("ref",n),c&&R("onSign",e);let d=new te(t),h=await ie({fsp:d,dotgit:i}),p=await $s({fs:d,gitdir:h,author:s});if(!p)throw new Xt("tagger");return await TN({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function PN({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",r,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function lS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await PN({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}var cS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function jg({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let w;if(i)try{w=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(b){w="0000000000000000000000000000000000000000"}let y;try{y=await q.resolve({fs:t,gitdir:s,ref:o})}catch(b){if(o==="HEAD")throw b;let S=`${a}/${o}`;if(y=await q.resolve({fs:t,gitdir:s,ref:S}),h){let C=await ht.get({fs:t,gitdir:s});await C.set(`branch.${o}.remote`,a),await C.set(`branch.${o}.merge`,`refs/heads/${o}`),await ht.save({fs:t,gitdir:s,config:C})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:y})}if(!c){let b;try{b=await RN({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(v){throw v instanceof Ge&&v.data.what===y?new Kc(o,y):v}let S=b.filter(([v])=>v==="conflict").map(([v,x])=>x);if(S.length>0)throw new qc(S);let C=b.filter(([v])=>v==="error").map(([v,x])=>x);if(C.length>0)throw new me(C.join(", "));if(f){i&&await i({previousHead:w,newHead:y,type:l!=null&&l.length>0?"file":"branch"});return}let A=0,k=b.length;if(await dt.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(b.filter(([x])=>x==="delete"||x==="delete-index").map(async function([x,_]){let P=`${n}/${_}`;x==="delete"&&await t.rm(P),v.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}))}),await dt.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[x,_]of b)if(x==="rmdir"||x==="rmdir-index"){let P=`${n}/${_}`;try{x==="rmdir"&&await t.rmdir(P),v.delete({filepath:_}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}catch(T){if(T.code==="ENOTEMPTY")console.log(`Did not delete ${_} because directory is not empty`);else throw T}}}),await Promise.all(b.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,x]){let _=`${n}/${x}`;await t.mkdir(_),r&&await r({phase:"Updating workdir",loaded:++A,total:k})})),p){let v=b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index"),x=await PE("Update Working Dir",v.map(([_,P,T,M,$])=>()=>FN({fs:t,cache:e,gitdir:s,dir:n},[_,P,T,M,$])),r,g);await dt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(_){await PE("Update Index",x.map(([P,T,M])=>()=>$N({index:_,fullpath:P,oid:T,stats:M})),r,g)})}else await dt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(b.filter(([x])=>x==="create"||x==="create-index"||x==="update"||x==="mkdir-index").map(async function([x,_,P,T,M]){let $=`${n}/${_}`;try{if(x!=="create-index"&&x!=="mkdir-index"){let{object:Q}=await et({fs:t,cache:e,gitdir:s,oid:P});if(M&&await t.rm($),T===33188)await t.write($,Q);else if(T===33261)await t.write($,Q,{mode:511});else if(T===40960)await t.writelink($,Q);else throw new me(`Invalid mode 0o${T.toString(8)} detected in blob ${P}`)}let D=await t.lstat($);T===33261&&(D.mode=493),x==="mkdir-index"&&(D.mode=57344),v.insert({filepath:_,stats:D,oid:P}),r&&await r({phase:"Updating workdir",loaded:++A,total:k})}catch(D){console.log(D)}}))});i&&await i({previousHead:w,newHead:y,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let b=await q.expand({fs:t,gitdir:s,ref:o});b.startsWith("refs/heads")?await q.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:b}):await q.writeRef({fs:t,gitdir:s,ref:"HEAD",value:y})}}async function RN({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:o}){let l=0;return Ps({fs:t,cache:e,dir:i,gitdir:n,trees:[Kr({ref:s}),tl(),Ea()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>cS(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 a&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await f.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!a)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=ZE(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function $N({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}async function FN({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,o,l]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){let{object:f}=await et({fs:t,cache:e,gitdir:r,oid:a});if(l&&await t.rm(c),o===33188)await t.write(c,f);else if(o===33261)await t.write(c,f,{mode:511});else if(o===40960)await t.writelink(c,f);else throw new me(`Invalid mode 0o${o.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return o===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}async function PE(t,e,r,i){let n=[];try{for(let s=0;sl());(await Promise.allSettled(a)).forEach(l=>{l.status==="fulfilled"&&n.push(l.value)}),r&&await r({phase:"Updating workdir",loaded:s+a.length,total:e.length})}return n}catch(s){console.error(`Error during ${t}: ${s}`)}return n}async function Vg({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=H(i,".git"),remote:s="origin",ref:a,filepaths:o,noCheckout:l=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:p=!1,batchSize:g=100}){try{R("fs",t),R("dir",i),R("gitdir",n);let w=a||"HEAD",y=new te(t),b=await ie({fsp:y,dotgit:n});return await jg({fs:y,cache:h,onProgress:e,onPostCheckout:r,dir:i,gitdir:b,remote:s,ref:w,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,nonBlocking:p,batchSize:g})}catch(w){throw w.caller="git.checkout",w}}var Sg=/^.*(\r?\n|$)/gm;function IN({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],o=s.match(Sg),l=n.match(Sg),c=a.match(Sg),u=AL(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)} ${i} +`);return{cleanMerge:h,mergedText:d}}async function uS({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Kr({ref:s}),g=Kr({ref:a}),w=Kr({ref:o}),y=[],b=[],S=[],C=[],A=await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,w],map:async function(k,[v,x,_]){let P=md(k),T=await _d(v,x),M=await _d(_,x);switch(`${T}-${M}`){case"false-false":return{mode:await x.mode(),path:P,oid:await x.oid(),type:await x.type()};case"false-true":return!_&&await v.type()==="tree"?{mode:await v.mode(),path:P,oid:await v.oid(),type:await v.type()}:_?{mode:await _.mode(),path:P,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return!v&&await _.type()==="tree"?{mode:await _.mode(),path:P,oid:await _.oid(),type:await _.type()}:v?{mode:await v.mode(),path:P,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&_&&await v.type()==="tree"&&await _.type()==="tree")return{mode:await v.mode(),path:P,oid:await v.oid(),type:"tree"};if(v&&_&&await v.type()==="blob"&&await _.type()==="blob")return MN({fs:t,gitdir:i,path:P,ours:v,base:x,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async $=>{if($.cleanMerge)d||n.insert({filepath:k,oid:$.mergeResult.oid,stage:0});else if(y.push(k),b.push(k),!d){let D="";x&&await x.type()==="blob"&&(D=await x.oid());let Q=await v.oid(),ye=await _.oid();n.delete({filepath:k}),D&&n.insert({filepath:k,oid:D,stage:1}),n.insert({filepath:k,oid:Q,stage:2}),n.insert({filepath:k,oid:ye,stage:3})}return $.mergeResult});if(x&&!v&&_&&await x.type()==="blob"&&await _.type()==="blob"){if(y.push(k),S.push(k),!d){let $=await x.oid(),D=await _.oid();n.delete({filepath:k}),n.insert({filepath:k,oid:$,stage:1}),n.insert({filepath:k,oid:D,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:P}}if(x&&v&&!_&&await x.type()==="blob"&&await v.type()==="blob"){if(y.push(k),C.push(k),!d){let $=await x.oid(),D=await v.oid();n.delete({filepath:k}),n.insert({filepath:k,oid:$,stage:1}),n.insert({filepath:k,oid:D,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:P}}if(x&&!v&&!_&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new Yo}}},reduce:y.length!==0&&(!r||d)?void 0:async(k,v)=>{let x=v.filter(Boolean);if(k&&!(k&&k.type==="tree"&&x.length===0&&k.path!==".")){if(x.length>0||k.path==="."&&x.length===0){let P=new Mr(x).toObject(),T=await Or({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});k.oid=T}return k}}});return y.length!==0?(r&&!d&&await Ps({fs:t,cache:e,dir:r,gitdir:i,trees:[Kr({ref:A.oid})],map:async function(k,[v]){let x=`${r}/${k}`;if(await v.type()==="blob"){let _=await v.mode(),P=new TextDecoder().decode(await v.content());await t.write(x,P,{mode:_})}return!0}}),new wa(y,b,S,C)):A.oid}async function MN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=IN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=E.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let w=E.from(await i.content()).toString("utf8"),y=E.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,a,o],contents:[p,w,y],path:r}),C=await Or({fs:t,gitdir:e,type:"blob",object:E.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:r,oid:C,type:f}}}var DN={stage:Ea,workdir:tl},kg;async function Qo(t,e){return kg===void 0&&(kg=new Uc),kg.acquire(t,e)}async function ON(t,e,r,i,n=null){let s=H(r,i),a=await t.lstat(s);if(!a)throw new Ge(s);if(a.isDirectory())throw new me(`${s}: file expected, but found directory`);let o=n?await zE({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await Qo({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(QE):await t.read(s);if(c===null)throw new Ge(s);l=await Or({fs:t,gitdir:e,type:"blob",object:c})}),l}async function LN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await fu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await ON(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function RE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?DN[h]():h),a=[],u=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0?p:void 0),iterate:async(h,p)=>{let g=[];for(let w of p){let[y,b]=w;n?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(w):a.push([null,b])):y&&(b?g.push(w):a.push([y,null]))}return g.length?Promise.all(g.map(h)):[]}});if(a.length===0||u.length===0)return null;let d=(await LN({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return fu({fs:t,gitdir:r,tree:d})}async function fS({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],o=[],l=await Ps({fs:t,cache:{},dir:e,gitdir:r,trees:[Kr({ref:n}),Kr({ref:i})],map:async(c,[u,f])=>{if(c==="."||await Rs.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let p=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&o.push({filepath:c,oid:await u.oid()}),{method:p,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(s&&o.push({filepath:c,oid:h,stats:await t.lstat(H(e,c))}),{method:"write",filepath:c,oid:h})}});await Qo({fs:t,gitdir:r,dirRemoved:a,ops:l},async()=>{for(let c of l){let u=H(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(f=>u.startsWith(f))){let{object:f}=await et({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await dt.acquire({fs:t,gitdir:r,cache:{}},async c=>{o.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}async function $E({fs:t,cache:e,dir:r,gitdir:i,oid:n,dryRun:s=!1,noUpdateBranch:a=!1,abortOnConflict:o=!0,committer:l,mergeDriver:c}){let{commit:u,oid:f}=await vn({fs:t,cache:e,gitdir:i,oid:n});if(u.parent.length>1)throw new Yc(f,u.parent.length);if(u.parent.length===0)throw new Zc(f);let d=await q.resolve({fs:t,gitdir:i,ref:"HEAD"}),{commit:h}=await vn({fs:t,cache:e,gitdir:i,oid:d}),p=u.parent[0],{commit:g}=await vn({fs:t,cache:e,gitdir:i,oid:p}),w=await dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async b=>uS({fs:t,cache:e,dir:r,gitdir:i,index:b,ourOid:h.tree,baseOid:g.tree,theirOid:u.tree,ourName:"HEAD",baseName:`parent of ${f.slice(0,7)}`,theirName:f.slice(0,7),dryRun:s,abortOnConflict:o,mergeDriver:c}));if(w instanceof wa)throw w;let y=await cu({fs:t,cache:e,gitdir:i,message:u.message,tree:w,parent:[d],author:u.author,committer:l,dryRun:s,noUpdateBranch:a});return r&&!s&&!a&&await fS({fs:t,dir:r,gitdir:i,stashCommit:y,parentCommit:d,wasStaged:!0}),y}async function dS({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,cache:n={},committer:s,dryRun:a=!1,noUpdateBranch:o=!1,abortOnConflict:l=!0,mergeDriver:c}){try{R("fs",t),R("gitdir",r),R("oid",i);let u=new te(t),f=await ie({fsp:u,dotgit:r}),{commit:d}=await vn({fs:u,cache:n,gitdir:f,oid:i});if(d.parent&&d.parent.length>1)return await $E({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:void 0,mergeDriver:c});let h=await _a({fs:u,gitdir:f,committer:s});if(!h)throw new Xt("committer");return await $E({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:h,mergeDriver:c})}catch(u){throw u.caller="git.cherryPick",u}}var NN=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function ga(t){let e=NN.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Is({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await q.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await q.resolve({fs:t,gitdir:e,ref:n})}catch(s){return}if(n.startsWith("refs/"))return r?n:ga(n)}function BN(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function hS({username:t="",password:e=""}){return`Basic ${E.from(`${t}:${e}`).toString("base64")}`}async function du(t,e){let r=WE(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}async function yd(t){let e=0,r=[];await du(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}function FE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}function Hg(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var lt=class{static flush(){return E.from("0000","utf8")}static delim(){return E.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=E.from(e));let r=e.length+4,i=Hg(4,r);return E.concat([E.from(i,"utf8"),e])}static streamReader(e){let r=new wd(e);return async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s==null?!0:s}catch(n){return e.error=n,!0}}}};async function IE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function ME(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=lt.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new Xc;if(a.includes("version 2"))return IE(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new ba(`# service=${e}\\n`,a.toString("utf8"));let o=await s();for(;o===null;)o=await s();if(o===!0)return{capabilities:r,refs:i,symrefs:n};if(o=o.toString("utf8"),o.includes("version 2"))return IE(s);let[l,c]=Ag(o,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Ag(l," "," ");for(i.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,p]=Ag(d.toString("utf8")," "," ");i.set(p,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&n.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}function Ag(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new ba(`Two strings separated by '${r}'`,t.toString("utf8"));return i}var DE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,OE=(t,e)=>{(e.username||e.password)&&(t.Authorization=hS(e)),e.headers&&Object.assign(t,e.headers)},Cg=async t=>{try{let e=E.from(await yd(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},Jo=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=FE(l),h=a?DE(a,f):f;(d.username||d.password)&&(c.Authorization=hS(d)),u===2&&(c["Git-Protocol"]="version=2");let p,g,w=!1;do if(p=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let y=w?s:i;if(y){if(d=await y(f,{...d,headers:{...c}}),d&&d.cancel)throw new Ko;d&&(OE(c,d),w=!0,g=!0)}}else p.statusCode===200&&w&&n&&await n(f,d);while(g);if(p.statusCode!==200){let{response:y}=await Cg(p);throw new qo(p.statusCode,p.statusMessage,y)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let y=await ME(p.body,{service:o});return y.auth=d,y}else{let{preview:y,response:b,data:S}=await Cg(p);try{let C=await ME([S],{service:o});return C.auth=d,C}catch(C){throw new ru(y,b)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:o,headers:l}){let c=FE(s);c&&(s=c.url),i&&(s=DE(i,s)),l["content-type"]=`application/x-${n}-request`,l.accept=`application/x-${n}-result`,OE(l,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=Cg(u);throw new qo(u.statusCode,u.statusMessage,f)}return u}},el=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",Jo),r.set("https",Jo);let i=HN({url:e});if(!i)throw new nu(e);if(r.has(i.transport))return r.get(i.transport);throw new iu(e,i.transport,i.transport==="ssh"?BN(e):void 0)}};function HN({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 ma=null,ya=class{static async read({fs:e,gitdir:r}){ma===null&&(ma=new Uc);let i=H(r,"shallow"),n=new Set;return await ma.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(` +`).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ma===null&&(ma=new Uc);let n=H(r,"shallow");if(i.size>0){let s=[...i].join(` +`)+` +`;await ma.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ma.acquire(n,async function(){await e.rm(n)})}};async function UN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function GN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(H(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await Gg({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new me(l.error);if(l.offsets.has(i))return!0}return!1}async function LE({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>et({fs:t,cache:e,gitdir:r,oid:o}),a=await UN({fs:t,gitdir:r,oid:i});return a||(a=await GN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function jN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function pS(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Ad={name:"isomorphic-git",version:"1.37.4",agent:"git/isomorphic-git@1.37.4"},Vo=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 VN(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 mS(t){let e=new Vo,r="";return(async()=>(await du(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=VN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var xd=class{static demux(e){let r=lt.streamReader(e),i=new Vo,n=new Vo,s=new Vo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function zN(t){let{packetlines:e,packfile:r,progress:i}=xd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{du(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new As(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function WN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(lt.encode(`want ${c}${l} +`)),l="";for(let c of i)o.push(lt.encode(`shallow ${c} +`));n!==null&&o.push(lt.encode(`deepen ${n} +`)),s!==null&&o.push(lt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)} +`));for(let c of a)o.push(lt.encode(`deepen-not ${c} +`));o.push(lt.flush());for(let c of r)o.push(lt.encode(`have ${c} +`));return o.push(lt.encode(`done +`)),o}async function zg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:w=[],relative:y=!1,tags:b=!1,singleBranch:S=!1,headers:C={},prune:A=!1,pruneTags:k=!1}){let v=c||await Is({fs:t,gitdir:l,test:!0}),x=await ht.get({fs:t,gitdir:l}),_=f||v&&await x.get(`branch.${v}.remote`)||"origin",P=d||await x.get(`remote.${_}.url`);if(typeof P=="undefined")throw new Ir("remote OR url");let T=u||v&&await x.get(`branch.${v}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let M=el.getRemoteHelperFor({url:P}),$=await M.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:h,service:"git-upload-pack",url:P,headers:C,protocolVersion:1}),D=$.auth,Q=$.refs;if(Q.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!$.capabilities.has("shallow"))throw new ks("shallow","depth");if(g!==null&&!$.capabilities.has("deepen-since"))throw new ks("deepen-since","since");if(w.length>0&&!$.capabilities.has("deepen-not"))throw new ks("deepen-not","exclude");if(y===!0&&!$.capabilities.has("deepen-relative"))throw new ks("deepen-relative","relative");let{oid:ye,fullref:de}=q.resolveAgainstMap({ref:T,map:Q});for(let B of Q.keys())B===de||B==="HEAD"||B.startsWith("refs/heads/")||b&&B.startsWith("refs/tags/")||Q.delete(B);let J=pS([...$.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ad.agent}`]);y&&J.push("deepen-relative");let X=S?[ye]:Q.values(),he=S?[v]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let B of he)try{B=await q.expand({fs:t,gitdir:l,ref:B});let N=await q.resolve({fs:t,gitdir:l,ref:B});await LE({fs:t,cache:e,gitdir:l,oid:N})&&z.push(N)}catch(N){}z=[...new Set(z)];let K=await ya.read({fs:t,gitdir:l}),G=$.capabilities.has("shallow")?[...K]:[],Me=WN({capabilities:J,wants:X,haves:z,shallows:G,depth:p,since:g,exclude:w}),Et=E.from(await yd(Me)),Ht=await M.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:D,body:[Et],headers:C}),De=await zN(Ht.body);Ht.headers&&(De.headers=Ht.headers);for(let B of De.shallows)if(!K.has(B))try{let{object:N}=await et({fs:t,cache:e,gitdir:l,oid:B}),ue=new Dr(N),Re=await Promise.all(ue.headers().parent.map(Pr=>LE({fs:t,cache:e,gitdir:l,oid:Pr})));Re.length===0||Re.every(Pr=>Pr)||K.add(B)}catch(N){K.add(B)}for(let B of De.unshallows)K.delete(B);if(await ya.write({fs:t,gitdir:l,oids:K}),S){let B=new Map([[de,ye]]),N=new Map,ue=10,Re=de;for(;ue--;){let vo=$.symrefs.get(Re);if(vo===void 0)break;N.set(Re,vo),Re=vo}let Ut=Q.get(Re);Ut&&B.set(Re,Ut);let{pruned:Pr}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:B,symrefs:N,tags:b,prune:A});A&&(De.pruned=Pr)}else{let{pruned:B}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:Q,symrefs:$.symrefs,tags:b,prune:A,pruneTags:k});A&&(De.pruned=B)}if(De.HEAD=$.symrefs.get("HEAD"),De.HEAD===void 0){let{oid:B}=q.resolveAgainstMap({ref:"HEAD",map:Q});for(let[N,ue]of Q.entries())if(N!=="HEAD"&&ue===B){De.HEAD=N;break}}let Rt=de.startsWith("refs/tags")?"tag":"branch";if(De.FETCH_HEAD={oid:ye,description:`${Rt} '${ga(de)}' of ${P}`},i||n){let B=mS(De.progress);du(B,async N=>{if(n&&await n(N),i){let ue=N.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);ue&&await i({phase:ue[1].trim(),loaded:parseInt(ue[2],10),total:parseInt(ue[3],10)})}})}let $t=E.from(await yd(De.packfile));if(Ht.body.error)throw Ht.body.error;let Xe=$t.slice(-20).toString("hex"),re={defaultBranch:De.HEAD,fetchHead:De.FETCH_HEAD.oid,fetchHeadDescription:De.FETCH_HEAD.description};if(De.headers&&(re.headers=De.headers),A&&(re.pruned=De.pruned),Xe!==""&&!jN($t)){re.packfile=`objects/pack/pack-${Xe}.pack`;let B=H(l,re.packfile);await t.write(B,$t);let N=Re=>et({fs:t,cache:e,gitdir:l,oid:Re}),ue=await zc.fromPack({pack:$t,getExternalRefDelta:N,onProgress:i});await t.write(B.replace(/\.pack$/,".idx"),await ue.toBuffer())}return re}async function gS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:H(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core] + repositoryformatversion = 0 + filemode = false + bare = ${e} +`+(e?"":` logallrefupdates = true +`)+` symlinks = false + ignorecase = true +`),await t.write(i+"/HEAD",`ref: refs/heads/${n} +`)}async function qN({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:w,exclude:y,relative:b,singleBranch:S,noCheckout:C,noTags:A,headers:k,nonBlocking:v,batchSize:x=100}){try{if(await gS({fs:t,gitdir:u}),await sS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await ht.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await ht.save({fs:t,gitdir:u,config:T})}let{defaultBranch:_,fetchHead:P}=await zg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:w,exclude:y,relative:b,singleBranch:S,headers:k,tags:!A});if(P===null)return;h=h||_,h=h.replace("refs/heads/",""),await jg({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:C,nonBlocking:v,batchSize:x})}catch(_){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),_}}async function vS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=H(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:w=[],relative:y=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:C=!1,headers:A={},cache:k={},nonBlocking:v=!1,batchSize:x=100}){try{R("fs",t),R("http",e),R("gitdir",c),S||R("dir",l),R("url",u);let _=new te(t),P=await ie({fsp:_,dotgit:c});return await qN({fs:_,cache:k,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:w,relative:y,singleBranch:b,noCheckout:S,noTags:C,headers:A,nonBlocking:v,batchSize:x})}catch(_){throw _.caller="git.clone",_}}async function wS({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:d,tree:h,cache:p={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let g=new te(t),w=await ie({fsp:g,dotgit:i});return await cu({fs:g,cache:p,onSign:e,gitdir:w,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:d,tree:h})}catch(g){throw g.caller="git.commit",g}}async function bS({fs:t,dir:e,gitdir:r=H(e,".git"),fullname:i=!1,test:n=!1}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Is({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function YN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:t,gitdir:e,ref:r}))throw new Ge(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Is({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await q.resolve({fs:t,gitdir:e,ref:n});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:n});let a=ga(r),o=await ht.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await ht.save({fs:t,gitdir:e,config:o})}async function _S({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await YN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function yS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});await q.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function ZN({fs:t,gitdir:e,remote:r}){let i=await ht.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await ht.save({fs:t,gitdir:e,config:i})}async function xS({fs:t,dir:e,gitdir:r=H(e,".git"),remote:i}){try{R("fs",t),R("remote",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await ZN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function KN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:t,gitdir:e,ref:r})}async function ES({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await KN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function XN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function QN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(H(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await Gg({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new me(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function JN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>et({fs:t,cache:e,gitdir:r,oid:o}),s=await XN({fs:t,gitdir:r,oid:i}),a=await QN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Wc("oids",i,s):new Ge(`an object matching "${i}"`)}async function SS({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await JN({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.expandOid",s}}async function kS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i}){try{R("fs",t),R("gitdir",r),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await q.expand({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.expandRef",n}}async function Wg({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((o,l)=>({index:l,oid:o}));for(;a.length;){let o=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of a)try{let{object:f}=await et({fs:t,cache:e,gitdir:r,oid:c}),d=Dr.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!n[p]||!n[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}a=Array.from(l.values())}return[]}async function AS({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:g,mergeDriver:w,allowUnrelatedHistories:y=!1}){n===void 0&&(n=await Is({fs:t,gitdir:i,fullname:!0})),n=await q.expand({fs:t,gitdir:i,ref:n}),s=await q.expand({fs:t,gitdir:i,ref:s});let b=await q.resolve({fs:t,gitdir:i,ref:n}),S=await q.resolve({fs:t,gitdir:i,ref:s}),C=await Wg({fs:t,cache:e,gitdir:i,oids:[b,S]});if(C.length!==1)if(C.length===0&&y)C.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Yo;let A=C[0];if(A===S)return{oid:b,alreadyMerged:!0};if(a&&A===b)return!l&&!c&&await q.writeRef({fs:t,gitdir:i,ref:n,value:S}),{oid:S,fastForward:!0};{if(o)throw new Qc;let k=await dt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async x=>uS({fs:t,cache:e,dir:r,gitdir:i,index:x,ourOid:b,theirOid:S,baseOid:A,ourName:ga(n),baseName:"base",theirName:ga(s),dryRun:l,abortOnConflict:u,mergeDriver:w}));if(k instanceof wa)throw k;return f||(f=`Merge branch '${ga(s)}' into ${ga(n)}`),{oid:await cu({fs:t,cache:e,gitdir:i,message:f,ref:n,tree:k,parent:[b,S],author:d,committer:h,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:k,mergeCommit:!0}}}async function CS({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:g,fastForward:w,fastForwardOnly:y,corsProxy:b,singleBranch:S,headers:C,author:A,committer:k,signingKey:v}){try{if(!u){let P=await Is({fs:t,gitdir:c});if(!P)throw new Ir("ref");u=P}let{fetchHead:x,fetchHeadDescription:_}=await zg({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:d,remoteRef:h,singleBranch:S,headers:C,prune:p,pruneTags:g});await AS({fs:t,cache:e,gitdir:c,ours:u,theirs:x,fastForward:w,fastForwardOnly:y,message:`Merge ${_}`,author:A,committer:k,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await jg({fs:t,cache:e,onProgress:i,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(x){throw x.caller="git.pull",x}}async function TS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:g={},cache:w={}}){try{R("fs",t),R("http",e),R("gitdir",l);let y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},b=new te(t),S=await ie({fsp:b,dotgit:l});return await CS({fs:b,cache:w,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:S,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:g,author:y,committer:y})}catch(y){throw y.caller="git.fastForward",y}}async function PS({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:w=[],relative:y=!1,tags:b=!1,singleBranch:S=!1,headers:C={},prune:A=!1,pruneTags:k=!1,cache:v={}}){try{R("fs",t),R("http",e),R("gitdir",l);let x=new te(t),_=await ie({fsp:x,dotgit:l});return await zg({fs:x,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:_,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:g,exclude:w,relative:y,tags:b,singleBranch:S,headers:C,prune:A,pruneTags:k})}catch(x){throw x.caller="git.fetch",x}}async function RS({fs:t,dir:e,gitdir:r=H(e,".git"),oids:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Wg({fs:s,cache:n,gitdir:a,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}async function $S({fs:t,filepath:e}){if(await t.exists(H(e,".git")))return e;{let r=va(e);if(r===e)throw new Ge(`git root for ${e}`);return $S({fs:t,filepath:r})}}async function FS({fs:t,filepath:e}){try{return R("fs",t),R("filepath",e),await $S({fs:new te(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function IS({fs:t,dir:e,gitdir:r=H(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await ou({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfig",n}}async function eB({fs:t,gitdir:e,path:r}){return(await ht.get({fs:t,gitdir:e})).getall(r)}async function MS({fs:t,dir:e,gitdir:r=H(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await eB({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}async function DS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1}){try{R("http",t),R("url",s);let c=await el.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),g=u;for(let w of h)g[w]=g[w]||{},g=g[w];g[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),g=u;for(let w of h)g[w]=g[w]||{},g=g[w];g[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function OS(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let l=s.replace("^{}",""),c=n[n.length-1],u=c.ref===l?c:n.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let o={ref:s,oid:a};r&&t.symrefs.has(s)&&(o.target=t.symrefs.get(s)),n.push(o)}return n}async function LS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2}){try{R("http",t),R("url",s);let u=await el.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,p]=d.split("=");p?f[h]=p:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:OS(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function tB({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Cs.wrap({type:t,object:e})),i=await wn(e)),{oid:i,object:e}}async function NS({object:t}){try{R("object",t),typeof t=="string"?t=E.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await tB({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function rB({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=H(i,s);let a=await t.read(s),o=c=>et({fs:t,cache:e,gitdir:n,oid:c}),l=await zc.fromPack({pack:a,getExternalRefDelta:o,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(a){throw a.caller="git.indexPack",a}}async function BS({fs:t,onProgress:e,dir:r,gitdir:i=H(r,".git"),filepath:n,cache:s={}}){try{R("fs",t),R("dir",r),R("gitdir",r),R("filepath",n);let a=new te(t),o=await ie({fsp:a,dotgit:i});return await rB({fs:a,cache:s,onProgress:e,dir:r,gitdir:o,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}async function HS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:H(r,".git"),defaultBranch:n="master"}){try{R("fs",t),R("gitdir",i),e||R("dir",r);let s=new te(t),a=await ie({fsp:s,dotgit:i});return await gS({fs:s,bare:e,dir:r,gitdir:a,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}async function US({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await ya.read({fs:t,gitdir:r});if(!i)throw new Ir("oid");if(!n)throw new Ir("ancestor");if(i===n)return!1;let o=[i],l=new Set,c=0;for(;o.length;){if(c++===s)throw new eu(s);let u=o.shift(),{type:f,object:d}=await et({fs:t,cache:e,gitdir:r,oid:u});if(f!=="commit")throw new _r(u,f,"commit");let h=Dr.from(d).parse();for(let p of h.parent)if(p===n)return!0;if(!a.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function GS({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{R("fs",t),R("gitdir",r),R("oid",i),R("ancestor",n);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await US({fs:o,cache:a,gitdir:l,oid:i,ancestor:n,depth:s})}catch(o){throw o.caller="git.isDescendent",o}}async function jS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return Rs.isIgnored({fs:n,dir:e,gitdir:s,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}async function VS({fs:t,dir:e,gitdir:r=H(e,".git"),remote:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listBranches({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.listBranches",n}}async function iB({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await q.resolve({gitdir:e,fs:t,ref:r}),s=[];return await zS({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return dt.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}async function zS({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await rl({fs:t,cache:e,gitdir:r,oid:i});for(let o of a)o.type==="tree"?await zS({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:n,prefix:H(s,o.path)}):n.push(H(s,o.path))}async function WS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,cache:n={}}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await iB({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listFiles",s}}async function nB({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await q.resolve({gitdir:r,fs:t,ref:i})}catch(o){if(o instanceof Ge)return[]}return(await rl({fs:t,cache:e,gitdir:r,oid:n})).tree.map(o=>({target:o.path,note:o.oid}))}async function qS({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await nB({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listNotes",s}}async function YS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listRefs({fs:n,gitdir:s,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}async function sB({fs:t,gitdir:e}){let r=await ht.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}async function ZS({fs:t,dir:e,gitdir:r=H(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return await sB({fs:i,gitdir:n})}catch(i){throw i.caller="git.listRemotes",i}}async function aB(t){let e=lt.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),o={ref:s,oid:n};for(let l of a){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}r.push(o)}return r}async function oB({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(lt.encode(`command=ls-refs +`)),i.push(lt.encode(`agent=${Ad.agent} +`)),(r||e||t)&&i.push(lt.delim()),r&&i.push(lt.encode("peel")),e&&i.push(lt.encode("symrefs")),t&&i.push(lt.encode(`ref-prefix ${t}`)),i.push(lt.flush()),i}async function KS({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let d=await Jo.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return OS(d,c,u,f);let h=await oB({prefix:c,symrefs:u,peelTags:f}),p=await Jo.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return aB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function XS({fs:t,dir:e,gitdir:r=H(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return q.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function lB(t,e){return t.committer.timestamp-e.committer.timestamp}var cB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function NE({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===cB)return;let s=i,a,o=await Xo({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await QS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function QS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=H(o,c.path),a.push(u)):c.type==="tree"&&(u=et({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return QS({fs:t,cache:e,gitdir:r,tree:Mr.from(f),fileId:n,oid:s,filepaths:a,parentPath:H(o,c.path)})})),u});return await Promise.all(l),a}async function uB({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l}){let c=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),u=[],f=await ya.read({fs:t,gitdir:r}),d=await q.resolve({fs:t,gitdir:r,ref:n}),h=[await vn({fs:t,cache:e,gitdir:r,oid:d})],p,g,w;function y(b){w&&i&&u.push(b)}for(;h.length>0;){let b=h.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(i){let S;try{S=await uu({fs:t,cache:e,gitdir:r,oid:b.commit.tree,filepath:i}),g&&p!==S&&u.push(g),p=S,g=b,w=!0}catch(C){if(C instanceof Ge){let A=l&&p;if(A&&(A=await NE({fs:t,cache:e,gitdir:r,oid:b.commit.tree,fileId:p}),A))if(Array.isArray(A)){if(g){let k=await NE({fs:t,cache:e,gitdir:r,oid:g.commit.tree,fileId:p});if(Array.isArray(k))if(A=A.filter(v=>k.indexOf(v)===-1),A.length===1)A=A[0],i=A,g&&u.push(g);else{A=!1,g&&u.push(g);break}}}else i=A,g&&u.push(g);if(!A){if(w&&p&&(u.push(g),!o))break;if(!o&&!l)throw C}g=b,w=!1}else throw C}}else u.push(b);if(s!==void 0&&u.length===s){y(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let C=await vn({fs:t,cache:e,gitdir:r,oid:S});h.map(A=>A.oid).includes(C.oid)||h.push(C)}h.length===0&&y(b),h.sort((S,C)=>lB(S.commit,C.commit))}return u}async function JS({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,cache:c={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});return await uB({fs:u,cache:c,gitdir:f,filepath:i,ref:n,depth:s,since:a,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function ek({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:w,allowUnrelatedHistories:y=!1}){try{R("fs",t),p&&R("onSign",e);let b=new te(t),S=await ie({fsp:b,dotgit:i}),C=await $s({fs:b,gitdir:S,author:d});if(!C&&(!o||!a))throw new Xt("author");let A=await _a({fs:b,gitdir:S,author:C,committer:h});if(!A&&(!o||!a))throw new Xt("committer");return await AS({fs:b,cache:g,dir:r,gitdir:S,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:C,committer:A,signingKey:p,onSign:e,mergeDriver:w,allowUnrelatedHistories:y})}catch(b){throw b.caller="git.merge",b}}var fB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function tk({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),oids:n}){let s=new BE,a=[];function o(u,f){let d=E.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=fB[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let w=(p|d|g).toString(16);for(o(w,"hex");p;)p=h>127?128:0,w=p|h&127,o(Hg(2,w),"hex"),h=h>>>7;o(E.from(await XE(f)))}o("PACK"),o("00000002","hex"),o(Hg(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await et({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function dB({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await tk({fs:t,cache:e,gitdir:r,oids:i}),a=E.from(await yd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(H(r,`objects/pack/${l}`),a),{filename:l}):{filename:l,packfile:new Uint8Array(a)}}async function rk({fs:t,dir:e,gitdir:r=H(e,".git"),oids:i,write:n=!1,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await dB({fs:a,cache:s,gitdir:o,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}async function ik({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=H(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:w=!1,corsProxy:y,singleBranch:b,headers:S={},author:C,committer:A,signingKey:k,cache:v={}}){try{R("fs",t),R("gitdir",l);let x=new te(t),_=await ie({fsp:x,dotgit:l}),P=await $s({fs:x,gitdir:_,author:C});if(!P)throw new Xt("author");let T=await _a({fs:x,gitdir:_,author:P,committer:A});if(!T)throw new Xt("committer");return await CS({fs:x,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:_,ref:c,url:u,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:w,corsProxy:y,singleBranch:b,headers:S,author:P,committer:T,signingKey:k,prune:h,pruneTags:p})}catch(x){throw x.caller="git.pull",x}}async function hB({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),start:n,finish:s}){let a=await ya.read({fs:t,gitdir:i}),o=new Set,l=new Set;for(let f of n)o.add(await q.resolve({fs:t,gitdir:i,ref:f}));for(let f of s)try{let d=await q.resolve({fs:t,gitdir:i,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await et({fs:t,cache:e,gitdir:i,oid:f});if(d==="tag"){let g=Xr.from(h).headers().object;return u(g)}if(d!=="commit")throw new _r(f,d,"commit");if(!a.has(f)){let g=Dr.from(h).headers().parent;for(f of g)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function Tg({fs:t,cache:e,dir:r,gitdir:i=H(r,".git"),oids:n}){let s=new Set;async function a(o){if(s.has(o))return;s.add(o);let{type:l,object:c}=await et({fs:t,cache:e,gitdir:i,oid:o});if(l==="tag"){let f=Xr.from(c).headers().object;await a(f)}else if(l==="commit"){let f=Dr.from(c).headers().tree;await a(f)}else if(l==="tree"){let u=Mr.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await a(f.oid)}}for(let o of n)await a(o);return s}async function pB(t){let e={},r="",i=lt.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+` +`),n=await i();let s=r.toString("utf8").split(` +`);if(n=s.shift(),!n.startsWith("unpack "))throw new ba('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function mB({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(lt.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i} +`)),i="";return r.push(lt.flush()),r}async function gB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:w,headers:y={}}){let b=u||await Is({fs:t,gitdir:c});if(typeof b=="undefined")throw new Ir("ref");let S=await ht.get({fs:t,gitdir:c});d=d||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let C=h||await S.get(`remote.${d}.pushurl`)||await S.get(`remote.${d}.url`);if(typeof C=="undefined")throw new Ir("remote OR url");let A=f||await S.get(`branch.${b}.merge`);if(typeof C=="undefined")throw new Ir("remoteRef");w===void 0&&(w=await S.get("http.corsProxy"));let k=await q.expand({fs:t,gitdir:c,ref:b}),v=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:k}),x=el.getRemoteHelperFor({url:C}),_=await x.discover({http:r,onAuth:s,onAuthSuccess:a,onAuthFailure:o,corsProxy:w,service:"git-receive-pack",url:C,headers:y,protocolVersion:1}),P=_.auth,T;if(!A)T=k;else try{T=await q.expandAgainstMap({ref:A,map:_.refs})}catch(K){if(K instanceof Ge)T=A.startsWith("refs/")?A:`refs/heads/${A}`;else throw K}let M=_.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:C,localRef:{ref:g?"(delete)":k,oid:v},remoteRef:{ref:T,oid:M}}))throw new Ko;let $=!_.capabilities.has("no-thin"),D=new Set;if(!g){let K=[..._.refs.values()],G=new Set;if(M!=="0000000000000000000000000000000000000000"){let Me=await Wg({fs:t,cache:e,gitdir:c,oids:[v,M]});for(let Et of Me)K.push(Et);$&&(G=await Tg({fs:t,cache:e,gitdir:c,oids:Me}))}if(!K.includes(v)){let Me=await hB({fs:t,cache:e,gitdir:c,start:[v],finish:K});D=await Tg({fs:t,cache:e,gitdir:c,oids:Me})}if($){try{let Me=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:Et}=await q.resolveAgainstMap({ref:Me.replace(`refs/remotes/${d}/`,""),fullref:Me,map:_.refs}),Ht=[Et];for(let De of await Tg({fs:t,cache:e,gitdir:c,oids:Ht}))G.add(De)}catch(Me){}for(let Me of G)D.delete(Me)}if(v===M&&(p=!0),!p){if(k.startsWith("refs/tags")&&M!=="0000000000000000000000000000000000000000")throw new Zo("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&M!=="0000000000000000000000000000000000000000"&&!await US({fs:t,cache:e,gitdir:c,oid:v,ancestor:M,depth:-1}))throw new Zo("not-fast-forward")}}let Q=pS([..._.capabilities],["report-status","side-band-64k",`agent=${Ad.agent}`]),ye=await mB({capabilities:Q,triplets:[{oldoid:M,oid:v,fullRef:T}]}),de=g?[]:await tk({fs:t,cache:e,gitdir:c,oids:[...D]}),J=await x.connect({http:r,onProgress:i,corsProxy:w,service:"git-receive-pack",url:C,auth:P,headers:y,body:[...ye,...de]}),{packfile:X,progress:he}=await xd.demux(J.body);if(n){let K=mS(he);du(K,async G=>{await n(G)})}let z=await pB(X);if(J.headers&&(z.headers=J.headers),d&&z.ok&&z.refs[T].ok&&!k.startsWith("refs/tags")){let K=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:K}):await q.writeRef({fs:t,gitdir:c,ref:K,value:v})}if(z.ok&&Object.values(z.refs).every(K=>K.ok))return z;{let K=Object.entries(z.refs).filter(([G,Me])=>!Me.ok).map(([G,Me])=>` + - ${G}: ${Me.error}`).join("");throw new Jc(K,z)}}async function nk({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=H(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:w,headers:y={},cache:b={}}){try{R("fs",t),R("http",e),R("gitdir",c);let S=new te(t),C=await ie({fsp:S,dotgit:c});return await gB({fs:S,cache:b,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:C,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:w,headers:y})}catch(S){throw S.caller="git.push",S}}async function sk({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=Xr.from(s).parse().object,sk({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new _r(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function ak({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await uu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await sk({fs:t,cache:e,gitdir:r,oid:i})}async function ok({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,filepath:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await ak({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function qg({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await vn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function vB({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await q.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await ak({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function lk({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oid",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await vB({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function ck({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});s!==void 0&&(i=await uu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await et({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Dr.from(f.object).parse();break;case"tree":f.object=Mr.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Xr.from(f.object).parse();break;default:throw new _r(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function wB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await et({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new _r(i,n,"tag");let a=Xr.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function uk({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await wB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function fk({fs:t,dir:e,gitdir:r=H(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await rl({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function dk({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});await dt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function bB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof Ge))throw p}let f=(await rl({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await fu({fs:t,gitdir:i,tree:f});return await cu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' +`,author:a,committer:o,signingKey:l})}async function hk({fs:t,onSign:e,dir:r,gitdir:i=H(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",i),R("oid",s);let u=new te(t),f=await ie({fsp:u,dotgit:i}),d=await $s({fs:u,gitdir:f,author:a});if(!d)throw new Xt("author");let h=await _a({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Xt("committer");return await bB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function _B({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!lu(i,!0))throw new Gi(i,Gc.clean(i));if(!lu(r,!0))throw new Gi(r,Gc.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Ui("branch",i,!1);let l=await q.resolve({fs:t,gitdir:e,ref:s,depth:1});await q.writeRef({fs:t,gitdir:e,ref:a,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:s});let u=await Is({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function pk({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oldref",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await _B({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function mk({gitdir:t,type:e,object:r}){return wn(Cs.wrap({type:e,object:r}))}async function gk({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i,ref:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l,c;try{l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await uu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(H(e,i));f&&(c=await mk({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(H(e,i)))),await dt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function vk({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,depth:n}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await q.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function wk({fs:t,dir:e,gitdir:r=H(e,".git"),path:i,value:n,append:s=!1}){try{R("fs",t),R("gitdir",r),R("path",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l=await ht.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await ht.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function bk({fs:t,gitdir:e,commit:r}){let i=Dr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Ed=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i} +`}static getStashReflogEntry(e,r=!1){return e.split(` +`).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},xa=class t{constructor({fs:e,dir:r,gitdir:i=H(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return H(this.gitdir,t.refStash)}get refLogsStashPath(){return H(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await $s({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Xt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return bk({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new Gi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?vn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Ed.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await Qo({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Ed.getStashReflogEntry(r,e)}};async function _k({fs:t,dir:e,gitdir:r,message:i=""}){let n=new xa({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Is({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await qg({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Kr({ref:"HEAD"}),d=await RE({fs:t,dir:e,gitdir:r,treePair:[Kr({ref:"HEAD"}),"stage"]});if(d){let w=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(w),u=d,f=Ea()}let h=await RE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let w=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(w),u=h}if(!u||!d&&!h)throw new Ge("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function yB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await _k({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await Vg({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function xB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await _k({fs:t,dir:e,gitdir:r,message:i});return n}async function yk({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new xa({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await Qo({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(` +`)+` +`,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function EB({fs:t,dir:e,gitdir:r}){return new xa({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function SB({fs:t,dir:e,gitdir:r}){let i=new xa({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await Qo(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function kB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await yk({fs:t,dir:e,gitdir:r,refIdx:i}),await xk({fs:t,dir:e,gitdir:r,refIdx:i})}async function Ek({fs:t,dir:e,gitdir:r=H(e,".git"),op:i="push",message:n="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",r),R("op",i);let a={push:yB,apply:yk,drop:xk,list:EB,clear:SB,pop:kB,create:xB},o=["apply","drop","pop"];try{let l=new te(t),c=await ie({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>H(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new Gi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function Sk({fs:t,dir:e,gitdir:r=H(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});if(await Rs.isIgnored({fs:s,gitdir:a,dir:e,filepath:i}))return"ignored";let l=await AB({fs:s,cache:n,gitdir:a}),c=await kk({fs:s,cache:n,gitdir:a,tree:l,path:i}),u=await dt.acquire({fs:s,gitdir:a,cache:n},async function(w){for(let y of w)if(y.path===i)return y;return null}),f=await s.lstat(H(e,i)),d=c!==null,h=u!==null,p=f!==null,g=async()=>{if(h&&!pd(u,f))return u.oid;{let w=await s.read(H(e,i)),y=await mk({gitdir:a,type:"blob",object:w});return h&&u.oid===y&&f.size!==-1&&dt.acquire({fs:s,gitdir:a,cache:n},async function(b){b.insert({filepath:i,stats:f,oid:y})}),y}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await g()===u.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return c===u.oid,"*deleted";if(d&&p&&!h)return await g()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let w=await g();return w===c?w===u.oid?"unmodified":"*unmodified":w===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function kk({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await et({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Mr.from(l);return kk({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new _r(a.oid,o,"blob",n.join("/"))}return null}async function AB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof Ge)return[]}let{tree:n}=await rl({fs:t,cache:e,gitdir:r,oid:i});return n}async function Ak({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});return await Ps({fs:l,cache:a,dir:e,gitdir:c,trees:[Kr({ref:i}),tl(),Ea()],map:async function(u,[f,d,h]){if(!f&&!h&&d&&!o&&await Rs.isIgnored({fs:l,dir:e,filepath:u})||!n.some(v=>cS(u,v)))return null;if(s&&!s(u))return;let[p,g,w]=await Promise.all([f&&f.type(),d&&d.type(),h&&h.type()]),y=[p,g,w].includes("blob");if((p==="tree"||p==="special")&&!y)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!y)return;if(w==="commit")return null;if((w==="tree"||w==="special")&&!y)return;let b=p==="blob"?await f.oid():void 0,S=w==="blob"?await h.oid():void 0,C;p!=="blob"&&g==="blob"&&w!=="blob"?C="42":g==="blob"&&(C=await d.oid());let A=[void 0,b,C,S],k=A.map(v=>A.indexOf(v));return k.shift(),[u,...k]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function Ck({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,object:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let a=new te(t);if(i===void 0)throw new Ir("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ie({fsp:a,dotgit:r}),l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await q.exists({fs:a,gitdir:o,ref:i}))throw new Ui("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function Tk({fs:t,dir:e,gitdir:r=H(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{R("fs",t),R("gitdir",r),R("filepath",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});if(l)return await dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(H(e,n));if(p){if(p.isDirectory())throw new Ts("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(H(e,n)),!d)throw new Ge(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Ts("directory")}return await dt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new Ge(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{p=d;let g=p.isSymbolicLink()?await u.readlink(H(e,n)):await u.read(H(e,n));s=await Or({fs:u,gitdir:f,type:"blob",format:"content",object:g})}return h.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}function Pk(){try{return Ad.version}catch(t){throw t.caller="git.version",t}}async function Rk({fs:t,dir:e,gitdir:r=H(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:o={}}){try{R("fs",t),R("gitdir",r),R("trees",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});return await Ps({fs:l,cache:o,dir:e,gitdir:c,trees:i,map:n,reduce:s,iterate:a})}catch(l){throw l.caller="git.walk",l}}async function $k({fs:t,dir:e,gitdir:r=H(e,".git"),blob:i}){try{R("fs",t),R("gitdir",r),R("blob",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await Or({fs:n,gitdir:s,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}async function Fk({fs:t,dir:e,gitdir:r=H(e,".git"),commit:i}){try{R("fs",t),R("gitdir",r),R("commit",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await bk({fs:n,gitdir:s,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}async function Ik({fs:t,dir:e,gitdir:r=H(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:o=void 0}){try{let l=new te(t),c=await ie({fsp:l,dotgit:r});if(s==="parsed"){switch(i){case"commit":n=Dr.from(n).toObject();break;case"tree":n=Mr.from(n).toObject();break;case"blob":n=E.from(n,o);break;case"tag":n=Xr.from(n).toObject();break;default:throw new _r(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await Or({fs:l,gitdir:c,type:i,object:n,oid:a,format:s}),a}catch(l){throw l.caller="git.writeObject",l}}async function Mk({fs:t,dir:e,gitdir:r=H(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("value",n);let o=new te(t);if(!lu(i,!0))throw new Gi(i,Gc.clean(i));let l=await ie({fsp:o,dotgit:r});if(!s&&await q.exists({fs:o,gitdir:l,ref:i}))throw new Ui("ref",i);a?await q.writeSymbolicRef({fs:o,gitdir:l,ref:i,value:n}):(n=await q.resolve({fs:o,gitdir:l,ref:n}),await q.writeRef({fs:o,gitdir:l,ref:i,value:n}))}catch(o){throw o.caller="git.writeRef",o}}async function CB({fs:t,gitdir:e,tag:r}){let i=Xr.from(r).toObject();return await Or({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}async function Dk({fs:t,dir:e,gitdir:r=H(e,".git"),tag:i}){try{R("fs",t),R("gitdir",r),R("tag",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await CB({fs:n,gitdir:s,tag:i})}catch(n){throw n.caller="git.writeTag",n}}async function Ok({fs:t,dir:e,gitdir:r=H(e,".git"),tree:i}){try{R("fs",t),R("gitdir",r),R("tree",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await fu({fs:n,gitdir:s,tree:i})}catch(n){throw n.caller="git.writeTree",n}}var TB={Errors:YE,STAGE:Ea,TREE:Kr,WORKDIR:tl,add:JE,abortMerge:KE,addNote:nS,addRemote:aS,annotatedTag:oS,branch:lS,cherryPick:dS,checkout:Vg,clone:vS,commit:wS,getConfig:IS,getConfigAll:MS,setConfig:wk,currentBranch:bS,deleteBranch:_S,deleteRef:yS,deleteRemote:xS,deleteTag:ES,expandOid:SS,expandRef:kS,fastForward:TS,fetch:PS,findMergeBase:RS,findRoot:FS,getRemoteInfo:DS,getRemoteInfo2:LS,hashBlob:NS,indexPack:BS,init:HS,isDescendent:GS,isIgnored:jS,listBranches:VS,listFiles:WS,listNotes:qS,listRefs:YS,listRemotes:ZS,listServerRefs:KS,listTags:XS,log:JS,merge:ek,packObjects:rk,pull:ik,push:nk,readBlob:ok,readCommit:qg,readNote:lk,readObject:ck,readTag:uk,readTree:fk,remove:dk,removeNote:hk,renameBranch:pk,resetIndex:gk,updateIndex:Tk,resolveRef:vk,status:Sk,statusMatrix:Ak,tag:Ck,version:Pk,walk:Rk,writeBlob:$k,writeCommit:Fk,writeObject:Ik,writeRef:Mk,writeTag:Dk,writeTree:Ok,stash:Ek};Z.Errors=YE;Z.STAGE=Ea;Z.TREE=Kr;Z.WORKDIR=tl;Z.abortMerge=KE;Z.add=JE;Z.addNote=nS;Z.addRemote=aS;Z.annotatedTag=oS;Z.branch=lS;Z.checkout=Vg;Z.cherryPick=dS;Z.clone=vS;Z.commit=wS;Z.currentBranch=bS;Z.default=TB;Z.deleteBranch=_S;Z.deleteRef=yS;Z.deleteRemote=xS;Z.deleteTag=ES;Z.expandOid=SS;Z.expandRef=kS;Z.fastForward=TS;Z.fetch=PS;Z.findMergeBase=RS;Z.findRoot=FS;Z.getConfig=IS;Z.getConfigAll=MS;Z.getRemoteInfo=DS;Z.getRemoteInfo2=LS;Z.hashBlob=NS;Z.indexPack=BS;Z.init=HS;Z.isDescendent=GS;Z.isIgnored=jS;Z.listBranches=VS;Z.listFiles=WS;Z.listNotes=qS;Z.listRefs=YS;Z.listRemotes=ZS;Z.listServerRefs=KS;Z.listTags=XS;Z.log=JS;Z.merge=ek;Z.packObjects=rk;Z.pull=ik;Z.push=nk;Z.readBlob=ok;Z.readCommit=qg;Z.readNote=lk;Z.readObject=ck;Z.readTag=uk;Z.readTree=fk;Z.remove=dk;Z.removeNote=hk;Z.renameBranch=pk;Z.resetIndex=gk;Z.resolveRef=vk;Z.setConfig=wk;Z.stash=Ek;Z.status=Sk;Z.statusMatrix=Ak;Z.tag=Ck;Z.updateIndex=Tk;Z.version=Pk;Z.walk=Rk;Z.writeBlob=$k;Z.writeCommit=Fk;Z.writeObject=Ik;Z.writeRef=Mk;Z.writeTag=Dk;Z.writeTree=Ok});var Vk=U((zz,jk)=>{"use strict";m();jk.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 Wk=U((qz,zk)=>{m();var tv={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}};zk.exports=function(t,e,r,i){if(!tv.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!tv[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var n=tv[r][e]*t;return i!==!1?(i=Math.pow(10,parseInt(i)||5),Math.round(n*i)/i):n}});var aA=U(Wn=>{"use strict";m();Object.defineProperty(Wn,"__esModule",{value:!0});Wn.fromRgba=sl;Wn.fromRgb=rv;Wn.fromHsla=Id;Wn.fromHsl=nA;Wn.fromString=sA;Wn.default=void 0;var qk=Kk(Vk()),MB=Kk(Wk());function Kk(t){return t&&t.__esModule?t:{default:t}}function DB(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yk(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r-1}function UB(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}})();return[f*60,u*100,c*100]}function GB(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=(function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]})(),u=yr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var jB=(function(){function t(e){var r=yr(e,4),i=r[0],n=r[1],s=r[2],a=r[3];DB(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return OB(t,[{key:"toRgbString",value:function(){var r=yr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=yr(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=yr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=yr(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=UB(i,n,s),l=yr(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function sl(t){var e=yr(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new jB([r,i,n,s])}function rv(t){var e=yr(t,3),r=e[0],i=e[1],n=e[2];return sl([r,i,n,1])}function Id(t){var e=yr(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=GB(r,i,n),o=yr(a,3),l=o[0],c=o[1],u=o[2];return sl([l,c,u,s])}function nA(t){var e=yr(t,3),r=e[0],i=e[1],n=e[2];return Id([r,i,n,1])}function VB(t){var e=Xk.exec(t)||Qk.exec(t),r=yr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,sl([i,n,s,a])}function zB(t){var e=Jk.exec(t)||tA.exec(t)||eA.exec(t)||rA.exec(t),r=yr(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=mu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=mu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=mu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(mu(a,"%")?100:1),sl([i,n,s,a])}function WB(t){var e=iA.exec(t),r=yr(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,MB.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(mu(o,"%")?100:1),Id([i,s,a,o])}function sA(t){return qk.default[t]?rv(qk.default[t]):Xk.test(t)||Qk.test(t)?VB(t):Jk.test(t)||tA.test(t)||eA.test(t)||rA.test(t)?zB(t):iA.test(t)?WB(t):null}var qB={fromString:sA,fromRgb:rv,fromRgba:sl,fromHsl:nA,fromHsla:Id};Wn.default=qB});var wA=U((n9,vA)=>{m();vA.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,w,y,b,S){return{startX:g,startY:w,endX:y,endY:b,r:S}},p=function(g,w,y){var b,S,C,A,k;for(w>y?b=l[g-1+o]:b=l[g+1+o],k=C=Math.max(w,y),A=S=C-g;S=g+1;--A)y[A+o]=p(A,y[A-1+o]+1,y[A+1+o]);y[g+o]=p(g,y[g-1+o]+1,y[g+1+o])}while(y[g+o]!==s);for(ed=g+2*b,S=l[g+o],k=n,v=s,x=[];S!==-1;){let _=c[S];(n!=_.endX||s!=_.endY)&&x.push({file1:[a?_.endY:_.endX,a?v-_.endY:k-_.endX],file2:[a?_.endX:_.endY,a?k-_.endX:v-_.endY]}),k=_.startX,v=_.startY,S=c[S].r}return(k!=0||v!=0)&&x.push({file1:[0,a?v:k],file2:[0,a?k:v]}),x.reverse(),x}}}});var yA=U((a9,_A)=>{m();var bA=wA();function KB(t,e,r){var i,n=new bA(e,t).compose(),s=new bA(e,r).compose(),a=[];function o($,D){a.push([$.file1[0],D,$.file1[1],$.file2[0],$.file2[1]])}for(i=0;ic&&(l.push([1,c,$-c]),c=$)}for(var f=0;fg)break;g=Math.max(g,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var S=h[1],C=b[S],A=h[0],k=A+h[2],v=h[3],x=v+h[4];C[0]=Math.min(v,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(A,C[2]),C[3]=Math.max(k,C[3])}var _=b[0][0]+(p-b[0][2]),P=b[0][1]+(g-b[0][3]),T=b[2][0]+(p-b[2][2]),M=b[2][1]+(g-b[2][3]);l.push([-1,_,P-_,p,g-p,T,M-T])}c=g}return u(e.length),l}function XB(t,e,r){var i=[],n=[t,e,r],s=KB(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{m();var ul=1e3,fl=ul*60,dl=fl*60,Aa=dl*24,e3=Aa*7,t3=Aa*365.25;EA.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return r3(t);if(r==="number"&&isFinite(t))return e.long?n3(t):i3(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function r3(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*t3;case"weeks":case"week":case"w":return r*e3;case"days":case"day":case"d":return r*Aa;case"hours":case"hour":case"hrs":case"hr":case"h":return r*dl;case"minutes":case"minute":case"mins":case"min":case"m":return r*fl;case"seconds":case"second":case"secs":case"sec":case"s":return r*ul;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i3(t){var e=Math.abs(t);return e>=Aa?Math.round(t/Aa)+"d":e>=dl?Math.round(t/dl)+"h":e>=fl?Math.round(t/fl)+"m":e>=ul?Math.round(t/ul)+"s":t+"ms"}function n3(t){var e=Math.abs(t);return e>=Aa?Ld(t,e,Aa,"day"):e>=dl?Ld(t,e,dl,"hour"):e>=fl?Ld(t,e,fl,"minute"):e>=ul?Ld(t,e,ul,"second"):t+" ms"}function Ld(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var AA=U((w9,kA)=>{m();function s3(t){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=n,r.enabled=o,r.humanize=SA(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let f=0;for(let d=0;d{if(k==="%%")return"%";C++;let x=r.formatters[v];if(typeof x=="function"){let _=w[C];k=x.call(y,_),w.splice(C,1),C--}return k}),r.formatArgs.call(y,w),(y.log||r.log).apply(y,w)}return g.namespace=u,g.useColors=r.useColors(),g.color=r.selectColor(u),g.extend=i,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,p=r.enabled(u)),p),set:w=>{d=w}}),typeof r.init=="function"&&r.init(g),g}function i(u,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function n(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(u,f){let d=0,h=0,p=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),u}function o(u){for(let f of r.skips)if(s(u,f))return!1;for(let f of r.names)if(s(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}kA.exports=s3});var Bd=U((Lr,Nd)=>{m();Lr.formatArgs=o3;Lr.save=l3;Lr.load=c3;Lr.useColors=a3;Lr.storage=u3();Lr.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`."))}})();Lr.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 a3(){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 o3(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,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Lr.log=console.debug||console.log||(()=>{});function l3(t){try{t?Lr.storage.setItem("debug",t):Lr.storage.removeItem("debug")}catch(e){}}function c3(){let t;try{t=Lr.storage.getItem("debug")||Lr.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function u3(){try{return localStorage}catch(t){}}Nd.exports=AA()(Lr);var{formatters:f3}=Nd.exports;f3.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var CA=U(Qr=>{"use strict";m();var d3=Qr&&Qr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qr,"__esModule",{value:!0});var h3=require("fs"),p3=d3(Bd()),hl=p3.default("@kwsites/file-exists");function m3(t,e,r){hl("checking %s",t);try{let i=h3.statSync(t);return i.isFile()&&e?(hl("[OK] path represents a file"),!0):i.isDirectory()&&r?(hl("[OK] path represents a directory"),!0):(hl("[FAIL] path represents something other than a file or directory"),!1)}catch(i){if(i.code==="ENOENT")return hl("[FAIL] path is not accessible: %o",i),!1;throw hl("[FATAL] %o",i),i}}function g3(t,e=Qr.READABLE){return m3(t,(e&Qr.FILE)>0,(e&Qr.FOLDER)>0)}Qr.exists=g3;Qr.FILE=1;Qr.FOLDER=2;Qr.READABLE=Qr.FILE+Qr.FOLDER});var TA=U(Hd=>{"use strict";m();function v3(t){for(var e in t)Hd.hasOwnProperty(e)||(Hd[e]=t[e])}Object.defineProperty(Hd,"__esModule",{value:!0});v3(CA())});var uv=U(Ca=>{"use strict";m();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.createDeferred=Ca.deferred=void 0;function cv(){let t,e,r="pending";return{promise:new Promise((n,s)=>{t=n,e=s}),done(n){r==="pending"&&(r="resolved",t(n))},fail(n){r==="pending"&&(r="rejected",e(n))},get fulfilled(){return r!=="pending"},get status(){return r}}}Ca.deferred=cv;Ca.createDeferred=cv;Ca.default=cv});var _2=U(()=>{m()});var y2=U(()=>{m()});var rw=U((RW,sh)=>{m();(function(){"use strict";var t="input is invalid type",e=typeof window=="object",r=e?window:{};r.JS_SHA256_NO_WINDOW&&(e=!1);var i=!e&&typeof self=="object",n=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";n?r=global:i&&(r=self);var s=!r.JS_SHA256_NO_COMMON_JS&&typeof sh=="object"&&sh.exports,a=typeof define=="function"&&define.amd,o=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",l="0123456789abcdef".split(""),c=[-2147483648,8388608,32768,128],u=[24,16,8,0],f=[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],d=["hex","array","digest","arrayBuffer"],h=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"}),o&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(k){return typeof k=="object"&&k.buffer&&k.buffer.constructor===ArrayBuffer});var p=function(k,v){return function(x){return new S(v,!0).update(x)[k]()}},g=function(k){var v=p("hex",k);n&&(v=w(v,k)),v.create=function(){return new S(k)},v.update=function(P){return v.create().update(P)};for(var x=0;x>>2]|=k[P]<>>2]|=_<>>2]|=(192|_>>>6)<>>2]|=(128|_&63)<=57344?($[T>>>2]|=(224|_>>>12)<>>2]|=(128|_>>>6&63)<>>2]|=(128|_&63)<>>2]|=(240|_>>>18)<>>2]|=(128|_>>>12&63)<>>2]|=(128|_>>>6&63)<>>2]|=(128|_&63)<=64?(this.block=$[16],this.start=T-64,this.hash(),this.hashed=!0):this.start=T}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},S.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var k=this.blocks,v=this.lastByteIndex;k[16]=this.block,k[v>>>2]|=c[v&3],this.block=k[16],v>=56&&(this.hashed||this.hash(),k[0]=this.block,k[16]=k[1]=k[2]=k[3]=k[4]=k[5]=k[6]=k[7]=k[8]=k[9]=k[10]=k[11]=k[12]=k[13]=k[14]=k[15]=0),k[14]=this.hBytes<<3|this.bytes>>>29,k[15]=this.bytes<<3,this.hash()}},S.prototype.hash=function(){var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=this.blocks,Q,ye,de,J,X,he,z,K,G,Me,Et;for(Q=16;Q<64;++Q)X=D[Q-15],ye=(X>>>7|X<<25)^(X>>>18|X<<14)^X>>>3,X=D[Q-2],de=(X>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,D[Q]=D[Q-16]+ye+D[Q-7]+de<<0;for(Et=v&x,Q=0;Q<64;Q+=4)this.first?(this.is224?(K=300032,X=D[0]-1413257819,$=X-150054599<<0,_=X+24177077<<0):(K=704751109,X=D[0]-210244248,$=X-1521486534<<0,_=X+143694565<<0),this.first=!1):(ye=(k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10),de=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7),K=k&v,J=K^k&x^Et,z=P&T^~P&M,X=$+de+z+f[Q]+D[Q],he=ye+J,$=_+X<<0,_=X+he<<0),ye=(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),de=($>>>6|$<<26)^($>>>11|$<<21)^($>>>25|$<<7),G=_&k,J=G^_&v^K,z=$&P^~$&T,X=M+de+z+f[Q+1]+D[Q+1],he=ye+J,M=x+X<<0,x=X+he<<0,ye=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),de=(M>>>6|M<<26)^(M>>>11|M<<21)^(M>>>25|M<<7),Me=x&_,J=Me^x&k^G,z=M&$^~M&P,X=T+de+z+f[Q+2]+D[Q+2],he=ye+J,T=v+X<<0,v=X+he<<0,ye=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),de=(T>>>6|T<<26)^(T>>>11|T<<21)^(T>>>25|T<<7),Et=v&x,J=Et^v&_^Me,z=T&M^~T&$,X=P+de+z+f[Q+3]+D[Q+3],he=ye+J,P=k+X<<0,k=X+he<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+k<<0,this.h1=this.h1+v<<0,this.h2=this.h2+x<<0,this.h3=this.h3+_<<0,this.h4=this.h4+P<<0,this.h5=this.h5+T<<0,this.h6=this.h6+M<<0,this.h7=this.h7+$<<0},S.prototype.hex=function(){this.finalize();var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=l[k>>>28&15]+l[k>>>24&15]+l[k>>>20&15]+l[k>>>16&15]+l[k>>>12&15]+l[k>>>8&15]+l[k>>>4&15]+l[k&15]+l[v>>>28&15]+l[v>>>24&15]+l[v>>>20&15]+l[v>>>16&15]+l[v>>>12&15]+l[v>>>8&15]+l[v>>>4&15]+l[v&15]+l[x>>>28&15]+l[x>>>24&15]+l[x>>>20&15]+l[x>>>16&15]+l[x>>>12&15]+l[x>>>8&15]+l[x>>>4&15]+l[x&15]+l[_>>>28&15]+l[_>>>24&15]+l[_>>>20&15]+l[_>>>16&15]+l[_>>>12&15]+l[_>>>8&15]+l[_>>>4&15]+l[_&15]+l[P>>>28&15]+l[P>>>24&15]+l[P>>>20&15]+l[P>>>16&15]+l[P>>>12&15]+l[P>>>8&15]+l[P>>>4&15]+l[P&15]+l[T>>>28&15]+l[T>>>24&15]+l[T>>>20&15]+l[T>>>16&15]+l[T>>>12&15]+l[T>>>8&15]+l[T>>>4&15]+l[T&15]+l[M>>>28&15]+l[M>>>24&15]+l[M>>>20&15]+l[M>>>16&15]+l[M>>>12&15]+l[M>>>8&15]+l[M>>>4&15]+l[M&15];return this.is224||(D+=l[$>>>28&15]+l[$>>>24&15]+l[$>>>20&15]+l[$>>>16&15]+l[$>>>12&15]+l[$>>>8&15]+l[$>>>4&15]+l[$&15]),D},S.prototype.toString=S.prototype.hex,S.prototype.digest=function(){this.finalize();var k=this.h0,v=this.h1,x=this.h2,_=this.h3,P=this.h4,T=this.h5,M=this.h6,$=this.h7,D=[k>>>24&255,k>>>16&255,k>>>8&255,k&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255,T>>>24&255,T>>>16&255,T>>>8&255,T&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255];return this.is224||D.push($>>>24&255,$>>>16&255,$>>>8&255,$&255),D},S.prototype.array=S.prototype.digest,S.prototype.arrayBuffer=function(){this.finalize();var k=new ArrayBuffer(this.is224?28:32),v=new DataView(k);return v.setUint32(0,this.h0),v.setUint32(4,this.h1),v.setUint32(8,this.h2),v.setUint32(12,this.h3),v.setUint32(16,this.h4),v.setUint32(20,this.h5),v.setUint32(24,this.h6),this.is224||v.setUint32(28,this.h7),k};function C(k,v,x){var _,P=typeof k;if(P==="string"){var T=[],M=k.length,$=0,D;for(_=0;_>>6,T[$++]=128|D&63):D<55296||D>=57344?(T[$++]=224|D>>>12,T[$++]=128|D>>>6&63,T[$++]=128|D&63):(D=65536+((D&1023)<<10|k.charCodeAt(++_)&1023),T[$++]=240|D>>>18,T[$++]=128|D>>>12&63,T[$++]=128|D>>>6&63,T[$++]=128|D&63);k=T}else if(P==="object"){if(k===null)throw new Error(t);if(o&&k.constructor===ArrayBuffer)k=new Uint8Array(k);else if(!Array.isArray(k)&&(!o||!ArrayBuffer.isView(k)))throw new Error(t)}else throw new Error(t);k.length>64&&(k=new S(v,!0).update(k).array());var Q=[],ye=[];for(_=0;_<64;++_){var de=k[_]||0;Q[_]=92^de,ye[_]=54^de}S.call(this,v,x),this.update(ye),this.oKeyPad=Q,this.inner=!0,this.sharedMemory=x}C.prototype=new S,C.prototype.finalize=function(){if(S.prototype.finalize.call(this),this.inner){this.inner=!1;var k=this.array();S.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(k),S.prototype.finalize.call(this)}};var A=g();A.sha256=A,A.sha224=g(!0),A.sha256.hmac=b(),A.sha224.hmac=b(!0),s?sh.exports=A:(r.sha256=A.sha256,r.sha224=A.sha224,a&&define(function(){return A}))})()});var rR=U(jw=>{m();(function(t){var e=/\S/,r=/\"/g,i=/\n/g,n=/\r/g,s=/\\/g,a=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(x,_){var P=x.length,T=0,M=1,$=2,D=T,Q=null,ye=null,de="",J=[],X=!1,he=0,z=0,K="{{",G="}}";function Me(){de.length>0&&(J.push({tag:"_t",text:new String(de)}),de="")}function Et(){for(var Rt=!0,$t=z;$t"&&(re.indent=J[Xe].text.toString()),J.splice(Xe,1));else $t||J.push({tag:` +`});X=!1,z=J.length}function De(Rt,$t){var Xe="="+G,re=Rt.indexOf(Xe,$t),B=c(Rt.substring(Rt.indexOf("=",$t)+1,re)).split(" ");return K=B[0],G=B[B.length-1],re+Xe.length-1}for(_&&(_=_.split(" "),K=_[0],G=_[1]),he=0;he0;){if(D=v.shift(),$&&$.tag=="<"&&!(D.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[D.tag]<=t.tags.$||h(D,P))_.push(D),D.nodes=d(v,D.tag,_,P);else if(D.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+D.n);if(M=_.pop(),D.n!=M.n&&!p(D.n,M.n,P))throw new Error("Nesting error: "+M.n+" vs. "+D.n);return M.end=D.i,T}else D.tag==` +`&&(D.last=v.length==0||v[0].tag==` +`);T.push(D)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return T}function h(v,x){for(var _=0,P=x.length;_":C,"<":function(v,x){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(v.nodes,_);var P=x.partials[C(v,x)];P.subs=_.subs,P.partials=_.partials},$:function(v,x){var _={subs:{},code:"",partials:x.partials,prefix:v.n};t.walk(v.nodes,_),x.subs[v.n]=_.code,x.inPartial||(x.code+='t.sub("'+b(v.n)+'",c,p,i);')},"\n":function(v,x){x.code+=k('"\\n"'+(v.last?"":" + i"))},_v:function(v,x){x.code+="t.b(t.v(t."+S(v.n)+'("'+b(v.n)+'",c,p,0)));'},_t:function(v,x){x.code+=k('"'+b(v.text)+'"')},"{":A,"&":A};function A(v,x){x.code+="t.b(t.t(t."+S(v.n)+'("'+b(v.n)+'",c,p,0)));'}function k(v){return"t.b("+v+");"}t.walk=function(v,x){for(var _,P=0,T=v.length;P{m();var c4={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var w=this.ep(d,p);return w?w.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var w=0;w=0;C--)if(y=h[C],w=e(d,y,S),w!==void 0){b=!0;break}return b?(!g&&typeof w=="function"&&(w=this.mv(w,h,p)),w):g?!1:""},ls:function(d,h,p,g,w,y){var b=this.options.delimiters;return this.options.delimiters=y,this.b(this.ct(c(d.call(h,w,p)),h,g)),this.options.delimiters=b,!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,g,w,y,b){var S,C=h[h.length-1],A=d.call(C);return typeof A=="function"?g?!0:(S=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(A,C,h,p,S.substring(w,y),b)):A},mv:function(d,h,p){var g=h[h.length-1],w=d.call(g);return typeof w=="function"?this.ct(c(w.call(g)),g,p):w},sub:function(d,h,p,g){var w=this.subs[d];w&&(this.activeSub=d,w(h,p,this,g),this.activeSub=!1)}};function e(d,h,p){var g;return h&&typeof h=="object"&&(h[d]!==void 0?g=h[d]:p&&h.get&&typeof h.get=="function"&&(g=h.get(d))),g}function r(d,h,p,g,w,y){function b(){}b.prototype=d;function S(){}S.prototype=d.subs;var C,A=new b;A.subs=new S,A.subsText={},A.buf="",g=g||{},A.stackSubs=g,A.subsText=y;for(C in h)g[C]||(g[C]=h[C]);for(C in g)A.subs[C]=g[C];w=w||{},A.stackPartials=w;for(C in p)w[C]||(w[C]=p[C]);for(C in w)A.partials[C]=w[C];return A}var i=/&/g,n=//g,a=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(i,"&").replace(n,"<").replace(s,">").replace(a,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof Vw!="undefined"?Vw:c4)});var zw=U((hY,nR)=>{m();var Bh=rR();Bh.Template=iR().Template;Bh.template=Bh.Template;nR.exports=Bh});var oR=U(Ai=>{"use strict";m();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.ColorSchemeType=Ai.DiffStyleType=Ai.LineMatchingType=Ai.OutputFormatType=Ai.LineType=void 0;var sR;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(sR||(Ai.LineType=sR={}));Ai.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};Ai.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};Ai.DiffStyleType={WORD:"word",CHAR:"char"};var aR;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(aR||(Ai.ColorSchemeType=aR={}))});var pG={};DF(pG,{default:()=>Vp});module.exports=OF(pG);m();var hF=Gt(Yg(),1),Se=require("obsidian"),pF=Gt(require("path"),1),zp=Gt(require("fs/promises"),1);m();var zt={};m();var Cd=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=[]}};m();var j=require("obsidian");m();var Lk=require("obsidian"),Td="YYYY-MM-DD",Zg=`${Td} HH:mm`,Kg=`${Td} HH:mm:ss`,Pd=40,il="conflict-files-obsidian-git.md",pt={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:Kg,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:Lk.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:Zg,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}},Qt={type:"git-view",name:"Source Control",icon:"git-pull-request"},bi={type:"git-history-view",name:"History",icon:"history"},Ms={type:"split-diff-view",name:"Diff view",icon:"diff"},Ds={type:"diff-view",name:"Diff View",icon:"git-pull-request"},Rd="C:\\Program Files\\Git\\cmd\\git.exe",$d=".git_credentials_input",Sa="obsidian_askpass.sh",Nk=`#!/bin/sh + +PROMPT="$1" +TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" + +cleanup() { + rm -f "$TEMP_FILE" "$TEMP_FILE.response" +} +trap cleanup EXIT + +echo "$PROMPT" > "$TEMP_FILE" + +while [ ! -e "$TEMP_FILE.response" ]; do + if [ ! -e "$TEMP_FILE" ]; then + echo "Trigger file got removed: Abort" >&2 + exit 1 + fi + sleep 0.1 +done + +RESPONSE=$(cat "$TEMP_FILE.response") + +echo "$RESPONSE" +`,Bk=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var hu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,w=1/0,y=()=>{for(let b=Math.max(g,-c);b<=Math.min(w,c);b+=2){let S,C=h[b-1],A=h[b+1];C&&(h[b-1]=void 0);let k=!1;if(A){let x=A.oldPos-b;k=A&&0<=x&&x=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(w=Math.min(w,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=y();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Xg=class extends hu{constructor(){super(...arguments),this.tokenize=RB}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(` +`))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),r.endsWith(` +`)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},PB=new Xg;function Qg(t,e,r){return PB.diff(t,e,r)}function RB(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` +`));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Os(t){if(!$B(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var Jg={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function ev(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;Qg(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(Qg(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(b){return b.map(function(S){return" "+S})}let d=[],h=0,p=0,g=[],w=1,y=1;for(let b=0;b0?f(A.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let A of C)g.push((S.added?"+":"-")+A);S.added?y+=C.length:w+=C.length}else{if(h)if(C.length<=l*2&&b1&&!e.includeFileHeaders&&!t.every(u=>u.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(u=>Fd(u,e)).join(` +`)}let l=[];if(t.isGit){if(e=Jg,!t.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!t.newFileName)throw new Error("newFileName must be specified for Git patches");let u=t.oldFileName,f=t.newFileName;t.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):t.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+Os(u)+" "+Os(f)),t.isDelete&&l.push("deleted file mode "+((r=t.oldMode)!==null&&r!==void 0?r:"100644")),t.isCreate&&l.push("new file mode "+((i=t.newMode)!==null&&i!==void 0?i:"100644")),t.oldMode&&t.newMode&&!t.isDelete&&!t.isCreate&&(l.push("old mode "+t.oldMode),l.push("new mode "+t.newMode)),t.isRename&&(l.push("rename from "+Os(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Os(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Os(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Os(((o=t.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&t.oldFileName==t.newFileName&&t.oldFileName!==void 0&&l.push("Index: "+t.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=t.hunks.length>0;e.includeFileHeaders&&t.oldFileName!==void 0&&t.newFileName!==void 0&&(!t.isGit||c)&&(l.push("--- "+Os(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Os(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u{o(l?Fd(l,a.headerOptions):void 0)}}))}else{let o=ev(t,e,r,i,n,s,a);return o?Fd(o,a==null?void 0:a.headerOptions):void 0}}function pu(t,e,r,i,n,s){return Hk(t,t,e,r,i,n,s)}function FB(t){let e=t.endsWith(` +`),r=t.split(` +`).map(i=>i+` +`);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var se=Gt(Yg(),1),ka=require("obsidian");m();function Uk(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var nl=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var Gk=require("obsidian"),IB={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},tt=class extends Gk.SuggestModal{constructor(e,r){if(super(e.app),this.config={...IB,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var oA=Gt(aA(),1),lA=require("child_process"),qn=require("obsidian");function Md(t){throw new Error(`Unexpected object: ${t}`)}function gu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var iv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function ji(t,e){let r;if(e){if(e.button===0||e.button===1){let i=qn.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function bn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new qn.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new qn.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function Ls(t){throw new Error("Impossible branch: "+t)}function nv(t){return`rgb(${t.r},${t.g},${t.b})`}function cA(t){var s;let e=(s=oA.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function uA(t){return t.diff(qn.moment.unix(0),"seconds")}function fA(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function vu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function dA(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function hA(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function sv(t,e,r){return t<=e&&e<=r}function Yn(t){let[e,...r]=t.split("/");return[e,r.length===0?void 0:r.join("/")]}function _n(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function pA(t){return t===1?"1 minute":`${t} minutes`}function YB(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function al(t){if(t.endsWith(".md"))return!1;let e=YB(t);return Bk.includes(e)}function av(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function ol(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof qn.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function mA({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function ll(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function wu(t,e,r={}){return new Promise((i,n)=>{let s=(0,lA.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:a,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var gA=require("os"),Dd=require("obsidian"),cl=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){return r&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}unload(){}_getTreeStructure(e,r=0){let i=[];for(e=[...e];e.length>0;){let n=e.first(),s=n.path.substring(r);if(s.contains("/")){let a=s.substring(0,s.indexOf("/")),o=e.filter(c=>c.path.substring(r).startsWith(a+"/"));o.forEach(c=>e.remove(c));let l=n.path.substring(0,s.indexOf("/")+r);i.push({title:a,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(r>0?r+a.length:a.length)+1)})}else i.push({title:s,data:n,path:n.path,vaultPath:this.getRelativeVaultPath(n.path)}),e.remove(n)}return i}simplify(e){var r,i,n,s;for(let a of e){for(;;){let o=((r=a.children)==null?void 0:r.length)==1,l=((n=(i=a.children)==null?void 0:i.first())==null?void 0:n.data)==null;if(!(a.children!=null&&o&&l))break;let c=a.children.first();a.title+="/"+c.title,a.data=c.data,a.path=c.path,a.vaultPath=c.vaultPath,a.children=c.children}a.children!=null&&this.simplify(a.children),(s=a.children)==null||s.sort((o,l)=>{let c=(l.data==null?1:0)-(o.data==null?1:0);return c!=0?c:o.title.localeCompare(l.title)})}return e.sort((a,o)=>{let l=(o.data==null?1:0)-(a.data==null?1:0);return l!=0?l:a.title.localeCompare(o.title)})}getTreeStructure(e){let r=this._getTreeStructure(e);return this.simplify(r)}async formatCommitMessage(e){let r;if(e.includes("{{numFiles}}")){r=await this.status();let i=r.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";!i&&Dd.Platform.isDesktopApp&&(i=(0,gA.hostname)()),e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let i={},n="";if(r.staged.length<100){r.staged.forEach(a=>{a.index in i?i[a.index].push(a.path):i[a.index]=[a.path]});let s=[];for(let[a,o]of Object.entries(i))s.push(a+" "+o.join(" "));n=s.join(", ")}else n="Too many files to list";e=e.replace("{{files}}",n)}if(e=e.replace("{{date}}",(0,Dd.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=r!=null?r:await this.status(),n="";i.staged.length<100?n=i.staged.map(s=>s.path).join(` +`):n="Too many files to list",e=e+` + +Affected files: +`+n}return e}};m();var Ns=require("obsidian"),Od=class{constructor(e,r){this.plugin=r;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,r){var i;if(this.maybeLog("Read: "+e+JSON.stringify(r)),r=="utf8"||r.encoding=="utf8"){let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?(this.maybeLog("Reuse"),this.vault.read(n)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(i=this.index)!=null?i:this.adapter.readBinary(e);let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(n)):this.adapter.readBinary(e)}}async writeFile(e,r){if(this.maybeLog("Write: "+e),typeof r=="string"){let i=this.vault.getAbstractFileByPath(e);return i instanceof Ns.TFile?this.vault.modify(i,r):this.adapter.write(e,r)}else{let i=ZB(r);if(e.endsWith(this.gitDir+"/index"))this.index=i,this.indexmtime=Date.now();else{let n=this.vault.getAbstractFileByPath(e);return n instanceof Ns.TFile?this.vault.modifyBinary(n,i):this.adapter.writeBinary(e,i)}}}async readdir(e){e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Ns.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,r){var i,n;return this.adapter.rmdir(e,(n=(i=r==null?void 0:r.options)==null?void 0:i.recursive)!=null?n:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw{code:"ENOENT"};return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Ns.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};function ZB(t){return t instanceof ArrayBuffer?t:t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice().buffer}var xA=Gt(yA(),1),Vi=class extends cl{constructor(r){super(r);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new Od(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new ka.Notice("Authentication failed. Please try with different credentials");let r=await new tt(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new tt(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await JB(s));let o=await(0,ka.requestUrl)({url:r,method:i,headers:n,body:a,throw:!1});return{url:r,method:i,headers:o.headers,body:QB(o.arrayBuffer),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await r;return await this.fs.saveAndClear(),i}catch(i){throw await this.fs.saveAndClear(),i}}async status(r){let i,n=window.setTimeout(()=>{i=new ka.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let s={...this.getRepo()};(r==null?void 0:r.path)!=null&&(s.filepaths=[`${r.path}/`]);let a=(await this.wrapFS(se.default.statusMatrix(s))).map(f=>this.getFileStatusResult(f)),o=[],l=[],c=[];for(let f of a)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&c.push(f);let u=[];return window.clearTimeout(n),i==null||i.hide(),{all:c,changed:o,staged:l,conflicted:u}}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async commitAll({message:r,status:i,unstagedFiles:n}){try{return await this.checkAuthorInfo(),await this.stageAll({status:i,unstagedFiles:n}),this.commit({message:r})}catch(s){throw this.plugin.displayError(s),s}}async commit({message:r}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let i=await this.formatCommitMessage(r),n=this.plugin.localStorage.getConflict(),s;if(n){let a=await this.branchInfo();s=[a.current,a.tracking]}await this.wrapFS(se.default.commit({...this.getRepo(),message:i,parent:s})),this.plugin.localStorage.setConflict(!1);return}catch(i){throw this.plugin.displayError(i),i}}async stage(r,i){let n=this.getRelativeRepoPath(r,i),s;i?s=r:s=this.getRelativeVaultPath(r);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(s)?await this.wrapFS(se.default.add({...this.getRepo(),filepath:n})):await this.wrapFS(se.default.remove({...this.getRepo(),filepath:n}))}catch(a){throw this.plugin.displayError(a),a}}async stageAll({dir:r,status:i,unstagedFiles:n}){try{if(i)await Promise.all(i.changed.map(s=>s.workingDir!=="D"?this.wrapFS(se.default.add({...this.getRepo(),filepath:s.path})):se.default.remove({...this.getRepo(),filepath:s.path})));else{let s=n!=null?n:await this.getUnstagedFiles(r!=null?r:".");await Promise.all(s.map(({path:a,type:o})=>o=="D"?se.default.remove({...this.getRepo(),filepath:a}):this.wrapFS(se.default.add({...this.getRepo(),filepath:a}))))}}catch(s){throw this.plugin.displayError(s),s}}async unstage(r,i){try{this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.wrapFS(se.default.resetIndex({...this.getRepo(),filepath:r}))}catch(n){throw this.plugin.displayError(n),n}}async unstageAll({dir:r,status:i}){try{let n;i?n=i.staged.map(s=>s.path):n=(await this.getStagedFiles(r!=null?r:".")).map(({path:a})=>a),await this.wrapFS(Promise.all(n.map(s=>se.default.resetIndex({...this.getRepo(),filepath:s}))))}catch(n){throw this.plugin.displayError(n),n}}async discard(r){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(se.default.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async discardAll({dir:r,status:i}){let n=[];i?r!=null?n=i.changed.filter(s=>s.workingDir!="U"&&s.path.startsWith(r)).map(s=>s.path):n=i.changed.filter(s=>s.workingDir!="U").map(s=>s.path):n=(await this.getUnstagedFiles(r)).filter(s=>s.type!="A").map(({path:s})=>s);try{await this.wrapFS(se.default.checkout({...this.getRepo(),filepaths:n,force:!0}))}catch(s){throw this.plugin.displayError(s),s}}async getUntrackedPaths(r){let i=[];if(r.status)for(let n of r.status.changed)n.index=="U"&&n.workingDir==="U"&&n.path.startsWith(r.path!=null?`${r.path}/`:"")&&i.push(n.path);else{let n=await this.status({path:r==null?void 0:r.path});for(let s of n.changed)s.index==="U"&&s.workingDir==="U"&&i.push(s.path)}return i}getProgressText(r,i){let n=`${r} progress:`;return i.phase&&(n=`${n} ${i.phase}:`),i.loaded&&(n=`${n} ${i.loaded}`,i.total&&(n=`${n} of ${i.total}`)),n}resolveRef(r){return this.wrapFS(se.default.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let i=await this.resolveRef("HEAD");await this.fetch();let n=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(se.default.merge({...this.getRepo(),ours:n.current,theirs:n.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var b,S,C;let c=l[0],u=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(b=u.match(d))!=null?b:[],p=(S=c.match(d))!=null?S:[],g=(C=f.match(d))!=null?C:[],w=(0,xA.default)(h,p,g),y="";for(let A of w)A.ok&&(y+=A.ok.join("")),A.conflict&&(y+=this.plugin.settings.mergeStrategy==="ours"?A.conflict.a.join(""):A.conflict.b.join(""));return{cleanMerge:!0,mergedText:y}}:void 0}))).alreadyMerged||await this.wrapFS(se.default.checkout({...this.getRepo(),ref:n.current,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Checkout",l))},remote:n.remote})),r==null||r.hide();let a=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(i,a);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(i){throw r==null||r.hide(),i instanceof se.Errors.MergeConflictError&&await this.plugin.handleConflict(i.data.filepaths.map(n=>this.getRelativeVaultPath(n))),this.plugin.displayError(i),i}}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let i=await this.branchInfo(),n=i.tracking,s=i.current,a=(await this.getFileChangesCount(s,n)).length;this.plugin.setPluginState({gitAction:5});let o=await this.getCurrentRemote();return await this.wrapFS(se.default.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Pushing",l))}})),r==null||r.hide(),a}catch(i){throw r==null||r.hide(),this.plugin.displayError(i),i}}async getUnpushedCommits(){let r=await this.branchInfo(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let s=await this.resolveRef(n),a=await this.resolveRef(i);return(await this.getFileChangesCount(s,a)).length}async canPush(){let r=await this.branchInfo(),i=r.tracking,n=r.current,s=await this.resolveRef(n),a=await this.resolveRef(i);return s!=a}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var r,i;try{let n=await se.default.currentBranch(this.getRepo())||"",s=await se.default.listBranches(this.getRepo()),a=(r=await this.getConfig(`branch.${n}.remote`))!=null?r:"origin",o=(i=await this.getConfig(`branch.${n}.merge`))==null?void 0:i.split("refs/heads")[1],l=o?a+o:void 0;return{current:n,tracking:l,branches:s,remote:a}}catch(n){throw this.plugin.displayError(n),n}}async getCurrentRemote(){var n;let r=await se.default.currentBranch(this.getRepo())||"";return(n=await this.getConfig(`branch.${r}.remote`))!=null?n:"origin"}async checkout(r,i){try{return this.wrapFS(se.default.checkout({...this.getRepo(),ref:r,force:!!i,remote:i}))}catch(n){throw this.plugin.displayError(n),n}}async createBranch(r){try{await this.wrapFS(se.default.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(i){throw this.plugin.displayError(i),i}}async deleteBranch(r){try{await this.wrapFS(se.default.deleteBranch({...this.getRepo(),ref:r}))}catch(i){throw this.plugin.displayError(i),i}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(se.default.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,i,n){let s=this.showNotice("Initializing clone");try{await this.wrapFS(se.default.clone({...this.getRepo(),dir:i,url:r,depth:n,onProgress:a=>{s!==void 0&&s.setMessage(this.getProgressText("Cloning",a))}})),s==null||s.hide()}catch(a){throw s==null||s.hide(),this.plugin.displayError(a),a}}async setConfig(r,i){try{return this.wrapFS(se.default.setConfig({...this.getRepo(),path:r,value:i}))}catch(n){throw this.plugin.displayError(n),n}}async getConfig(r){try{return this.wrapFS(se.default.getConfig({...this.getRepo(),path:r}))}catch(i){throw this.plugin.displayError(i),i}}async fetch(r){let i=this.showNotice("Initializing fetch");try{let n={...this.getRepo(),onProgress:s=>{i!==void 0&&i.setMessage(this.getProgressText("Fetching",s))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(se.default.fetch(n)),i==null||i.hide()}catch(n){throw this.plugin.displayError(n),i==null||i.hide(),n}}async setRemote(r,i){try{await this.wrapFS(se.default.addRemote({...this.getRepo(),remote:r,url:i,force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async getRemoteBranches(r){let i=[];return i.push(...await this.wrapFS(se.default.listBranches({...this.getRepo(),remote:r}))),i.remove("HEAD"),i=i.map(n=>`${r}/${n}`),i}async getRemotes(){return(await this.wrapFS(se.default.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(se.default.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var i;return(i=(await this.wrapFS(se.default.listRemotes({...this.getRepo()}))).filter(n=>n.remote==r)[0])==null?void 0:i.url}async log(r,i=!0,n,s){let a=await this.wrapFS(se.default.log({...this.getRepo(),depth:n,ref:s}));return Promise.all(a.map(async o=>{let l=o.commit.message.split(` + +`);return{message:l[0],author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(` + +`),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(c=>({path:c.path,status:c.type,vaultPath:this.getRelativeVaultPath(c.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}async updateUpstreamBranch(r){let[i,n]=Yn(r),s=await this.branchInfo();await this.wrapFS(se.default.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[se.default.TREE({ref:r}),se.default.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return await this.wrapFS(se.default.walk({...this.getRepo(),trees:r,map:async function(s,[a,o]){if(!iv(s,i))return null;if(await(a==null?void 0:a.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(a==null?void 0:a.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(a),console.log(o)),u!=="equal")return{path:s,type:u}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[se.default.TREE({ref:"HEAD"}),se.default.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new ka.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(se.default.walk({...s,trees:[se.default.WORKDIR(),se.default.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await se.default.isIgnored({...s,filepath:o})||!iv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await se.default.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await(0,se.readBlob)({...this.getRepo(),filepath:r,oid:n}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof se.default.Errors.NotFoundError))throw h}),u=await se.default.readCommit({...this.getRepo(),oid:n}),f=await(0,se.readBlob)({...this.getRepo(),filepath:r,oid:u.commit.parent.first()}).then(h=>new TextDecoder().decode(h.blob)).catch(h=>{if(!(h instanceof se.default.Errors.NotFoundError))throw h});return pu(s,f!=null?f:"",c!=null?c:"")}let o=(await se.default.walk({...this.getRepo(),trees:[se.default.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>(0,se.readBlob)({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof se.default.Errors.NotFoundError))throw f});return pu(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",pu(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await se.default.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){let i=this.status_mapping[`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`];return{index:i[0]=="?"?"U":i[0],workingDir:i[1]=="?"?"U":i[1],path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new ka.Notice(r,i?this.noticeLength:void 0)}};async function*QB(t){yield new Uint8Array(t)}async function JB(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}m();var w2=Gt(Bd(),1),ei=Gt(require("fs/promises"),1),Zn=require("obsidian"),We=Gt(require("path"),1),Tu=require("path");m();var Zd=Gt(TA(),1);m();var lv=new WeakMap;function pl(...t){let e=new String(t);return lv.set(e,t),e}function _i(t){return t instanceof String&&lv.has(t)}function ml(t){var e;return(e=lv.get(t))!=null?e:[]}var qd=Gt(Bd(),1),nT=require("child_process");var GT=Gt(uv(),1),JT=require("node:path");m();function*PA(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var w3=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),b3=new Set(["--get","--get-all","--get-color","--get-colorbool","--get-regexp","--get-urlmatch","--list","-l"]),_3=new Set(["edit","remove-section","rename-section","set","unset"]),y3=new Set(["get","get-color","get-colorbool","list"]);function x3(t,e){var i;for(let{name:n}of PA(t,"task")){if(w3.has(n))return gl(!0,e);if(b3.has(n))return gl(!1,e)}let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:_3.has(r)?gl(!0,e.slice(1)):y3.has(r)?gl(!1,e.slice(1)):e.length===1?gl(!1,e):gl(!0,e)}function gl(t=!1,e=[]){var i;let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:{isWrite:t,isRead:!t,key:r,value:e.at(1)}}function E3(t,e){return e.isWrite&&e.value!==void 0?{key:e.key,value:e.value,scope:t}:{key:e.key,scope:t}}function S3(t){let e=(t==null?void 0:t.indexOf("="))||-1;return!t||e<0?null:{key:t.slice(0,e).trim().toLowerCase(),value:t.slice(e+1)}}function k3(t){for(let{name:e}of PA(t,"task"))switch(e){case"--global":return"global";case"--system":return"system";case"--worktree":return"worktree";case"--local":return"local";case"--file":case"-f":return"file"}return"local"}function A3({name:t}){if(t==="-c"||t==="--config")return"inline";if(t==="--config-env")return"env"}function*C3(t){for(let e of t){let r=A3(e),i=r&&S3(e.value);i&&(yield{...i,scope:r})}}function T3(t,e,r){let i={read:[],write:[...C3(e)]};return t==="config"&&P3(i,k3(e),x3(e,r)),i}function P3(t,e,r){if(r===null)return;let i=E3(e,r);r.isWrite?t.write.push(i):t.read.push(i)}var RA={short:new Map([["c",!0]])},R3={short:new Map([["C",!0],["P",!1],["h",!1],["p",!1],["v",!1],...RA.short.entries()]),long:new Set(["attr-source","config-env","exec-path","git-dir","list-cmds","namespace","super-prefix","work-tree"])},$3={clone:{short:new Map([["b",!0],["j",!0],["l",!1],["n",!1],["o",!0],["q",!1],["s",!1],["u",!0]]),long:new Set(["branch","config","jobs","origin","upload-pack","u","template"])},commit:{short:new Map([["C",!0],["F",!0],["c",!0],["m",!0],["t",!0]]),long:new Set(["file","message","reedit-message","reuse-message","template"])},config:{short:new Map([["e",!1],["f",!0],["l",!1]]),long:new Set(["blob","comment","default","file","type","value"])},fetch:{short:new Map,long:new Set(["upload-pack"])},init:{short:new Map,long:new Set(["template"])},pull:{short:new Map,long:new Set(["upload-pack"])},push:{short:new Map,long:new Set(["exec","receive-pack"])}},F3={short:new Map,long:new Set};function I3(t){var r;let e=(r=$3[t!=null?t:""])!=null?r:F3;return{short:new Map([...RA.short.entries(),...e.short.entries()]),long:e.long}}function $A(t,e=R3){if(t.startsWith("--")){let r=t.indexOf("=");if(r>2)return[{name:t.slice(0,r),value:t.slice(r+1),needsNext:!1}];let i=t.slice(2);return[{name:t,needsNext:e.long.has(i)}]}if(t.length===2){let r=t.charAt(1),i=e.short.get(r);return[{name:t,needsNext:i===!0}]}return M3(t,e.short)}function M3(t,e){let r=t.slice(1).split(""),i=[];for(let n=0;ne.has(l)))return i.push({name:`-${s}`,value:o,needsNext:!1}),i}i.push({name:`-${s}`,needsNext:a})}return i}function D3(t,e=[]){let r=0;for(;rfunction(){return t&&(e=(0,t[Fv(t)[0]])(t=0)),e},K3=(t,e)=>function(){return e||(0,t[Fv(t)[0]])((e={exports:{}}).exports,e),e.exports},St=(t,e)=>{for(var r in e)$v(t,r,{get:e[r],enumerable:!0})},X3=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fv(e))!Z3.call(t,n)&&n!==r&&$v(t,n,{get:()=>e[n],enumerable:!(i=Y3(e,n))||i.enumerable});return t},_t=t=>X3($v({},"__esModule",{value:!0}),t),Br,Hs=Y({"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)}}}}),Eu,_l=Y({"src/lib/errors/git-response-error.ts"(){"use strict";Hs(),Eu=class extends Br{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),hC,pC=Y({"src/lib/errors/task-configuration-error.ts"(){"use strict";Hs(),hC=class extends Br{constructor(t){super(void 0,t)}}}});function mC(t){return typeof t!="function"?$a:t}function gC(t){return typeof t=="function"&&t!==$a}function vC(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function wC(t,e=0){return bC(t)&&t.length>e?t[e]:void 0}function Ra(t,e=0){if(bC(t)&&t.length>e)return t[t.length-1-e]}function bC(t){return Jd(t)}function Su(t="",e=!0,r=` +`){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Iv(t,e){return Su(t,!0).map(r=>e(r))}function Mv(t){return(0,Zd.exists)(t,Zd.FOLDER)}function Ei(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function _C(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function Kd(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function yn(t){return Array.isArray(t)?t:[t]}function yC(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function yl(t){return yn(t).map(e=>e instanceof String?e:String(e))}function Qe(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function yu(t,e){let r=[];for(let i=0,n=t.length;i{t[i]!==void 0&&(r[i]=t[i])}),r}function vv(t=0){return new Promise(e=>setTimeout(e,t))}function wv(t){if(t!==!1)return t}var wl,$a,ku,Xd=Y({"src/lib/utils/util.ts"(){"use strict";Dv(),wl="\0",$a=()=>{},ku=Object.prototype.toString.call.bind(Object.prototype.toString)}});function lr(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function bv(t,e){let r=_i(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function Qd(t){return!!t&&ku(t)==="[object Object]"}function EC(t){return typeof t=="function"}var Au,SC,mt,zd,Jd,Dv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";Xd(),Au=t=>Array.isArray(t),SC=t=>typeof t=="number",mt=t=>typeof t=="string"||_i(t),zd=t=>mt(t)||Array.isArray(t)&&t.every(mt),Jd=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),_v,Q3=Y({"src/lib/utils/exit-codes.ts"(){"use strict";_v=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(_v||{})}}),Wd,J3=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";Wd=class kC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new kC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function e8(){throw new Error("LineParser:useMatches not implemented")}var _e,Bs,t8=Y({"src/lib/utils/line-parser.ts"(){"use strict";_e=class{constructor(t,e){this.matches=[],this.useMatches=e8,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},Bs=class extends _e{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 AC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...CC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var CC,r8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";CC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Ov(t,e=[]){return Qd(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(_i(n))r.push(n);else if(bv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)bv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function xr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n{for(let s=Su(n,i),a=0,o=s.length;a{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var s8=Y({"src/lib/utils/task-parser.ts"(){"use strict";Xd()}}),TC={};St(TC,{ExitCodes:()=>_v,GitOutputStreams:()=>Wd,LineParser:()=>_e,NOOP:()=>$a,NULL:()=>wl,RemoteLineParser:()=>Bs,append:()=>Ei,appendTaskOptions:()=>Ov,asArray:()=>yn,asCamelCase:()=>yC,asFunction:()=>mC,asNumber:()=>Qe,asStringArray:()=>yl,bufferToString:()=>xu,callTaskParser:()=>yv,createInstanceConfig:()=>AC,delay:()=>vv,filterArray:()=>Au,filterFunction:()=>EC,filterHasLength:()=>Jd,filterNumber:()=>SC,filterPlainObject:()=>Qd,filterPrimitives:()=>bv,filterString:()=>mt,filterStringOrStringArray:()=>zd,filterType:()=>lr,first:()=>wC,folderExists:()=>Mv,forEachLineWithContent:()=>Iv,getTrailingOptions:()=>xr,including:()=>_C,isUserFunction:()=>gC,last:()=>Ra,objectToString:()=>ku,orVoid:()=>wv,parseStringResponse:()=>Hr,pick:()=>xC,prefixedArray:()=>yu,remove:()=>Kd,splitOn:()=>vC,toLinesWithContent:()=>Su,trailingFunctionArgument:()=>st,trailingOptionsArgument:()=>Lv});var ve=Y({"src/lib/utils/index.ts"(){"use strict";Dv(),Q3(),J3(),t8(),r8(),n8(),s8(),Xd()}}),PC={};St(PC,{CheckRepoActions:()=>xv,checkIsBareRepoTask:()=>$C,checkIsRepoRootTask:()=>RC,checkIsRepoTask:()=>a8});function a8(t){switch(t){case"bare":return $C();case"root":return RC()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:eh,parser:Nv}}function RC(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:eh,parser(e){return/^\.(git)?$/.test(e.trim())}}}function $C(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:eh,parser:Nv}}function o8(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var xv,eh,Nv,FC=Y({"src/lib/tasks/check-is-repo.ts"(){"use strict";ve(),xv=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(xv||{}),eh=({exitCode:t},e,r,i)=>{if(t===128&&o8(e))return r(E.from("false"));i(e)},Nv=t=>t.trim()==="true"}});function l8(t,e){let r=new IC(t),i=t?DC:MC;return Su(e).forEach(n=>{let s=n.replace(i,"");r.paths.push(s),(OC.test(s)?r.folders:r.files).push(s)}),r}var IC,MC,DC,OC,c8=Y({"src/lib/responses/CleanSummary.ts"(){"use strict";ve(),IC=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},MC=/^[a-z]+\s*/i,DC=/^[a-z]+\s+[a-z]+\s*/i,OC=/\/$/}}),Ev={};St(Ev,{EMPTY_COMMANDS:()=>th,adhocExecTask:()=>LC,configurationErrorTask:()=>Nr,isBufferTask:()=>BC,isEmptyTask:()=>HC,straightThroughBufferTask:()=>NC,straightThroughStringTask:()=>Er});function LC(t){return{commands:th,format:"empty",parser:t}}function Nr(t){return{commands:th,format:"empty",parser(){throw typeof t=="string"?new hC(t):t}}}function Er(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function NC(t){return{commands:t,format:"buffer",parser(e){return e}}}function BC(t){return t.format==="buffer"}function HC(t){return t.format==="empty"||!t.commands.length}var th,yt=Y({"src/lib/tasks/task.ts"(){"use strict";pC(),th=[]}}),UC={};St(UC,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Bv,CONFIG_ERROR_MODE_REQUIRED:()=>Hv,CONFIG_ERROR_UNKNOWN_OPTION:()=>Uv,CleanOptions:()=>Pa,cleanTask:()=>GC,cleanWithOptionsTask:()=>u8,isCleanOptionsArray:()=>f8});function u8(t,e){let{cleanMode:r,options:i,valid:n}=d8(t);return r?n.options?(i.push(...e),i.some(m8)?Nr(Bv):GC(r,i)):Nr(Uv+JSON.stringify(t)):Nr(Hv)}function GC(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(i){return l8(t==="n",i)}}}function f8(t){return Array.isArray(t)&&t.every(e=>Gv.has(e))}function d8(t){let e,r=[],i={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(n=>{h8(n)?(e=n,i.cleanMode=!0):i.options=i.options&&p8(r[r.length]=`-${n}`)}),{cleanMode:e,options:r,valid:i}}function h8(t){return t==="f"||t==="n"}function p8(t){return/^-[a-z]$/i.test(t)&&Gv.has(t.charAt(1))}function m8(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var Bv,Hv,Uv,Pa,Gv,jC=Y({"src/lib/tasks/clean.ts"(){"use strict";c8(),ve(),yt(),Bv="Git clean interactive mode is not supported",Hv='Git clean mode parameter ("n" or "f") is required',Uv="Git clean unknown option found in: ",Pa=(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))(Pa||{}),Gv=new Set(["i",...yl(Object.values(Pa))])}});function g8(t){let e=new zC;for(let r of VC(t))e.addValue(r.file,String(r.key),r.value);return e}function v8(t,e){let r=null,i=[],n=new Map;for(let s of VC(t,e))s.key===e&&(i.push(r=s.value),n.has(s.file)||n.set(s.file,[]),n.get(s.file).push(r));return{key:e,paths:Array.from(n.keys()),scopes:n,value:r,values:i}}function w8(t){return t.replace(/^(file):/,"")}function*VC(t,e=null){let r=t.split("\0");for(let i=0,n=r.length-1;iObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Ra(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function fv(t,e){return typeof t=="string"&&Object.hasOwn(Sv,t)?t:e}function _8(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function y8(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return v8(i,t)}}}function x8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return g8(r)}}}function E8(){return{addConfig(t,e,...r){return this._runTask(_8(t,e,r[0]===!0,fv(r[1],"local")),st(arguments))},getConfig(t,e){return this._runTask(y8(t,fv(e,void 0)),st(arguments))},listConfig(...t){return this._runTask(x8(fv(t[0],void 0)),st(arguments))}}}var Sv,WC=Y({"src/lib/tasks/config.ts"(){"use strict";b8(),ve(),Sv=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Sv||{})}});function S8(t){return qC.has(t)}var dv,qC,YC=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";dv=(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))(dv||{}),qC=new Set(Object.values(dv))}});function k8(...t){return new KC().param(...t)}function A8(t){let e=new Set,r={};return Iv(t,i=>{let[n,s,a]=i.split(wl);e.add(n),(r[n]=r[n]||[]).push({line:Qe(s),path:n,preview:a})}),{paths:e,results:r}}function C8(){return{grep(t){let e=st(arguments),r=xr(arguments);for(let n of ZC)if(r.includes(n))return this._runTask(Nr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=k8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return A8(n)}},e)}}}var ZC,_u,OA,KC,XC=Y({"src/lib/tasks/grep.ts"(){"use strict";ve(),yt(),ZC=["-h"],_u=Symbol("grepQuery"),KC=class{constructor(){this[OA]=[]}*[(OA=_u,Symbol.iterator)](){for(let t of this[_u])yield t}and(...t){return t.length&&this[_u].push("--and","(",...yu(t,"-e"),")"),this}param(...t){return this[_u].push(...yu(t,"-e")),this}}}}),QC={};St(QC,{ResetMode:()=>Gd,getResetMode:()=>P8,resetTask:()=>T8});function T8(t,e){let r=["reset"];return JC(t)&&r.push(`--${t}`),r.push(...e),Er(r)}function P8(t){if(JC(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function JC(t){return typeof t=="string"&&eT.includes(t)}var Gd,eT,tT=Y({"src/lib/tasks/reset.ts"(){"use strict";ve(),yt(),Gd=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Gd||{}),eT=yl(Object.values(Gd))}});function R8(){return(0,qd.default)("simple-git")}function LA(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function $8(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function jv(t,e,r,i=R8()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=$8(lr(e,mt),a,i);return c(r);function l(u,f){return Ei(s,jv(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&LA(a,f)||$a,h=LA(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var rT=Y({"src/lib/git-logger.ts"(){"use strict";ve(),qd.default.formatters.L=t=>String(Jd(t)?t.length:"-"),qd.default.formatters.B=t=>E.isBuffer(t)?t.toString("utf8"):ku(t)}}),iT,F8=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Hs(),rT(),iT=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=jv(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new Br(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger("Starting task"),i}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function Ta(t,e){return{method:wC(t.commands)||"",commands:e}}function I8(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(E.from(String(r.stack),"ascii"))}}function NA(t,e,r,i){return n=>{r("%s received %L bytes",e,n),i("%B",n),t.push(n)}}var kv,M8=Y({"src/lib/runners/git-executor-chain.ts"(){"use strict";Hs(),yt(),ve(),F8(),kv=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new iT}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:i}=this._queue.attempt(t);return await(HC(t)?this.attemptEmptyTask(t,i):this.attemptRemoteTask(t,i))}catch(i){throw this.onFatalException(t,i)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof 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","",Ta(t,t.commands)),i=this._plugins.exec("spawn.args",[...t.commands],{...Ta(t,t.commands),env:{...this.env}}),n=await this.gitResponse(t,r,i,this.outputHandler,e.step("SPAWN")),s=await this.handleTaskData(t,i,n,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),BC(t)?yv(t.parser,s):yv(t.parser,s.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,i){let{exitCode:n,rejection:s,stdOut:a,stdErr:o}=r;return new Promise((l,c)=>{i("Preparing to handle process response exitCode=%d stdOut=",n);let{error:u}=this._plugins.exec("task.error",{error:s},{...Ta(t,e),...r});if(u&&t.onError)return i.info("exitCode=%s handling with custom error handler"),t.onError(r,u,f=>{i.info("custom error handler treated as success"),i("custom error returned a %s",ku(f)),l(new Wd(Array.isArray(f)?E.concat(f):f,E.concat(o)))},c);if(u)return i.info("handling as error: exitCode=%s stdErr=%s rejection=%o",n,o.length,s),c(u);i.info("retrieving task output complete"),l(new Wd(E.concat(a),E.concat(o)))})}async gitResponse(t,e,r,i,n){let s=n.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Ta(t,t.commands));return new Promise(o=>{let l=[],c=[];n.info("%s %o",e,r),n("%O",a);let u=this._beforeSpawn(t,r);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,{...Ta(t,r),kill(d){u=d||u}});let f=(0,nT.spawn)(e,r,a);f.stdout.on("data",NA(l,"stdOut",n,s.step("stdOut"))),f.stderr.on("data",NA(c,"stdErr",n,s.step("stdErr"))),f.on("error",I8(c,n)),i&&(n("Passing child process stdOut/stdErr to custom outputHandler"),i(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...Ta(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:c,exitCode:d,rejection:u||h})},kill(d){f.killed||(u=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...Ta(t,e),kill(i){r=i||r}}),r}}}}),sT={};St(sT,{GitExecutor:()=>aT});var aT,D8=Y({"src/lib/runners/git-executor.ts"(){"use strict";M8(),aT=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new kv(this,this._scheduler,this._plugins)}chain(){return new kv(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function O8(t,e,r=$a){let i=s=>{r(null,s)},n=s=>{(s==null?void 0:s.task)===t&&r(s instanceof Eu?L8(s):s,void 0)};e.then(i,n)}function L8(t){let e=i=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${i} should be GitResponseError.git.${i}, this will no longer be available in version 3`),e=$a};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(i,n){return n in t||(i[n]={enumerable:!1,configurable:!1,get(){return e(n),t.git[n]}}),i}}var N8=Y({"src/lib/task-callback.ts"(){"use strict";_l(),ve()}});function BA(t,e){return LC(r=>{if(!Mv(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var B8=Y({"src/lib/tasks/change-working-directory.ts"(){"use strict";ve(),yt()}});function hv(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=Kd(e,"-B")),Er(e)}function H8(){return{checkout(){return this._runTask(hv(xr(arguments,1)),st(arguments))},checkoutBranch(t,e){return this._runTask(hv(["-b",t,e,...xr(arguments)]),st(arguments))},checkoutLocalBranch(t){return this._runTask(hv(["-b",t,...xr(arguments)]),st(arguments))}}}var U8=Y({"src/lib/tasks/checkout.ts"(){"use strict";ve(),yt()}});function G8(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function j8(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Hr(G8(),[oT],t)}})}}}var oT,V8=Y({"src/lib/tasks/count-objects.ts"(){"use strict";ve(),oT=new _e(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let i=yC(e);Object.hasOwn(t,i)&&(t[i]=Qe(r))})}});function z8(t){return Hr({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},lT,t)}var lT,W8=Y({"src/lib/parsers/parse-commit.ts"(){"use strict";ve(),lT=[new _e(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,i])=>{t.branch=e,t.commit=i,t.root=!!r}),new _e(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),i=r.pop();!i||!i.includes("@")||(t.author={email:i.substr(0,i.length-1),name:r.join("<").trim()})}),new _e(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(i,10)||0}),new _e(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0;let n=parseInt(r,10)||0;i==="-"?t.summary.deletions=n:i==="+"&&(t.summary.insertions=n)})]}});function q8(t,e,r){return{commands:["-c","core.abbrev=40","commit",...yu(t,"-m"),...e,...r],format:"utf-8",parser:z8}}function Y8(){return{commit(e,...r){let i=st(arguments),n=t(e)||q8(yn(e),yn(lr(r[0],zd,[])),[...yl(lr(r[1],Au,[])),...xr(arguments,0,!0)]);return this._runTask(n,i)}};function t(e){return!zd(e)&&Nr("git.commit: requires the commit message to be supplied as a string/string[]")}}var Z8=Y({"src/lib/tasks/commit.ts"(){"use strict";W8(),ve(),yt()}});function K8(){return{firstCommit(){return this._runTask(Er(["rev-list","--max-parents=0","HEAD"],!0),st(arguments))}}}var X8=Y({"src/lib/tasks/first-commit.ts"(){"use strict";ve(),yt()}});function Q8(t,e){let r=["hash-object",t];return e&&r.push("-w"),Er(r,!0)}var J8=Y({"src/lib/tasks/hash-object.ts"(){"use strict";yt()}});function eH(t,e,r){let i=String(r).trim(),n;if(n=cT.exec(i))return new jd(t,e,!1,n[1]);if(n=uT.exec(i))return new jd(t,e,!0,n[1]);let s="",a=i.split(" ");for(;a.length;)if(a.shift()==="in"){s=a.join(" ");break}return new jd(t,e,/^re/i.test(i),s)}var jd,cT,uT,tH=Y({"src/lib/responses/InitSummary.ts"(){"use strict";jd=class{constructor(t,e,r,i){this.bare=t,this.path=e,this.existing=r,this.gitDir=i}},cT=/^Init.+ repository in (.+)$/,uT=/^Rein.+ in (.+)$/}});function rH(t){return t.includes(Vv)}function iH(t=!1,e,r){let i=["init",...r];return t&&!rH(i)&&i.splice(1,0,Vv),{commands:i,format:"utf-8",parser(n){return eH(i.includes("--bare"),e,n)}}}var Vv,nH=Y({"src/lib/tasks/init.ts"(){"use strict";tH(),Vv="--bare"}});function zv(t){for(let e=0;eHr(new fT,e,r,!1)}var pv,HA,UA,GA,hT,pT=Y({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Cu(),aH(),YC(),ve(),pv=[new _e(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,i=""])=>{t.files.push({file:e.trim(),changes:Qe(r),insertions:i.replace(/[^+]/g,"").length,deletions:i.replace(/[^-]/g,"").length,binary:!1})}),new _e(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,i])=>{t.files.push({file:e.trim(),before:Qe(r),after:Qe(i),binary:!0})}),new _e(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let i=/(\d+) i/.exec(r),n=/(\d+) d/.exec(r);t.changed=Qe(e),t.insertions=Qe(i==null?void 0:i[1]),t.deletions=Qe(n==null?void 0:n[1])})],HA=[new _e(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,i])=>{let n=Qe(e),s=Qe(r);t.changed++,t.insertions+=n,t.deletions+=s,t.files.push({file:i,changes:n+s,insertions:n,deletions:s,binary:!1})}),new _e(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],UA=[new _e(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],GA=[new _e(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,i,n,s])=>{t.changed++,t.files.push({file:s!=null?s:i,changes:0,insertions:0,deletions:0,binary:!1,status:wv(S8(e)&&e),from:wv(!!s&&i!==s&&i),similarity:Qe(r)})})],hT={"":pv,"--stat":pv,"--numstat":HA,"--name-status":GA,"--name-only":UA}}});function oH(t,e){return e.reduce((r,i,n)=>(r[i]=t[n]||"",r),Object.create({diff:null}))}function mT(t=Zv,e=gT,r=""){let i=dT(r);return function(n){let s=Su(n.trim(),!1,qv).map(function(a){let o=a.split(Yv),l=oH(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=i(o[1])),l});return{all:s,latest:s.length&&s[0]||null,total:s.length}}}var qv,Yv,Zv,gT,vT=Y({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";ve(),pT(),Cu(),qv="\xF2\xF2\xF2\xF2\xF2\xF2 ",Yv=" \xF2\xF2",Zv=" \xF2 ",gT=["hash","date","message","refs","author_name","author_email"]}}),wT={};St(wT,{diffSummaryTask:()=>lH,validateLogFormatConfig:()=>rh});function lH(t){let e=zv(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),rh(r)||{commands:r,format:"utf-8",parser:dT(e)}}function rh(t){let e=t.filter(sH);if(e.length>1)return Nr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Nr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var Kv=Y({"src/lib/tasks/diff.ts"(){"use strict";Cu(),pT(),yt()}});function cH(t,e){let r=[],i=[];return Object.keys(t).forEach(n=>{r.push(n),i.push(String(t[n]))}),[r,i.join(e)]}function uH(t){return Object.keys(t).reduce((e,r)=>(r in Av||(e[r]=t[r]),e),{})}function bT(t={},e=[]){let r=lr(t.splitter,mt,Zv),i=Qd(t.format)?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[n,s]=cH(i,r),a=[],o=[`--pretty=format:${qv}${s}${Yv}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let c=t.symmetric!==!1?"...":"..";a.push(`${t.from||""}${c}${t.to||""}`)}return mt(t.file)&&o.push("--follow",pl(t.file)),Ov(uH(t),o),{fields:n,splitter:r,commands:[...o,...a]}}function fH(t,e,r){let i=mT(t,e,zv(r));return{commands:["log",...r],format:"utf-8",parser:i}}function dH(){return{log(...r){let i=st(arguments),n=bT(Lv(arguments),yl(lr(arguments[0],Au,[]))),s=e(...r)||rh(n.commands)||t(n);return this._runTask(s,i)}};function t(r){return fH(r.splitter,r.fields,r.commands)}function e(r,i){return mt(r)&&mt(i)&&Nr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Av,_T=Y({"src/lib/tasks/log.ts"(){"use strict";Cu(),vT(),ve(),yt(),Kv(),Av=(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))(Av||{})}}),Vd,yT,hH=Y({"src/lib/responses/MergeSummary.ts"(){"use strict";Vd=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},yT=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"}}}}),Cv,xT,pH=Y({"src/lib/responses/PullSummary.ts"(){"use strict";Cv=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},xT=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function mv(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 jA(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:Qe(e&&e[1]||"0"),delta:Qe(r&&r[1]||"0")}}var ET,mH=Y({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";ve(),ET=[new Bs(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=mv(t.remoteMessages);Object.assign(n,{[i]:Qe(r)})}),new Bs(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=mv(t.remoteMessages);Object.assign(n,{[i]:Qe(r)})}),new Bs(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,i])=>{let n=mv(t.remoteMessages);n.total=jA(e),n.reused=jA(r),n.packReused=Qe(i)})]}});function ST(t,e){return Hr({remoteMessages:new AT},kT,e)}var kT,AT,CT=Y({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";ve(),mH(),kT=[new Bs(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...ET,new Bs([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Bs([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,i])=>{t.remoteMessages.vulnerabilities={count:Qe(e),summary:r,url:i}})],AT=class{constructor(){this.all=[]}}}});function gH(t,e){let r=Hr(new xT,TT,[t,e]);return r.message&&r}var VA,zA,WA,qA,TT,YA,Xv,PT=Y({"src/lib/parsers/parse-pull.ts"(){"use strict";pH(),ve(),CT(),VA=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,zA=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,WA=/^(create|delete) mode \d+ (.+)/,qA=[new _e(VA,(t,[e,r,i])=>{t.files.push(e),r&&(t.insertions[e]=r.length),i&&(t.deletions[e]=i.length)}),new _e(zA,(t,[e,,r,,i])=>r!==void 0||i!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+i||0,!0):!1),new _e(WA,(t,[e,r])=>{Ei(t.files,r),Ei(e==="create"?t.created:t.deleted,r)})],TT=[new _e(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new _e(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new _e(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,i,n])=>{t.branch.local=i,t.hash.local=e,t.branch.remote=n,t.hash.remote=r})],YA=(t,e)=>Hr(new Cv,qA,[t,e]),Xv=(t,e)=>Object.assign(new Cv,YA(t,e),ST(t,e))}}),ZA,RT,KA,vH=Y({"src/lib/parsers/parse-merge.ts"(){"use strict";hH(),ve(),PT(),ZA=[new _e(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new _e(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new Vd(e,r))}),new _e(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,i])=>{t.conflicts.push(new Vd(e,r,{deleteRef:i}))}),new _e(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new Vd(e,null))}),new _e(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],RT=(t,e)=>Object.assign(KA(t,e),Xv(t,e)),KA=t=>Hr(new yT,ZA,t)}});function XA(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let i=RT(e,r);if(i.failed)throw new Eu(i);return i}}:Nr("Git.merge requires at least one option")}var wH=Y({"src/lib/tasks/merge.ts"(){"use strict";_l(),vH(),yt()}});function bH(t,e,r){let i=r.includes("deleted"),n=r.includes("tag")||/^refs\/tags/.test(t),s=!r.includes("new");return{deleted:i,tag:n,branch:!n,new:!s,alreadyUpdated:s,local:t,remote:e}}var QA,$T,JA,_H=Y({"src/lib/parsers/parse-push.ts"(){"use strict";ve(),CT(),QA=[new _e(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new _e(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new _e(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,i])=>{t.pushed.push(bH(e,r,i))}),new _e(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,i])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:i}}),new _e(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,i,n])=>{t.update={head:{local:e,remote:r},hash:{from:i,to:n}}})],$T=(t,e)=>{let r=JA(t,e),i=ST(t,e);return{...r,...i}},JA=(t,e)=>Hr({pushed:[]},QA,[t,e])}}),FT={};St(FT,{pushTagsTask:()=>yH,pushTask:()=>Qv});function yH(t={},e){return Ei(e,"--tags"),Qv(t,e)}function Qv(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),Kd(r,"-v"),Ei(r,"--verbose"),Ei(r,"--porcelain"),{commands:r,format:"utf-8",parser:$T}}var IT=Y({"src/lib/tasks/push.ts"(){"use strict";_H(),ve()}});function xH(){return{showBuffer(){let t=["show",...xr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(NC(t),st(arguments))},show(){let t=["show",...xr(arguments,1)];return this._runTask(Er(t),st(arguments))}}}var EH=Y({"src/lib/tasks/show.ts"(){"use strict";ve(),yt()}}),eC,MT,SH=Y({"src/lib/responses/FileStatusSummary.ts"(){"use strict";eC=/^(.+)\0(.+)$/,MT=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let i=eC.exec(t)||[null,t,t];this.from=i[2]||"",this.path=i[1]||""}}}}});function tC(t){let[e,r]=t.split(wl);return{from:r||e,to:e}}function Jr(t,e,r){return[`${t}${e}`,r]}function gv(t,...e){return e.map(r=>Jr(t,r,(i,n)=>i.conflicted.push(n)))}function kH(t,e){let r=e.trim();switch(" "){case r.charAt(2):return i(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return i(" ",r.charAt(0),r.slice(2));default:return}function i(n,s,a){let o=`${n}${s}`,l=DT.get(o);l&&l(t,a),o!=="##"&&o!=="!!"&&t.files.push(new MT(a,n,s))}}var rC,DT,OT,AH=Y({"src/lib/responses/StatusSummary.ts"(){"use strict";ve(),SH(),rC=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}},DT=new Map([Jr(" ","A",(t,e)=>t.created.push(e)),Jr(" ","D",(t,e)=>t.deleted.push(e)),Jr(" ","M",(t,e)=>t.modified.push(e)),Jr("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),Jr("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),Jr("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),Jr("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Jr("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),Jr("R"," ",(t,e)=>{t.renamed.push(tC(e))}),Jr("R","M",(t,e)=>{let r=tC(e);t.renamed.push(r),t.modified.push(r.to)}),Jr("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),Jr("?","?",(t,e)=>t.not_added.push(e)),...gv("A","A","U"),...gv("D","D","U"),...gv("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,i=/behind (\d+)/,n=/^(.+?(?=(?:\.{3}|\s|$)))/,s=/\.{3}(\S*)/,a=/\son\s(\S+?)(?=\.{3}|$)/,o=r.exec(e);t.ahead=o&&+o[1]||0,o=i.exec(e),t.behind=o&&+o[1]||0,o=n.exec(e),t.current=lr(o==null?void 0:o[1],mt,null),o=s.exec(e),t.tracking=lr(o==null?void 0:o[1],mt,null),o=a.exec(e),o&&(t.current=lr(o==null?void 0:o[1],mt,t.current)),t.detached=/\(no branch\)/.test(e)}]]),OT=function(t){let e=t.split(wl),r=new rC;for(let i=0,n=e.length;i!LT.includes(r))],parser(r){return OT(r)}}}var LT,TH=Y({"src/lib/tasks/status.ts"(){"use strict";AH(),LT=["--null","-z"]}});function Yd(t=0,e=0,r=0,i="",n=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:i,installed:n},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function PH(){return Yd(0,0,0,"",!1)}function RH(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:$H,onError(t,e,r,i){if(t.exitCode===-2)return r(E.from(Jv));i(e)}})}}}function $H(t){return t===Jv?PH():Hr(Yd(0,0,0,t),NT,t)}var Jv,NT,FH=Y({"src/lib/tasks/version.ts"(){"use strict";ve(),Jv="installed=false",NT=[new _e(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,i,n=""])=>{Object.assign(t,Yd(Qe(e),Qe(r),Qe(i),n))}),new _e(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,i,n=""])=>{Object.assign(t,Yd(Qe(e),Qe(r),i,n))})]}});function iC(t,e,r,...i){return mt(r)?e(r,lr(i[0],mt),xr(arguments)):Nr(`git.${t}() requires a string 'repoPath'`)}function IH(){return{clone(t,...e){return this._runTask(iC("clone",Tv,lr(t,mt),...e),st(arguments))},mirror(t,...e){return this._runTask(iC("mirror",BT,lr(t,mt),...e),st(arguments))}}}var Tv,BT,MH=Y({"src/lib/tasks/clone.ts"(){"use strict";yt(),ve(),Tv=(t,e,r)=>{let i=["clone",...r];return mt(t)&&i.push(pl(t)),mt(e)&&i.push(pl(e)),Er(i)},BT=(t,e,r)=>(Ei(r,"--mirror"),Tv(t,e,r))}}),HT={};St(HT,{SimpleGitApi:()=>Pv});var Pv,DH=Y({"src/lib/simple-git-api.ts"(){"use strict";N8(),B8(),U8(),V8(),Z8(),WC(),X8(),XC(),J8(),nH(),_T(),wH(),IT(),EH(),TH(),yt(),FH(),ve(),MH(),Pv=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),i=r.push(t);return e&&O8(t,i,e),Object.create(this,{then:{value:i.then.bind(i)},catch:{value:i.catch.bind(i)},_executor:{value:r}})}add(t){return this._runTask(Er(["add",...yn(t)]),st(arguments))}cwd(t){let e=st(arguments);return typeof t=="string"?this._runTask(BA(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(BA(t.path,t.root&&this._executor||void 0),e):this._runTask(Nr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(Q8(t,e===!0),st(arguments))}init(t){return this._runTask(iH(t===!0,this._executor.cwd,xr(arguments)),st(arguments))}merge(){return this._runTask(XA(xr(arguments)),st(arguments))}mergeFromTo(t,e){return mt(t)&&mt(e)?this._runTask(XA([t,e,...xr(arguments)]),st(arguments,!1)):this._runTask(Nr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Qv({remote:lr(arguments[0],mt),branch:lr(arguments[1],mt)},xr(arguments));return this._runTask(t,st(arguments))}stash(){return this._runTask(Er(["stash",...xr(arguments)]),st(arguments))}status(){return this._runTask(CH(xr(arguments)),st(arguments))}},Object.assign(Pv.prototype,H8(),IH(),Y8(),E8(),j8(),K8(),C8(),dH(),xH(),RH())}}),UT={};St(UT,{Scheduler:()=>jT});var nC,jT,OH=Y({"src/lib/runners/scheduler.ts"(){"use strict";ve(),rT(),nC=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,GT.createDeferred)();return{promise:e,done:r,id:t}}})(),jT=class{constructor(t=2){this.concurrency=t,this.logger=jv("","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=Ei(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),Kd(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Ei(this.pending,nC());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),VT={};St(VT,{applyPatchTask:()=>LH});function LH(t,e){return Er(["apply",...e,...t])}var NH=Y({"src/lib/tasks/apply-patch.ts"(){"use strict";yt()}});function BH(t,e){return{branch:t,hash:e,success:!0}}function HH(t){return{branch:t,hash:null,success:!1}}var zT,UH=Y({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";zT=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function WT(t,e){return e===1&&Rv.test(t)}var sC,Rv,aC,ih,GH=Y({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";UH(),ve(),sC=/(\S+)\s+\(\S+\s([^)]+)\)/,Rv=/^error[^']+'([^']+)'/m,aC=[new _e(sC,(t,[e,r])=>{let i=BH(e,r);t.all.push(i),t.branches[e]=i}),new _e(Rv,(t,[e])=>{let r=HH(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],ih=(t,e)=>Hr(new zT,aC,[t,e])}}),qT,jH=Y({"src/lib/responses/BranchSummary.ts"(){"use strict";qT=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,i,n){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:i,label:n}}}}});function oC(t){return t?t.charAt(0):""}function YT(t,e=!1){return Hr(new qT,e?[KT]:ZT,t)}var ZT,KT,VH=Y({"src/lib/parsers/parse-branch.ts"(){"use strict";jH(),ve(),ZT=[new _e(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,i,n])=>{t.push(oC(e),!0,r,i,n)}),new _e(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,i,n])=>{t.push(oC(e),!1,r,i,n)})],KT=new _e(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),XT={};St(XT,{branchLocalTask:()=>WH,branchTask:()=>zH,containsDeleteBranchCommand:()=>QT,deleteBranchTask:()=>YH,deleteBranchesTask:()=>qH});function QT(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function zH(t){let e=QT(t),r=t.includes("--show-current"),i=["branch",...t];return i.length===1&&i.push("-a"),i.includes("-v")||i.splice(1,0,"-v"),{format:"utf-8",commands:i,parser(n,s){return e?ih(n,s).all[0]:YT(n,r)}}}function WH(){return{format:"utf-8",commands:["branch","-v"],parser(t){return YT(t)}}}function qH(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,i){return ih(r,i)},onError({exitCode:r,stdOut:i},n,s,a){if(!WT(String(n),r))return a(n);s(i)}}}function YH(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(i,n){return ih(i,n).branches[t]},onError({exitCode:i,stdErr:n,stdOut:s},a,o,l){if(!WT(String(a),i))return l(a);throw new Eu(r.parser(xu(s),xu(n)),String(a))}};return r}var ZH=Y({"src/lib/tasks/branch.ts"(){"use strict";_l(),GH(),VH(),ve()}});function KH(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,JT.normalize)(e)}var e2,XH=Y({"src/lib/responses/CheckIgnore.ts"(){"use strict";e2=t=>t.split(/\n/g).map(KH).filter(Boolean)}}),t2={};St(t2,{checkIgnoreTask:()=>QH});function QH(t){return{commands:["check-ignore",...t],format:"utf-8",parser:e2}}var JH=Y({"src/lib/tasks/check-ignore.ts"(){"use strict";XH()}});function e6(t,e){return Hr({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},r2,[t,e])}var r2,t6=Y({"src/lib/parsers/parse-fetch.ts"(){"use strict";ve(),r2=[new _e(/From (.+)$/,(t,[e])=>{t.remote=e}),new _e(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new _e(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new _e(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new _e(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,i,n])=>{t.updated.push({name:i,tracking:n,to:r,from:e})})]}}),i2={};St(i2,{fetchTask:()=>i6});function r6(t){return/^--upload-pack(=|$)/.test(t)}function i6(t,e,r){let i=["fetch",...r];return t&&e&&i.push(t,e),i.find(r6)?Nr("git.fetch: potential exploit argument blocked."):{commands:i,format:"utf-8",parser:e6}}var n6=Y({"src/lib/tasks/fetch.ts"(){"use strict";t6(),yt()}});function s6(t){return Hr({moves:[]},n2,t)}var n2,a6=Y({"src/lib/parsers/parse-move.ts"(){"use strict";ve(),n2=[new _e(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),s2={};St(s2,{moveTask:()=>o6});function o6(t,e){return{commands:["mv","-v",...yn(t),e],format:"utf-8",parser:s6}}var l6=Y({"src/lib/tasks/move.ts"(){"use strict";a6(),ve()}}),a2={};St(a2,{pullTask:()=>c6});function c6(t,e,r){let i=["pull",...r];return t&&e&&i.splice(1,0,t,e),{commands:i,format:"utf-8",parser(n,s){return Xv(n,s)},onError(n,s,a,o){let l=gH(xu(n.stdOut),xu(n.stdErr));if(l)return o(new Eu(l));o(s)}}}var u6=Y({"src/lib/tasks/pull.ts"(){"use strict";_l(),PT(),ve()}});function f6(t){let e={};return o2(t,([r])=>e[r]={name:r}),Object.values(e)}function d6(t){let e={};return o2(t,([r,i,n])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),n&&i&&(e[r].refs[n.replace(/[^a-z]/g,"")]=i)}),Object.values(e)}function o2(t,e){Iv(t,r=>e(r.split(/\s+/)))}var h6=Y({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";ve()}}),l2={};St(l2,{addRemoteTask:()=>p6,getRemotesTask:()=>m6,listRemotesTask:()=>g6,remoteTask:()=>v6,removeRemoteTask:()=>w6});function p6(t,e,r){return Er(["remote","add",...r,t,e])}function m6(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?d6:f6}}function g6(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Er(e)}function v6(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Er(e)}function w6(t){return Er(["remote","remove",t])}var b6=Y({"src/lib/tasks/remote.ts"(){"use strict";h6(),yt()}}),c2={};St(c2,{stashListTask:()=>_6});function _6(t={},e){let r=bT(t),i=["stash","list",...r.commands,...e],n=mT(r.splitter,r.fields,zv(i));return rh(i)||{commands:i,format:"utf-8",parser:n}}var y6=Y({"src/lib/tasks/stash-list.ts"(){"use strict";Cu(),vT(),Kv(),_T()}}),u2={};St(u2,{addSubModuleTask:()=>x6,initSubModuleTask:()=>E6,subModuleTask:()=>nh,updateSubModuleTask:()=>S6});function x6(t,e){return nh(["add",t,e])}function E6(t){return nh(["init",...t])}function nh(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Er(e)}function S6(t){return nh(["update",...t])}var k6=Y({"src/lib/tasks/sub-module.ts"(){"use strict";yt()}});function A6(t,e){let r=Number.isNaN(t),i=Number.isNaN(e);return r!==i?r?1:-1:r?f2(t,e):0}function f2(t,e){return t===e?0:t>e?1:-1}function C6(t){return t.trim()}function Ud(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var lC,d2,T6=Y({"src/lib/responses/TagList.ts"(){"use strict";lC=class{constructor(t,e){this.all=t,this.latest=e}},d2=function(t,e=!1){let r=t.split(` +`).map(C6).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return A6(Ud(a[0]),Ud(o[0]));for(let l=0,c=Math.max(a.length,o.length);ln.indexOf(".")>=0);return new lC(r,i)}}}),h2={};St(h2,{addAnnotatedTagTask:()=>$6,addTagTask:()=>R6,tagListTask:()=>P6});function P6(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return d2(r,e)}}}function R6(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function $6(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var F6=Y({"src/lib/tasks/tag.ts"(){"use strict";T6()}}),I6=K3({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(D8(),_t(sT)),{SimpleGitApi:i}=(DH(),_t(HT)),{Scheduler:n}=(OH(),_t(UT)),{adhocExecTask:s,configurationErrorTask:a}=(yt(),_t(Ev)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ve(),_t(TC)),{applyPatchTask:w}=(NH(),_t(VT)),{branchTask:y,branchLocalTask:b,deleteBranchesTask:S,deleteBranchTask:C}=(ZH(),_t(XT)),{checkIgnoreTask:A}=(JH(),_t(t2)),{checkIsRepoTask:k}=(FC(),_t(PC)),{cleanWithOptionsTask:v,isCleanOptionsArray:x}=(jC(),_t(UC)),{diffSummaryTask:_}=(Kv(),_t(wT)),{fetchTask:P}=(n6(),_t(i2)),{moveTask:T}=(l6(),_t(s2)),{pullTask:M}=(u6(),_t(a2)),{pushTagsTask:$}=(IT(),_t(FT)),{addRemoteTask:D,getRemotesTask:Q,listRemotesTask:ye,remoteTask:de,removeRemoteTask:J}=(b6(),_t(l2)),{getResetMode:X,resetTask:he}=(tT(),_t(QC)),{stashListTask:z}=(y6(),_t(c2)),{addSubModuleTask:K,initSubModuleTask:G,subModuleTask:Me,updateSubModuleTask:Et}=(k6(),_t(u2)),{addAnnotatedTagTask:Ht,addTagTask:De,tagListTask:Rt}=(F6(),_t(h2)),{straightThroughBufferTask:$t,straightThroughStringTask:Xe}=(yt(),_t(Ev));function re(B,N){this._plugins=N,this._executor=new r(B.baseDir,new n(B.maxConcurrentProcesses),N),this._trimmed=B.trimmed}(re.prototype=Object.create(i.prototype)).constructor=re,re.prototype.customBinary=function(B){return this._plugins.reconfigure("binary",B),this},re.prototype.env=function(B,N){return arguments.length===1&&typeof B=="object"?this._executor.env=B:(this._executor.env=this._executor.env||{})[B]=N,this},re.prototype.stashList=function(B){return this._runTask(z(g(arguments)||{},l(B)&&B||[]),p(arguments))},re.prototype.mv=function(B,N){return this._runTask(T(B,N),p(arguments))},re.prototype.checkoutLatestTag=function(B){var N=this;return this.pull(function(){N.tags(function(ue,Re){N.checkout(Re.latest,B)})})},re.prototype.pull=function(B,N,ue,Re){return this._runTask(M(d(B,u),d(N,u),h(arguments)),p(arguments))},re.prototype.fetch=function(B,N){return this._runTask(P(d(B,u),d(N,u),h(arguments)),p(arguments))},re.prototype.silent=function(B){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},re.prototype.tags=function(B,N){return this._runTask(Rt(h(arguments)),p(arguments))},re.prototype.rebase=function(){return this._runTask(Xe(["rebase",...h(arguments)]),p(arguments))},re.prototype.reset=function(B){return this._runTask(he(X(B),h(arguments)),p(arguments))},re.prototype.revert=function(B){let N=p(arguments);return typeof B!="string"?this._runTask(a("Commit must be a string"),N):this._runTask(Xe(["revert",...h(arguments,0,!0),B]),N)},re.prototype.addTag=function(B){let N=typeof B=="string"?De(B):a("Git.addTag requires a tag name");return this._runTask(N,p(arguments))},re.prototype.addAnnotatedTag=function(B,N){return this._runTask(Ht(B,N),p(arguments))},re.prototype.deleteLocalBranch=function(B,N,ue){return this._runTask(C(B,typeof N=="boolean"?N:!1),p(arguments))},re.prototype.deleteLocalBranches=function(B,N,ue){return this._runTask(S(B,typeof N=="boolean"?N:!1),p(arguments))},re.prototype.branch=function(B,N){return this._runTask(y(h(arguments)),p(arguments))},re.prototype.branchLocal=function(B){return this._runTask(b(),p(arguments))},re.prototype.raw=function(B){let N=!Array.isArray(B),ue=[].slice.call(N?arguments:B,0);for(let Ut=0;Utconsole.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},re.prototype.checkIgnore=function(B,N){return this._runTask(A(o(d(B,f,[]))),p(arguments))},re.prototype.checkIsRepo=function(B,N){return this._runTask(k(d(B,u)),p(arguments))},e.exports=re}});Hs();var M6=class extends Br{constructor(t,e){super(void 0,e),this.config=t}};Hs();Hs();var bl=class extends Br{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};_l();pC();FC();jC();WC();YC();XC();tT();function D6(t){return t?[{type:"spawn.before",action(i,n){t.aborted&&n.kill(new bl(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(i,n){function s(){n.kill(new bl(void 0,"abort","Abort signal received"))}t.addEventListener("abort",s),n.spawned.on("close",()=>t.removeEventListener("abort",s))}}]:void 0}function O6(t={}){return{type:"spawn.args",action(e,{env:r}){for(let i of DA(e,r))if(t[i.category]!==!0)throw new bl(void 0,"unsafe",i.message);return e}}}ve();function L6(t){let e=yu(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}ve();var cC=(0,vl.deferred)().promise;function N6({onClose:t=!0,onExit:e=50}={}){function r(){let n=-1,s={close:(0,vl.deferred)(),closeTimeout:(0,vl.deferred)(),exit:(0,vl.deferred)(),exitTimeout:(0,vl.deferred)()},a=Promise.race([t===!1?cC:s.closeTimeout.promise,e===!1?cC:s.exitTimeout.promise]);return i(t,s.close,s.closeTimeout),i(e,s.exit,s.exitTimeout),{close(o){n=o,s.close.done()},exit(o){n=o,s.exit.done()},get exitCode(){return n},result:a}}function i(n,s,a){n!==!1&&(n===!0?s.promise:s.promise.then(()=>vv(n))).then(a.done)}return{type:"spawn.after",async action(n,{spawned:s,close:a}){var u,f;let o=r(),l=!0,c=()=>{l=!1};(u=s.stdout)==null||u.on("data",c),(f=s.stderr)==null||f.on("data",c),s.on("error",c),s.on("close",d=>o.close(d)),s.on("exit",d=>o.exit(d));try{await o.result,l&&await vv(50),a(o.exitCode)}catch(d){a(o.exitCode,d)}}}}ve();var B6="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",uC="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function H6(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function fC(t,e){if(t.length<1||t.length>2)throw new bl(void 0,"binary",B6);if(t.some(H6))if(e)console.warn(uC);else throw new bl(void 0,"binary",uC);let[i,n]=t;return{binary:i,prefix:n}}function U6(t,e=["git"],r=!1){let i=fC(yn(e),r);t.on("binary",n=>{i=fC(yn(n),r)}),t.append("spawn.binary",()=>i.binary),t.append("spawn.args",n=>i.prefix?[i.prefix,...n]:n)}Hs();function G6(t){return!!(t.exitCode&&t.stdErr.length)}function j6(t){return E.concat([...t.stdOut,...t.stdErr])}function V6(t=!1,e=G6,r=j6){return(i,n)=>!t&&i||!e(n)?i:r(n)}function dC(t){return{type:"task.error",action(e,r){let i=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return E.isBuffer(i)?{error:new Br(void 0,i.toString("utf-8"))}:{error:i}}}}ve();var z6=class{constructor(){this.plugins=new Set,this.events=new p2.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Ei(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return yn(t).forEach(r=>r&&this.plugins.add(Ei(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let i=e,n=Object.freeze(Object.create(r));for(let s of this.plugins)s.type===t&&(i=s.action(i,n));return i}};ve();function W6(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(s,a){return r.includes(a.method)?_C(s,e):s}},{type:"spawn.after",action(s,a){var o;a.commands.includes(e)&&((o=a.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:a.method,stage:q6(c[1]),progress:Qe(c[2]),processed:Qe(c[3]),total:Qe(c[4])})}))}}]}function q6(t){return String(t.toLowerCase().split(" ",1))||"unknown"}ve();function Y6(t){let e=xC(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function Z6({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(i,n){var c,u;let s;function a(){s&&clearTimeout(s),s=setTimeout(l,t)}function o(){var f,d;(f=n.spawned.stdout)==null||f.off("data",a),(d=n.spawned.stderr)==null||d.off("data",a),n.spawned.off("exit",o),n.spawned.off("close",o),s&&clearTimeout(s)}function l(){o(),n.kill(new bl(void 0,"timeout","block timeout reached"))}r&&((c=n.spawned.stdout)==null||c.on("data",a)),e&&((u=n.spawned.stderr)==null||u.on("data",a)),n.spawned.on("exit",o),n.spawned.on("close",o),a()}}}function K6(){return{type:"spawn.args",action(t){let e=[],r;function i(n){(r=r||[]).push(...n)}for(let n=0;n_i(a)&&ml(a)||a));break}e.push(s)}return r?[...e,"--",...r.map(String)]:e}}}ve();var X6=I6();function Q6(t,e){var n;let r=new z6,i=AC(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Mv(i.baseDir))throw new M6(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(L6(i.config)),r.add(O6(i.unsafe)),r.add(N6(i.completion)),i.abort&&r.add(D6(i.abort)),i.progress&&r.add(W6(i.progress)),i.timeout&&r.add(Z6(i.timeout)),i.spawnOptions&&r.add(Y6(i.spawnOptions)),r.add(K6()),r.add(dC(V6(!0))),i.errors&&r.add(dC(i.errors)),U6(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new X6(i,r)}_l();var m2=Q6;var Ce=class extends cl{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var i;if(await this.isGitInstalled()){let n=this.app.vault.adapter,s=n.getBasePath(),a=s;this.plugin.settings.basePath&&(await n.exists((0,Zn.normalizePath)(this.plugin.settings.basePath))?a=We.join(s,this.plugin.settings.basePath):r||new Zn.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=a,this.git=m2({baseDir:a,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Rd:void 0),config:["core.quotepath=off"],unsafe:{allowUnsafeCustomBinary:!0,allowUnsafeEditor:!0,allowUnsafeAskPass:!0,allowUnsafeConfigEnvCount:!0,allowUnsafeConfigPaths:!0,allowUnsafeCredentialHelper:!0,allowUnsafeGitProxy:!0,allowUnsafeGpgProgram:!0,allowUnsafeHooksPath:!0,allowUnsafeMergeDriver:!0,allowUnsafeSshCommand:!0,allowUnsafePager:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir,u={...process.env};if(o.length>0){let y=o.join(":")+":"+u.PATH;u.PATH=y}c&&(u.GIT_DIR=c,u.GIT_WORK_TREE=a);for(let y of l){let[b,S]=y.split("=");u[b]=S}let f="simple-git",d=",",p=((i=localStorage.debug)!=null?i:"").split(d);if(!p.includes(f)&&!p.includes(`-${f}`)&&(p.push(f),w2.default.enable(p.join(d))),await this.git.env(u).checkIsRepo()){let y=await this.git.revparse("--show-cdup"),b=(0,Tu.resolve)(a+Tu.sep+y);this.absoluteRepoPath=b,await this.git.cwd(b)}let g=We.join(s,this.app.vault.configDir,"plugins","obsidian-git"),w=We.join(g,Sa);u.SSH_ASKPASS==null&&(u.SSH_ASKPASS=w),u.SSH_ASKPASS_REQUIRE="force",u.OBSIDIAN_GIT_CREDENTIALS_INPUT=We.join(g,$d),u.SSH_ASKPASS==w&&this.askpass().catch(y=>this.plugin.displayError(y)),u.OBSIDIAN_GIT="1",this.git=this.git.env(u)}}getRelativeVaultPath(r){let n=this.app.vault.adapter.getBasePath(),s=We.join(this.absoluteRepoPath,r),a=We.relative(n,s);return Zn.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(r,i=!0){if(i){let s=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,o=We.join(s,r),l=We.relative(a,o);return Zn.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let i=this.app.vault.adapter.getBasePath();return We.join(i,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return We.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,i=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await ei.writeFile(We.join(this.absPluginConfigPath,Sa),Nk),await ei.chmod(We.join(this.absPluginConfigPath,Sa),493),this.watchAbortController=new AbortController;let{signal:n}=this.watchAbortController;try{let s=ei.watch(this.absPluginConfigPath,{signal:n});for await(let a of s){if(a.filename!=$d)continue;let o=i+$d;if(await new Promise(d=>window.setTimeout(d,200)),!await r.exists(o))continue;let l=await r.read(o),c;l.length>60&&(c=new Zn.Notice(l,999999));let u=!0;l.contains("Username for")&&(u=!1);let f=await new tt(this.plugin,{allowEmpty:!0,obscure:u,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();c==null||c.hide(),await r.exists(o)&&await r.write(`${o}.response`,f!=null?f:"")}}catch(s){this.plugin.displayError(s),await ei.rm(We.join(this.absPluginConfigPath,Sa),{force:!0}),await ei.rm(We.join(this.absPluginConfigPath,`${Sa}.response`),{force:!0}),await new Promise(a=>window.setTimeout(a,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),i=We.join(this.app.vault.configDir,"plugins","obsidian-git",Sa),n=this.getRelativeRepoPath(i,!0);(await ei.readFile(r,"utf-8")).split(` +`).some(l=>l.contains(n))||await ei.appendFile(r,n+` +`)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=await this.git.status(i!=null?["--",i]:[]);this.plugin.setPluginState({gitAction:0});let s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",We.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(` +`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Tu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Pd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:Ls(i)}a.push("--",o);let c=await this.git.raw(a);return J6(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes}async commit({message:r,amend:i}){this.plugin.setPluginState({gitAction:4});let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),n}async stage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.add(r!=null?r:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:r}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(r!=null?["--",r]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(r,i){this.plugin.setPluginState({gitAction:3}),r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r]),this.plugin.setPluginState({gitAction:0})}async discard(r){this.plugin.setPluginState({gitAction:3}),await this.isTracked(r)&&await this.git.checkout(["--",r]),this.plugin.setPluginState({gitAction:0})}async applyPatch(r){let i=We.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path;this.plugin.setPluginState({gitAction:1});let n=[];i!=null&&n.push("--",i);let s=await this.git.clean(Pa.RECURSIVE+Pa.DRY_RUN,n);return this.plugin.setPluginState({gitAction:0}),s.paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo(),i=await this.git.revparse([r.current]);if(!r.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.unstageAll({})}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in o?o.message:o}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=await this.git.subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let r=await this.git.status(),i=r.tracking,n=r.current;if(!i&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let s=null;return i&&(s=(await this.git.diffSummary([n,i,"--"])).changed),await this.git.push(),s}catch(r){this.convertErrors(r)}}async getUnpushedCommits(){let r=await this.git.status(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let[s]=Yn(i);return(await this.getRemoteBranches(s)).includes(i)?(await this.git.diffSummary([n,i,"--"])).changed:(this.plugin.log(`Tracking branch ${i} does not exist on remote ${s}.`),0)}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let r=await this.git.status(),i=r.tracking,n=r.current;return i?(await this.git.diffSummary([n,i,"--"])).changed!==0:!1}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),i=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:i.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(i){if(String(i).contains(r))return;throw i}}async log(r,i=!0,n,s){let a;r&&(a=this.getRelativeRepoPath(r,i));let o={file:a,maxCount:n,"--diff-merges":"first-parent","--name-status":null};return s&&(o[s]=null),(await this.git.log(o)).all.map(c=>{var u,f,d,h;return{...c,author:{name:c.author_name,email:c.author_email},refs:c.refs.split(", ").filter(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,i,n=!0){let s=this.getRelativeRepoPath(i,n);return this.git.show([r+":"+s])}async getLocalBranchUpstream(r){try{let n=(await this.git.raw(["rev-parse","--abbrev-ref",`${r}@{upstream}`])).trim();return n.length>0?n:void 0}catch(i){return}}getAvailableLocalBranchName(r,i,n){let s=r;if(!n.includes(s))return s;let a=`${r}-${i}`,o=a,l=0;for(;n.includes(o);)l+=1,o=`${a}-${l}`;return o}async checkout(r,i){if(i){let n=`${i}/${r}`,s=await this.branchInfo();if(s.branches.includes(r)&&await this.getLocalBranchUpstream(r)===n)await this.git.checkout(r);else{let l=this.getAvailableLocalBranchName(r,i,s.branches);await this.git.checkout(["-b",l,n])}}else await this.git.checkout(r);if(this.plugin.settings.submoduleRecurseCheckout){let n=await this.getSubmodulePaths();for(let s of n){let a=await this.git.cwd({path:s,root:!1}).branch();Object.keys(a.branches).includes(r)&&await this.git.cwd({path:s,root:!1}).checkout(r)}}}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,i){await this.git.branch([i?"-D":"-d",r])}async branchIsMerged(r){return!(await this.git.branch(["--no-merged"])).all.contains(r)}async init(){await this.git.init(!1)}async clone(r,i,n){await this.git.clone(r,We.join(this.app.vault.adapter.getBasePath(),i),n?["--depth",`${n}`]:[]),await this.setGitInstance()}async setConfig(r,i){i==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,i)}async getConfig(r,i="local"){var s;return(s=(await this.git.getConfig(r.toLowerCase(),i=="all"?void 0:i)).value)!=null?s:void 0}async fetch(r){await this.git.fetch(r!=null?[r]:[])}async setRemote(r,i){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,i]):await this.git.remote(["add",r,i])}async getRemoteBranches(r){let i=await this.git.branch(["-r","--list",`${r}*`]),n=[];for(let s in i.branches)n.push(i.branches[s].name);return n}async getRemotes(){let r=await this.git.remote([]);return r?r.trim().split(` +`):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Yn(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" ");return await this.git.raw(i[0],...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(We.dirname(r)))return;let i=await this.git.raw(["-C",We.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",We.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(We.normalize(r)),o=We.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof Br){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await wu(r||"git",["--version"],{});if(i.error)if(Zn.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Rd}) of Git for Windows.`);let n=await wu(Rd,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof Br){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new nl(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},b2={hash:"000000",isZeroCommit:!0,summary:""};function J6(t){let r=t.replace(`\r +`,` +`).split(` +`),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return i}function t5(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r],a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=v2(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=v2(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function r5(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);ew(t.author)&&(t.author=void 0),ew(t.committer)&&(t.committer=void 0),ew(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function ew(t){return!t||Object.keys(t).length===0}function g2(t){return t.length>0&&t[0].trim()===t[0]}function v2(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}m();var q2=require("@codemirror/state");m();var tw=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()}},Kn=new tw;m();var ah=require("@codemirror/state"),x2=Gt(rw(),1);function E2(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var S2=ah.StateEffect.define();function k2(t,e,r){return r.update({effects:S2.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var xl=ah.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(S2))return r.value;return i5(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function oh(t){var s;let e=x2.sha256.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var Pu={get:void 0,save:void 0};function A2(t,e){Pu.get=t,Pu.save=e}function lh(t){var e,r;return(r=(e=Ru(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Ru(pt.lineAuthor.coloringMaxAge).asDays()}function i5(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let w=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,y=f===g,b=h-d;y&&(w+=b),e.lineOffsetsFromUnsavedChanges.set(g,w)}}),e}m();function C2(){El=void 0,iw=[],ch=0,fh.clear(),dh.clear(),Sl.clear()}var El,uh=()=>El;function T2(t,e){var n;let r=e.length;if(r<((n=El==null?void 0:El.length)!=null?n:0))return;El={gutter:t,length:r,text:e};let i=zt.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&zt.plugin.localStorage.setGutterSpacingFallbackLength(r)}var iw=[],n5=15,ch=0;function P2(t){iw[ch]=t,ch=(ch+1)%n5}function R2(){return fA(iw)}var fh=new Map,dh=new Map,Sl=new Set;m();var V2=require("@codemirror/state"),z2=require("@codemirror/view");m();var ow=require("@codemirror/view"),B2=Gt(rw(),1),kl=require("obsidian");m();m();var hh={x:-10,y:-10};function $2(){hh.x===-10&&window.addEventListener("mousedown",t=>{hh.x=t.clientX,hh.y=t.clientY})}function F2(){for(let t of Sl)if(s5(t,hh))return t}function s5(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var I2="data-commit";function M2(t,e,r){if(e.hasFocus())return;let i=F2();if(!i)return;let n=o5(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&a5(n,t),nw("showCommitHash",t),nw("authorDisplay",t),nw("dateTimeFormatOptions",t))}function a5(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(i=>navigator.clipboard.writeText(t.hash)))}function nw(t,e){var l,c;let r,i,n=zt.plugin.settings.lineAuthor,s=n[t],a=typeof s=="boolean"?s:s!=="hide",o=pt.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",i=s;else if(t==="authorDisplay"){let u=(l=n.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(a?s:u),i=a?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=n.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(a?s:u),r+=r.contains("date")?"":" date",i=a?"hide":u}else Ls(t);e.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(a).onClick(f=>{var d,h;return(h=(d=zt.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,i)}))}function D2(t,e,r){r.setAttr(I2,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function o5(t){let e=t.getAttr(I2);return e?JSON.parse(e):void 0}m();function mh(t,e){return t==="oldest"?ph(0,!1,e).color:ph(void 0,!0,e).color}function ph(t,e,r){let i=lh(r),n=Date.now()/1e3,s=t!=null?t:0,o=(e?0:n-s)/60/60/24,l=Math.pow(Math.clamp(o/i,0,1),1/2.3),c=l5(),u=r.colorNew,f=r.colorOld,d=c?.4:1,h=sw(u.r,f.r,l)*d,p=sw(u.g,f.g,l)*d,g=sw(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${g},${c?.75:.25})`,daysSinceCommit:o}}function sw(t,e,r){return t+(e-t)*r}function l5(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function O2(t){activeDocument.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}m();function L2(t,e,r){let i;for(let n=e;n<=r;n++){let s=t.hashPerLine[n],a=t.commits.get(s);(!i||a.isZeroCommit||c5(a,i))&&(i=a)}return i}function c5(t,e){var n,s,a,o;let r=(s=(n=t.author)==null?void 0:n.epochSeconds)!=null?s:0,i=(o=(a=e.author)==null?void 0:a.epochSeconds)!=null?o:0;return r>i}var H2=require("node:util");var N2="-",u5="+",f5=3,d5="*",h5=/\S/g,p5="%",Al=class t extends ow.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof t&&this.text===r.text}toDOM(){return activeDocument.createTextNode(this.text)}destroy(r){}},aw=class extends ow.GutterMarker{constructor(r,i,n,s,a,o){super();this.lineAuthoring=r;this.startLine=i;this.endLine=n;this.key=s;this.settings=a;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(r){return this.key===(r==null?void 0:r.key)&&this.startLine===(r==null?void 0:r.startLine)&&this.endLine===(r==null?void 0:r.endLine)&&(this==null?void 0:this.options)===(r==null?void 0:r.options)}toDOM(){var r;return this.precomputedDomProvider=(r=this.precomputedDomProvider)!=null?r:this.computeDom(),this.precomputedDomProvider()}destroy(r){r&&(activeDocument.body.contains(r)||Sl.delete(r))}computeDom(){let r=L2(this.lineAuthoring,this.startLine,this.endLine),i=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?T2(this,i):i=this.adaptTextForFakeCommit(r,i,this.options),this.createHtmlNode(r,i,this.options==="waiting-for-result")}createHtmlNode(r,i,n){var c,u,f,d,h,p;let s=window.createDiv();s.setText(i);let{color:a,daysSinceCommit:o}=ph((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);s.style.backgroundColor=a,s.setAttribute("data-author",(f=(u=r==null?void 0:r.author)==null?void 0:u.name)!=null?f:""),s.setAttribute("data-author-email",(h=(d=r==null?void 0:r.author)==null?void 0:d.email)!=null?h:""),(0,kl.setTooltip)(s,(p=r==null?void 0:r.summary)!=null?p:""),D2(r,n,s);function l(){let g=s.cloneNode(!0);return Sl.add(g),n||P2(o),g}return l}renderNonZeroCommit(r){let i=this.settings.showCommitHash?this.renderHash(r):"",n=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,s=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[i,n,s].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,i){var o,l,c,u;let n=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",s=n.split(" ").filter(f=>f.length>=1),a;switch(i){case"initials":a=s.map(f=>f[0].toUpperCase()).join("");break;case"first name":a=(c=s.first())!=null?c:N2;break;case"last name":a=(u=s.last())!=null?u:N2;break;case"full":a=n;break;default:return Ls(i)}return(0,H2.isDeepStrictEqual)(r==null?void 0:r.author,r==null?void 0:r.committer)||(a=a+d5),a}renderAuthoringDate(r,i,n,s){var c;if(((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds)===void 0)return"?";let o;switch(i){case"date":o=Td;break;case"datetime":o=Zg;break;case"custom":o=n;break;case"natural language":o=u=>{let f=u.diff((0,kl.moment)());return kl.moment.duration(f).humanize(!0)};break;default:return Ls(i)}let l=kl.moment.unix(r.author.epochSeconds);switch(s){case"viewer-local":break;case"author-local":l=l.utcOffset(r.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return Ls(s)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,i,n){var l,c,u;let s=(c=(l=uh())==null?void 0:l.text)!=null?c:i,a=n!=="waiting-for-result"&&r.isZeroCommit?u5:p5;i=s.replace(h5,a);let o=(u=zt.plugin.localStorage.getGutterSpacingFallbackLength())!=null?u:i.length;if(i=dA(i,o,a),n!=="waiting-for-result"&&r.isZeroCommit){let f=Math.min(o,f5);i=hA(i,o-f)}return i}};function Fa(t,e,r,i,n,s){let a=B2.sha256.create();a.update(JSON.stringify(n)),a.update(`s${e}-e${r}-k${i}-o${s}`);let o=a.hex(),l=fh.get(o);if(l)return l;let c=new aw(t,e,r,i,n,s);return fh.set(o,c),c}m();var U2=require("obsidian");function lw(){let t=zt.plugin.localStorage.getGutterSpacingFallbackLength();return new Al(Array(t).fill("-").join(""))}function cw(t){let{lineAuthoring:e,ageForInitialRender:r}=m5(t);return Fa(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function m5(t){var s;let e=(s=R2())!=null?s:lh(t)*.25,r=(0,U2.moment)().add(-e,"days"),i={name:"",epochSeconds:uA(r),tz:"+0000"},n={hash:"waiting-for-result",author:i,committer:i,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",n]])},ageForInitialRender:e}}m();function G2(t,e){return Fa({hashPerLine:[void 0,"000000"],commits:new Map([["000000",b2]])},1,1,t,e)}var uw=new Al(""),W2=(0,z2.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(xl,!1);return g5(t,e)},lineMarkerChange(t){let e=oh(t.state.field(xl));return oh(t.startState.field(xl))!==e},renderEmptyElements:!0,initialSpacer:t=>(j2(t),lw()),updateSpacer:(t,e)=>{var r,i;return j2(e.view),(i=(r=uh())==null?void 0:r.gutter)!=null?i:lw()}});function g5(t,e){let r=oh(e),i=t.state.doc,n=new Map;for(let u=1;u<=i.lines;u++){let f=i.line(u).from,d=t.lineBlockAt(f).to;n.set(u,[f,d]),r.update([f,d,0])}let s=Pu.get();r.update("s"+Object.values(Pu).join(","));let a=r.hex(),o=dh.get(a);if(o)return o;let{result:l,allowCache:c}=v5(i,n,s,e);return c&&dh.set(a,l),l}function v5(t,e,r,i){let n=!0,s=t.lines,a=[];function o(f,d,h){return a.push(h.range(f,d))}let l=w5(s,i),c=t.length===0,u=t.iterLines(s,s+1).next().value==="";for(let f=1;f<=s;f++){let[d,h]=e.get(f),p=t.lineAt(h).number;if(c){o(d,h,uw);continue}if(f===s&&u){o(d,h,uw);continue}if(i===void 0){o(d,h,cw(r)),n=!1;continue}let{key:g,la:w}=i;if(w==="untracked"){o(d,h,G2(w,r));continue}let y=w.hashPerLine.length-1,b=l[f],S=l[p];if(S&&S>y&&o(d,h,uw),b!==void 0&&sv(1,b,y)&&S!==void 0&&sv(1,S,y)){o(d,h,Fa(w,b,S,g,r));continue}if(y<1){o(d,h,cw(r)),n=!1;continue}let C=Math.clamp(b!=null?b:f,1,y),A=Math.clamp(S!=null?S:p,1,y);o(d,h,Fa(w,C,A,g+"computing",r,"waiting-for-result"))}return{result:V2.RangeSet.of(a,!0),allowCache:n}}function w5(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),n=>n);let r=[void 0],i=0;for(let n=1;n<=t;n++){let s=e.lineOffsetsFromUnsavedChanges.get(n);i+=s!=null?s:0,r[n]=s===void 0?n-i:void 0}return r}function j2(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var gh=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(),C2()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,i=await r.submoduleAwareHeadRevisonInContainingDirectory(e),n=await r.hashObject(e),s=E2(i,n,e);if(s!==void 0){if(!this.lineAuthorings.has(s)){let a=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(s,a)}this.notifyComputationResultToSubscribers(e,s)}}notifyComputationResultToSubscribers(e,r){Kn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},Y2=q2.Prec.high([xl,W2]);var Z2="https://momentjs.com/docs/#/parsing/string-format/",b5="https://publish.obsidian.md/git-doc/Line+Authoring",vh=class extends j.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i;this.lineAuthorColorSettings=new Map;this.icon="git-pull-request"}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,i=this.plugin,n;i.settings.differentIntervalCommitAndPush?n="commit":n="commit-and-sync";let s=i.gitReady;r.empty(),s||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let a;if(s){new j.Setting(r).setName("Automatic").setHeading(),new j.Setting(r).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(f=>f.setValue(i.settings.differentIntervalCommitAndPush).onChange(async d=>{i.settings.differentIntervalCommitAndPush=d,await i.saveSettings(),i.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new j.Setting(r).setName(`Auto ${n} interval (minutes)`).setDesc(`${i.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoSaveInterval"}),f.setPlaceholder(String(pt.autoSaveInterval)),f.onChange(async d=>{d!==""?i.settings.autoSaveInterval=Number(d):i.settings.autoSaveInterval=pt.autoSaveInterval,await i.saveSettings(),i.automaticsManager.reload("commit")})}),a=new j.Setting(r).setName(`Auto ${n} after stopping file edits`).setDesc(`Requires the ${n} interval not to be 0. + If turned on, do auto ${n} every ${pA(i.settings.autoSaveInterval)} after stopping file edits. + This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new j.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new j.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(pt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=pt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new j.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(pt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=pt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new j.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new j.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new j.Setting(r).setName(`Commit message on auto ${n}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(f=>{f.setPlaceholder(pt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=pt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new j.Setting(r).setName("Commit message").setHeading();let c=new j.Setting(r).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${pt.commitMessage}"`).onClick(()=>{f.setValue(pt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),j.Platform.isDesktopApp&&new j.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=pt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new j.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${Kg}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:Z2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new j.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new j.Setting(r).setName("Preview commit message").addButton(f=>f.setButtonText("Preview").onClick(async()=>{let d=await i.gitManager.formatCommitMessage(i.settings.commitMessage);new j.Notice(`${d}`)})),new j.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(f=>f.setValue(i.settings.listChangedFilesInMessageBody).onChange(async d=>{i.settings.listChangedFilesInMessageBody=d,await i.saveSettings()})),new j.Setting(r).setName("Pull").setHeading(),i.gitManager instanceof Ce&&new j.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(f=>{let d={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};f.addOptions(d),f.setValue(i.settings.syncMethod),f.onChange(async h=>{i.settings.syncMethod=h,await i.saveSettings()})}),new j.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(f=>{let d={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};f.addOptions(d),f.setValue(i.settings.mergeStrategy),f.onChange(async h=>{i.settings.mergeStrategy=h,await i.saveSettings()})}),new j.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(f=>f.setValue(i.settings.autoPullOnBoot).onChange(async d=>{i.settings.autoPullOnBoot=d,await i.saveSettings()})),new j.Setting(r).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),a=new j.Setting(r).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${i.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(f=>f.setValue(!i.settings.disablePush).onChange(async d=>{i.settings.disablePush=!d,this.refreshDisplayWithDelay(),await i.saveSettings()})),new j.Setting(r).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${i.settings.disablePush?"":"and push "}only.`).addToggle(f=>f.setValue(i.settings.pullBeforePush).onChange(async d=>{i.settings.pullBeforePush=d,this.refreshDisplayWithDelay(),await i.saveSettings()})),i.gitManager instanceof Ce&&(new j.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new j.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(f=>f.setValue(i.settings.hunks.showSigns).onChange(async d=>{i.settings.hunks.showSigns=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(f=>f.setValue(i.settings.hunks.hunkCommands).onChange(async d=>{i.settings.hunks.hunkCommands=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Status bar with summary of line changes").addDropdown(f=>f.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(i.settings.hunks.statusBar).onChange(async d=>{i.settings.hunks.statusBar=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new j.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new j.Setting(r).setName("History view").setHeading(),new j.Setting(r).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(i.settings.authorInHistoryView),c.onChange(async f=>{i.settings.authorInHistoryView=f,await i.saveSettings(),await i.refresh()})}),new j.Setting(r).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(i.settings.dateInHistoryView).onChange(async u=>{i.settings.dateInHistoryView=u,await i.saveSettings(),await i.refresh()})),new j.Setting(r).setName("Source control view").setHeading(),new j.Setting(r).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(i.settings.refreshSourceControl).onChange(async u=>{i.settings.refreshSourceControl=u,await i.saveSettings()})),new j.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(pt.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?i.settings.refreshSourceControlTimer=Math.max(Number(f),500):i.settings.refreshSourceControlTimer=pt.refreshSourceControlTimer,await i.saveSettings(),i.setRefreshDebouncer()})}),new j.Setting(r).setName("Miscellaneous").setHeading(),i.gitManager instanceof Ce&&new j.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(c=>{let u={split:"Split",git_unified:"Unified"};c.addOptions(u),c.setValue(i.settings.diffStyle),c.onChange(async f=>{i.settings.diffStyle=f,await i.saveSettings()})}),new j.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(i.settings.disablePopups).onChange(async u=>{i.settings.disablePopups=u,this.refreshDisplayWithDelay(),await i.saveSettings()})),new j.Setting(r).setName("Disable error notifications").setDesc("Disable error notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(!i.settings.showErrorNotices).onChange(async u=>{i.settings.showErrorNotices=!u,await i.saveSettings()})),i.settings.disablePopups||new j.Setting(r).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(i.settings.disablePopupsForNoChanges).onChange(async u=>{i.settings.disablePopupsForNoChanges=u,await i.saveSettings()})),new j.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showStatusBar).onChange(async u=>{i.settings.showStatusBar=u,await i.saveSettings()})),new j.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(c=>c.setValue(i.settings.showFileMenu).onChange(async u=>{i.settings.showFileMenu=u,await i.saveSettings()})),new j.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showBranchStatusBar).onChange(async u=>{i.settings.showBranchStatusBar=u,await i.saveSettings()})),new j.Setting(r).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(i.settings.changedFilesInStatusBar).onChange(async u=>{i.settings.changedFilesInStatusBar=u,await i.saveSettings()})),i.gitManager instanceof Vi?new j.Setting(r).setName("Authentication/commit author").setHeading():new j.Setting(r).setName("Commit author").setHeading(),i.gitManager instanceof Vi&&new j.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=i.localStorage.getUsername())!=null?u:""),c.onChange(f=>{i.localStorage.setUsername(f)})}),i.gitManager instanceof Vi&&new j.Setting(r).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(c=>{c.inputEl.autocapitalize="off",c.inputEl.autocomplete="off",c.inputEl.spellcheck=!1,c.onChange(u=>{i.localStorage.setPassword(u)})}),i.gitReady&&new j.Setting(r).setName("Author name for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.name"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.name",f==""?void 0:f)})}),i.gitReady&&new j.Setting(r).setName("Author email for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.email"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.email",f==""?void 0:f)})}),new j.Setting(r).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be required for special setups.").setHeading(),i.gitManager instanceof Ce&&(new j.Setting(r).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(c=>c.setValue(i.settings.updateSubmodules).onChange(async u=>{i.settings.updateSubmodules=u,await i.saveSettings()})),i.settings.updateSubmodules&&new j.Setting(r).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(c=>c.setValue(i.settings.submoduleRecurseCheckout).onChange(async u=>{i.settings.submoduleRecurseCheckout=u,await i.saveSettings()}))),i.gitManager instanceof Ce&&new j.Setting(r).setName("Custom Git binary path").setDesc("Specify the path to the Git binary/executable. Git should already be in your PATH. Should only be necessary for a custom Git installation.").addText(c=>{var u;c.setValue((u=i.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{i.localStorage.setGitPath(f),i.gitManager.updateGitPath(f||"git").catch(d=>i.displayError(d))})}),i.gitManager instanceof Ce&&new j.Setting(r).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(c=>{c.setPlaceholder("GIT_DIR=/path/to/git/dir"),c.setValue(i.localStorage.getEnvVars().join(` +`)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(` +`))})}),i.gitManager instanceof Ce&&new j.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(` +`)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(` +`))})}),i.gitManager instanceof Ce&&new j.Setting(r).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await i.gitManager.setGitInstance()})}),new j.Setting(r).setName("Custom base path (Git repository path)").setDesc(` + Sets the relative path to the vault from which the Git binary should be executed. + Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. + `).addText(c=>{c.setValue(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new j.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new j.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new j.Notice("Obsidian must be restarted for the changes to take affect.")})),new j.Setting(r).setName("Support").setHeading(),new j.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new j.Notice("Debug information copied to clipboard. May contain sensitive information!")},j.Platform.isDesktopApp){let c=r.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging: +You can always see the logs of this and every other plugin by opening the console with`);let u=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),j.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new j.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:b5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new j.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${Pd} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new j.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new j.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new j.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new j.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new j.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.descEl.empty(),n.descEl.createSpan({text:`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 +`}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new j.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Ru(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new j.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new j.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection."})}}createColorSetting(r){let i=new j.Setting(this.containerEl).setName("").addText(n=>{let s=fw(r,this.settings.lineAuthor),a=fw(r,pt.lineAuthor);n.setPlaceholder(nv(a)),n.setValue(nv(s)),n.onChange(async o=>{let l=cA(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,fw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?mh(i,n):"rgba(127,127,127,0.3)",o=j.moment.unix(j.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:Z2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,j.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Ru(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color. +Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];pt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function fw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Ru(t){let e=j.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var ti=require("obsidian");var wh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,ti.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.localStorage.getPausedAutomatics()?((0,ti.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,ti.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,ti.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,ti.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,ti.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,ti.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,ti.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,ti.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=` +(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,ti.setIcon)(this.iconEl,"globe"):(0,ti.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};m();var _h=require("obsidian"),bh=class extends _h.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,_h.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var K2=require("obsidian"),$u=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval)))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}startAutoCommitAndSync(e){let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,K2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged;return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,onlyStaged:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,onlyStaged:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}diff(e,r){let n=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,n)}};m();var Wi=require("obsidian");m();var Fu=require("obsidian");async function X2(t,e,r){let i=await J2(e,r);if(i.result==="failure"){new Fu.Notice(i.reason);return}let{isGitHub:n,branch:s,repo:a,user:o,filePath:l}=i;if(n){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}-L${u}`)}else new Fu.Notice("It seems like you are not using GitHub")}async function Q2(t,e){let r=await J2(t,e);if(r.result==="failure"){new Fu.Notice(r.reason);return}let{isGitHub:i,branch:n,repo:s,user:a,filePath:o}=r;i?window.open(`https://github.com/${a}/${s}/commits/${n}/${o}`):new Fu.Notice("It seems like you are not using GitHub")}async function J2(t,e){let r=await e.branchInfo(),i=r.tracking,n=r.current,s,a=e.getRelativeRepoPath(t.path);if(e instanceof Ce){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){a=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(i=c.tracking||void 0,n=c.current||void 0,i){let u=i.substring(0,i.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)s=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(i==null)return{result:"failure",reason:"Remote branch is not configured"};if(n==null)return{result:"failure",reason:"Failed to get current branch name"};if(s==null){let l=i.substring(0,i.indexOf("/"));if(s=await e.getConfig(`remote.${l}.url`),s==null)return{result:"failure",reason:"Failed to get remote url"}}let o=s.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[l,c,u,f,d]=o;return{result:"success",isGitHub:!!l,repo:u||d,user:c||f,branch:n,filePath:a}}}m();var eP=require("obsidian"),yh=class extends eP.FuzzySuggestModal{constructor(e,r){super(e.app),this.plugin=e,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.workingDir=="U")return`Untracked | ${e.vaultPath}`;let r="",i="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(i=`Index: ${e.index}`),`${r}${i} | ${e.vaultPath}`}onChooseItem(e,r){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};m();var tP=require("obsidian"),xh=class extends tP.Modal{constructor(r,i){super(r);this.content=i;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:i}=this;i.setText("Edit .gitignore");let n=r.createDiv(),s=n.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});n.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(s.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};m();var ju=require("@codemirror/state"),Uh=require("@codemirror/view");m();var Pl=require("@codemirror/state");m();var Wt=class t{static createHunk(e,r,i,n){return{removed:{start:e,count:r,lines:[]},added:{start:i,count:n,lines:[]},head:`@@ -${e}${r>0?`,${r}`:""} +${i}${n>0?`,${n}`:""} @@`,vend:i+Math.max(n-1,0),type:n===0?"delete":r===0?"add":"change"}}static createPartialHunk(e,r,i){let n=r,s=i-r+1,a=0;for(let o of e){let l=o.added.count-o.removed.count,c=0;if(o.added.start>=r&&o.vend<=i)c=l;else{let u=Math.max(0,i+1-(o.added.start+o.removed.count)),f=Math.max(0,r-(o.added.start+o.removed.count));o.added.start>=r&&o.added.start<=i?c=u:o.vend>=r&&o.vend<=i?(c=l-f,n=n-f):o.added.start<=r&&o.vend>=i?(c=u-f,n=n-f):a++,r>o.vend&&(n=n-l)}s=s-c}if(a!==e.length)return s===0&&(n=n-1),this.createHunk(n,s,r,i-r+1)}patchLines(e,r=!1){let i=[];for(let n of e.removed.lines)i.push("-"+n);for(let n of e.added.lines)i.push("+"+n);return r?i.map(n=>n.replace(/\r$/,"")):i}static parseDiffLine(e){let n=e.split("@@")[1].trim().split(" "),s=n[0].substring(1).split(","),a=n[1].substring(1).split(","),o=this.createHunk(parseInt(s[0]),parseInt(s[1]||"1"),parseInt(a[0]),parseInt(a[1]||"1"));return o.head=e,o}static changeEnd(e){return e.added.count===0?e.added.start:e.removed.count===0?e.added.start+e.added.count-1:e.added.start+Math.min(e.added.count,e.removed.count)-1}static calcSigns(e,r,i,n=1,s=1/0,a){if(a&&r.type!=="add")return console.error(`Invalid hunk with untracked=${a} hunk="${r.head}"`),[];n=Math.max(1,n);let{start:o,added:l,removed:c}={start:r.added.start,added:r.added.count,removed:r.removed.count},u=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!i||i.added.start!==o+1);f&&n===1&&(n=0);let d=[];for(let h=Math.max(o,n);h<=Math.min(u,s);h++){let p=r.type==="change"&&(c>l&&h===u||e&&e.added.start===0);d.push({type:f?"topdelete":p?"changedelete":a?"untracked":r.type,count:h===o?r.type==="add"?l:c:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>c&&r.vend>=n&&u<=s)for(let h=Math.max(u,n);h<=Math.min(r.vend,s);h++)d.push({type:"add",count:h===r.vend?l-c:void 0,lnum:h});return d}static createPatch(e,r,i,n=!1){let s=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${i}`,`--- a/${e}`,`+++ b/${e}`],a=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,c=o.removed.count,u=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;n&&([c,u]=[u,c],[f,d]=[d,f]),s.push(`@@ -${l},${c} +${l+a},${u} @@`);for(let h of f)s.push("-"+h);(n?o.added:o.removed).no_nl_at_eof&&s.push("\\ No newline at end of file");for(let h of d)s.push("+"+h);(n?o.removed:o.added).no_nl_at_eof&&s.push("\\ No newline at end of file"),o.removed.start=l+a,a=a+(u-c)}return s}getSummary(e){let r={added:0,changed:0,removed:0};for(let i of e)if(i.type==="add")r.added+=i.added.count;else if(i.type==="delete")r.removed+=i.removed.count;else if(i.type==="change"){let n=i.added.count,s=i.removed.count,a=Math.min(n,s);r.changed+=a,r.added+=n-a,r.removed+=s-a}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let i=0;i=e)return[n,i]}return[void 0,void 0]}static findNearestHunk(e,r,i,n){if(r.length!==0){if(i==="first")return 0;if(i==="last")return r.length-1;if(i==="next"){if(r[0].added.start>e)return 0;for(let s=r.length-1;s>=0;s--)if(r[s].added.start<=e){if(s+1e)return s+1;if(n)return 0}}else if(i==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[s-1].vend,1)l.added.start?n++:o.added.starta.map(w=>g.replace(/&/,w))).reduce((g,w)=>g.concat(w)),p,l);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(n(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in e)s(n(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=iP[rP]||1;return iP[rP]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[dw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new hw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},nP=new Map,hw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=nP.get(i);if(s)return e[dw]=s;this.sheet=new n.CSSStyleSheet,nP.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[dw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;cc){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new kt(e,e+f,n,n),new kt(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new kt(e,e,n,n+f),new kt(r,r,n+f+l,s)]}if(l==1||c==1)return[new kt(e,r,n,s)];let u=SP(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ma(t,e,f,i,n,d).concat(Ma(t,f+h,r,i,d+h,s))}return y5(t,e,r,i,n,s)}var Iu=1e9,Mu=0,_w=!1;function y5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Iu<1e9&&Math.min(a,o)>Iu*16||Mu>0&&Date.now()>Mu)return Math.min(a,o)>Iu*64?[new kt(e,r,n,s)]:sP(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);pw.reset(l),mw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?mw:null,d=f?null:pw;for(let h=0;hIu||Mu>0&&!(h&63)&&Date.now()>Mu)return sP(t,e,r,i,n,s);let p=pw.advance(h,a,o,l,f,!1,c)||mw.advance(h,a,o,l,d,!0,u);if(p)return x5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new kt(e,r,n,s)]}var Th=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},pw=new Th,mw=new Th;function x5(t,e,r,i,n,s,a,o){let l=!1;return!Tl(t,i)&&++i==r&&(l=!0),!Tl(n,o)&&++o==a&&(l=!0),l?[new kt(e,r,s,a)]:Ma(t,e,i,n,s,o).concat(Ma(t,i,r,n,o,a))}function EP(t,e){let r=1,i=Math.min(t,e);for(;rr||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Tl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function xw(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=EP(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function gw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=yw(t,f,r,i,n+h+d.length,s),g=xw(t,e,u,i,n,n+h),w=d.length+p+g;(!c||c[2]>1}}function SP(t,e,r,i,n,s){let a=r-e,o=s-n;if(an.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new kt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function E5(t,e,r){for(;;){kP(r,1);let i=!1;for(let n=0;n3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=oP(e,s.fromA,c),d=aP(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[w,y,b]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==w.slice(b-h,b)?(s=t[n]=new kt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=aP(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==w.slice(y,y+p)&&(s=t[n]=new kt(d-a,d,s.fromB+p,s.toB+p),d=s.toA,f=oP(e,s.fromA,s.fromA-i)),h=s.fromA-f,p=d-s.toA}if(h||p)s=t[n]=new kt(s.fromA-h,s.toA+p,s.fromB-h,s.toB+p);else if(a){if(!o){let g=cP(e,s.fromA,s.toA),w,y=g<0?-1:lP(e,s.toA,s.fromA);g>-1&&(w=g-s.fromA)<=u&&e.slice(s.fromA,g)==e.slice(s.toA,s.toA+w)?s=t[n]=s.offset(w):y>-1&&(w=s.toA-y)<=c&&e.slice(s.fromA-w,s.fromA)==e.slice(y,s.toA)&&(s=t[n]=s.offset(-w))}}else{let g=cP(r,s.fromB,s.toB),w,y=g<0?-1:lP(r,s.toB,s.fromB);g>-1&&(w=g-s.fromB)<=u&&r.slice(s.fromB,g)==r.slice(s.toB,s.toB+w)?s=t[n]=s.offset(w):y>-1&&(w=s.toB-y)<=c&&r.slice(s.fromB-w,s.fromB)==r.slice(y,s.toB)&&(s=t[n]=s.offset(-w))}}i=s.toA}return kP(t,3),t}var Ia;try{Ia=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function AP(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function CP(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?AP(r)?1:0:Ia?!RP(r)||e==t.length-1?Ia.test(String.fromCharCode(r))?1:0:Ia.test(t.slice(e,e+2))?2:0:0}function TP(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?AP(r)?1:0:Ia?!$P(r)||e==1?Ia.test(String.fromCharCode(r))?1:0:Ia.test(t.slice(e-2,e))?2:0:0}var PP=8;function aP(t,e,r){if(e==t.length||!TP(t,e))return e;for(let i=e,n=e+r,s=0;sn)return i;i+=a}return e}function oP(t,e,r){if(!e||!CP(t,e))return e;for(let i=e,n=e-r,s=0;st>=55296&&t<=56319,$P=t=>t>=56320&&t<=57343;function Tl(t,e){return!e||e==t.length||!RP(t.charCodeAt(e-1))||!$P(t.charCodeAt(e))}function k5(t,e,r){var i;let n=r==null?void 0:r.override;return n?n(t,e):(Iu=((i=r==null?void 0:r.scanLimit)!==null&&i!==void 0?i:1e9)>>1,Mu=r!=null&&r.timeout?Date.now()+r.timeout:0,_w=!1,E5(t,e,Ma(t,0,t.length,e,0,e.length)))}function FP(){return!_w}function IP(t,e,r){return S5(k5(t,e,r),t,e)}var Si=Ie.Facet.define({combine:t=>t[0]}),vw=Ie.StateEffect.define(),A5=Ie.Facet.define(),xn=Ie.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is(vw)&&(t=r.value);for(let r of e.state.facet(A5))t=r(t,e);return t}});function Ew(t){let e=t.field(xn,!1);if(!e)return null;let r=t.facet(Si);return{chunks:e,side:r?r.side:null}}var Xn=class t{constructor(e,r,i,n,s,a=!0){this.changes=e,this.fromA=r,this.toA=i,this.fromB=n,this.toB=s,this.precise=a}offset(e,r){return e||r?new t(this.changes,this.fromA+e,this.toA+e,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,r,i){let n=IP(e.toString(),r.toString(),i);return MP(n,e,r,0,0,FP())}static updateA(e,r,i,n,s){return pP(hP(e,n,!0,i.length),e,r,i,s)}static updateB(e,r,i,n,s){return pP(hP(e,n,!1,r.length),e,r,i,s)}};function uP(t,e,r,i){let n=r.lineAt(t),s=i.lineAt(e);return n.to==t&&s.to==e&&tf+1&&w>d+1)break;h.push(p.offset(-c+i,-u+n)),[f,d]=fP(p.toA+i,p.toB+n,e,r),o++}a.push(new Xn(h,c,Math.max(c,f),u,Math.max(u,d),s))}return a}var Sh=1e3;function dP(t,e,r,i){let n=0,s=t.length;for(;;){if(n==s){let u=0,f=0;n&&({toA:u,toB:f}=t[n-1]);let d=e-(r?u:f);return[u+d,f+d]}let a=n+s>>1,o=t[a],[l,c]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)s=a;else if(c<=e)n=a+1;else return i?[o.fromA,o.fromB]:[o.toA,o.toB]}}function hP(t,e,r,i){let n=[];return e.iterChangedRanges((s,a,o,l)=>{let c=0,u=r?e.length:i,f=0,d=r?i:e.length;s>Sh&&([c,f]=dP(t,s-Sh,r,!0)),a=c?n[n.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:d,diffA:p.diffA+g,diffB:p.diffB+w}:n.push({fromA:c,toA:u,fromB:f,toB:d,diffA:g,diffB:w})}),n}function pP(t,e,r,i,n){if(!t.length)return e;let s=[];for(let a=0,o=0,l=0,c=0;;a++){let u=a==t.length?null:t[a],f=u?u.fromA+o:r.length,d=u?u.fromB+l:i.length;for(;cf||w.toB+l>d))break;s.push(w.offset(o,l)),c++}if(!u)break;let h=u.toA+o+u.diffA,p=u.toB+l+u.diffB,g=IP(r.sliceString(f,h),i.sliceString(d,p),n);for(let w of MP(g,r,i,f,d,FP()))s.push(w);for(o+=u.diffA,l+=u.diffB;ch&&w.fromB+l>p)break;c++}}return s}var C5={scanLimit:500},DP=Le.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=vP(t))}update(t){(t.docChanged||t.viewportChanged||T5(t.startState,t.state)||P5(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=vP(t.view))}},{decorations:t=>t.deco}),kh=Ie.Prec.low((0,Le.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(DP))===null||e===void 0?void 0:e.gutter)||Ie.RangeSet.empty}}));function T5(t,e){return t.field(xn,!1)!=e.field(xn,!1)}function P5(t,e){return t.facet(Si)!=e.facet(Si)}var mP=Le.Decoration.line({class:"cm-changedLine"}),R5=Le.Decoration.mark({class:"cm-changedText"}),$5=Le.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),F5=Le.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),gP=new class extends Le.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function I5(t,e,r,i,n,s){let a=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(a!=o){n.add(a,a,mP),n.add(a,o,r?F5:$5),s&&s.add(a,a,gP);for(let c=e.iterRange(a,o-1),u=a;!c.next().done;){if(c.lineBreak){u++,n.add(u,u,mP),s&&s.add(u,u,gP);continue}let f=u+c.value.length;if(i)for(;l=u)break;(a?f.toA:f.toB)>c&&(!s||!s(t.state,f,o,l))&&I5(f,t.state.doc,a,i,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var Cl=class extends Le.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}},Ph=Ie.StateEffect.define({map:(t,e)=>t.map(e)}),Du=Ie.StateField.define({create:()=>Le.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(Ph))return r.value;return t.map(e.changes)},provide:t=>Le.EditorView.decorations.from(t)}),Ah=.01;function wP(t,e){if(t.size!=e.size)return!1;let r=t.iter(),i=e.iter();for(;r.value;){if(r.from!=i.from||Math.abs(r.value.spec.widget.height-i.value.spec.widget.height)>1)return!1;r.next(),i.next()}return!0}function M5(t,e,r){let i=new Ie.RangeSetBuilder,n=new Ie.RangeSetBuilder,s=t.state.field(Du).iter(),a=e.state.field(Du).iter(),o=0,l=0,c=0,u=0,f=t.viewport,d=e.viewport;for(let w=0;;w++){let y=wAh&&(u+=k,n.add(l,l,Le.Decoration.widget({widget:new Cl(k),block:!0,side:-1})))}if(b>o+1e3&&of.from&&ld.from){let C=Math.min(f.from-o,d.from-l);o+=C,l+=C,w--}else if(y)o=y.toA,l=y.toB;else break;for(;s.value&&s.fromAh&&n.add(e.state.doc.length,e.state.doc.length,Le.Decoration.widget({widget:new Cl(h),block:!0,side:1}));let p=i.finish(),g=n.finish();wP(p,t.state.field(Du))||t.dispatch({effects:Ph.of(p)}),wP(g,e.state.field(Du))||e.dispatch({effects:Ph.of(g)})}var ww=Ie.StateEffect.define({map:(t,e)=>e.mapPos(t)});var bw=class extends Le.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=e.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",i=>{let n=e.posAtDOM(i.target);e.dispatch({effects:ww.of(n)});let{side:s,sibling:a}=e.state.facet(Si);a&&a().dispatch({effects:ww.of(D5(n,e.state.field(xn),s=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function D5(t,e,r){let i=0,n=0;for(let s=0;;s++){let a=s=t)return n+(t-i);[i,n]=r?[a.toA,a.toB]:[a.toB,a.toA]}}var O5=Ie.StateField.define({create(t){return Le.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(ww)&&(t=t.update({filter:i=>i!=r.value}));if(t.size&&e.state.field(xn)!=e.startState.field(xn,!1)){let r=e.state.facet(Si).side=="a",i=[];for(let n of e.state.field(xn))t.between(r?n.fromA:n.fromB,r?n.toA:n.toB,s=>{i.push(s)});i.length&&(t=t.update({filter:n=>i.indexOf(n)<0}))}return t},provide:t=>Le.EditorView.decorations.from(t)});function bP({margin:t=3,minSize:e=4}){return O5.init(r=>L5(r,t,e))}function L5(t,e,r){let i=new Ie.RangeSetBuilder,n=t.facet(Si).side=="a",s=t.field(xn),a=1;for(let o=0;;o++){let l=o=r&&i.add(t.doc.line(c).from,t.doc.line(u).to,Le.Decoration.replace({widget:new bw(f),block:!0})),!l)break;a=t.doc.lineAt(Math.min(t.doc.length,n?l.toA:l.toB)).number}return i.finish()}var N5=Le.EditorView.styleModule.of(new Eh({".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"}})),B5=Le.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"}}),_P=new Ie.Compartment,Ch=new Ie.Compartment,Rh=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||C5;let r=[Ie.Prec.low(DP),B5,N5,Du,Le.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Ph)))&&this.measure()})],i=[Si.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(kh);let n=Ie.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Le.EditorView.editorAttributes.of({class:"cm-merge-a"}),Ch.of(i),r]}),s=[Si.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(kh);let a=Ie.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Le.EditorView.editorAttributes.of({class:"cm-merge-b"}),Ch.of(s),r]});this.chunks=Xn.build(n.doc,a.doc,this.diffConf);let o=[xn.init(()=>this.chunks),_P.of(e.collapseUnchanged?bP(e.collapseUnchanged):[])];n=n.update({effects:Ie.StateEffect.appendConfig.of(o)}).state,a=a.update({effects:Ie.StateEffect.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:u),this.editorDOM.appendChild(l=="a-b"?u:c),this.a=new Le.EditorView({state:n,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Le.EditorView({state:a,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,r){if(e.some(i=>i.docChanged)){let i=e[e.length-1],n=e.reduce((a,o)=>a.compose(o.changes),Ie.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?Xn.updateA(this.chunks,i.newDoc,this.b.state.doc,n,this.diffConf):Xn.updateB(this.chunks,this.a.state.doc,i.newDoc,n,this.diffConf),r.update([...e,i.state.update({effects:vw.of(this.chunks)})]);let s=r==this.a?this.b:this.a;s.update([s.state.update({effects:vw.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,o=this.b.dom.parentNode;a.remove(),o.remove(),this.editorDOM.insertBefore(s?a:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,o=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(s,a,o)}let r="highlightChanges"in e,i="gutter"in e,n="collapseUnchanged"in e;if(r||i||n){let s=[],a=[];if(r||i){let o=this.a.state.facet(Si),l=i?e.gutter!==!1:o.markGutter,c=r?e.highlightChanges!==!1:o.highlightChanges;s.push(Ch.reconfigure([Si.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?kh:[]])),a.push(Ch.reconfigure([Si.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?kh:[]]))}if(n){let o=_P.reconfigure(e.collapseUnchanged?bP(e.collapseUnchanged):[]);s.push(o),a.push(o)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,r,i){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=i,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",n=>this.revertClicked(n)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){M5(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,i=this.a.viewport,n=this.b.viewport;for(let s=0;si.to||a.fromB>n.to)break;if(a.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function yP(t){let e=t.nextSibling;return t.remove(),e}var Sw=require("@codemirror/state");function kw(t,e,r){let i=[],n=t.split(` +`),s=e.split(` +`);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=Wt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;dn.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;ds.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Aw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:$h(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:$h(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var OP={scanLimit:1e3,timeout:200};function H5(t,e,r,i){let n=Sw.Text.of(t.split(` +`)),s=Sw.Text.of(e.split(` +`)),a=r&&i?Xn.updateB(r,n,s,i,OP):Xn.build(n,s,OP),o=[];for(let l=0;lh.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(` +`).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(` +`).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(` +`).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(` +`)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(` +`).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(` +`).length&&!u.compareText.endsWith(` +`)&&(c.removed.no_nl_at_eof=!0);return c}},Ur=Pl.StateField.define({create:t=>{},update:(t,e)=>{let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let n of e.effects)n.is($l)&&(r.compareText=n.value.compareText,r.compareTextHead=n.value.compareTextHead,i=(t==null?void 0:t.compareText)!==n.value.compareText,i&&(r.chunks=void 0)),n.is(Ou)&&NP(r,n.value,e.state);if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let n=U5(e,r.compareText,r.chunks,r.maxDiffTimeMs);n&&NP(r,n,e.state)}}else r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;return r}});function NP(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(Rl.editorInfoField).file;(s=(n=zt.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var Cw=Pl.StateField.define({create:()=>({debouncer:(0,Rl.debounce)(t=>{let{state:e,compareText:r,previousChunks:i,changeDesc:n}=t,s=BP(e,r,i,n);e.field(Rl.editorEditorField).dispatch({effects:Ou.of(s)})},1e3,!0),maxDiffTimeMs:0}),update:(t,e)=>{var r;for(let i of e.effects)if(i.is(Ou))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 BP(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=LP(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function U5(t,e,r,i){let n=t.state,s=Math.abs(t.changes.length-t.changes.newLength),a=n.field(Cw);if(s>1e3||i>16)a.debouncer({state:n,compareText:e,previousChunks:r,changeDesc:a.changeDesc});else return a.changeDesc=void 0,BP(n,e,r,t.changes)}var $l=Pl.StateEffect.define(),Ou=Pl.StateEffect.define();function HP(t,e){return e.update({effects:$l.of(t)})}m();m();m();var at;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(at||(at={}));var UP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},GP={LINES:"lines",WORDS:"words",NONE:"none"},jP={WORD:"word",CHAR:"char"},Da;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Da||(Da={}));m();var G5=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],j5=RegExp("["+G5.join("\\")+"]","g");function VP(t){return t.replace(j5,"\\$&")}function Tw(t){return t&&t.replace(/\\/g,"/")}function zP(t){let e,r,i,n=0;for(e=0,i=t.length;e1?r[r.length-1]:e}function qP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var YP=["a/","b/","i/","w/","c/","o/"];function Us(t,e,r){let i=r!==void 0?[...YP,r]:YP,n=e?new RegExp(`^${VP(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function V5(t,e){return Us(t,"---",e)}function z5(t,e){return Us(t,"+++",e)}function ZP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,w=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,C=/^rename to "?(.+)"?/,A=/^similarity index (\d+)%/,k=/^dissimilarity index (\d+)%/,v=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,$=/^deleted file mode (\d{6}),(\d{6})/,D=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` +`).split(` +`);function Q(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function ye(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function de(){Q(),ye(),i={blocks:[],deletedLines:0,addedLines:0}}function J(z){Q();let K;i!==null&&((K=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(K[1],10),o=parseInt(K[2],10)):(K=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(K[1],10),a=parseInt(K[2],10),o=parseInt(K[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function X(z){if(i===null||n===null||s===null||o===null)return;let K={content:z},G=i.isCombined?["+ "," +","++"]:["+"],Me=i.isCombined?["- "," -","--"]:["-"];qP(z,G)?(i.addedLines++,K.type=at.INSERT,K.oldNumber=void 0,K.newNumber=o++):qP(z,Me)?(i.deletedLines++,K.type=at.DELETE,K.oldNumber=s++,K.newNumber=void 0):(K.type=at.CONTEXT,K.oldNumber=s++,K.newNumber=o++),n.lines.push(K)}function he(z,K){let G=K;for(;G{if(!z||z.startsWith("*"))return;let G,Me=D[K-1],Et=D[K+1],Ht=D[K+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(de(),(G=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=Us(G[1],void 0,e.dstPrefix),c=Us(G[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(de(),(G=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=Us(G[1],void 0,e.dstPrefix),c=Us(G[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&Et.startsWith(f)&&Ht.startsWith(d))&&de(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let Rt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";J(Rt);return}if(z.startsWith(u)&&Et.startsWith(f)||z.startsWith(f)&&Me.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(G=V5(z,e.srcPrefix))){i.oldName=G,i.language=WP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(G=z5(z,e.dstPrefix))){i.newName=G,i.language=WP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){J(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){X(z);return}let De=!he(z,K);if(i===null)throw new Error("Where is my file !!!");(G=h.exec(z))?i.oldMode=G[1]:(G=p.exec(z))?i.newMode=G[1]:(G=g.exec(z))?(i.deletedFileMode=G[1],i.isDeleted=!0):(G=w.exec(z))?(i.newFileMode=G[1],i.isNew=!0):(G=y.exec(z))?(De&&(i.oldName=G[1]),i.isCopy=!0):(G=b.exec(z))?(De&&(i.newName=G[1]),i.isCopy=!0):(G=S.exec(z))?(De&&(i.oldName=G[1]),i.isRename=!0):(G=C.exec(z))?(De&&(i.newName=G[1]),i.isRename=!0):(G=x.exec(z))?(i.isBinary=!0,i.oldName=Us(G[1],void 0,e.srcPrefix),i.newName=Us(G[2],void 0,e.dstPrefix),J("Binary file")):_.test(z)?(i.isBinary=!0,J(z)):(G=A.exec(z))?i.unchangedPercentage=parseInt(G[1],10):(G=k.exec(z))?i.changedPercentage=parseInt(G[1],10):(G=v.exec(z))?(i.checksumBefore=G[1],i.checksumAfter=G[2],G[3]&&(i.mode=G[3])):(G=P.exec(z))?(i.checksumBefore=[G[2],G[3]],i.checksumAfter=G[1]):(G=T.exec(z))?(i.oldMode=[G[2],G[3]],i.newMode=G[1]):(G=M.exec(z))?(i.newFileMode=G[1],i.isNew=!0):(G=$.exec(z))&&(i.deletedFileMode=G[1],i.isDeleted=!0)}),Q(),ye(),r}m();m();m();m();var Gs=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=b=>{if(b=this.postProcess(b,i),n){setTimeout(function(){n(b)},0);return}else return b},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,w=1/0,y=()=>{for(let b=Math.max(g,-c);b<=Math.min(w,c);b+=2){let S,C=h[b-1],A=h[b+1];C&&(h[b-1]=void 0);let k=!1;if(A){let x=A.oldPos-b;k=A&&0<=x&&x=l&&p+1>=o)return a(this.buildValues(S.lastComponent,r,e))||!0;h[b]=S,S.oldPos+1>=l&&(w=Math.min(w,b-1)),p+1>=o&&(g=Math.max(g,b+1))}c++};if(n)(function b(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);y()||b()},0)})();else for(;c<=u&&Date.now()<=d;){let b=y();if(b)return b}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Pw=class extends Gs{},KP=new Pw;function Rw(t,e,r){return KP.diff(t,e,r)}m();m();function $w(t,e){let r;for(r=0;re.length&&(r=t.length-e.length);let i=e.length;t.length0&&e[a]!=e[s];)s=n[s];e[a]==e[s]&&s++}s=0;for(let a=r;a0&&t[a]!=e[s];)s=n[s];t[a]==e[s]&&s++}return s}function Mw(t,e){let r=[];for(let i of Array.from(e.segment(t))){let n=i.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(n)?r[r.length-1]+=n:r.push(n)}return r}function Dh(t,e){if(e)return Il(t,e)[1];let r;for(r=t.length-1;r>=0&&t[r].match(/\s/);r--);return t.substring(r+1)}function Oa(t,e){if(e)return Il(t,e)[0];let r=t.match(/^\s*/);return r?r[0]:""}function Il(t,e){if(!e)return[Oa(t),Dh(t)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let r=Mw(t,e),i=r[0],n=r[r.length-1],s=/\s/.test(i)?i:"",a=/\s/.test(n)?n:"";return[s,a]}var Oh="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Y5=new RegExp(`[${Oh}]+|\\s+|[^${Oh}]`,"ug"),Dw=class extends Gs{equals(e,r,i){return i.ignoreCase&&(e=e.toLowerCase(),r=r.toLowerCase()),e.trim()===r.trim()}tokenize(e,r={}){let i;if(r.intlSegmenter){let a=r.intlSegmenter;if(a.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=Mw(e,a)}else i=e.match(Y5)||[];let n=[],s=null;return i.forEach(a=>{/\s/.test(a)?s==null?n.push(a):n.push(n.pop()+a):s!=null&&/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+a):n.push(s+a):n.push(a),s=a}),n}join(e){return e.map((r,i)=>i==0?r:r.replace(/^\s+/,"")).join("")}postProcess(e,r){if(!e||r.oneChangePerToken)return e;let i=null,n=null,s=null;return e.forEach(a=>{a.added?n=a:a.removed?s=a:((n||s)&&XP(i,s,n,a,r.intlSegmenter),i=a,n=null,s=null)}),(n||s)&&XP(i,s,n,null,r.intlSegmenter),e}},Z5=new Dw;function XP(t,e,r,i,n){if(e&&r){let[s,a]=Il(e.value,n),[o,l]=Il(r.value,n);if(t){let c=$w(s,o);t.value=Mh(t.value,o,c),e.value=Fl(e.value,c),r.value=Fl(r.value,c)}if(i){let c=Fw(a,l);i.value=Ih(i.value,l,c),e.value=Lu(e.value,c),r.value=Lu(r.value,c)}}else if(r){if(t){let s=Oa(r.value,n);r.value=r.value.substring(s.length)}if(i){let s=Oa(i.value,n);i.value=i.value.substring(s.length)}}else if(t&&i){let s=Oa(i.value,n),[a,o]=Il(e.value,n),l=$w(s,a);e.value=Fl(e.value,l);let c=Fw(Fl(s,l),o);e.value=Lu(e.value,c),i.value=Ih(i.value,s,c),t.value=Mh(t.value,s,s.slice(0,s.length-c.length))}else if(i){let s=Oa(i.value,n),a=Dh(e.value,n),o=Iw(a,s);e.value=Lu(e.value,o)}else if(t){let s=Dh(t.value,n),a=Oa(e.value,n),o=Iw(s,a);e.value=Fl(e.value,o)}}var Ow=class extends Gs{tokenize(e){let r=new RegExp(`(\\r?\\n)|[${Oh}]+|[^\\S\\n\\r]+|[^${Oh}]`,"ug");return e.match(r)||[]}},QP=new Ow;function Lw(t,e,r){return QP.diff(t,e,r)}m();function X5(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ml(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return X5(i,n)/(i.length+n.length)}}function Dl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l0||o.indexB>0)&&(S=w.concat(S)),(i.length>d||n.length>h)&&(S=S.concat(b)),S}return r}var Jt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},La={matching:GP.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:jP.WORD,colorScheme:Da.LIGHT},En="/",JP=Ml(t=>t.value),Q5=Dl(JP);function Bw(t){return t.indexOf("dev/null")!==-1}function J5(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function e4(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function Ol(t){switch(t){case at.CONTEXT:return Jt.CONTEXT;case at.INSERT:return Jt.INSERTS;case at.DELETE:return Jt.DELETES}}function Ll(t){switch(t){case Da.DARK:return"d2h-dark-color-scheme";case Da.AUTO:return"d2h-auto-color-scheme";case Da.LIGHT:default:return"d2h-light-color-scheme"}}function t4(t){return t?2:1}function js(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function ki(t,e,r=!0){let i=t4(e);return{prefix:t.substring(0,i),content:r?js(t.substring(i)):t.substring(i)}}function Na(t){let e=Tw(t.oldName),r=Tw(t.newName);if(e!==r&&!Bw(e)&&!Bw(r)){let i=[],n=[],s=e.split(En),a=r.split(En),o=s.length,l=a.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&s[u]===a[f];)n.unshift(a[f]),u-=1,f-=1;let d=i.join(En),h=n.join(En),p=s.slice(c,u+1).join(En),g=a.slice(c,f+1).join(En);return d.length&&h.length?d+En+"{"+p+" \u2192 "+g+"}"+En+h:d.length?d+En+"{"+p+" \u2192 "+g+"}":h.length?"{"+p+" \u2192 "+g+"}"+En+h:e+" \u2192 "+r}else return Bw(r)?e:r}function Nl(t){return`d2h-${zP(Na(t)).toString().slice(-6)}`}function Bl(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 Lh(t,e,r,i={}){let{matching:n,maxLineLengthHighlight:s,matchWordsThreshold:a,diffStyle:o}=Object.assign(Object.assign({},La),i),l=ki(t,r,!1),c=ki(e,r,!1);if(l.content.length>s||c.content.length>s)return{oldLine:{prefix:l.prefix,content:js(l.content)},newLine:{prefix:c.prefix,content:js(c.content)}};let u=o==="char"?Rw(l.content,c.content):Lw(l.content,c.content),f=[];if(o==="word"&&n==="words"){let h=u.filter(w=>w.removed),p=u.filter(w=>w.added);Q5(p,h).forEach(w=>{w[0].length===1&&w[1].length===1&&JP(w[0][0],w[1][0]){let g=p.added?"ins":p.removed?"del":null,w=f.indexOf(p)>-1?' class="d2h-change"':"",y=js(p.value);return g!==null?`${h}<${g}${w}>${y}`:`${h}${y}`},"");return{oldLine:{prefix:l.prefix,content:J5(d)},newLine:{prefix:c.prefix,content:e4(d)}}}var eR="file-summary",r4="icon",i4={colorScheme:La.colorScheme},Nh=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},i4),r)}render(e){let r=e.map(i=>this.hoganUtils.render(eR,"line",{fileHtmlId:Nl(i),oldName:i.oldName,newName:i.newName,fileName:Na(i),deletedLines:"-"+i.deletedLines,addedLines:"+"+i.addedLines},{fileIcon:this.hoganUtils.template(r4,Bl(i))})).join(` +`);return this.hoganUtils.render(eR,"wrapper",{colorScheme:Ll(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var Uw=Object.assign(Object.assign({},La),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Nu="generic",tR="line-by-line",n4="icon",s4="tag",Bu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Uw),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` +`);return this.hoganUtils.render(Nu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(tR,"file-diff"),n=this.hoganUtils.template(Nu,"file-path"),s=this.hoganUtils.template(n4,"file"),a=this.hoganUtils.template(s4,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(Nu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:Jt})}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(Nu,"block-header",{CSSLineClass:Jt,blockHeader:e.isTooBig?i.header:js(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:Jt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(` +`)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===at.CONTEXT?r.push([[a],[],[]]):a.type===at.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===at.INSERT&&i.length>0?n.push(a):a.type===at.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=Fh(e.concat(r).map(o=>o.content.length));return n{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` +`);return this.hoganUtils.render(Hu,"wrapper",{colorScheme:Ll(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(a4,"file-diff"),n=this.hoganUtils.template(Hu,"file-path"),s=this.hoganUtils.template(o4,"file"),a=this.hoganUtils.template(l4,Bl(e));return i.render({file:e,fileHtmlId:Nl(e),diffs:r,filePath:n.render({fileDiffName:Na(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Hu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:Jt})}}generateFileHtml(e){let r=Dl(Ml(i=>ki(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ki(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:Jt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:Jt.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===at.CONTEXT?r.push([[a],[],[]]):a.type===at.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===at.INSERT&&i.length>0?n.push(a):a.type===at.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=Fh(e.concat(r).map(o=>o.content.length));return n'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileName",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("addedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(' '),i.b(i.v(i.f("deletedLines",t,e,0))),i.b(""),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{"'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")"),i.b(` +`+r),i.b(' hide'),i.b(` +`+r),i.b(' show'),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
    '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-block-header"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-empty-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" File without changes"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-file-path"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(''),i.b(` +`+r),i.b(i.rp("'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b(""),i.b(` +`+r),i.b(i.rp(""),i.b(` +`+r),i.b('"),i.fl()},partials:{""),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("prefix",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b('  '),i.b(` +`+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("content",n,s,0))),a.b(""),a.b(` +`+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b('
'),i.b(` +`+r)),i.b("
"),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b(""),i.fl()},partials:{},subs:{}});xt["generic-wrapper"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["icon-file-added"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-changed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-deleted"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file-renamed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["icon-file"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});xt["line-by-line-file-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["line-by-line-numbers"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("
"),i.b(` +`+r),i.b('
'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("
"),i.fl()},partials:{},subs:{}});xt["side-by-side-file-diff"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b('
'),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(' '),i.b(` +`+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(` +`+r),i.b(" "),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.b(` +`+r),i.b("
"),i.fl()},partials:{},subs:{}});xt["tag-file-added"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('ADDED'),i.fl()},partials:{},subs:{}});xt["tag-file-changed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('CHANGED'),i.fl()},partials:{},subs:{}});xt["tag-file-deleted"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('DELETED'),i.fl()},partials:{},subs:{}});xt["tag-file-renamed"]=new At.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('RENAMED'),i.fl()},partials:{},subs:{}});var Gu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=Ww.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},xt),e),i)}static compile(e){return Ww.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var u4=Object.assign(Object.assign(Object.assign({},Uw),Gw),{outputFormat:UP.LINE_BY_LINE,drawFileList:!0});function Hh(t,e={}){let r=Object.assign(Object.assign({},u4),e),i=typeof t=="string"?ZP(t,r):t,n=new Gu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Nh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Uu(n,r).render(i):new Bu(n,r).render(i);return o+l}var cR=Gt(oR(),1);var Ba=require("obsidian"),qw=ju.StateEffect.define();function Vs(t,e){let r=t.state,i=r.field(Gh),n=r.field(Ur),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=Wt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(Ba.editorEditorField).dispatch({effects:qw.of({pos:o,add:!l})})}var Gh=ju.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(qw)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),uR=ju.StateField.define({create:t=>lR(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is($l)||r.is(qw))?lR(e.state):t},provide:t=>Uh.showTooltip.computeN([t],e=>e.field(t))}),fR=Uh.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 lR(t){let e=t.field(Ur);return e?[...t.field(Gh)].map(i=>{let n=t.doc.lineAt(i),s=Wt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>f4(s,t,i)}}).filter(i=>i!==void 0):[]}function f4(t,e,r){var g,w;let i=Wt.createPatch("file",[t],"10064",!1).join(` +`)+` +`,n=Hh(i,{colorScheme:cR.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(y,b)=>{let S=createDiv();return(0,Ba.setIcon)(S,y),S.setAttr("aria-label",b),S.addClass("clickable-icon"),S},l=o("x","Close hunk"),c=o("plus","Stage hunk"),u=o("undo","Reset hunk");a.appendChild(l),a.appendChild(c),a.appendChild(u);let f=createDiv();f.appendChild(a),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(Ba.editorEditorField);l.onclick=()=>{Vs(d,r)},c.onclick=()=>{let y=zt.plugin;y&&(y.promiseQueue.addTask(()=>y.hunkActions.stageHunk(r)),Vs(d,r))},u.onclick=()=>{let y=zt.plugin;y&&(y.hunkActions.resetHunk(r),Vs(d,r))};let h=(w=(g=zt.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(Ba.MarkdownView))==null?void 0:w.scope,p=h==null?void 0:h.register(null,"Escape",(y,b)=>{Vs(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:y=>{r=y.changes.mapPos(r)}}}function dR(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new xh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Qt.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Qt.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(bi.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:bi.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);t.tools.openDiff({aFile:n,aRef:""})}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return X2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return Q2(i,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.addFileToGitignore(i.path,i instanceof Wi.TFolder).catch(n=>t.displayError(n))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:i})})}),t.addCommand({id:"commit-staged",name:"Commit staged",checkCallback:function(r){if(r)return!1;t.promiseQueue.addTask(async()=>t.commit({fromAuto:!1,requestCustomMessage:!1}))}}),Wi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(async()=>{let i=(await t.updateCachedStatus()).staged.length>0;return t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:i})})}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",checkCallback:function(r){return r?!1:t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.stageFile(i))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;t.promiseQueue.addTask(()=>t.unstageFile(i))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(r=>t.displayError(r))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(r=>t.displayError(r))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(r=>t.displayError(r))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new tt(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 Wi.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new Wi.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 yh(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 Wi.Notice("Discarded all changes in tracked files.");break;case"delete":new Wi.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 Wi.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new Wi.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let i=t.gitManager;if(r)return i instanceof Ce;t.tools.runRawCommand().catch(n=>t.displayError(n))}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=t.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}}),t.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(r,i,n){if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.resetHunk()}}),t.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.promiseQueue.addTask(()=>t.hunkActions.stageHunk())}}),t.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let s=t.hunkActions.editor.editor;Vs(s)}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("next")}}),t.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;t.hunkActions.goToHunk("prev")}})}m();var jh=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let r of e){let i=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&i!=null&&i!=null&&(this.app.saveLocalStorage(this.prefix+r,i),localStorage.removeItem(this.prefix+r))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(e){return this.app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(e){return this.app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return this.app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return this.app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return this.app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,r;return(r=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?r:[]}setPATHPaths(e){return this.app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}getPausedAutomatics(){return this.app.loadLocalStorage(this.prefix+"pausedAutomatics")=="true"}setPausedAutomatics(e){return this.app.saveLocalStorage(this.prefix+"pausedAutomatics",`${e}`)}getGutterSpacingFallbackLength(){var e;return(e=this.app.loadLocalStorage(this.prefix+"gutterSpacingFallbackLength"))!=null?e:5}setGutterSpacingFallbackLength(e){return this.app.saveLocalStorage(this.prefix+"gutterSpacingFallbackLength",e)}};m();var Hl=require("obsidian");var Vu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),i=r.tracking?Yn(r.tracking)[0]:null;if(!i)return!1;let n=await this.plugin.gitManager.getRemoteUrl(i);if(n!=null&&n.includes("github.com")){let s=[],a=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),c=!1;if(l instanceof Hl.TFile)l.stat.size>=1e8&&(c=!0);else{let u=await this.plugin.app.vault.adapter.stat(o.vaultPath);u&&u.size>=1e8&&(c=!0)}if(c){let u=!1;a instanceof Ce&&(u=await a.isFileTrackedByLFS(o.path)),u||s.push(o)}}if(s.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: +- ${s.map(o=>o.vaultPath).join(` +- `)} +Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(il,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&il.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(il,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;Hl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=ji(this.plugin.app,s))==null||l.setViewState({type:Ms.type,active:!0,state:o}):a=="git_unified"&&((c=ji(this.plugin.app,s))==null||c.setViewState({type:Ds.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof Ce))return;let i=await new tt(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new Hl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var Vh=require("obsidian");var Ha=class extends Vh.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Ds.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Ds.name}getIcon(){return Ds.icon}async setState(r,i){this.state=r,Vh.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof Ce&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` +`);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null ++++ ${this.state.bFile} +@@ -0,0 +1,${s.split(` +`).length} @@`.split(` +`),...s.split(` +`).map(o=>`+${o}`)].join(` +`)}}if(i){let s=this.parser.parseFromString(Hh(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var Qn=require("obsidian");var Gl=require("@codemirror/commands");var zh=require("@codemirror/search"),Ul=require("@codemirror/state"),Ci=require("@codemirror/view");var Ua=class extends Qn.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Qn.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Ms.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Ms.name}getIcon(){return Ms.icon}async setState(r,i){this.state=r,Qn.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof Br&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Ul.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(r){let i=r.createDiv(),n=i.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Qn.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async s=>{var p;let a=this.mergeView.b,o=this.mergeView.a,l=Ew(a.state),c=(p=i.parentElement)==null?void 0:p.indexOf(i),u=l.chunks[c],f=Aw(u,o.state.doc,a.state.doc),d=kw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[f])[0],h=Wt.createPatch(this.state.bFile,[d],"100644",this.state.bRef!=null).join(` +`)+` +`;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=i.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,Qn.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=Ew(l.state),u=(d=i.parentElement)==null?void 0:d.indexOf(i),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,w=f.toB,y=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&w<=l.state.doc.length&&(y+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,w),insert:y},userEvent:"revert"})}}}return i.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},i}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let g=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(g)?o=await this.app.vault.adapter.read(g):o=""}let l=[(0,Ci.lineNumbers)(),(0,zh.highlightSelectionMatches)(),(0,Ci.drawSelection)(),Ci.keymap.of([...Gl.standardKeymap,Gl.indentWithTab]),(0,Gl.history)(),(0,zh.search)(),Ci.EditorView.lineWrapping],c=this,u=Ci.ViewPlugin.define(g=>({update(w){if(w.docChanged&&!w.transactions.some(y=>y.annotation(Ul.Transaction.remote))){let y=g.state.doc.toString();c.fileSaveDebouncer(y)}}})),f={doc:a,extensions:[...l,Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0)]},d=[...l];this.bIsEditable?d.push(u):d.push(Ci.EditorView.editable.of(!1),Ul.EditorState.readOnly.of(!0));let h={doc:o,extensions:d};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let p=this.plugin.gitManager instanceof Ce&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Rh({b:h,a:f,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:p?()=>this.renderButtons(s):void 0,revertControls:p?"a-to-b":void 0,diffConfig:{scanLimit:this.bIsEditable?1e3:1e4},parent:s}),this.refreshing=!1}}};m();var rF=require("obsidian");m();m();m();var hR,pR,mR;typeof window!="undefined"&&((mR=(pR=(hR=window.__svelte)!=null?hR:window.__svelte={}).v)!=null?mR:pR.v=new Set).add("5");m();m();m();var Jn={};var qe=Symbol("uninitialized"),Ti=Symbol("filename");var Wh="http://www.w3.org/1999/xhtml";m();m();m();m();var qh=!0;m();var L=!1;m();var es=Array.isArray,gR=Array.prototype.indexOf,zs=Array.prototype.includes,jl=Array.from,Yw=Object.keys,cr=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,Zw=Object.getOwnPropertyDescriptors,Kw=Object.prototype,vR=Array.prototype,Vl=Object.getPrototypeOf,Xw=Object.isExtensible;function Qw(t){return typeof t=="function"}var ur=()=>{};function Yh(t){for(var e=0;e{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var er=Symbol("$state"),zu=Symbol("legacy props"),bR=Symbol(""),Kh=Symbol("proxy path"),Xh=Symbol("attributes"),Wu=Symbol("class"),Jw=Symbol("style"),qu=Symbol("text"),Ga=Symbol("form reset"),e0=Symbol("hmr anchor"),Ws=new class extends Error{constructor(){super(...arguments);He(this,"name","StaleReactionError");He(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},wR,t0=!!((wR=globalThis.document)!=null&&wR.contentType)&&globalThis.document.contentType.includes("xml");var zl=3,Pi=8;m();m();function _R(t){if(L){let e=new Error(`invariant_violation +An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}" +https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function Qh(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 xR(){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 r0(){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 ER(){if(L){let t=new Error(`derived_references_self +A derived value cannot reference itself recursively +https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function i0(t,e,r){if(L){let i=new Error(`each_key_duplicate +${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`} +https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function SR(t,e,r){if(L){let i=new Error(`each_key_volatile +Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item +https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function kR(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 AR(){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 CR(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 TR(){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 PR(){if(L){let t=new Error(`hydration_failed +Failed to hydrate the application +https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function RR(t){if(L){let e=new Error(`props_invalid_value +Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value +https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function $R(t){if(L){let e=new Error(`rune_outside_svelte +The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files +https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function FR(){if(L){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function IR(){if(L){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function MR(){if(L){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function DR(){if(L){let t=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Sn="font-weight: bold",kn="font-weight: normal";function OR(t){L?console.warn(`%c[svelte] await_reactivity_loss +%cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\` +https://svelte.dev/e/await_reactivity_loss`,Sn,kn):console.warn("https://svelte.dev/e/await_reactivity_loss")}function LR(t,e){L?console.warn(`%c[svelte] await_waterfall +%cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app +https://svelte.dev/e/await_waterfall`,Sn,kn):console.warn("https://svelte.dev/e/await_waterfall")}function NR(){L?console.warn(`%c[svelte] derived_inert +%cReading a derived belonging to a now-destroyed effect may result in stale values +https://svelte.dev/e/derived_inert`,Sn,kn):console.warn("https://svelte.dev/e/derived_inert")}function BR(t,e,r){L?console.warn(`%c[svelte] hydration_attribute_changed +%cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value +https://svelte.dev/e/hydration_attribute_changed`,Sn,kn):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ja(t){L?console.warn(`%c[svelte] hydration_mismatch +%c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"} +https://svelte.dev/e/hydration_mismatch`,Sn,kn):console.warn("https://svelte.dev/e/hydration_mismatch")}function HR(){L?console.warn(`%c[svelte] lifecycle_double_unmount +%cTried to unmount a component that was not mounted +https://svelte.dev/e/lifecycle_double_unmount`,Sn,kn):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Jh(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`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function UR(){L?console.warn(`%c[svelte] state_proxy_unmount +%cTried to unmount a state proxy, rather than a component +https://svelte.dev/e/state_proxy_unmount`,Sn,kn):console.warn("https://svelte.dev/e/state_proxy_unmount")}function GR(){L?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Sn,kn):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function jR(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`,Sn,kn):console.warn("https://svelte.dev/e/transition_slide_display")}var ae=!1;function It(t){ae=t}var be;function je(t){if(t===null)throw ja(),Jn;return be=t}function fr(){return je(rr(be))}function V(t){if(ae){if(rr(be)!==null)throw ja(),Jn;be=t}}function Va(t=1){if(ae){for(var e=t,r=be;e--;)r=rr(r);be=r}}function An(t=!0){for(var e=0,r=be;;){if(r.nodeType===Pi){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=rr(r);t&&r.remove(),r=n}}function Zu(t){if(!t||t.nodeType!==Pi)throw ja(),Jn;return t.data}m();m();m();m();function ep(t){return t===this.v}function n0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function tp(t){return!n0(t,this.v)}m();var Ct=!1,ts=!1,qi=!1;m();m();m();var Ku=null;function dr(t,e){return t.label=e,ip(t.v,e),t}function ip(t,e){var r;return(r=t==null?void 0:t[Kh])==null||r.call(t,e),t}m();function Yi(t){let e=new Error,r=h4();return r.length===0?null:(r.unshift(` +`),cr(e,"stack",{value:r.join(` +`)}),cr(e,"name",{value:t}),e)}function h4(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(` +`),i=[];for(let n=0;n{e===za&&WR()})}za.push(t)}function qR(){for(;za.length>0;)WR()}m();var a0=new WeakMap;function sp(t){var e=ee;if(e===null)return le.f|=8388608,t;if(L&&t instanceof Error&&!a0.has(t)&&a0.set(t,p4(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw L&&!e.parent&&t instanceof Error&&YR(t),t;Xi(t,e)}function Xi(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw L&&t instanceof Error&&YR(t),t}}function p4(t,e){var a,o,l;let r=Gr(t,"message");if(!(r&&!r.configurable)){for(var i=Qu?" ":" ",n=` +${i}in ${((a=e.fn)==null?void 0:a.name)||""}`,s=e.ctx;s!==null;)n+=` +${i}in ${(o=s.function)==null?void 0:o[Ti].split("/").pop()}`,s=s.p;return{message:t.message+` +${n} +`,stack:(l=t.stack)==null?void 0:l.split(` +`).filter(c=>!c.includes("svelte/src/internal")).join(` +`)}}}function YR(t){let e=a0.get(t);e&&(cr(t,"message",{value:e.message}),cr(t,"stack",{value:e.stack}))}m();m();var m4=-7169;function Ve(t,e){t.f=t.f&m4|e}function Zl(t){(t.f&512)!==0||t.deps===null?Ve(t,1024):Ve(t,4096)}function ZR(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,ZR(e.deps))}function ap(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),ZR(t.deps),Ve(t,1024)}m();m();m();var KR=!1,op=!1;function o0(t){var e=op;try{return op=!1,[t(),op]}finally{op=e}}m();m();m();m();m();function XR(t){let e=0,r=pr(0),i;return L&&dr(r,"createSubscriber version"),()=>{qs()&&(I(r),ar(()=>(e===0&&(i=Ye(()=>t(()=>Za(r)))),e+=1,()=>{Mt(()=>{e-=1,e===0&&(i==null||i(),i=void 0,Za(r))})})))}}var v4=589824;function d0(t,e,r,i){new l0(t,e,r,i)}var ii,Ju,Fi,Ka,jr,Ii,kr,ni,ns,Xa,Ys,Xl,ef,tf,Pn,up,it,JR,e$,t$,c0,lp,cp,u0,f0,l0=class{constructor(e,r,i,n){ge(this,it);He(this,"parent");He(this,"is_pending",!1);He(this,"transform_error");ge(this,ii);ge(this,Ju,ae?be:null);ge(this,Fi);ge(this,Ka);ge(this,jr);ge(this,Ii,null);ge(this,kr,null);ge(this,ni,null);ge(this,ns,null);ge(this,Xa,0);ge(this,Ys,0);ge(this,Xl,!1);ge(this,ef,new Set);ge(this,tf,new Set);ge(this,Pn,null);ge(this,up,XR(()=>(pe(this,Pn,pr(F(this,Xa))),L&&dr(F(this,Pn),"$effect.pending()"),()=>{pe(this,Pn,null)})));var s,a;pe(this,ii,e),pe(this,Fi,r),pe(this,Ka,o=>{var l=ee;l.b=this,l.f|=128,i(o)}),this.parent=ee.b,this.transform_error=(a=n!=null?n:(s=this.parent)==null?void 0:s.transform_error)!=null?a:(o=>o),pe(this,jr,ai(()=>{if(ae){let o=F(this,Ju);fr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Ae(this,it,e$).call(this,u)}else l?Ae(this,it,t$).call(this):Ae(this,it,JR).call(this)}else Ae(this,it,c0).call(this)},v4)),ae&&pe(this,ii,be)}defer_effect(e){ap(e,F(this,ef),F(this,tf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!F(this,Fi).pending}update_pending_count(e,r){Ae(this,it,u0).call(this,e,r),pe(this,Xa,F(this,Xa)+e),!(!F(this,Pn)||F(this,Xl))&&(pe(this,Xl,!0),Mt(()=>{pe(this,Xl,!1),F(this,Pn)&&Qi(F(this,Pn),F(this,Xa))}))}get_effect_pending(){return F(this,up).call(this),I(F(this,Pn))}error(e){var r;if(!F(this,Fi).onerror&&!F(this,Fi).failed)throw e;(r=ce)!=null&&r.is_fork?(F(this,Ii)&&ce.skip_effect(F(this,Ii)),F(this,kr)&&ce.skip_effect(F(this,kr)),F(this,ni)&&ce.skip_effect(F(this,ni)),ce.oncommit(()=>{Ae(this,it,f0).call(this,e)})):Ae(this,it,f0).call(this,e)}};ii=new WeakMap,Ju=new WeakMap,Fi=new WeakMap,Ka=new WeakMap,jr=new WeakMap,Ii=new WeakMap,kr=new WeakMap,ni=new WeakMap,ns=new WeakMap,Xa=new WeakMap,Ys=new WeakMap,Xl=new WeakMap,ef=new WeakMap,tf=new WeakMap,Pn=new WeakMap,up=new WeakMap,it=new WeakSet,JR=function(){try{pe(this,Ii,Ot(()=>F(this,Ka).call(this,F(this,ii))))}catch(e){this.error(e)}},e$=function(e){let r=F(this,Fi).failed;r&&pe(this,ni,Ot(()=>{r(F(this,ii),()=>e,()=>()=>{})}))},t$=function(){let e=F(this,Fi).pending;e&&(this.is_pending=!0,pe(this,kr,Ot(()=>e(F(this,ii)))),Mt(()=>{var r=pe(this,ns,document.createDocumentFragment()),i=Bt();r.append(i),pe(this,Ii,Ae(this,it,cp).call(this,()=>Ot(()=>F(this,Ka).call(this,i)))),F(this,Ys)===0&&(F(this,ii).before(r),pe(this,ns,null),Rn(F(this,kr),()=>{pe(this,kr,null)}),Ae(this,it,lp).call(this,ce))}))},c0=function(){try{if(this.is_pending=this.has_pending_snippet(),pe(this,Ys,0),pe(this,Xa,0),pe(this,Ii,Ot(()=>{F(this,Ka).call(this,F(this,ii))})),F(this,Ys)>0){var e=pe(this,ns,document.createDocumentFragment());Ql(F(this,Ii),e);let r=F(this,Fi).pending;pe(this,kr,Ot(()=>r(F(this,ii))))}else Ae(this,it,lp).call(this,ce)}catch(r){this.error(r)}},lp=function(e){this.is_pending=!1,e.transfer_effects(F(this,ef),F(this,tf))},cp=function(e){var r=ee,i=le,n=Ee;Nt(F(this,jr)),Lt(F(this,jr)),rs(F(this,jr).ctx);try{return si.ensure(),e()}catch(s){return sp(s),null}finally{Nt(r),Lt(i),rs(n)}},u0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Ae(i=this.parent,it,u0).call(i,e,r);return}pe(this,Ys,F(this,Ys)+e),F(this,Ys)===0&&(Ae(this,it,lp).call(this,r),F(this,kr)&&Rn(F(this,kr),()=>{pe(this,kr,null)}),F(this,ns)&&(F(this,ii).before(F(this,ns)),pe(this,ns,null)))},f0=function(e){F(this,Ii)&&(vt(F(this,Ii)),pe(this,Ii,null)),F(this,kr)&&(vt(F(this,kr)),pe(this,kr,null)),F(this,ni)&&(vt(F(this,ni)),pe(this,ni,null)),ae&&(je(F(this,Ju)),Va(),je(An()));var r=F(this,Fi).onerror;let i=F(this,Fi).failed;var n=!1,s=!1;let a=()=>{if(n){GR();return}n=!0,s&&DR(),F(this,ni)!==null&&Rn(F(this,ni),()=>{pe(this,ni,null)}),Ae(this,it,cp).call(this,()=>{Ae(this,it,c0).call(this)})},o=l=>{try{s=!0,r==null||r(l,a),s=!1}catch(c){Xi(c,F(this,jr)&&F(this,jr).parent)}i&&pe(this,ni,Ae(this,it,cp).call(this,()=>{try{return Ot(()=>{var c=ee;c.b=this,c.f|=128,i(F(this,ii),()=>l,()=>a)})}catch(c){return Xi(c,F(this,jr).parent),null}}))};Mt(()=>{var l;try{l=this.transform_error(e)}catch(c){Xi(c,F(this,jr)&&F(this,jr).parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(o,c=>Xi(c,F(this,jr)&&F(this,jr).parent)):o(l)})};function fp(t,e,r,i){let n=Tn()?Zs:Qa;var s=t.filter(h=>!h.settled),a=e.map(n);if(L&&a.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,w)=>w)}),r.length===0&&s.length===0){i(a);return}var o=ee,l=r$(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function u(h){if((o.f&16384)===0){l();try{i([...a,...h])}catch(p){Xi(p,o)}Jl()}}var f=h0();if(r.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(r.map(h=>m0(h))).then(u).catch(h=>Xi(h,o)).finally(f)}c?c.then(()=>{l(),d(),Jl()}):d()}function r$(){var t=ee,e=le,r=Ee,i=ce;if(L)var n=Cn;return function(a=!0){Nt(t),Lt(e),rs(r),a&&(t.f&16384)===0&&(i==null||i.activate(),i==null||i.apply()),L&&(p0(null),Yl(n))}}function Jl(t=!0){var e;Nt(null),Lt(null),rs(null),t&&((e=ce)==null||e.deactivate()),L&&(p0(null),Yl(null))}function h0(){var t=ee,e=t.b,r=ce,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,r),r.increment(i,t),()=>{e==null||e.update_pending_count(-1,r),r.decrement(i,t)}}var zr=null;function p0(t){zr=t}var rf=new Set;function Zs(t){var e=2050;ee!==null&&(ee.f|=524288);let r={ctx:Ee,deps:null,effects:null,equals:ep,f:e,fn:t,reactions:null,rv:0,v:qe,wv:0,parent:ee,ac:null};return L&&qi&&(r.created=Yi("created at")),r}var ec=Symbol("obsolete");function m0(t,e,r){let i=ee;i===null&&xR();var n=void 0,s=pr(qe);L&&(s.label=e!=null?e:t.toString());var a=!le,o=new Set;return s$(()=>{var h,p;var l=ee;L&&(zr={effect:l,effect_deps:new Set,warned:!1});var c=Zh();n=c.promise;try{Promise.resolve(t()).then(c.resolve,g=>{g!==Ws&&c.reject(g)}).finally(Jl)}catch(g){c.reject(g),Jl()}if(L){if(zr){if(l.deps!==null)for(let g=0;g{L&&(zr=null),f==null||f(),o.delete(c),w!==ec&&(u.activate(),w?(s.f|=8388608,Qi(s,w)):((s.f&8388608)!==0&&(s.f^=8388608),L&&r!==void 0&&!s.equals(g)&&(rf.add(s),setTimeout(()=>{rf.has(s)&&(l.f&16384)===0&&(LR(s.label,r),rf.delete(s))})),Qi(s,g)),u.deactivate())};c.promise.then(d,g=>d(null,g||"unknown"))}),nr(()=>{for(let l of o)l.reject(ec)}),L&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===n?l(s):c(n)}u.then(f,f)}c(n)})}function ft(t){let e=Zs(t);return Ct||pp(e),e}function Qa(t){let e=Zs(t);return e.equals=tp,e}function i$(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;rthis.schedule(i)){var i=F(this,Fn).get(e);if(i){F(this,Fn).delete(e);for(var n of i.d)Ve(n,2048),r(n);for(n of i.m)Ve(n,4096),r(n)}F(this,cc).add(e)}capture(e,r,i=!1){e.v!==qe&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[r,i]),Tt==null||Tt.set(e,r)),this.is_fork||(e.v=r)}activate(){ce=this}deactivate(){ce=null,Tt=null}flush(){try{L&&_0.clear(),b0=!0,ce=this,Ae(this,Be,af).call(this)}finally{if(a$=0,y0=null,to=null,lf=null,b0=!1,ce=null,Tt=null,fs.clear(),L)for(let e of _0)e.updated=null}}discard(){var e;for(let r of F(this,ac))r(this);F(this,ac).clear();for(let r of this.async_deriveds.values())r.reject(ec);Ae(this,Be,of).call(this),(e=F(this,lc))==null||e.resolve()}register_created_effect(e){F(this,cf).push(e)}increment(e,r){var i;if(pe(this,oc,F(this,oc)+1),e){let n=(i=F(this,cs).get(r))!=null?i:0;F(this,cs).set(r,n+1)}}decrement(e,r){var i;if(pe(this,oc,F(this,oc)-1),e){let n=(i=F(this,cs).get(r))!=null?i:0;n===1?F(this,cs).delete(r):F(this,cs).set(r,n-1)}F(this,Ks)||(pe(this,Ks,!0),Mt(()=>{pe(this,Ks,!1),this.linked&&this.flush()}))}transfer_effects(e,r){for(let i of e)F(this,us).add(i);for(let i of r)F(this,Ji).add(i);e.clear(),r.clear()}oncommit(e){F(this,sc).add(e)}ondiscard(e){F(this,ac).add(e)}settled(){var e;return((e=F(this,lc))!=null?e:pe(this,lc,Zh())).promise}static ensure(){if(ce===null){let e=ce=new gp;!b0&&!Wa&&Mt(()=>{F(e,nc)||e.flush()})}return ce}apply(){if(!Ct||!this.is_fork&&F(this,os)===null&&F(this,ls)===null){Tt=null;return}Tt=new Map;for(let[r,[i]]of this.current)Tt.set(r,i);for(let r=mp;r!==null;r=F(r,ls))if(!(r===this||r.is_fork)){var e=!1;if(r.id1e3&&(Ae(this,Be,of).call(this),y4()),L)for(let d of this.current.keys())_0.add(d);for(let d of F(this,us))F(this,Ji).delete(d),Ve(d,2048),this.schedule(d);for(let d of F(this,Ji))Ve(d,4096),this.schedule(d);let e=F(this,Cr);pe(this,Cr,[]),this.apply();var r=to=[],i=[],n=lf=[];for(let d of e)try{Ae(this,Be,E0).call(this,d,r,i)}catch(h){throw h$(d),Ae(this,Be,x0).call(this)||this.discard(),h}if(ce=null,n.length>0){var s=gp.ensure();for(let d of n)s.schedule(d)}if(to=null,lf=null,Ae(this,Be,x0).call(this)){Ae(this,Be,ic).call(this,i),Ae(this,Be,ic).call(this,r);for(let[d,h]of F(this,Fn))d$(d,h);n.length>0&&Ae(l=ce,Be,af).call(l);return}let a=Ae(this,Be,l$).call(this);if(a){Ae(this,Be,ic).call(this,i),Ae(this,Be,ic).call(this,r),Ae(c=a,Be,c$).call(c,this);return}F(this,us).clear(),F(this,Ji).clear();for(let d of F(this,sc))d(this);F(this,sc).clear(),as=this,o$(i),o$(r),as=null,(u=F(this,lc))==null||u.resolve();var o=ce;if(F(this,oc)===0&&(F(this,Cr).length===0||o!==null)&&(Ae(this,Be,of).call(this),Ct&&(Ae(this,Be,u$).call(this),ce=o)),F(this,Cr).length>0)if(o!==null){let d=o;F(d,Cr).push(...F(this,Cr).filter(h=>!F(d,Cr).includes(h)))}else o=this;o!==null&&Ae(f=o,Be,af).call(f)},E0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||F(this,Fn).has(n);if(!l&&n.fn!==null){a?n.f^=1024:(s&4)!==0?r.push(n):Ct&&(s&16777224)!==0?i.push(n):Xs(n)&&((s&16)!==0&&F(this,Ji).add(n),$n(n));var c=n.first;if(c!==null){n=c;continue}}for(;n!==null;){var u=n.next;if(u!==null){n=u;break}n=n.parent}}},l$=function(){for(var e=F(this,os);e!==null;){if(!e.is_fork){for(let[r,[,i]]of this.current)if(e.current.has(r)&&!i)return e}e=F(e,os)}return null},c$=function(e){var i;for(let[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(let[n,s]of e.async_deriveds){let a=this.async_deriveds.get(n);a&&s.promise.then(a.resolve).catch(a.reject)}e.async_deriveds.clear(),this.transfer_effects(F(e,us),F(e,Ji));let r=n=>{var s=n.reactions;if(s!==null)for(let l of s){var a=l.f;if((a&2)!==0)r(l);else{var o=l;a&4194320&&!this.async_deriveds.has(o)&&(F(this,Ji).delete(o),Ve(o,2048),this.schedule(o))}}};for(let n of this.current.keys())r(n);this.oncommit(()=>e.discard()),Ae(i=e,Be,of).call(i),ce=this,Ae(this,Be,af).call(this)},ic=function(e){for(var r=0;r!d.current.get(h)[1]);if(!(!F(d,nc)||n.length===0)){var s=n.filter(h=>!this.current.has(h));if(s.length===0)e&&d.discard();else if(r.length>0){if(L&&!F(d,Ks)&&zR(F(d,Cr).length===0,"Batch has scheduled roots"),e)for(let h of F(this,cc))d.unskip_effect(h,p=>{var g;(p.f&4194320)!==0?d.schedule(p):Ae(g=d,Be,ic).call(g,[p])});d.activate();var a=new Set,o=new Map;for(var l of r)f$(l,s,a,o);o=new Map;var c=[...d.current].filter(([h,p])=>{let g=this.current.get(h);return g?g[0]!==p[0]||g[1]!==p[1]:!0}).map(([h])=>h);if(c.length>0)for(let h of F(this,cf))(h.f&155648)===0&&S0(h,c,o)&&((h.f&4194320)!==0?(Ve(h,2048),d.schedule(h)):F(d,us).add(h));if(F(d,Cr).length>0&&!F(d,Ks)){d.apply();for(var u of F(d,Cr))Ae(f=d,Be,E0).call(f,u,[],[]);pe(d,Cr,[])}d.deactivate()}}}},of=function(){if(this.linked){var e=F(this,os),r=F(this,ls);e===null?mp=r:pe(e,ls,r),r===null?rc=e:pe(r,os,e),this.linked=!1}};var si=gp;function io(t){var e=Wa;Wa=!0;try{var r;for(t&&(ce!==null&&!ce.is_fork&&ce.flush(),r=t());;){if(qR(),ce===null)return r;ce.flush()}}finally{Wa=e}}function y4(){var r;if(L){var t=new Map;for(let i of ce.current.keys())for(let[n,s]of(r=i.updated)!=null?r:[]){var e=t.get(n);e||(e={error:s.error,count:0},t.set(n,e)),e.count+=s.count}for(let i of t.values())i.error&&console.error(i.error)}try{TR()}catch(i){L&&cr(i,"stack",{value:""}),Xi(i,y0)}}var Wr=null;function o$(t){var e=t.length;if(e!==0){for(var r=0;r0)){fs.clear();for(let n of Wr){if((n.f&24576)!==0)continue;let s=[n],a=n.parent;for(;a!==null;)Wr.has(a)&&(Wr.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){let l=s[o];(l.f&24576)===0&&$n(l)}}Wr.clear()}}Wr=null}}function f$(t,e,r,i){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(let n of t.reactions){let s=n.f;(s&2)!==0?f$(n,e,r,i):(s&4194320)!==0&&(s&2048)===0&&S0(n,e,i)&&(Ve(n,2048),ff(n))}}function S0(t,e,r){let i=r.get(t);if(i!==void 0)return i;if(t.deps!==null)for(let n of t.deps){if(zs.call(e,n))return!0;if((n.f&2)!==0&&S0(n,e,r))return r.set(n,!0),!0}return r.set(t,!1),!1}function ff(t){ce.schedule(t)}function d$(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):(t.f&4096)!==0&&e.m.push(t),Ve(t,1024);for(var r=t.first;r!==null;)d$(r,e),r=r.next}}function h$(t){Ve(t,1024);for(var e=t.first;e!==null;)h$(e),e=e.next}var Ja=new Set,fs=new Map;function dp(t){Ja=t}var A0=!1;function m$(){A0=!0}function pr(t,e){var r={f:0,v:t,reactions:null,equals:ep,rv:0,wv:0};return L&&qi&&(r.created=e!=null?e:Yi("created at"),r.updated=null,r.set_during_effect=!1,r.trace=null),r}function Ne(t,e){let r=pr(t,e);return pp(r),r}function qa(t,e=!1,r=!0){var n,s;let i=pr(t);return e||(i.equals=tp),ts&&r&&Ee!==null&&Ee.l!==null&&((s=(n=Ee.l).s)!=null?s:n.s=[]).push(i),i}function oe(t,e,r=!1){le!==null&&(!Tr||(le.f&131072)!==0)&&Tn()&&(le.f&4325394)!==0&&(li===null||!li.has(t))&&MR();let i=r?Je(e):e;return L&&ip(i,t.label),Qi(t,i,lf)}function Qi(t,e,r=null){var n,s,a;if(!t.equals(e)){fs.set(t,oi?e:t.v);var i=si.ensure();if(i.capture(t,e),L){if(qi||ee!==null){(n=t.updated)!=null||(t.updated=new Map);let o=((a=(s=t.updated.get(""))==null?void 0:s.count)!=null?a:0)+1;if(t.updated.set("",{error:null,count:o}),qi||o>5){let l=Yi("updated at");if(l!==null){let c=t.updated.get(l.stack);c||(c={error:l,count:0},t.updated.set(l.stack,c)),c.count++}}}ee!==null&&(t.set_during_effect=!0)}if((t.f&2)!==0){let o=t;(t.f&2048)!==0&&nf(o),Tt===null&&Zl(o)}t.wv=tc(),g$(t,2048,r),Tn()&&ee!==null&&(ee.f&1024)!==0&&(ee.f&96)===0&&(ci===null?v$([t]):ci.push(t)),!i.is_fork&&Ja.size>0&&!A0&&vp()}return e}function vp(){A0=!1;for(let t of Ja){(t.f&1024)!==0&&Ve(t,4096);let e;try{e=Xs(t)}catch(r){e=!0}e&&$n(t)}Ja.clear()}function Za(t){oe(t,t.v+1)}function g$(t,e,r){var d;var i=t.reactions;if(i!==null)for(var n=Tn(),s=i.length,a=0;a{if(Qs===a)return f();var d=le,h=Qs;Lt(null),C0(a);var p=f();return Lt(d),C0(h),p};i&&(r.set("length",Ne(t.length,s)),L&&(t=k4(t)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,dr(n,`${l} version`);for(let[d,h]of r)dr(h,no(l,d));c=!1}}return new Proxy(t,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&FR();var p=r.get(d);return p===void 0?o(()=>{var g=Ne(h.value,s);return r.set(d,g),L&&typeof d=="string"&&dr(g,no(l,d)),g}):oe(p,h.value,!0),!0},deleteProperty(f,d){var h=r.get(d);if(h===void 0){if(d in f){let p=o(()=>Ne(qe,s));r.set(d,p),Za(n),L&&dr(p,no(l,d))}}else oe(h,qe),Za(n);return!0},get(f,d,h){var y;if(d===er)return t;if(L&&d===Kh)return u;var p=r.get(d),g=d in f;if(p===void 0&&(!g||(y=Gr(f,d))!=null&&y.writable)&&(p=o(()=>{var b=Je(g?f[d]:qe),S=Ne(b,s);return L&&dr(S,no(l,d)),S}),r.set(d,p)),p!==void 0){var w=I(p);return w===qe?void 0:w}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var p=r.get(d);p&&(h.value=I(p))}else if(h===void 0){var g=r.get(d),w=g==null?void 0:g.v;if(g!==void 0&&w!==qe)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return h},has(f,d){var w;if(d===er)return!0;var h=r.get(d),p=h!==void 0&&h.v!==qe||Reflect.has(f,d);if(h!==void 0||ee!==null&&(!p||(w=Gr(f,d))!=null&&w.writable)){h===void 0&&(h=o(()=>{var y=p?Je(f[d]):qe,b=Ne(y,s);return L&&dr(b,no(l,d)),b}),r.set(d,h));var g=I(h);if(g===qe)return!1}return p},set(f,d,h,p){var v;var g=r.get(d),w=d in f;if(i&&d==="length")for(var y=h;yNe(qe,s)),r.set(y+"",b),L&&dr(b,no(l,y)))}if(g===void 0)(!w||(v=Gr(f,d))!=null&&v.writable)&&(g=o(()=>Ne(void 0,s)),L&&dr(g,no(l,d)),oe(g,Je(h)),r.set(d,g));else{w=g.v!==qe;var S=o(()=>Je(h));oe(g,S)}var C=Reflect.getOwnPropertyDescriptor(f,d);if(C!=null&&C.set&&C.set.call(p,h),!w){if(i&&typeof d=="string"){var A=r.get("length"),k=Number(d);Number.isInteger(k)&&k>=A.v&&oe(A,k+1)}Za(n)}return!0},ownKeys(f){I(n);var d=Reflect.ownKeys(f).filter(g=>{var w=r.get(g);return w===void 0||w.v!==qe});for(var[h,p]of r)p.v!==qe&&!(h in f)&&d.push(h);return d},setPrototypeOf(){IR()}})}function no(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:E4.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function wp(t){try{if(t!==null&&typeof t=="object"&&er in t)return t[er]}catch(e){}return t}var S4=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function k4(t){return new Proxy(t,{get(e,r,i){var n=Reflect.get(e,r,i);return S4.has(r)?function(...s){m$();var a=n.apply(this,s);return vp(),a}:n}})}function w$(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:i,includes:n}=t;t.indexOf=function(s,a){let o=r.call(this,s,a);if(o===-1){for(let l=a!=null?a:0;l{t.indexOf=r,t.lastIndexOf=i,t.includes=n}}var T0,b$,Qu,_$,y$;function bp(){if(T0===void 0){T0=window,b$=document,Qu=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;_$=Gr(e,"firstChild").get,y$=Gr(e,"nextSibling").get,Xw(t)&&(t[Wu]=void 0,t[Xh]=null,t[Jw]=void 0,t.__e=void 0),Xw(r)&&(r[qu]=void 0),L&&(t.__svelte_meta=null,w$())}}function Bt(t=""){return document.createTextNode(t)}function or(t){return _$.call(t)}function rr(t){return y$.call(t)}function W(t,e){if(!ae)return or(t);var r=or(be);if(r===null)r=be.appendChild(Bt());else if(e&&r.nodeType!==zl){var i=Bt();return r==null||r.before(i),je(i),i}return e&&yp(r),je(r),r}function Mi(t,e=!1){var n,s;if(!ae){var r=or(t);return r instanceof Comment&&r.data===""?rr(r):r}if(e){if(((n=be)==null?void 0:n.nodeType)!==zl){var i=Bt();return(s=be)==null||s.before(i),je(i),i}yp(be)}return be}function ne(t,e=1,r=!1){let i=ae?be:t;for(var n;e--;)n=i,i=rr(i);if(!ae)return i;if(r){if((i==null?void 0:i.nodeType)!==zl){var s=Bt();return i===null?n==null||n.after(s):i.before(s),je(s),s}yp(i)}return je(i),i}function fc(t){t.textContent=""}function _p(){if(!Ct||Wr!==null)return!1;var t=ee.f;return(t&32768)!==0}function In(t,e,r){return e==null||e===Wh?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function yp(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===zl;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}m();m();function P0(t){ae&&or(t)!==null&&fc(t)}var x$=!1;function R0(){x$||(x$=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ga])==null||e.call(r)})},{capture:!0}))}function en(t){var e=le,r=ee;Lt(null),Nt(null);try{return t()}finally{Lt(e),Nt(r)}}function $0(t,e,r,i=r){t.addEventListener(e,()=>en(r));let n=t[Ga];n?t[Ga]=()=>{n(),i(!0)}:t[Ga]=()=>i(!0),R0()}function S$(t){ee===null&&(le===null&&CR(t),AR()),oi&&kR(t)}function C4(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Mn(t,e){var a,o;var r=ee;if(L)for(;r!==null&&(r.f&131072)!==0;)r=r.parent;r!==null&&(r.f&8192)!==0&&(t|=8192);var i={ctx:Ee,deps:null,nodes:null,f:t|2048|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};L&&(i.component_function=Zi),(a=ce)==null||a.register_created_effect(i);var n=i;if((t&4)!==0)to!==null?to.push(i):si.ensure().schedule(i);else if(e!==null){try{$n(i)}catch(l){throw vt(i),l}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&524288)===0&&(n=n.first,(t&16)!==0&&(t&65536)!==0&&n!==null&&(n.f|=65536))}if(n!==null&&(n.parent=r,r!==null&&C4(n,r),le!==null&&(le.f&2)!==0&&(t&64)===0)){var s=le;((o=s.effects)!=null?o:s.effects=[]).push(n)}return i}function qs(){return le!==null&&!Tr}function nr(t){let e=Mn(8,null);return Ve(e,1024),e.teardown=t,e}function mr(t){var n;S$("$effect"),L&&cr(t,"name",{value:"$effect"});var e=ee.f,r=!le&&(e&32)!==0&&Ee!==null&&!Ee.i;if(r){var i=Ee;((n=i.e)!=null?n:i.e=[]).push(t)}else return s0(t)}function s0(t){return Mn(1048580,t)}function I0(t){si.ensure();let e=Mn(524352,t);return()=>{vt(e)}}function k$(t){si.ensure();let e=Mn(524352,t);return(r={})=>new Promise(i=>{r.outro?Rn(e,()=>{vt(e),i(void 0)}):(vt(e),i(void 0))})}function qr(t){return Mn(4,t)}function s$(t){return Mn(4718592,t)}function ar(t,e=0){return Mn(8|e,t)}function Ue(t,e=[],r=[],i=[]){fp(i,e,r,n=>{Mn(8,()=>{t(...n.map(I))})})}function ai(t,e=0){var r=Mn(16|e,t);return L&&(r.dev_stack=Cn),r}function Ot(t){return Mn(524320,t)}function M0(t){var e=t.teardown;if(e!==null){let r=oi,i=le;F0(!0),Lt(null);try{e.call(null)}finally{F0(r),Lt(i)}}}function sf(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){let n=r.ac;n!==null&&en(()=>{n.abort(Ws)});var i=r.next;(r.f&64)!==0?r.parent=null:vt(r,e),r=i}}function A$(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&vt(e),e=r}}function vt(t,e=!0){var r=!1;(e||(t.f&262144)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(C$(t.nodes.start,t.nodes.end),r=!0),t.f|=33554432,sf(t,e&&!r),eo(t,0);var i=t.nodes&&t.nodes.t;if(i!==null)for(let s of i)s.stop();M0(t),t.f^=33554432,t.f|=16384;var n=t.parent;n!==null&&n.first!==null&&k0(t),L&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function C$(t,e){for(;t!==null;){var r=t===e?null:rr(t);t.remove(),t=r}}function k0(t){var e=t.parent,r=t.prev,i=t.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),e!==null&&(e.first===t&&(e.first=i),e.last===t&&(e.last=r))}function Rn(t,e,r=!0){var i=[];T$(t,i,!0);var n=()=>{r&&vt(t),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var o of i)o.out(a)}else n()}function T$(t,e,r){if((t.f&8192)===0){t.f^=8192;var i=t.nodes&&t.nodes.t;if(i!==null)for(let o of i)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var s=n.next;if((n.f&64)===0){var a=(n.f&65536)!==0||(n.f&32)!==0&&(t.f&16)!==0;T$(n,e,a?r:!1)}n=s}}}function dc(t){P$(t,!0)}function P$(t,e){if((t.f&8192)!==0){t.f^=8192,(t.f&1024)===0&&(Ve(t,2048),si.ensure().schedule(t));for(var r=t.first;r!==null;){var i=r.next,n=(r.f&65536)!==0||(r.f&32)!==0;P$(r,n?e:!1),r=i}var s=t.nodes&&t.nodes.t;if(s!==null)for(let a of s)(a.is_global||e)&&a.in()}}function Ql(t,e){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end;r!==null;){var n=r===i?null:rr(r);e.append(r),r=n}}m();var R$=null;var xp=!1,oi=!1;function F0(t){oi=t}var le=null,Tr=!1;function Lt(t){le=t}var ee=null;function Nt(t){ee=t}var li=null;function pp(t){le!==null&&(!Ct||(le.f&2)!==0)&&(li!=null?li:li=new Set).add(t)}var Zt=null,Ar=0,ci=null;function v$(t){ci=t}var $$=1,so=0,Qs=so;function C0(t){Qs=t}function tc(){return++$$}function Xs(t){var e=t.f;if((e&2048)!==0)return!0;if(e&2&&(t.f&=-65537),(e&4096)!==0){for(var r=t.deps,i=r.length,n=0;nt.wv)return!0}(e&512)!==0&&Tt===null&&Ve(t,1024)}return!1}function F$(t,e,r=!0){var i=t.reactions;if(i!==null&&!(!Ct&&li!==null&&li.has(t)))for(var n=0;n{t.ac.abort(Ws)}),t.ac=null);try{t.f|=2097152;var u=t.fn,f=u();t.f|=32768;var d=t.deps,h=(g=ce)==null?void 0:g.is_fork;if(Zt!==null){var p;if(h||eo(t,Ar),d!==null&&Ar>0)for(d.length=Ar+Zt.length,p=0;p{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),io()}function I(t){var h,p,g;var e=t.f,r=(e&2)!==0;if((h=R$)==null||h.add(t),le!==null&&!Tr){var i=ee!==null&&(ee.f&16384)!==0;if(!i&&(li===null||!li.has(t))){var n=le.deps;if((le.f&2097152)!==0)t.rvr==null?void 0:r.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Mt(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function ui(t,e,r,i,n){var s={capture:i,passive:n},a=O$(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&nr(()=>{e.removeEventListener(t,a,s)})}function we(t,e,r){var i;((i=e[ao])!=null?i:e[ao]={})[t]=r}function Pt(t){for(var e=0;e{throw y});throw d}}finally{t[ao]=e,delete t.currentTarget,Lt(u),Nt(f)}}}m();m();var L$,O0=((L$=globalThis==null?void 0:globalThis.window)==null?void 0:L$.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function N$(t){var e;return(e=O0==null?void 0:O0.createHTML(t))!=null?e:t}function L0(t){var e=In("template");return e.innerHTML=N$(t.replaceAll("","")),e.content}function tn(t,e){var r=ee;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function xe(t,e){var r=(e&1)!==0,i=(e&2)!==0,n,s=!t.startsWith("");return()=>{if(ae)return tn(be,null),be;n===void 0&&(n=L0(s?t:""+t),r||(n=or(n)));var a=i||Qu?document.importNode(n,!0):n.cloneNode(!0);if(r){var o=or(a),l=a.lastChild;tn(o,l)}else tn(a,a);return a}}function oo(){if(ae)return tn(be,null),be;var t=document.createDocumentFragment(),e=document.createComment(""),r=Bt();return t.append(e,r),tn(e,r),t}function fe(t,e){if(ae){var r=ee;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=be),fr();return}t!==null&&t.before(e)}m();var M4=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Jee=[...M4,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var D4=["touchstart","touchmove"];function B$(t){return D4.includes(t)}var O4=["$state","$state.raw","$derived","$derived.by"],ete=[...O4,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var Cp=!0;function ze(t,e){var i,n;var r=e==null?"":typeof e=="object"?`${e}`:e;r!==((n=t[i=qu])!=null?n:t[i]=t.nodeValue)&&(t[qu]=r,t.nodeValue=`${r}`)}function Js(t,e){return H$(t,e)}function H0(t,e){var a;bp(),e.intro=(a=e.intro)!=null?a:!1;let r=e.target,i=ae,n=be;try{for(var s=or(r);s&&(s.nodeType!==Pi||s.data!=="[");)s=rr(s);if(!s)throw Jn;It(!0),je(s);let o=H$(t,{...e,anchor:s});return It(!1),o}catch(o){if(o instanceof Error&&o.message.split(` +`).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==Jn&&console.warn("Failed to hydrate: ",o),e.recover===!1&&PR(),bp(),fc(r),It(!1),Js(t,e)}finally{It(i),je(n)}}var Ap=new Map;function H$(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){bp();var l=void 0,c=k$(()=>{var u=r!=null?r:e.appendChild(Bt());d0(u,{pending:()=>{}},h=>{ct({});var p=Ee;if(s&&(p.c=s),n&&(i.$$events=n),ae&&tn(h,null),Cp=a,l=t(h,i)||{},Cp=!0,ae&&(ee.nodes.end=be,be===null||be.nodeType!==Pi||be.data!=="]"))throw ja(),Jn;ut()},o);var f=new Set,d=h=>{for(var p=0;p{var w;for(var h of f)for(let y of[e,document]){var p=Ap.get(y),g=p.get(h);--g==0?(y.removeEventListener(h,kp),p.delete(h),p.size===0&&Ap.delete(y)):p.set(h,g)}Sp.delete(d),u!==r&&((w=u.parentNode)==null||w.removeChild(u))}});return B0.set(l,c),l}var B0=new WeakMap;function ds(t,e){let r=B0.get(t);return r?(B0.delete(t),r(e)):(L&&(er in t?UR():HR()),Promise.resolve())}m();m();m();var rn,Dn,fi,lo,df,hf,Tp,hs=class{constructor(e,r=!0){He(this,"anchor");ge(this,rn,new Map);ge(this,Dn,new Map);ge(this,fi,new Map);ge(this,lo,new Set);ge(this,df,!0);ge(this,hf,e=>{if(F(this,rn).has(e)){var r=F(this,rn).get(e),i=F(this,Dn).get(r);if(i)dc(i),F(this,lo).delete(r);else{var n=F(this,fi).get(r);n&&(dc(n.effect),F(this,Dn).set(r,n.effect),F(this,fi).delete(r),L&&(n.fragment.lastChild[e0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of F(this,rn)){if(F(this,rn).delete(s),s===e)break;let o=F(this,fi).get(a);o&&(vt(o.effect),F(this,fi).delete(a))}for(let[s,a]of F(this,Dn)){if(s===r||F(this,lo).has(s))continue;let o=()=>{if(Array.from(F(this,rn).values()).includes(s)){var c=document.createDocumentFragment();Ql(a,c),c.append(Bt()),F(this,fi).set(s,{effect:a,fragment:c})}else vt(a);F(this,lo).delete(s),F(this,Dn).delete(s)};F(this,df)||!i?(F(this,lo).add(s),Rn(a,o,!1)):o()}}});ge(this,Tp,e=>{F(this,rn).delete(e);let r=Array.from(F(this,rn).values());for(let[i,n]of F(this,fi))r.includes(i)||(vt(n.effect),F(this,fi).delete(i))});this.anchor=e,pe(this,df,r)}ensure(e,r){var i=ce,n=_p();if(r&&!F(this,Dn).has(e)&&!F(this,fi).has(e))if(n){var s=document.createDocumentFragment(),a=Bt();s.append(a),F(this,fi).set(e,{effect:Ot(()=>r(a)),fragment:s})}else F(this,Dn).set(e,Ot(()=>r(this.anchor)));if(F(this,rn).set(i,e),n){for(let[o,l]of F(this,Dn))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of F(this,fi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit(F(this,hf)),i.ondiscard(F(this,Tp))}else ae&&(this.anchor=be),F(this,hf).call(this,i)}};rn=new WeakMap,Dn=new WeakMap,fi=new WeakMap,lo=new WeakMap,df=new WeakMap,hf=new WeakMap,Tp=new WeakMap;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;$R(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function co(t){Ee===null&&Qh("onMount"),ts&&Ee.l!==null?B4(Ee).m.push(t):mr(()=>{let e=Ye(t);if(typeof e=="function")return e})}function B4(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var j$=new Map;function V$(t,e){var r=j$.get(t);r||(r=new Set,j$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function Fe(t,e,r=!1){var i;ae&&(i=be,fr());var n=new hs(t),s=r?65536:0;function a(o,l){if(ae){var c=Zu(i);if(o!==parseInt(c.substring(1))){var u=An();je(u),n.anchor=u,It(!1),n.ensure(o,l),It(!0);return}}n.ensure(o,l)}ai(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function di(t,e){return e}function q4(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;U0(t,jl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;fc(u),u.append(c),t.items.clear()}U0(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function U0(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n{var S=r();return es(S)?S:S==null?[]:jl(S)});L&&dr(f,"{#each ...}");var d,h=new Map,p=!0;function g(S){(b.effect.f&16384)===0&&(b.pending.delete(S),b.fallback=u,Y4(b,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?dc(u):(u.f^=33554432,mf(u,null,a)):Rn(u,()=>{u=null})))}function w(S){b.pending.delete(S)}var y=ai(()=>{d=I(f);var S=d.length;let C=!1;if(ae){var A=Zu(a)==="[!";A!==(S===0)&&(a=An(),je(a),It(!1),C=!0)}for(var k=new Set,v=ce,x=_p(),_=0;_s(a)):(u=Ot(()=>s(hc!=null?hc:hc=Bt())),u.f|=33554432)),S>k.size&&(L?K4(d,i):i0("","","")),ae&&S>0&&je(An()),!p)if(h.set(v,k),x){for(let[D,Q]of o)k.has(D)||v.skip_effect(Q.e);v.oncommit(g),v.ondiscard(w)}else g(v);C&&It(!0),I(f)}),b={effect:y,flags:e,items:o,pending:h,outrogroups:null,fallback:u};p=!1,ae&&(a=be)}function pf(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function Y4(t,e,r,i,n){var P,T,M,$,D,Q,ye,de,J;var s=(i&8)!==0,a=e.length,o=t.items,l=pf(t.effect.first),c,u=null,f,d=[],h=[],p,g,w,y;if(s)for(y=0;y0){var _=(i&4)!==0&&a===0?r:null;if(s){for(y=0;y{var X,he;if(f!==void 0)for(w of f)(he=(X=w.nodes)==null?void 0:X.a)==null||he.apply()})}function Z4(t,e,r,i,n,s,a,o){var l=(a&1)!==0?(a&16)===0?qa(r,!1,!1):pr(r):null,c=(a&2)!==0?pr(n):null;return L&&l&&(l.trace=()=>{var u;o()[(u=c==null?void 0:c.v)!=null?u:n]}),{v:l,i:c,e:Ot(()=>(s(e,l!=null?l:r,c!=null?c:n,o),()=>{t.delete(i)}))}}function mf(t,e,r){if(t.nodes)for(var i=t.nodes.start,n=t.nodes.end,s=e&&(e.f&33554432)===0?e.nodes.start:r;i!==null;){var a=rr(i);if(s.before(i),i===n)return;i=a}}function ea(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function K4(t,e){let r=new Map,i=t.length;for(let n=0;nperformance.now():()=>Date.now(),nn={tick:t=>(qh?requestAnimationFrame:ur)(t),now:()=>X4(),tasks:new Set};function W$(){let t=nn.now();nn.tasks.forEach(e=>{e.c(t)||(nn.tasks.delete(e),e.f())}),nn.tasks.size!==0&&nn.tick(W$)}function q$(t){let e;return nn.tasks.size===0&&nn.tick(W$),{promise:new Promise(r=>{nn.tasks.add(e={c:t,f:r})}),abort(){nn.tasks.delete(e)}}}function Pp(t,e){en(()=>{t.dispatchEvent(new CustomEvent(e))})}function tU(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 Y$(t){let e={},r=t.split(";");for(let i of r){let[n,s]=i.split(":");if(!n||s===void 0)break;let a=tU(n.trim());e[a]=s.trim()}return e}var rU=t=>t;function sn(t,e,r,i){var S,C;var n=(t&1)!==0,s=(t&2)!==0,a=n&&s,o=(t&4)!==0,l=a?"both":n?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function p(){return en(()=>{var A;return c!=null?c:c=r()(e,(A=i==null?void 0:i())!=null?A:{},{direction:l})})}var g={is_global:o,in(){var A;if(e.inert=u,!n){h==null||h.abort(),(A=h==null?void 0:h.reset)==null||A.call(h);return}s||d==null||d.abort(),d=G0(e,p(),h,1,()=>{Pp(e,"introstart")},()=>{Pp(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(A){if(!s){A==null||A(),c=void 0;return}e.inert=!0,h=G0(e,p(),d,0,()=>{Pp(e,"outrostart")},()=>{Pp(e,"outroend"),A==null||A()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},w=ee;if(((C=(S=w.nodes).t)!=null?C:S.t=[]).push(g),n&&Cp){var y=o;if(!y){for(var b=w.parent;b&&(b.f&65536)!==0;)for(;(b=b.parent)&&(b.f&16)===0;);y=!b||(b.f&32768)!==0}y&&qr(()=>{Ye(()=>g.in())})}}function G0(t,e,r,i,n,s){var a=i===1;if(Qw(e)){var o,l=!1;return Mt(()=>{if(!l){var y=e({direction:a?"in":"out"});o=G0(t,y,r,i,n,s)}}),{abort:()=>{l=!0,o==null||o.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration)&&!(e!=null&&e.delay))return n(),s(),{abort:ur,deactivate:ur,reset:ur,t:()=>i};let{delay:c=0,css:u,tick:f,easing:d=rU}=e;var h=[];if(a&&r===void 0&&(f&&f(0,1),u)){var p=Y$(u(0,1));h.push(p,p)}var g=()=>1-i,w=t.animate(h,{duration:c,fill:"forwards"});return w.onfinish=()=>{var P;w.cancel(),n();var y=(P=r==null?void 0:r.t())!=null?P:1-i;r==null||r.abort();var b=i-y,S=e.duration*Math.abs(b),C=[];if(S>0){var A=!1;if(u)for(var k=Math.ceil(S/16.666666666666668),v=0;v<=k;v+=1){var x=y+b*d(v/k),_=Y$(u(x,1-x));C.push(_),A||(A=_.overflow==="hidden")}A&&(t.style.overflow="hidden"),g=()=>{var T=w.currentTime;return y+b*d(T/S)},f&&q$(()=>{if(w.playState!=="running")return!1;var T=g();return f(T,1-T),!0})}w=t.animate(C,{duration:S,fill:"forwards"}),w.onfinish=()=>{g=()=>i,f==null||f(i,1-i),s()}},{abort:()=>{w&&(w.cancel(),w.effect=null,w.onfinish=ur)},deactivate:()=>{s=ur},reset:()=>{i===0&&(f==null||f(1,0))},t:()=>g()}}m();m();function an(t,e){qr(()=>{var n;var r=t.getRootNode(),i=r.host?r:(n=r.head)!=null?n:r.ownerDocument.head;if(!i.querySelector("#"+e.hash)){let s=In("style");s.id=e.hash,s.textContent=e.code,i.appendChild(s),L&&V$(e.hash,s)}})}m();m();m();m();m();m();var K$=[...` +\r\f\xA0\v\uFEFF`];function X$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||K$.includes(i[a-1]))&&(o===i.length||K$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function wt(t,e,r,i,n,s){var a=t[Wu];if(ae||a!==r||a===void 0){var o=X$(r,i,s);(!ae||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Wu]=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var uU=Symbol("is custom element"),fU=Symbol("is html"),dU=t0?"link":"LINK";function ke(t,e,r,i){var n=hU(t);if(ae&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===dU)){i||mU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[bR]=r),r==null?t.removeAttribute(e):typeof r!="string"&&pU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function hU(t){var e,r;return(r=t[e=Xh])!=null?r:t[e]={[uU]:t.nodeName.includes("-"),[fU]:t.namespaceURI===Wh}}var Q$=new Map;function pU(t){var e=t.getAttribute("is")||t.nodeName,r=Q$.get(e);if(r)return r;Q$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=Zw(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=Vl(n)}return r}function mU(t,e,r){var i;L&&(e==="srcset"&&gU(t,r)||j0((i=t.getAttribute(e))!=null?i:"",r)||BR(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function j0(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function J$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function gU(t,e){var r=J$(t.srcset),i=J$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(j0(r[a][0],n)||j0(n,r[a][0])))}m();m();m();function W0(t,e,r=e){var i=new WeakSet;$0(t,"input",async n=>{L&&t.type==="checkbox"&&r0();var s=n?t.defaultValue:t.value;if(s=V0(t)?z0(s):s,r(s),ce!==null&&i.add(ce),await Ep(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(ae&&t.defaultValue!==t.value||Ye(e)==null&&t.value)&&(r(V0(t)?z0(t.value):t.value),ce!==null&&i.add(ce)),ar(()=>{L&&t.type==="checkbox"&&r0();var n=e();if(t===document.activeElement){var s=Ct?as:ce;if(i.has(s))return}V0(t)&&n===z0(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function V0(t){var e=t.type;return e==="number"||e==="range"}function z0(t){return t===""?null:+t}m();m();m();m();m();function q0(t,e){return t===e||(t==null?void 0:t[er])===e}function ot(t={},e,r,i){var n=Ee.r,s=ee;return qr(()=>{var a,o;return ar(()=>{a=o,o=(i==null?void 0:i())||[],Ye(()=>{q0(r(...o),t)||(e(t,...o),a&&q0(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&q0(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Di(t,e,r,i){var C,A;var n=!ts||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=Zs(i)),I(c)):(l&&(l=!1,o=a?Ye(i):i),o);let f;if(s){var d=er in t||zu in t;f=(A=(C=Gr(t,e))==null?void 0:C.set)!=null?A:d&&e in t?k=>t[e]=k:void 0}var h,p=!1;s?[h,p]=o0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&RR(e),f(h)));var g;if(n?g=()=>{var k=t[e];return k===void 0?u():(l=!0,k)}:g=()=>{var k=t[e];return k!==void 0&&(o=void 0),k===void 0?o:k},n&&(r&4)===0)return g;if(f){var w=t.$$legacy;return(function(k,v){return arguments.length>0?((!n||!v||w||p)&&f(v?g():k),k):g()})}var y=!1,b=((r&1)!==0?Zs:Qa)(()=>(y=!1,g()));L&&(b.label=e),s&&I(b);var S=ee;return(function(k,v){if(arguments.length>0){let x=v?I(b):n&&s?Je(k):k;return oe(b,x),y=!0,o!==void 0&&(o=x),k}return oi&&y||(S.f&16384)!==0?b.v:I(b)})}m();m();m();function tF(t){return new Z0(t)}var ps,Oi,Z0=class{constructor(e){ge(this,ps);ge(this,Oi);var s,a;var r=new Map,i=(o,l)=>{var c=qa(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return I((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===zu?!0:(I((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return oe((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});pe(this,Oi,(e.hydrate?H0:Js)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Ct&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&io(),pe(this,ps,n.$$events);for(let o of Object.keys(F(this,Oi)))o==="$set"||o==="$destroy"||o==="$on"||cr(this,o,{get(){return F(this,Oi)[o]},set(l){F(this,Oi)[o]=l},enumerable:!0});F(this,Oi).$set=o=>{Object.assign(n,o)},F(this,Oi).$destroy=()=>{ds(F(this,Oi))}}$set(e){F(this,Oi).$set(e)}$on(e,r){F(this,ps)[e]=F(this,ps)[e]||[];let i=(...n)=>r.call(this,...n);return F(this,ps)[e].push(i),()=>{F(this,ps)[e]=F(this,ps)[e].filter(n=>n!==i)}}$destroy(){F(this,Oi).$destroy()}};ps=new WeakMap,Oi=new WeakMap;var PU;typeof HTMLElement=="function"&&(PU=class extends HTMLElement{constructor(e,r,i){super();He(this,"$$ctor");He(this,"$$s");He(this,"$$c");He(this,"$$cn",!1);He(this,"$$d",{});He(this,"$$r",!1);He(this,"$$p_d",{});He(this,"$$l",{});He(this,"$$l_u",new Map);He(this,"$$me");He(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=r,i&&(this.$$shadowRoot=this.attachShadow(i))}addEventListener(e,r,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let n=this.$$c.$on(e,r);this.$$l_u.set(r,n)}super.addEventListener(e,r,i)}removeEventListener(e,r,i){if(super.removeEventListener(e,r,i),this.$$c){let n=this.$$l_u.get(r);n&&(n(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return s=>{let a=In("slot");n!=="default"&&(a.name=n),fe(s,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},i=RU(this);for(let n of this.$$s)n in i&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),r.default=!0):r[n]=e(n));for(let n of this.attributes){let s=this.$$g_p(n.name);s in this.$$d||(this.$$d[s]=K0(s,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=tF({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=I0(()=>{ar(()=>{var n;this.$$r=!0;for(let s of Yw(this.$$c)){if(!((n=this.$$p_d[s])!=null&&n.reflect))continue;this.$$d[s]=this.$$c[s];let a=K0(s,this.$$d[s],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,a)}this.$$r=!1})});for(let n in this.$$l)for(let s of this.$$l[n]){let a=this.$$c.$on(n,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,r,i){var n;this.$$r||(e=this.$$g_p(e),this.$$d[e]=K0(e,i,this.$$p_d,"toProp"),(n=this.$$c)==null||n.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Yw(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function K0(t,e,r,i){var s;let n=(s=r[t])==null?void 0:s.type;if(e=n==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!r[t])return e;if(i==="toAttribute")switch(n){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(n){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function RU(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}m();m();function uo(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(u){try{c(i.next(u))}catch(f){a(f)}}function l(u){try{c(i.throw(u))}catch(f){a(f)}}function c(u){u.done?s(u.value):n(u.value).then(o,l)}c((i=i.apply(t,e||[])).next())})}var eb=require("obsidian");m();var Q0=require("obsidian");m();function $U(t){let e=t-1;return e*e*e+1}var X0=!1;function Nn(t,{delay:e=0,duration:r=400,easing:i=$U,axis:n="y"}={}){let s=getComputedStyle(t);L&&!X0&&/(contents|inline|table)/.test(s.display)&&(X0=!0,Promise.resolve().then(()=>X0=!1),jR(s.display));let a=+s.opacity,o=n==="y"?"height":"width",l=parseFloat(s[o]),c=n==="y"?["top","bottom"]:["left","right"],u=c.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),h=parseFloat(s[`margin${u[0]}`]),p=parseFloat(s[`margin${u[1]}`]),g=parseFloat(s[`border${u[0]}Width`]),w=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:r,easing:i,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*a};${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*g}px;border-${c[1]}-width: ${y*w}px;min-${o}: 0`}}m();var $p=require("obsidian");var FU=xe('
'),IU=xe('
'),MU={hash:"svelte-1c0jiav",code:"main.svelte-1c0jiav .nav-file-title:where(.svelte-1c0jiav) {align-items:center;}"};function gf(t,e){ct(e,!0),an(t,MU);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let b of r)b&&(0,$p.setIcon)(b,b.getAttr("data-icon"))});function n(b){b.stopPropagation(),al(e.diff.path)?s(b):a(b)}function s(b){var S;b.stopPropagation();let C=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);C instanceof $p.TFile&&((S=ji(e.view.app,b))===null||S===void 0||S.openFile(C).catch(A=>e.view.plugin.displayError(A)))}function a(b){var S;e.view.plugin.tools.openDiff({event:b,aFile:(S=e.diff.fromPath)!==null&&S!==void 0?S:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}var o=IU(),l=W(o),c=W(l),u=W(c,!0);V(c);var f=ne(c,2),d=W(f),h=W(d);{var p=b=>{var S=FU();ot(S,C=>r[0]=C,()=>r==null?void 0:r[0]),ui("auxclick",S,s),we("click",S,s),fe(b,S)},g=ft(()=>ol(e.diff.vaultPath,e.view.app));Fe(h,b=>{I(g)&&b(p)})}V(d);var w=ne(d,2),y=W(w,!0);V(w),V(f),V(l),V(o),Ue(b=>{ke(l,"data-path",e.diff.vaultPath),ke(l,"data-tooltip-position",I(i)),ke(l,"aria-label",e.diff.vaultPath),ze(u,b),ke(w,"data-type",e.diff.status),ze(y,e.diff.status)},[()=>_n(e.diff.vaultPath)]),we("click",o,n),ui("auxclick",o,b=>{b.stopPropagation(),b.button==2?bn(e.view.app,b,e.diff.vaultPath,e.view.leaf,"git-history"):n(b)}),fe(t,o),ut()}Pt(["click"]);m();var DU=xe("
"),OU=xe(''),LU=xe('
'),NU=xe("
"),BU={hash:"svelte-d9h7mp",code:"main.svelte-d9h7mp .nav-folder-title-content:where(.svelte-d9h7mp) {display:flex;align-items:center;}"};function vf(t,e){ct(e,!0),an(t,BU);let r=Di(e,"topLevel",3,!1),i=Di(e,"closed",15),n=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(l,c){l.stopPropagation(),i(i()[c.path]=!i()[c.path],!0)}var a=NU();let o;hi(a,21,()=>e.hierarchy.children,di,(l,c)=>{var u=oo(),f=Mi(u);{var d=p=>{var g=DU(),w=W(g);gf(w,{get diff(){return I(c).data},get view(){return e.view}}),V(g),fe(p,g)},h=p=>{var g=LU();let w;var y=W(g),b=ne(W(y),2);let S;var C=ne(b,2),A=W(C,!0);V(C),V(y);var k=ne(y,2);{var v=x=>{var _=OU(),P=W(_);vf(P,{get hierarchy(){return I(c)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return i()},set closed(T){i(T)}}),V(_),sn(3,_,()=>Nn,()=>({duration:150})),fe(x,_)};Fe(k,x=>{i()[I(c).path]||x(v)})}V(g),Ue(()=>{w=wt(g,1,"tree-item nav-folder",null,w,{"is-collapsed":i()[I(c).path]}),ke(y,"data-tooltip-position",I(n)),ke(y,"aria-label",I(c).vaultPath),S=wt(b,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,S,{"is-collapsed":i()[I(c).path]}),ze(A,I(c).title)}),we("click",y,x=>s(x,I(c))),fe(p,g)};Fe(f,p=>{I(c).data?p(d):p(h,-1)})}fe(l,u)}),V(a),Ue(()=>o=wt(a,1,"svelte-d9h7mp",null,o,{topLevel:r()})),fe(t,a),ut()}Pt(["click"]);var HU=xe('
'),UU=xe('
'),GU=xe('
'),jU=xe(''),VU=xe('
'),zU={hash:"svelte-1edsiy5",code:""};function J0(t,e){ct(e,!0),an(t,zU);let r=ft(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left"),n=Ne(!0),s=Ne(Je({}));function a(x){let _=x.author.name;if(e.plugin.settings.authorInHistoryView=="full")return _;if(e.plugin.settings.authorInHistoryView=="initials")return _.split(" ").filter(T=>T.length>0).map(T=>T[0].toUpperCase()).join("")}var o=VU(),l=W(o);let c;var u=W(l),f=W(u);let d;var h=ne(f,2),p=W(h);{var g=x=>{var _=HU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>e.log.refs.join(", ")]),fe(x,_)};Fe(p,x=>{e.log.refs.length>0&&x(g)})}var w=ne(p,2);{var y=x=>{var _=UU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>a(e.log)]),fe(x,_)};Fe(w,x=>{var _;e.plugin.settings.authorInHistoryView!="hide"&&((_=e.log.author)!=null&&_.name)&&x(y)})}var b=ne(w,2);{var S=x=>{var _=GU(),P=W(_,!0);V(_),Ue(T=>ze(P,T),[()=>(0,Q0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),fe(x,_)};Fe(b,x=>{e.plugin.settings.dateInHistoryView&&x(S)})}var C=ne(b,2),A=W(C,!0);V(C),V(h),V(u);var k=ne(u,2);{var v=x=>{var _=jU(),P=W(_);{var T=$=>{vf($,{get hierarchy(){return I(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return I(s)},set closed(D){oe(s,D,!0)}})},M=$=>{var D=oo(),Q=Mi(D);hi(Q,17,()=>e.log.diff.files,di,(ye,de)=>{gf(ye,{get view(){return e.view},get diff(){return I(de)}})}),fe($,D)};Fe(P,$=>{e.showTree?$(T):$(M,-1)})}V(_),sn(3,_,()=>Nn,()=>({duration:150})),fe(x,_)};Fe(k,x=>{I(n)||x(v)})}V(l),V(o),Ue(x=>{c=wt(l,1,"tree-item nav-folder",null,c,{"is-collapsed":I(n)}),ke(u,"aria-label",x),ke(u,"data-tooltip-position",I(i)),d=wt(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,{"is-collapsed":I(n)}),ze(A,e.log.message)},[()=>{var x;return`${e.log.refs.length>0?e.log.refs.join(", ")+` +`:""}${(x=e.log.author)==null?void 0:x.name} +${(0,Q0.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} +${e.log.message}`}]),we("click",u,()=>oe(n,!I(n))),fe(t,o),ut()}Pt(["click"]);var WU=xe(''),qU=xe('
'),YU={hash:"svelte-12n6twc",code:""};function tb(t,e){ct(e,!0),an(t,YU);let r=Di(e,"plugin",15),i=Ne(!1),n=Je([]),s=Ne(void 0),a=Ne(Je(r().settings.treeStructure)),o;mr(()=>{o&&o.empty()}),co(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),mr(()=>{n.forEach(C=>(0,eb.setIcon)(C,C.getAttr("data-icon")))}),co(()=>{let C=new IntersectionObserver(k=>{k[0].isIntersecting&&!I(i)&&u().catch(console.error)}),A=activeDocument.querySelector("#sentinel");return A&&C.observe(A),()=>{C.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}function c(){return uo(this,void 0,void 0,function*(){var C;if(!r().gitReady){oe(s,void 0);return}oe(i,!0);let A=r().gitManager instanceof Ce,k;((C=I(s)===null||I(s)===void 0?void 0:I(s).length)!==null&&C!==void 0?C:0)==0?k=A?50:10:k=I(s).length,oe(s,yield r().gitManager.log(void 0,!1,k),!0),oe(i,!1)})}function u(){return uo(this,void 0,void 0,function*(){var C;if(!r().gitReady||I(s)===void 0)return;oe(i,!0);let k=r().gitManager instanceof Ce?50:10,v=yield r().gitManager.log(void 0,!1,k,(C=I(s).last())===null||C===void 0?void 0:C.hash);I(s).push(...v.slice(1)),oe(i,!1)})}var f=qU(),d=W(f),h=W(d),p=W(h);ot(p,C=>n[0]=C,()=>n==null?void 0:n[0]);var g=ne(p,2);let w;ot(g,C=>n[1]=C,()=>n==null?void 0:n[1]),V(h),V(d);var y=ne(d,2),b=W(y);{var S=C=>{var A=WU();hi(A,21,()=>I(s),di,(k,v)=>{J0(k,{get view(){return e.view},get showTree(){return I(a)},get log(){return I(v)},get plugin(){return r()}})}),V(A),fe(C,A)};Fe(b,C=>{I(s)&&C(S)})}Va(4),V(y),V(f),Ue(()=>{ke(p,"data-icon",I(a)?"list":"folder"),w=wt(g,1,"clickable-icon nav-action-button",null,w,{loading:I(i)})}),we("click",p,()=>{oe(a,!I(a)),(0,eb.setIcon)(n[0],I(a)?"list":"folder"),r(r().settings.treeStructure=I(a),!0),r().saveSettings()}),we("click",g,l),fe(t,f),ut()}Pt(["click"]);var wf=class extends rF.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return bi.type}getDisplayText(){return bi.name}getIcon(){return bi.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Js(tb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var iF=require("obsidian"),Fp=class extends iF.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var aF=require("obsidian");m();var po=require("obsidian");m();var bf=require("obsidian");m();var nF=require("obsidian");var pc=class extends nF.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${gu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${gu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${gu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${gu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};var ZU=xe('
'),KU=xe('
');function _f(t,e){ct(e,!0);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let v of r)v&&(0,bf.setIcon)(v,v.getAttr("data-icon"))});function n(v){v.stopPropagation(),al(e.change.path)?a(v):l(v)}function s(v){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&ll(e.view.app,v,e.view,e.change.vaultPath)}function a(v){var x;v.stopPropagation();let _=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);_ instanceof bf.TFile&&((x=ji(e.view.app,v))===null||x===void 0||x.openFile(_).catch(P=>e.view.plugin.displayError(P)))}function o(v){v.stopPropagation(),e.manager.stage(e.change.path,!1).catch(x=>e.view.plugin.displayError(x)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(v){v.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:v})}function c(v){v.stopPropagation();let x=e.change.workingDir=="U";new pc({app:e.view.app,filesToDeleteCount:x?1:0,filesToDiscardCount:x?0:1,path:e.change.vaultPath}).openAndGetResult().then(_=>uo(this,void 0,void 0,function*(){if(_=="delete"){let P=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);P instanceof bf.TFile?yield e.view.app.fileManager.trashFile(P):yield e.view.app.vault.adapter.remove(e.change.vaultPath)}else _=="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")}),_=>e.view.plugin.displayError(_))}var u=KU(),f=W(u),d=W(f),h=W(d,!0);V(d);var p=ne(d,2),g=W(p),w=W(g);{var y=v=>{var x=ZU();ot(x,_=>r[0]=_,()=>r==null?void 0:r[0]),ui("auxclick",x,a),we("click",x,a),fe(v,x)},b=ft(()=>ol(e.change.vaultPath,e.view.app));Fe(w,v=>{I(b)&&v(y)})}var S=ne(w,2);ot(S,v=>r[1]=v,()=>r==null?void 0:r[1]);var C=ne(S,2);ot(C,v=>r[2]=v,()=>r==null?void 0:r[2]),V(g);var A=ne(g,2),k=W(A,!0);V(A),V(p),V(f),V(u),Ue(v=>{ke(f,"data-path",e.change.vaultPath),ke(f,"data-tooltip-position",I(i)),ke(f,"aria-label",e.change.vaultPath),ze(h,v),ke(A,"data-type",e.change.workingDir),ze(k,e.change.workingDir)},[()=>_n(e.change.vaultPath)]),we("mouseover",u,s),we("click",u,n),ui("auxclick",u,v=>{v.stopPropagation(),v.button==2?bn(e.view.app,v,e.change.vaultPath,e.view.leaf,"git-source-control"):n(v)}),we("click",S,c),we("click",C,o),fe(t,u),ut()}Pt(["mouseover","click"]);m();var sF=require("obsidian");var XU=xe('
');function yf(t,e){ct(e,!0);let r=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function i(d){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&ll(e.view.app,d,e.view,e.change.vaultPath)}function n(d){var h;d.stopPropagation();let p=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);p instanceof sF.TFile&&((h=ji(e.view.app,d))===null||h===void 0||h.openFile(p).catch(g=>e.view.plugin.displayError(g)))}var s=XU(),a=W(s),o=W(a),l=W(o,!0);V(o);var c=ne(o,2),u=W(c),f=W(u,!0);V(u),V(c),V(a),V(s),Ue(d=>{ke(a,"data-path",e.change.vaultPath),ke(a,"data-tooltip-position",I(r)),ke(a,"aria-label",e.change.vaultPath),ze(l,d),ke(u,"data-type",e.change.workingDir),ze(f,e.change.workingDir)},[()=>_n(e.change.vaultPath)]),we("mouseover",s,i),we("click",s,n),ui("auxclick",s,d=>{d.stopPropagation(),d.button==2?bn(e.view.app,d,e.change.vaultPath,e.view.leaf,"git-source-control"):n(d)}),fe(t,s),ut()}Pt(["mouseover","click"]);m();var Ip=require("obsidian");var QU=xe('
'),JU=xe('
');function xf(t,e){ct(e,!0);let r=Je([]),i=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");mr(()=>{for(let A of r)A&&(0,Ip.setIcon)(A,A.getAttr("data-icon"))});function n(A){A.stopPropagation(),al(e.change.path)?a(A):o(A)}function s(A){e.view.app.vault.getFileByPath(e.change.vaultPath)&&ll(e.view.app,A,e.view,e.change.vaultPath)}function a(A){var k;A.stopPropagation();let v=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);v instanceof Ip.TFile&&((k=ji(e.view.app,A))===null||k===void 0||k.openFile(v).catch(x=>e.view.plugin.displayError(x)))}function o(A){var k;A.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(k=e.change.from)!==null&&k!==void 0?k:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:A})}function l(A){A.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(k=>e.view.plugin.displayError(k)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var c=JU(),u=W(c),f=W(u),d=W(f,!0);V(f);var h=ne(f,2),p=W(h),g=W(p);{var w=A=>{var k=QU();ot(k,v=>r[0]=v,()=>r==null?void 0:r[0]),we("click",k,a),fe(A,k)},y=ft(()=>ol(e.change.vaultPath,e.view.app));Fe(g,A=>{I(y)&&A(w)})}var b=ne(g,2);ot(b,A=>r[1]=A,()=>r==null?void 0:r[1]),V(p);var S=ne(p,2),C=W(S,!0);V(S),V(h),V(u),V(c),Ue(A=>{ke(u,"data-path",e.change.vaultPath),ke(u,"data-tooltip-position",I(i)),ke(u,"aria-label",e.change.vaultPath),ze(d,A),ke(S,"data-type",e.change.index),ze(C,e.change.index)},[()=>_n(e.change.vaultPath)]),we("mouseover",c,s),we("click",c,n),ui("auxclick",c,A=>{A.stopPropagation(),A.button==2?bn(e.view.app,A,e.change.vaultPath,e.view.leaf,"git-source-control"):n(A)}),we("click",b,l),fe(t,c),ut()}Pt(["mouseover","click"]);m();m();var eG=xe(''),tG=xe("
");function fo(t,e){ct(e,!0);var r=tG(),i=W(r);{var n=s=>{var a=eG(),o=W(a),l=W(o),c=W(l,!0);V(l),V(o),V(a),Ue(()=>{ke(o,"aria-label","And "+(e.files.length-500)+" more files"),ze(c,"And "+(e.files.length-500)+" more files")}),fe(s,a)};Fe(i,s=>{e.files.length>500&&s(n)})}V(r),fe(t,r),ut()}var iG=xe("
"),nG=xe('
'),sG=xe('
',1),aG=xe(''),oG=xe('
'),lG=xe("
");function ho(t,e){ct(e,!0);let r=Di(e,"topLevel",3,!1),i=Di(e,"closed",15);co(()=>{var h,p;for(let g of e.hierarchy.children)((p=(h=g.children)===null||h===void 0?void 0:h.length)!==null&&p!==void 0?p:0)>100&&i(i()[g.title]=!0,!0)});let n=ft(()=>e.view.leaf.getRoot().side=="left"?"right":"left");function s(h,p){h.stopPropagation(),e.plugin.gitManager.stageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function a(h,p){h.stopPropagation(),e.plugin.gitManager.unstageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function o(h,p){h.stopPropagation(),e.plugin.discardAll(p.vaultPath)}function l(h,p){h.stopPropagation(),i(i()[p.path]=!i()[p.path],!0)}var c=lG();let u;var f=W(c);hi(f,17,()=>vu(e.hierarchy.children,500),di,(h,p)=>{var g=oo(),w=Mi(g);{var y=S=>{var C=iG(),A=W(C);{var k=_=>{xf(_,{get change(){return I(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},v=_=>{_f(_,{get change(){return I(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},x=_=>{yf(_,{get change(){return I(p).data},get view(){return e.view}})};Fe(A,_=>{e.fileType==0?_(k):e.fileType==1?_(v,1):e.fileType==2&&_(x,2)})}V(C),fe(S,C)},b=S=>{var C=oG();let A;var k=W(C),v=ne(W(k),2);let x;var _=ne(v,2),P=W(_,!0);V(_);var T=ne(_,2),M=W(T),$=W(M);{var D=J=>{var X=nG();we("click",X,he=>a(he,I(p).path)),fe(J,X)},Q=J=>{var X=sG(),he=Mi(X),z=ne(he,2);we("click",he,K=>o(K,I(p))),we("click",z,K=>s(K,I(p).path)),fe(J,X)};Fe($,J=>{e.fileType==0?J(D):J(Q,-1)})}Va(2),V(M),V(T),V(k);var ye=ne(k,2);{var de=J=>{var X=aG(),he=W(X);ho(he,{get hierarchy(){return I(p)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return i()},set closed(z){i(z)}}),V(X),sn(3,X,()=>Nn,()=>({duration:150})),fe(J,X)};Fe(ye,J=>{i()[I(p).path]||J(de)})}V(C),Ue(()=>{A=wt(C,1,"tree-item nav-folder",null,A,{"is-collapsed":i()[I(p).path]}),ke(k,"data-tooltip-position",I(n)),ke(k,"aria-label",I(p).vaultPath),x=wt(v,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,x,{"is-collapsed":i()[I(p).path]}),ze(P,I(p).title)}),ui("auxclick",C,J=>bn(e.view.app,J,I(p).vaultPath,e.view.leaf,"git-source-control")),we("click",k,J=>l(J,I(p))),fe(S,C)};Fe(w,S=>{I(p).data?S(y):S(b,-1)})}fe(h,g)});var d=ne(f,2);fo(d,{get files(){return e.hierarchy.children}}),V(c),Ue(()=>u=wt(c,1,"",null,u,{topLevel:r()})),fe(t,c),ut()}Pt(["click"]);var cG=xe('
'),rb=xe(" ",1),ib=xe(''),uG=xe('
'),fG=xe(''),dG=xe('
'),hG={hash:"svelte-5wq9p",code:`.commit-msg-input.svelte-5wq9p {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-5wq9p {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-5wq9p .git-tools:where(.svelte-5wq9p) .files-count:where(.svelte-5wq9p) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-5wq9p {align-items:center;}.git-commit-msg-clear-button.svelte-5wq9p {position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out;}.git-commit-msg-clear-button.svelte-5wq9p:after {content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat;}`};function nb(t,e){ct(e,!0),an(t,hG);let r=Di(e,"plugin",7),i=Di(e,"view",7),n=Ne(!1),s=Ne(void 0),a=Ne(Je([])),o=ft(()=>r().settings.commitMessage),l=Je([]),c=Ne(void 0),u=Ne(void 0),f=Ne(void 0),d=Ne(!0),h=Ne(!0),p=Ne(!0),g=Ne(0),w=Ne(Je({})),y=Ne(Je({})),b=Ne(Je({})),S=ft(()=>r().settings.treeStructure);co(()=>{i().registerEvent(i().app.workspace.on("obsidian-git:loading-status",()=>oe(n,!0))),i().registerEvent(i().app.workspace.on("obsidian-git:status-changed",()=>{k().catch(console.error)})),i().plugin.cachedStatus==null?i().plugin.refresh().catch(console.error):k().catch(console.error),i().scope=new po.Scope(r().app.scope),i().scope.register(["Ctrl"],"Enter",N=>A())}),mr(()=>{l.forEach(N=>(0,po.setIcon)(N,N.getAttr("data-icon")))}),mr(()=>{l.forEach(N=>{var ue,Re;!N||N.id!="push"||(po.Platform.isMobile?(N.removeClass("button-border"),I(g)>0&&N.addClass("button-border")):((ue=N.firstElementChild)===null||ue===void 0||ue.removeAttribute("color"),I(g)>0&&((Re=N.firstElementChild)===null||Re===void 0||Re.setAttr("color","var(--text-accent)"))))})});function C(){if(oe(n,!0),I(s)){let N=I(s).staged.length>0;r().promiseQueue.addTask(()=>r().commit({fromAuto:!1,commitMessage:I(o),onlyStaged:N}).then(()=>oe(o,r().settings.commitMessage)).finally(v))}}function A(){if(oe(n,!0),I(s)){let N=I(s).staged.length>0;r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:I(o),onlyStaged:N}).then(()=>{oe(o,r().settings.commitMessage)}).finally(v))}}function k(){return uo(this,void 0,void 0,function*(){if(!r().gitReady){oe(s,void 0);return}if(oe(g,yield r().gitManager.getUnpushedCommits(),!0),oe(s,r().cachedStatus,!0),oe(n,!1),r().lastPulledFiles&&r().lastPulledFiles!=I(a)&&(oe(a,r().lastPulledFiles,!0),oe(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(a))},!0)),I(s)){let N=(ue,Re)=>ue.vaultPath.split("/").last().localeCompare(_n(Re.vaultPath));I(s).changed.sort(N),I(s).staged.sort(N),oe(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(s).changed)},!0),oe(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(I(s).staged)},!0)}else oe(c,void 0),oe(u,void 0)})}function v(){i().app.workspace.trigger("obsidian-git:refresh")}function x(N){N.stopPropagation(),oe(n,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:I(s)}).finally(v))}function _(N){N.stopPropagation(),oe(n,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:I(s)}).finally(v))}function P(){oe(n,!0),r().promiseQueue.addTask(()=>r().push().finally(v))}function T(){oe(n,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(v))}function M(N){N.stopPropagation(),r().discardAll()}let $=ft(()=>(I(o).match(/\n/g)||[]).length+1||1);var D=dG(),Q=W(D),ye=W(Q),de=W(ye);ot(de,N=>l[0]=N,()=>l==null?void 0:l[0]);var J=ne(de,2);ot(J,N=>l[1]=N,()=>l==null?void 0:l[1]);var X=ne(J,2);ot(X,N=>l[2]=N,()=>l==null?void 0:l[2]);var he=ne(X,2);ot(he,N=>l[3]=N,()=>l==null?void 0:l[3]);var z=ne(he,2);ot(z,N=>l[4]=N,()=>l==null?void 0:l[4]);var K=ne(z,2);ot(K,N=>l[5]=N,()=>l==null?void 0:l[5]);var G=ne(K,2);ot(G,N=>l[6]=N,()=>l==null?void 0:l[6]);var Me=ne(G,2);let Et;ot(Me,N=>l[7]=N,()=>l==null?void 0:l[7]),V(ye),V(Q);var Ht=ne(Q,2),De=W(Ht);P0(De);var Rt=ne(De,2);{var $t=N=>{var ue=cG();ke(ue,"aria-label","Clear"),we("click",ue,()=>oe(o,"")),fe(N,ue)};Fe(Rt,N=>{I(o)&&N($t)})}V(Ht);var Xe=ne(Ht,2),re=W(Xe);{var B=N=>{var ue=fG(),Re=W(ue);let Ut;var Pr=W(Re),vo=W(Pr);let cb;var ub=ne(vo,4),Wp=W(ub),fb=W(Wp);ot(fb,gr=>l[8]=gr,()=>l==null?void 0:l[8]),V(Wp);var db=ne(Wp,2),mF=W(db,!0);V(db),V(ub),V(Pr);var gF=ne(Pr,2);{var vF=gr=>{var Rr=ib(),wo=W(Rr);{var ms=vr=>{ho(vr,{get hierarchy(){return I(u)},get plugin(){return r()},get view(){return i()},get fileType(){return 0},topLevel:!0,get closed(){return I(w)},set closed(Li){oe(w,Li,!0)}})},bo=vr=>{var Li=rb(),ta=Mi(Li);hi(ta,17,()=>vu(I(s).staged,500),di,(gs,gc)=>{xf(gs,{get change(){return I(gc)},get view(){return i()},get manager(){return r().gitManager}})});var ra=ne(ta,2);fo(ra,{get files(){return I(s).staged}}),fe(vr,Li)};Fe(wo,vr=>{I(S)?vr(ms):vr(bo,-1)})}V(Rr),sn(3,Rr,()=>Nn,()=>({duration:150})),fe(gr,Rr)};Fe(gF,gr=>{I(h)&&gr(vF)})}V(Re);var Sf=ne(Re,2);let hb;var kf=W(Sf),pb=W(kf);let mb;var gb=ne(pb,4),qp=W(gb),vb=W(qp),wb=ne(vb,2);ot(wb,gr=>l[9]=gr,()=>l==null?void 0:l[9]),V(qp);var bb=ne(qp,2),wF=W(bb,!0);V(bb),V(gb),V(kf);var bF=ne(kf,2);{var _F=gr=>{var Rr=ib(),wo=W(Rr);{var ms=vr=>{ho(vr,{get hierarchy(){return I(c)},get plugin(){return r()},get view(){return i()},get fileType(){return 1},topLevel:!0,get closed(){return I(y)},set closed(Li){oe(y,Li,!0)}})},bo=vr=>{var Li=rb(),ta=Mi(Li);hi(ta,17,()=>vu(I(s).changed,500),di,(gs,gc)=>{_f(gs,{get change(){return I(gc)},get view(){return i()},get manager(){return r().gitManager}})});var ra=ne(ta,2);fo(ra,{get files(){return I(s).changed}}),fe(vr,Li)};Fe(wo,vr=>{I(S)?vr(ms):vr(bo,-1)})}V(Rr),sn(3,Rr,()=>Nn,()=>({duration:150})),fe(gr,Rr)};Fe(bF,gr=>{I(d)&&gr(_F)})}V(Sf);var yF=ne(Sf,2);{var xF=gr=>{var Rr=uG();let wo;var ms=W(Rr),bo=ne(W(ms),4),vr=W(bo,!0);V(bo),V(ms);var Li=ne(ms,2);{var ta=ra=>{var gs=ib(),gc=W(gs);{var EF=_o=>{ho(_o,{get hierarchy(){return I(f)},get plugin(){return r()},get view(){return i()},get fileType(){return 2},topLevel:!0,get closed(){return I(b)},set closed(Af){oe(b,Af,!0)}})},SF=_o=>{var Af=rb(),_b=Mi(Af);hi(_b,17,()=>I(a),di,(AF,CF)=>{yf(AF,{get change(){return I(CF)},get view(){return i()}})});var kF=ne(_b,2);fo(kF,{get files(){return I(a)}}),fe(_o,Af)};Fe(gc,_o=>{I(S)?_o(EF):_o(SF,-1)})}V(gs),sn(3,gs,()=>Nn,()=>({duration:150})),fe(ra,gs)};Fe(Li,ra=>{I(p)&&ra(ta)})}V(Rr),Ue(()=>{wo=wt(Rr,1,"pulled nav-folder",null,wo,{"is-collapsed":!I(p)}),ze(vr,I(a).length)}),we("click",ms,()=>oe(p,!I(p))),fe(gr,Rr)};Fe(yF,gr=>{I(a).length>0&&I(f)&&gr(xF)})}V(ue),Ue(()=>{Ut=wt(Re,1,"staged tree-item nav-folder",null,Ut,{"is-collapsed":!I(h)}),cb=wt(vo,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,cb,{"is-collapsed":!I(h)}),ze(mF,I(s).staged.length),hb=wt(Sf,1,"changes tree-item nav-folder",null,hb,{"is-collapsed":!I(d)}),mb=wt(pb,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,mb,{"is-collapsed":!I(d)}),ze(wF,I(s).changed.length)}),we("click",Pr,()=>oe(h,!I(h))),we("click",fb,_),we("click",kf,()=>oe(d,!I(d))),we("click",vb,M),we("click",wb,x),fe(N,ue)};Fe(re,N=>{I(s)&&I(u)&&I(c)&&N(B)})}V(Xe),V(D),Ue(()=>{ke(D,"data-type",Qt.type),ke(G,"data-icon",I(S)?"list":"folder"),Et=wt(Me,1,"clickable-icon nav-action-button",null,Et,{loading:I(n)}),ke(De,"rows",I($))}),we("click",de,A),we("click",J,C),we("click",X,x),we("click",he,_),we("click",z,P),we("click",K,T),we("click",G,()=>{oe(S,!I(S)),(0,po.setIcon)(l[6],I(S)?"list":"folder"),r().settings.treeStructure=I(S),r().saveSettings()}),we("click",Me,v),W0(De,()=>I(o),N=>oe(o,N)),fe(t,D),ut()}Pt(["click"]);var Ef=class extends aF.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Qt.type}getDisplayText(){return Qt.name}getIcon(){return Qt.icon}onClose(){return this._view&&ds(this._view),super.onClose()}reload(){this._view&&ds(this._view),this._view=Js(nb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};m();var Mp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(i=>{this.plugin.switchBranch().catch(n=>r.displayError(n))})}async display(){if(this.plugin.gitReady){let e=await this.plugin.gitManager.branchInfo();e.current!=null?this.statusBarEl.setText(e.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}remove(){this.statusBarEl.remove()}};m();var oF=require("obsidian");var Dp=class{constructor(e){this.plugin=e}get editor(){var i;let e=(i=this.plugin.app.workspace.activeEditor)==null?void 0:i.editor,r=e==null?void 0:e.cm;if(!(!e||!zi.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=zi.getHunk(r.state,!1,e);if(n){let s,a;n.type==="delete"?(s=n.added.start+1,a=n.added.start+1):(s=n.added.start-0,a=n.added.start-1+n.added.count);let o=r.state.doc.line(s).from,l=n.type==="delete"?r.state.doc.line(a).from:r.state.doc.line(a).to+1,c=n.removed.lines.join(` +`);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=` +`),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=zi.getHunk(r.state,!1,e),n=!1;if(i||(i=zi.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(oF.editorInfoField).file.path,a=Wt.createPatch(s,[i],"100644",n).join(` +`)+` +`;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=zi.getHunks(r.state,!1),s=i.getCursor().line+1,a=Wt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var mo=require("obsidian");var Op=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 mo.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),A2(()=>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;O2(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new gh(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&&mo.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(Y2),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(),$2(),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;(r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e).catch(console.error)})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return e instanceof mo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof mo.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",M2)}};m();var mc=require("obsidian");m();m();var go=require("@codemirror/state"),Np=require("@codemirror/view");var Lp=class extends Np.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=createDiv();return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},sb=go.StateField.define({create:()=>go.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Ur,!1);if(!r)return go.RangeSet.empty;let i=e.effects.some(s=>s.is(Ou)),n=e.effects.some(s=>s.is($l));if(i||n||(e.docChanged||t.size==0)&&r.isDirty==!1){let s=new Set,a=lF(e,r.hunks,!1,s),o=lF(e,r.stagedHunks,!0,s);return t=go.RangeSet.of([...a,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function lF(t,e,r,i){let n=[];for(let a=0;a0?e[a-1]:void 0,l=a{var e;return(e=t.state.field(sb,!1))!=null?e:go.RangeSet.empty},initialSpacer:t=>new Lp("delete",!1),domEventHandlers:{click:(t,e,r)=>{var n;return((n=zi.getHunkAtPos(t.state,e.from,!1))!=null?n:zi.getHunkAtPos(t.state,e.from,!0))&&(Vs(t,e.from),r.preventDefault()),!1}}});var Bp=class{constructor(e){this.plugin=e}async trackChanged(e){return this.trackChangedHelper(e).catch(r=>(console.warn("Git: Error in trackChanged."+r),Promise.reject(r)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeSigns(e.path)}}destroy(){}async computeSigns(e){let i=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:i,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Kn.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyGitCompare(r)))}},uF=[uR,fR,cF,sb,Gh],fF=[Ur,Cw];m();var ab=require("obsidian"),Hp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;e.addClass("git-changes-status-bar"),r.settings.hunks.statusBar==="colored"&&e.addClass("git-changes-status-bar-colored"),e.setAttr("aria-label","Git diff of the current editor"),this.statusBarEl.setAttribute("data-tooltip-position","top"),r.app.workspace.on("active-leaf-change",i=>{(!i||i.getRoot()==r.app.workspace.rootSplit&&!(i.view instanceof ab.MarkdownView))&&this.statusBarEl.empty()})}display(e,r){var o;let i=this.plugin.app.workspace.getActiveViewOfType(ab.MarkdownView);if(!i||((o=i.file)==null?void 0:o.path)!==(r==null?void 0:r.path))return;let n=0,s=0,a=0;for(let l of e)n+=Math.max(0,l.added.count-l.removed.count),s+=Math.min(l.added.count,l.removed.count),a+=Math.max(0,l.removed.count-l.added.count);this.statusBarEl.empty(),n>0&&this.statusBarEl.createSpan({text:`+${n} `,cls:"git-add"}),s>0&&this.statusBarEl.createSpan({text:`~${s} `,cls:"git-change"}),a>0&&this.statusBarEl.createSpan({text:`-${a}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var Up=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 mc.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 Bp(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new Hp(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&&mc.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ce?this.plg.gitManager:void 0}}refresh(){this.plg.settings.hunks.showSigns&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(fF),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...uF),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileRenameEvent=this.createFileRenameEvent(),this.pluginRefreshedEvent=this.createPluginRefreshedEvent(),this.intervalRefreshEvent=this.createIntervalRefreshEvent(),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileRenameEvent),this.plg.registerEvent(this.pluginRefreshedEvent),this.plg.registerInterval(this.intervalRefreshEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.pluginRefreshedEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent),window.clearInterval(this.intervalRefreshEvent)}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return Kn.ifFilepathDefinedTransformSubscribers(r,n=>n.forEach(s=>{s.changeToNewFilepath(e.path)})),e instanceof mc.TFile&&((i=this.signsProvider)==null?void 0:i.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refresh",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,r;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((r=this.signsProvider)==null||r.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};m();var dF=require("@codemirror/state"),Gp=require("obsidian");var ob=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let i=this.view.state,n=k2(e,r,i);this.view.dispatch(n)}notifyGitCompare(e){if(this.view===void 0){console.warn("Git: View is not defined for editor cache key. Unforeseen situation. id: ");return}if(this.removeIfStale())return;let r=this.view.state,i=r.field(Ur);if(!i||i.compareText!=e.compareText||i.compareTextHead!=e.compareTextHead){let n=HP(e,r);this.view.dispatch(n)}}updateToNewState(e){return this.state=e,!this.lastSeenPath&&this.filepath&&this.subscribeMe(),this}removeIfStale(){var e;return((e=this.view)==null?void 0:e.state.field(lb,!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&&(Kn.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Kn.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(Gp.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(Gp.editorEditorField)}},lb=dF.StateField.define({create:t=>new ob(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var jp=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new Op(this.plg);this.signsFeature=new Up(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature()}onLoadPlugin(){this.plg.registerEditorExtension(lb),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 Vp=class extends Se.Plugin{constructor(){super(...arguments);this.automaticsManager=new $u(this);this.tools=new Vu(this);this.localStorage=new jh(this);this.state={gitAction:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Cd(this);this.intervalsToClear=[];this.editorIntegration=new jp(this);this.hunkActions=new Dp(this)}setPluginState(r){var i;this.state=Object.assign(this.state,r),(i=this.statusBar)==null||i.display()}async updateCachedStatus(){var r,i;return this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((r=this.branchBar)==null?void 0:r.display())):(this.localStorage.setConflict(!1),await((i=this.branchBar)==null?void 0:i.display())),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}async refresh(){if(!this.gitReady)return;let r=this.app.workspace.getLeavesOfType(Qt.type),i=this.app.workspace.getLeavesOfType(bi.type);(this.settings.changedFilesInStatusBar||r.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)})||i.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)}))&&await this.updateCachedStatus().catch(n=>this.displayError(n)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),zt.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new vh(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(r=>this.displayError(r))))}onExternalSettingsChange(){this.reloadSettings().catch(r=>this.displayError(r))}async reloadSettings(){let r=JSON.stringify(this.settings);await this.loadSettings();let i=JSON.stringify(this.settings);r!==i&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(Qt.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}),this.app.workspace.getLeavesOfType(bi.type).forEach(n=>{var s;if(!((s=n.isDeferred)!=null&&s))return n.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(r=>this.displayError(r))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{this.onActiveLeafChange(r)})),this.registerEvent(this.app.vault.on("modify",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerView(Qt.type,r=>new Ef(r,this)),this.registerView(bi.type,r=>new wf(r,this)),this.registerView(Ds.type,r=>new Ha(r,this)),this.registerView(Ms.type,r=>new Ua(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var n;let r=this.app.workspace.getLeavesOfType(Qt.type),i;r.length===0?(i=(n=this.app.workspace.getRightLeaf(!1))!=null?n:this.app.workspace.getLeaf(),await i.setViewState({type:Qt.type})):i=r.first(),await this.app.workspace.revealLeaf(i)}),this.registerHoverLinkSource(Qt.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),dR(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,Se.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,i){let n=this.gitManager.getRelativeRepoPath(r,!0),s=mA({isFolder:i,gitRelativePath:n});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` +`+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Se.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Se.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof Se.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof Se.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof Se.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(pF.join(o.getBasePath(),a))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=Uk(pt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Se.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new wh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Ce(this),await this.gitManager.setGitInstance()):this.gitManager=new Vi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Se.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}),Se.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Mp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;(o=this.branchBar)==null?void 0:o.display().catch(console.error)},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new Se.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+n)}}catch(n){this.displayError(n),console.error(n)}}async createNewRepo(){try{await this.gitManager.init(),new Se.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new tt(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new tt(this,{options:this.gitManager instanceof Vi?[n]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof Vi}).openAndGetResult();if(s==null)return;if(s===n&&(s="."),s=(0,Se.normalizePath)(s),s==="/"&&(s="."),s==="."){let f=await new tt(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 Se.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new tt(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 Se.Notice("Aborted clone");return}}}let a=await new tt(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(a===void 0){new Se.Notice("Aborted clone");return}if(a!==""&&(o=parseInt(a),isNaN(o))){new Se.Notice("Invalid depth. Aborting clone.");return}new Se.Notice(`Cloning new repo into "${s}"`);let l=this.settings.basePath,c=s&&s!==".";c&&(this.settings.basePath=s);try{await this.gitManager.clone(av(i),s,o),new Se.Notice("Cloned new repo."),new Se.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 i=await this.updateCachedStatus();i.conflicted.length>0&&(this.displayError(`You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync({fromAutoBackup:r,requestCustomMessage:i=!1,commitMessage:n,onlyStaged:s=!1}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:i,commitMessage:n,onlyStaged:s}))||(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?await this.push():this.displayMessage("No commits to push")),this.setPluginState({gitAction:0}))}async commit({fromAuto:r,requestCustomMessage:i=!1,onlyStaged:n=!1,commitMessage:s,amend:a=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c=[],u=[];if(this.gitManager instanceof Ce){if(await this.mayDeleteConflictFile(),l=await this.updateCachedStatus(),l.conflicted.length==0&&(o=!1),r&&l.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${l.conflicted.length} ${l.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(l.conflicted),!1;c=l.staged,u=l.changed}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;{o&&await this.mayDeleteConflictFile();let f=this.gitManager;n?c=await f.getStagedFiles():u=(await f.getUnstagedFiles()).map(({path:h,type:p})=>({vaultPath:this.gitManager.getRelativeVaultPath(h),path:h,type:p}))}}if(await this.tools.hasTooBigFiles(n?c:[...c,...u]))return this.setPluginState({gitAction:0}),!1;if(u.length+c.length!==0||o){let f=s!=null?s:s=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||i){!this.settings.disablePopups&&r&&new Se.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new bh(this).openAndGetResult();if(p!=null&&p!=""&&p!="...")f=p;else return this.setPluginState({gitAction:0}),!1}else if(this.gitManager instanceof Ce&&this.settings.commitMessageScript){let p=this.settings.commitMessageScript,g=this.localStorage.getHostname()||"",w=p.replace("{{hostname}}",g);w=w.replace("{{date}}",(0,Se.moment)().format(this.settings.commitDateFormat));let y="sh";if(Se.Platform.isWin){y=process.env.PROGRAMFILES+"\\Git\\bin\\sh.exe";let S=!1;try{await zp.access(y,zp.constants.X_OK),S=!0}catch(C){S=!1}if(!S)return this.displayError(`Cannot find sh.exe at ${y}. Please make sure Git is properly installed.`),!1}let b=await wu(y,["-c",w],{cwd:this.gitManager.absoluteRepoPath});b.code!=0?this.displayError(b.stderr):b.stdout.trim().length==0?this.displayMessage("Stdout from commit message script is empty. Using default message."):f=b.stdout}if(!f||f.trim()==="")return new Se.Notice("Commit aborted: No commit message provided"),this.setPluginState({gitAction:0}),!1;let d;n?d=await this.gitManager.commit({message:f,amend:a}):d=await this.gitManager.commitAll({message:f,status:l,unstagedFiles:u,amend:a}),this.gitManager instanceof Ce&&await this.updateCachedStatus();let h=!1;d===void 0&&(h=!0,d=u.length+c.length||0),this.displayMessage(`Committed${h?" approx.":""} ${d} ${d==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(o){return this.displayError(o),!1}}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let r=this.localStorage.getConflict();try{this.gitManager instanceof Ce&&await this.mayDeleteConflictFile();let i;if(this.gitManager instanceof Ce&&(i=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted),!1;if(this.gitManager instanceof Vi&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let n=await this.gitManager.push();return n!==void 0&&(n===null?this.displayMessage("Pushed to remote"):n>0?this.displayMessage(`Pushed ${n} ${n==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(i){return i instanceof nl?this.handleNoNetworkError(i):this.displayError(i),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let r=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),r.length>0&&(this.displayMessage(`Pulled ${r.length} ${r.length==1?"file":"files"} from remote`),this.lastPulledFiles=r),r.length}catch(r){return this.displayError(r),!1}}async fetch(){if(await this.remotesAreSet())try{await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh")}catch(r){this.displayError(r)}}async mayDeleteConflictFile(){let r=this.app.vault.getAbstractFileByPath(il);r&&(this.app.workspace.iterateAllLeaves(i=>{var n;i.view instanceof Se.MarkdownView&&((n=i.view.file)==null?void 0:n.path)==r.path&&i.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(r){return await this.isAllInitialized()?(await this.gitManager.unstage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),i=await new Fp(this,r.branches).openAndGetReslt();if(i!=null)return await this.gitManager.checkout(i),this.displayMessage(`Switched to ${i}`),this.app.workspace.trigger("obsidian-git:refresh"),await((n=this.branchBar)==null?void 0:n.display()),i}async switchRemoteBranch(){var s;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[i,n]=Yn(r);if(n!=null&&i!=null)return await this.gitManager.checkout(n,i),this.displayMessage(`Switched to ${r}`),await((s=this.branchBar)==null?void 0:s.display()),r}async createBranch(){var i;if(!await this.isAllInitialized())return;let r=await new tt(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async deleteBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let i=await new tt(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(i!=null){let s=!1;if(!await this.gitManager.branchIsMerged(i)){let o=await new tt(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;s=o==="YES"}return await this.gitManager.deleteBranch(i,s),this.displayMessage(`Deleted branch ${i}`),await((n=this.branchBar)==null?void 0:n.display()),i}}async remotesAreSet(){return this.settings.updateSubmodules||this.gitManager instanceof Ce&&await this.gitManager.getConfig("push.autoSetupRemote","all")=="true"||(await this.gitManager.branchInfo()).tracking?!0:(new Se.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let r=await this.selectRemoteBranch();return r==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(r),this.displayMessage(`Set upstream branch to ${r}`),this.setPluginState({gitAction:0}),!0)}async discardAll(r){if(!await this.isAllInitialized())return!1;let i=await this.gitManager.status({path:r}),n=0,s=0;for(let o of i.changed)o.workingDir=="U"?n++:s++;if(n+s==0)return!1;let a=await new pc({app:this.app,filesToDeleteCount:n,filesToDiscardCount:s,path:r!=null?r:""}).openAndGetResult();switch(a){case!1:return a;case"discard":await this.gitManager.discardAll({dir:r,status:this.cachedStatus});break;case"delete":{await this.gitManager.discardAll({dir:r,status:this.cachedStatus});let o=await this.gitManager.getUntrackedPaths({path:r,status:this.cachedStatus});for(let l of o){let c=this.gitManager.getRelativeVaultPath(l),u=this.app.vault.getAbstractFileByPath(c);u?await this.app.fileManager.trashFile(u):l.endsWith("/")?await this.app.vault.adapter.rmdir(c,!0):await this.app.vault.adapter.remove(c)}break}default:Md(a)}return this.app.workspace.trigger("obsidian-git:refresh"),a}async handleConflict(r){this.localStorage.setConflict(!0);let i;r!==void 0&&(i=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...r.map(n=>{let s=this.app.vault.getAbstractFileByPath(n);return s instanceof Se.TFile?`- [[${this.app.metadataCache.fileToLinktext(s,"/")}]]`:`- Not a file: ${n}`}),` +# Additional Instructions +I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text. + +\`\`\`diff +<<<<<<< HEAD + File changes in local repository +======= + File changes in remote repository +>>>>>>> origin/main +\`\`\``]),await this.tools.writeAndOpenFile(i==null?void 0:i.join(` +`))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new tt(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new tt(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,av(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new tt(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new tt(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new tt(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof Ha||i instanceof Ua))return;let n=this.app.workspace.getLeavesOfType(Qt.type).first(),s=this.app.workspace.getLeavesOfType(bi.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Ha||(r==null?void 0:r.view)instanceof Ua){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Se.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof hF.Errors.UserCanceledError){new Se.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.setPluginState({gitAction:0}),this.settings.showErrorNotices&&new Se.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; +/*! Bundled license information: + +ieee754/index.js: + (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) + +buffer/index.js: + (*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + *) + +safe-buffer/index.js: + (*! safe-buffer. MIT License. Feross Aboukhadijeh *) + +crc-32/crc32.js: + (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) + +isomorphic-git/index.cjs: + (*! + * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements. + * SPDX-License-Identifier: LGPL-3.0-or-later + * Copyright (c) James Prevett and other ZenFS contributors. + *) + +js-sha256/src/sha256.js: + (** + * [js-sha256]{@link https://github.com/emn178/js-sha256} + * + * @version 0.11.1 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2025 + * @license MIT + *) +*/ + +/* nosourcemap */ \ No newline at end of file diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json new file mode 100644 index 0000000..2e8f9b0 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -0,0 +1,10 @@ +{ + "author": "Vinzent", + "authorUrl": "https://github.com/Vinzent03", + "id": "obsidian-git", + "name": "Git", + "description": "Integrate Git version control with automatic backup and other advanced features.", + "isDesktopOnly": false, + "fundingUrl": "https://ko-fi.com/vinzent", + "version": "2.38.6" +} diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css new file mode 100644 index 0000000..7dee885 --- /dev/null +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -0,0 +1,705 @@ +@keyframes loading { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.workspace-leaf-content[data-type="git-view"] .button-border { + border: 2px solid var(--interactive-accent); + border-radius: var(--radius-s); +} + +.workspace-leaf-content[data-type="git-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.workspace-leaf-content[data-type="git-history-view"] .view-content { + padding-left: 0; + padding-top: 0; + padding-right: 0; +} + +.loading { + overflow: hidden; +} + +.loading > svg { + animation: 2s linear infinite loading; + transform-origin: 50% 50%; + display: inline-block; +} + +.obsidian-git-center { + margin: auto; + text-align: center; + width: 50%; +} + +.obsidian-git-textarea { + display: block; + margin-left: auto; + margin-right: auto; +} + +.obsidian-git-disabled { + opacity: 0.5; +} + +.obsidian-git-center-button { + display: block; + margin: 20px auto; +} + +.tooltip.mod-left { + overflow-wrap: break-word; +} + +.tooltip.mod-right { + overflow-wrap: break-word; +} + +/* Limits the scrollbar to the view body */ +.git-view { + display: flex; + flex-direction: column; + position: relative; + height: 100%; +} + +/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/ +.workspace-drawer .git-view .nav-buttons-container { + flex-wrap: wrap; +} + +.git-tools { + display: flex; + margin-left: auto; +} +.git-tools .type { + padding-left: var(--size-2-1); + display: flex; + align-items: center; + justify-content: center; + width: 11px; +} + +.git-tools .type[data-type="M"] { + color: orange; +} +.git-tools .type[data-type="D"] { + color: red; +} +.git-tools .buttons { + display: flex; +} +.git-tools .buttons > * { + padding: 0; + height: auto; +} + +.workspace-leaf-content[data-type="git-view"] .tree-item-self, +.workspace-leaf-content[data-type="git-history-view"] .tree-item-self { + align-items: center; +} + +.workspace-leaf-content[data-type="git-view"] + .tree-item-self:hover + .clickable-icon, +.workspace-leaf-content[data-type="git-history-view"] + .tree-item-self:hover + .clickable-icon { + color: var(--icon-color-hover); +} + +/* Highlight an item as active if it's diff is currently opened */ +.is-active .git-tools .buttons > * { + color: var(--nav-item-color-active); +} + +.git-author { + color: var(--text-accent); +} + +.git-date { + color: var(--text-accent); +} + +.git-ref { + color: var(--text-accent); +} + +/* ====== diff2html ====== +The following styles are adapted from the obsidian-version-history plugin by +@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss +which itself is adapted from the diff2html library with the following original license: + + https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md + + Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +.theme-dark, +.theme-light { + --git-delete-bg: #ff475040; + --git-delete-hl: #96050a75; + --git-insert-bg: #68d36840; + --git-insert-hl: #23c02350; + --git-change-bg: #ffd55840; + --git-selected: #3572b0; + + --git-delete: #cc3333; + --git-insert: #399839; + --git-change: #d0b44c; + --git-move: #3572b0; +} + +.git-diff { + .d2h-d-none { + display: none; + } + .d2h-wrapper { + text-align: left; + border-radius: 0.25em; + overflow: auto; + } + .d2h-file-header.d2h-file-header { + background-color: var(--background-secondary); + border-bottom: 1px solid var(--background-modifier-border); + font-family: + Source Sans Pro, + Helvetica Neue, + Helvetica, + Arial, + sans-serif; + height: 35px; + padding: 5px 10px; + } + .d2h-file-header, + .d2h-file-stats { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + } + .d2h-file-header { + display: none; + } + .d2h-file-stats { + font-size: 14px; + margin-left: auto; + } + .d2h-lines-added { + border: 1px solid var(--color-green); + border-radius: 5px 0 0 5px; + color: var(--color-green); + padding: 2px; + text-align: right; + vertical-align: middle; + } + .d2h-lines-deleted { + border: 1px solid var(--color-red); + border-radius: 0 5px 5px 0; + color: var(--color-red); + margin-left: 1px; + padding: 2px; + text-align: left; + vertical-align: middle; + } + .d2h-file-name-wrapper { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 15px; + width: 100%; + } + .d2h-file-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--text-normal); + font-size: var(--h5-size); + } + .d2h-file-wrapper { + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + margin-bottom: 1em; + max-height: 100%; + } + .d2h-file-collapse { + -webkit-box-pack: end; + -ms-flex-pack: end; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + border: 1px solid var(--background-secondary-alt); + border-radius: 3px; + cursor: pointer; + display: none; + font-size: 12px; + justify-content: flex-end; + padding: 4px 8px; + } + .d2h-file-collapse.d2h-selected { + background-color: var(--git-selected); + } + .d2h-file-collapse-input { + margin: 0 4px 0 0; + } + .d2h-diff-table { + border-collapse: collapse; + font-family: var(--font-monospace); + font-size: var(--code-size); + width: 100%; + } + .d2h-files-diff { + width: 100%; + } + .d2h-file-diff { + /* + overflow-y: scroll; + */ + border-radius: 5px; + font-size: var(--font-text-size); + line-height: var(--line-height-normal); + } + .d2h-file-side-diff { + display: inline-block; + margin-bottom: -8px; + margin-right: -4px; + overflow-x: scroll; + overflow-y: hidden; + width: 50%; + } + .d2h-code-line { + padding-left: 6em; + padding-right: 1.5em; + } + .d2h-code-line, + .d2h-code-side-line { + display: inline-block; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + white-space: nowrap; + width: 100%; + } + .d2h-code-side-line { + /* needed to be changed */ + padding-left: 0.5em; + padding-right: 0.5em; + } + .d2h-code-line-ctn { + word-wrap: normal; + background: none; + display: inline-block; + padding: 0; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + vertical-align: middle; + width: 100%; + /* only works for line-by-line */ + white-space: pre-wrap; + } + .d2h-code-line del, + .d2h-code-side-line del { + background-color: var(--git-delete-hl); + color: var(--text-normal); + } + .d2h-code-line del, + .d2h-code-line ins, + .d2h-code-side-line del, + .d2h-code-side-line ins { + border-radius: 0.2em; + display: inline-block; + margin-top: -1px; + text-decoration: none; + vertical-align: middle; + } + .d2h-code-line ins, + .d2h-code-side-line ins { + background-color: var(--git-insert-hl); + text-align: left; + } + .d2h-code-line-prefix { + word-wrap: normal; + background: none; + display: inline; + padding: 0; + white-space: pre; + } + .line-num1 { + float: left; + } + .line-num1, + .line-num2 { + -webkit-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + /* + padding: 0 0.5em; + */ + text-overflow: ellipsis; + width: 2.5em; + padding-left: 0; + } + .line-num2 { + float: right; + } + .d2h-code-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + display: inline-block; + position: absolute; + text-align: right; + width: 5.5em; + } + .d2h-code-linenumber:after { + content: "\200b"; + } + .d2h-code-side-linenumber { + background-color: var(--background-primary); + border: solid var(--background-modifier-border); + border-width: 0 1px; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: var(--text-faint); + cursor: pointer; + overflow: hidden; + padding: 0 0.5em; + text-align: right; + text-overflow: ellipsis; + width: 4em; + /* needed to be changed */ + display: table-cell; + position: relative; + } + .d2h-code-side-linenumber:after { + content: "\200b"; + } + .d2h-code-side-emptyplaceholder, + .d2h-emptyplaceholder { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + } + .d2h-code-line-prefix, + .d2h-code-linenumber, + .d2h-code-side-linenumber, + .d2h-emptyplaceholder { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + .d2h-code-linenumber, + .d2h-code-side-linenumber { + direction: rtl; + } + .d2h-del { + background-color: var(--git-delete-bg); + border-color: var(--git-delete-hl); + } + .d2h-ins { + background-color: var(--git-insert-bg); + border-color: var(--git-insert-hl); + } + .d2h-info { + background-color: var(--background-primary); + border-color: var(--background-modifier-border); + color: var(--text-faint); + } + .d2h-del, + .d2h-ins, + .d2h-file-diff .d2h-change { + color: var(--text-normal); + } + .d2h-file-diff .d2h-del.d2h-change { + background-color: var(--git-change-bg); + } + .d2h-file-diff .d2h-ins.d2h-change { + background-color: var(--git-insert-bg); + } + .d2h-file-list-wrapper { + a { + text-decoration: none; + cursor: default; + -webkit-user-drag: none; + } + + svg { + display: none; + } + } + .d2h-file-list-header { + text-align: left; + } + .d2h-file-list-title { + display: none; + } + .d2h-file-list-line { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; + } + .d2h-file-list { + } + .d2h-file-list > li { + border-bottom: 1px solid var(--background-modifier-border); + margin: 0; + padding: 5px 10px; + } + .d2h-file-list > li:last-child { + border-bottom: none; + } + .d2h-file-switch { + cursor: pointer; + display: none; + font-size: 10px; + } + .d2h-icon { + fill: currentColor; + margin-right: 10px; + vertical-align: middle; + } + .d2h-deleted { + color: var(--git-delete); + } + .d2h-added { + color: var(--git-insert); + } + .d2h-changed { + color: var(--git-change); + } + .d2h-moved { + color: var(--git-move); + } + .d2h-tag { + background-color: var(--background-secondary); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + font-size: 10px; + margin-left: 5px; + padding: 0 2px; + } + .d2h-deleted-tag { + border: 1px solid var(--git-delete); + } + .d2h-added-tag { + border: 1px solid var(--git-insert); + } + .d2h-changed-tag { + border: 1px solid var(--git-change); + } + .d2h-moved-tag { + border: 1px solid var(--git-move); + } + + /* needed for line-by-line*/ + + .d2h-diff-tbody { + position: relative; + } + + /* My additions */ + .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; + } +} + +/* ====================== Line Authoring Information ====================== */ + +.cm-gutterElement.obs-git-blame-gutter { + /* Add background color to spacing inbetween and around the gutter for better aesthetics */ + border-width: 0px 2px 0.2px; + border-style: solid; + border-color: var(--background-secondary); + background-color: var(--background-secondary); +} + +.cm-gutterElement.obs-git-blame-gutter > div, +.line-author-settings-preview { + /* delegate text color to settings */ + color: var(--obs-git-gutter-text); + font-family: monospace; + height: 100%; /* ensure, that age-based background color occupies entire parent */ + text-align: right; + padding: 0px 6px; + white-space: pre; /* Keep spaces and do not collapse them. */ +} + +@media (max-width: 800px) { + /* hide git blame gutter not to superpose text */ + .cm-gutterElement.obs-git-blame-gutter { + display: none; + } +} + +.git-unified-diff-view, +.git-split-diff-view .cm-deletedLine .cm-changedText { + background-color: #ee443330; +} + +.git-unified-diff-view, +.git-split-diff-view .cm-insertedLine .cm-changedText { + background-color: #22bb2230; +} + +.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after { + -webkit-mask-image: url('data:image/svg+xml,'); +} + +/* Override styling of Codemirror merge view "collapsed lines" indicator */ +.git-split-diff-view .ͼ2 .cm-collapsedLines { + background: var(--interactive-normal); + border-radius: var(--radius-m); + color: var(--text-accent); + font-size: var(--font-small); + padding: var(--size-4-1) var(--size-4-1); +} +.git-split-diff-view .ͼ2 .cm-collapsedLines:hover { + background: var(--interactive-hover); + color: var(--text-accent-hover); +} + +.git-signs-gutter { + .cm-gutterElement { + display: grid; + + /* Needed to align the sign properly for different line heigts. Such as + * when having a heading or list item. + */ + padding-top: 0 !important; + } +} + +.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; +} + +/* 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/.obsidian/workspace.json b/.obsidian/workspace.json index 515dd67..a0c0f1f 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,12 +13,12 @@ "state": { "type": "markdown", "state": { - "file": "Arcs/The Omened.md", + "file": "Maps/Eastmarch (Grid).md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "The Omened" + "title": "Eastmarch (Grid)" } } ] @@ -180,14 +180,47 @@ "daily-notes:Open today's daily note": false, "templates:Insert template": false, "command-palette:Open command palette": false, - "bases:Create new base": false + "bases:Create new base": false, + "obsidian-git:Open Git source control": false } }, - "active": "f3e46eff94992846", + "active": "6d0bca43dc3a52fe", "lastOpenFiles": [ - "Arcs/The Gathering Storm.md", - "Arcs/The Awakening.md", - "Arcs/Ascension.md", - "Campaign Overview.md" + "DnDCampaign", + "Maps/Valhold Map (Regional).md", + "Maps/Eastmarch (Grid).md", + "Maps/The Sinking Chapel (Grid).md", + "Maps/Keth's Landing Map (Regional).md", + "Maps/Ironheart Mine (Grid).md", + "Maps/Eastmarch Map (Regional).md", + "Arc 4 - Tide of Ruin.md", + "Maps/Sunken Spire (Grid).md", + "Maps/Thronewood Map (Regional).md", + "Maps/Freehold Map (Regional).md", + "Locations/Ironheart Mine.md", + "Locations/Silverwood.md", + "Locations/Freehold.md", + "Campaign Overview.md", + "Arcs/Arc 4/Overview.md", + "Arcs/Arc 1/Overview.md", + "Arc 1 - Heirs of Sundering.md", + "Arcs/Arc 3/Overview.md", + "Arcs/Arc 2/Overview.md", + "Arcs/Arc 4", + "Arcs/Arc 3", + "Arcs/Arc 2", + "Arcs/Arc 1", + "Arcs", + "Quests/Bandits & Wilderness Encounters.md", + "Rules/Pact of Seven Flames.md", + "World Council.md", + "Locations/World Council.md", + "Items/Seal-Warden's Blessing.md", + "Items/Favor of the Verdant Wing.md", + "Rules", + "History", + "Lore", + "Templates", + "Maps" ] } \ No newline at end of file diff --git a/Arc 1 - Heirs of Sundering.md b/Arc 1 - Heirs of Sundering.md new file mode 100644 index 0000000..af2ef62 --- /dev/null +++ b/Arc 1 - Heirs of Sundering.md @@ -0,0 +1,85 @@ +--- +arc: 1 +levels: 5-8 +status: planning +--- + +# Arc 1 — Heirs of Sundering + +## Summary + +The party arrives in the border town of [[Eastmarch]] amid strange weather and missing caravans. Investigation reveals a cell of the [[The Hand of Ruin|Hand of Ruin]] attempting to crack a [[Seal Anchor]] — one of seven keystones that bind the Primordial Wrath beneath the world. The party must stop the ritual, learn the scope of the conspiracy, and trace the cult to its regional master: a corrupted noble of [[Valdris]]. + +## Story Hooks + +### Hook 1: The Missing Caravan +A supply caravan from [[Kethra]] has vanished on the Old Salt Road. [[Marshal Aldren Voss]], Eastmarch's garrison commander, offers 200 gp per head for a recovery party. The caravan was carrying more than grain — it held a sealed [[The Silent College|Silent College]] shipment bound for the capital. + +**Combat:** [[Bandits & Wilderness Encounters#Old Salt Road Ambush|Bandit ambush]] on the road. The bandits are paid mercenaries hired by the cult. + +**Clue:** Among the wreckage, a broken amulet bearing the sigil of the Hand of Ruin — a downward spiral with seven cracks. + +### Hook 2: The Weeping Sky +Unnatural storms batter Eastmarch nightly — rain that burns crops and lightning that strikes the same hilltop three times per hour. Local druid [[Elder Ylara Moongrove]] suspects elemental disturbance and begs the party to investigate the hilltop. + +**Exploration:** The hilltop is a dormant [[Seal Anchor]]. Cultists have been performing blood rituals there for three weeks. + +**Combat:** 2 cult fanatics, 1 cult mage (Hand of Ruin), and 4 summoned mephits. The mage carries a [[Cult Cipher]], encoded instructions in Ignan. + +### Hook 3: The Poisoned Well +Eastmarch's water supply turns bitter. Townsfolk grow paranoid. A child goes missing. The town healer, [[Mira Thorne]], suspects foul play. + +**Investigation:** The well is tainted by alchemical residue from cult rituals. The missing child was taken as an offering. + +**Combat / Rescue:** Cult hideout beneath an abandoned mill. 3 cultists, 2 guard drakes, 1 cult fanatic leader. The child is alive but weakened. Rescue yields the party gratitude and a safe haven in Eastmarch. + +### Hook 4: The Lords' Summons +After resolving two of the hooks above, [[Marshal Aldren Voss]] receives a sealed letter from the Duke of [[Valdris]]. The Duke offers the party a formal commission as "Swordsworn Investigators" of the Crown — with access, resources, and the authority to pursue the cult across borders. This transitions the party toward [[Valhold]]. + +**Twist:** The letter is genuine, but the Duke's court is infiltrated. The cult knows the party is coming. + +## Key NPCs This Arc + +| NPC | Role | Location | Link | +|-----|------|----------|------| +| [[Marshal Aldren Voss]] | Quest-giver, garrison commander | Eastmarch | Honest, overworked, grateful | +| [[Elder Ylara Moongrove]] | Lore source, druid ally | Eastmarch outskirts | Knows old legends of the seals | +| [[Mira Thorne]] | Healer, moral compass | Eastmarch | Source of local rumors | +| [[Duke Edric Blackthorn]] | Patron, potential ally or enemy | Valhold | Infiltrated court | + +## Key Locations + +- [[Eastmarch]] — border town, campaign starting hub +- [[Seal Anchor]] — the ruined anchor site near Eastmarch +- [[Valhold]] — capital of Valdris, Duke's seat +- [[The Sinking Chapel]] — cult hideout beneath the Old Mill +- [[Old Salt Road]] — trade route between Valdris and Kethra + +## Quest Chains + +| Quest | Hook | Resolution | XP | +|-------|------|------------|-----| +| Missing Caravan | Hook 1 | Recover shipment, find cult amulet | 800 | +| Storm on the Hill | Hook 2 | Disrupt ritual, obtain cipher | 1,200 | +| Tainted Well | Hook 3 | Rescue child, clear hideout | 1,000 | +| The Duke's Commission | Hook 4 | Accept commission, travel to Valhold | 600 | +| Arc Milestone | — | Identify regional cult leader | Milestone → 6 | + +## Treasure & Rewards + +- **[[Cult Cipher]]** — encoded instructions; deciphered in Valhold, reveals next target: the [[Ironheart Mine]] in Arc 2. +- **[[Ring of the Verdant Eye]]** — uncommon, requires attunement. Gift from Elder Ylara if the party protects the seal anchor. Grants advantage on Wisdom (Perception) checks to detect aberrations and elementals. +- **Marshal's Commendation** — writ of passage through Valdris, free lodging at Crown inns. +- **Cult Mage's Grimoire** — contains 2nd-level wizard spells: *darkness*, *scorching ray*, *misty step*. + +## Arc Climax + +Confrontation with **[[Keeper Valdrek]]**, the regional cult leader, in the undercroft of Valhold. He is in the midst of a ritual to shatter the second seal anchor. Victory earns the party: + +- Level 8 milestone +- Recognition by the [[The Verdant Circle|Verdant Circle]], who reveal themselves +- The location of the [[Ironheart Mine]] — a deeper seal anchor under siege in Arc 2 + +## Transition to Arc 2 + +The Verdant Circle reveals that three more seal anchors are under active siege, and the [[Crown Concordat]] is about to go to war with [[Kethra]] — a war the Hand of Ruin is orchestrating as cover for their work. diff --git a/Arc 2 - The Gilded War.md b/Arc 2 - The Gilded War.md new file mode 100644 index 0000000..94939c7 --- /dev/null +++ b/Arc 2 - The Gilded War.md @@ -0,0 +1,97 @@ +--- +arc: 2 +levels: 9-12 +status: planning +--- + +# Arc 2 — The Gilded War + +## Summary + +The [[Crown Concordat]] and [[Kethra]] are on the brink of war — a conflict engineered by the [[The Hand of Ruin|Hand of Ruin]] to divert attention while they crack deeper seal anchors. The party must navigate a political minefield between [[Valdris]], [[Kethra]], and the mercenary [[The Iron Concord|Iron Concord]], all while hunting cult operations at the [[Ironheart Mine]], the [[Sunken Spire]], and the [[Thronewood]]. By arc's end, the party either brokers peace or chooses a side — but either way, the Hand of Ruin takes a devastating step toward freeing the Primordial Wrath. + +## Story Hooks + +### Hook 5: The Ironheart Siege +[[The Verdant Circle]] reports that the [[Ironheart Mine]] — built atop a seal anchor — is under siege by cult forces, mercenaries of the [[The Iron Concord|Iron Concord]], and a bound **young magma dragon**. The mine is a strategic resource for Valdris; losing it would break the war effort. The Duke offers 5,000 gp and noble titles for its liberation. + +**Dungeon:** 3-level mine complex. Infested with cultists, mercenaries, the dragon, and a proto-elemental spawning near the anchor. + +**Boss:** [[Scorchmaw]], young magma dragon (CR 10) bound by cult magic. Breaking the binding frees the dragon, who may become an uneasy ally in Arc 3. + +**Reward:** [[Dragonfang Vault]] of treasures, cult orders pointing to the [[Sunken Spire]], and the gratitude (or enmity) of [[Scorchmaw]]. + +### Hook 6: The Ambassador's Gambit +Peace talks between [[Valdris]] and [[Kethra]] are scheduled in neutral [[Freehold]]. The party is invited as neutral mediators. At the summit, an assassin strikes — the Hand of Ruin wants neither side to make peace. + +**Investigation / Social:** Track the assassin, uncover the cult's involvement, and prove it to both delegations before the armies march. + +**Combat:** Assassin (Hand of Ruin operative, CR 8 equivalent), 4 doppelganger infiltrators, and a summoned **invisible stalker**. + +**Outcome:** Peace is possible if the party gathers 3+ pieces of evidence and wins a DC 18 Persuasion (group check). Failure means war — and a harder Arc 3. + +### Hook 7: The Sunken Spire +A third seal anchor lies beneath a coastal ruin — the **Sunken Spire** — now controlled by a cult cell using merrow and sahuagin allies. The Verdant Circle asks the party to assault it before the next full moon (7 days). + +**Dungeon:** Aquatic ruin. Requires *water breathing* or similar magic. Three chambers: sunken temple, flooded catacombs, anchor chamber. + +**Boss:** [[Mistress Veyla]], cult warlock of the Deep (CR 11), and her bound **water elemental myrmidon**. + +**Reward:** The [[Tideheart Pearl]] — a rare magic item that grants *control water* 1/day. Cult documents reveal the Thronewood ambush (Hook 8). + +### Hook 8: Ambush at Thronewood +Cult intelligence confirms a major Hand of Ruin convoy moving through the [[Thronewood]] — escorting a captured [[Dragon Lords|Dragon Lord]] toward a fourth seal anchor. + +**Combat / Rescue:** Ambush the convoy. 12 cult soldiers, 2 cult mages, 1 **bone devil** (CR 9) summoned as enforcer, and a bound **adult copper dragon** (weakened, CR ~12 equivalent). + +**Outcome:** Freeing the dragon — **[[Khalyraxis, the Verdant Wing]]** — opens Arc 3. She reveals the full history of the Dragon Lords and the true nature of the seals. She becomes a powerful ally and patron. + +## Key NPCs This Arc + +| NPC | Role | Location | Link | +|-----|------|----------|------| +| [[Duke Edric Blackthorn]] | Crown patron (potentially compromised) | Valhold | Court intrigue | +| [[Ambassador Kael Vess]] | Kethran diplomat, potential ally | Freehold | Sharp, pragmatic | +| [[Captain Vara Holt]] | Iron Concord commander, torn loyalties | Ironheart Mine | Honor-bound mercenary | +| [[Scorchmaw]] | Young magma dragon, cult-bound | Ironheart Mine | Ally if freed | +| [[Mistress Veyla]] | Cult warlock, Sunken Spire leader | Sunken Spire | Fanatic | +| [[Khalyraxis, the Verdant Wing]] | Adult copper dragon, captured | Thronewood | Major ally | +| [[The Iron Concord]] | Mercenary guild | Various | Neutral power broker | + +## Key Locations + +- [[Ironheart Mine]] — dwarven mine / seal anchor dungeon +- [[Freehold]] — neutral city, summit location +- [[Sunken Spire]] — coastal ruin / seal anchor dungeon +- [[Thronewood]] — ancient forest, ambush site +- [[Valhold]] — capital, political hub + +## Quest Chains + +| Quest | Hook | Key Outcome | XP / Milestone | +|-------|------|-------------|----------------| +| Ironheart Siege | Hook 5 | Mine liberated, dragon freed or slain | 3,000 | +| Ambassador's Gambit | Hook 6 | Peace or war decided | 1,500 | +| Sunken Spire | Hook 7 | Anchor secured, documents found | 2,500 | +| Ambush at Thronewood | Hook 8 | Dragon Lord rescued | 3,000 | +| Arc Milestone | — | Hand of Ruin's regional network shattered | Milestone → 10 | + +## Treasure & Rewards + +- **[[Dragonfang Vault]]** — 8,000 gp, +1 weapon of choice, [[Cloak of the Mountebank]] +- **[[Tideheart Pearl]]** — rare, *control water* 1/day, water breathing while attuned +- **[[Verdant Wing Token]]** — Khalyraxis's favor; call for aid once (adult copper dragon arrives in 1d4 rounds) +- **Peace Accord** (if successful) — party gains noble titles and a keep in Valdris +- **War Outcome** (if failed) — Valdris and Kethra at war, all content harder, party must pick a side + +## Arc Climax + +**Choice at Thronewood:** After freeing Khalyraxis, she reveals that the Primordial Wrath is not merely imprisoned — it is the 7th and final seal, the keystone holding a far older entity at bay. The First Sages did not imprison the Wrath; they *created* it as a lock. Destroying the Wrath opens the door to something worse. + +She then offers the party a choice: +1. **Reinforce the seals** — requires journeying to the [[Heart of the Mountain]] in Arc 3, seeking the aid of other Dragon Lords. +2. **Destroy the Wrath directly** — a suicidal gambit that risks unleashing the Elder Dark. + +## Transition to Arc 3 + +The party, now level 12, must travel beyond the material plane — to the [[Heart of the Mountain]] in the Elemental Plane of Earth, where the remaining Dragon Lords convene. Only their combined draconic magic can reinforce the failing seals. diff --git a/Arc 3 - Heart of the Mountain.md b/Arc 3 - Heart of the Mountain.md new file mode 100644 index 0000000..0dea957 --- /dev/null +++ b/Arc 3 - Heart of the Mountain.md @@ -0,0 +1,114 @@ +--- +arc: 3 +levels: 13-16 +status: planning +--- + +# Arc 3 — Heart of the Mountain + +## Summary + +The [[Dragon Lords]] hold the key to reinforcing — or destroying — the seals that imprison the Primordial Wrath. The party must journey to the Elemental Plane of Earth, navigate the draconic court at the [[Heart of the Mountain]], and win the allegiance of at least three Dragon Lords to attempt the Rite of Seven Flames. Meanwhile, the [[The Hand of Ruin|Hand of Ruin]] sends its elite assassins and a **fallen Dragon Lord** to stop them. The arc ends with a grand ritual that either stabilizes the seals — or cracks four of them at once. + +## Story Hooks + +### Hook 9: The Obsidian Path +[[Khalyraxis, the Verdant Wing]] guides the party to the [[Gate of Stone]], a planar portal hidden in the [[Ashpeak Caldera]]. The gate is guarded by the **[[Stonewarden]]**, an ancient earth elemental bound to test those who would pass. + +**Trial:** Three tests — Strength (hold open a collapsing tunnel), Wisdom (navigate a maze of shifting illusions), and Sacrifice (give up something of personal value). + +**Combat (optional):** If the trial is failed by violence, the Stonewarden fights as a **CR 14 earth elemental myrmidon** with lair actions. The gate opens regardless, but the elemental's death alerts the Hand of Ruin. + +### Hook 10: The Draconic Court +The [[Heart of the Mountain]] is a colossal throne-hall carved inside a floating crystal in the Plane of Earth. Five Dragon Lords sit in judgment: + +| Dragon Lord | Color | Status | Disposition | +|-------------|-------|--------|-------------| +| **[[Aurathrax, the Stormbreaker]]** | Blue | Ancient | Skeptical — favors isolation | +| **[[Morgra, the Ashen Matron]]** | Red | Ancient | Hostile — cult-aligned (secret) | +| **[[Lythrendor, the Crystal Seer]]** | Crystal (homebrew) | Ancient | Allied — Verdant Circle ally | +| **[[Vornak, the Deep-Root]]** | Green | Ancient | Neutral — favors reinforcing seals | +| **[[Silvos, the Shifting Wind]]** | Silver | Adult | Ally — respects Khalyraxis | + +- **Roleplay challenge:** The party must persuade at least 3 Dragon Lords to support the Rite of Seven Flames. DC 20 Charisma (Persuasion) checks, modified by evidence gathered in Arcs 1-2 and party deeds. +- **[[Morgra, the Ashen Matron]]** is a traitor — she has been feeding the Hand of Ruin information for centuries. She will oppose the party at every turn. + +### Hook 11: The Crucible of Ash +To prove their worth, the Dragon Lords demand the party retrieve an artifact from the [[Crucible of Ash]] — a volcanic demiplane where a **fallen Dragon Lord** dwells: **[[Ignivar, the Betrayer]]**, a corrupted ancient red dragon who once served the Hand of Ruin. + +**Dungeon:** Volcanic demiplane. Lava rivers, obsidian bridges, ash-storms that reduce visibility to 60 feet. + +**Boss:** [[Ignivar, the Betrayer]], ancient red dragon (CR 23) — **but weakened** by the Crucible's magic to CR 16 due to centuries of torment. He guards the [[Emberheart]], a legendary artifact that fuels the Rite. + +**Lair Actions:** Ash storm (blinded), lava geysers (DEX save), collapsing platforms. + +**Reward:** [[Emberheart]] (legendary, see Items), knowledge of the Hand of Ruin's ultimate base: the [[Citadel of Sundering]]. + +### Hook 12: The Traitor's Gambit +After the party returns with the [[Emberheart]], [[Morgra, the Ashen Matron]] reveals her treachery. She and her brood attack the [[Heart of the Mountain]], attempting to destroy the other Dragon Lords and seize the ritual site. + +**Combat:** [[Morgra, the Ashen Matron]] (ancient red dragon, CR 24), 2 adult red dragons (her brood, CR 17), and 10 cult dragonsworn. The party fights alongside [[Lythrendor, the Crystal Seer]] and [[Silvos, the Shifting Wind]]. + +**Environment:** The battle takes place in the throne-hall — floating platforms, collapsing crystal, lair actions from allied Dragon Lords. + +**Outcome:** Morgra flees at 25% HP (she reappears in Arc 4). The remaining Dragon Lords, now unified, agree to perform the Rite. + +### Hook 13: The Rite of Seven Flames +The ritual to reinforce the seals requires all surviving Dragon Lords, the [[Emberheart]], and the party's protection while the ritual is performed. The Hand of Ruin launches a desperate assault during the ritual. + +**Combat (waves):** +1. Wave 1: 8 cult assassins, 2 cult mages +2. Wave 2: 4 summoned elementals (1 of each type), 2 bone devils +3. Wave 3: [[Keeper Malachar]], the Hand of Ruin's high executioner (CR 15 warlock), and 2 glabrezu demons + +**Mechanic:** The ritual takes 10 rounds. Each Dragon Lord channeling reduces the seal's instability by 2 points (starting at 10). Every round a cultist or demon occupies a ritual circle, instability increases by 1. The party must protect the circles. + +**Outcome:** The seals are reinforced — temporarily. But the Hand of Ruin has already cracked four of seven. The Primordial Wrath stirs. Arc 4 begins. + +## Key NPCs This Arc + +| NPC | Role | Status | +|-----|------|--------| +| [[Khalyraxis, the Verdant Wing]] | Guide, ally | Party companion | +| [[Aurathrax, the Stormbreaker]] | Ancient blue Dragon Lord | Persuadable | +| [[Morgra, the Ashen Matron]] | Ancient red Dragon Lord | Traitor | +| [[Lythrendor, the Crystal Seer]] | Ancient crystal Dragon Lord | Ally | +| [[Vornak, the Deep-Root]] | Ancient green Dragon Lord | Neutral | +| [[Silvos, the Shifting Wind]] | Adult silver Dragon Lord | Ally | +| [[Ignivar, the Betrayer]] | Fallen red dragon, Crucible guardian | Enemy | +| [[Keeper Malachar]] | Hand of Ruin high executioner | Enemy | +| [[Stonewarden]] | Planar gate guardian | Neutral | + +## Key Locations + +- [[Ashpeak Caldera]] — surface volcano, planar gate +- [[Gate of Stone]] — portal to Elemental Plane of Earth +- [[Heart of the Mountain]] — Draconic Court, floating crystal throne-hall +- [[Crucible of Ash]] — volcanic demiplane, Ignivar's prison +- [[Citadel of Sundering]] — revealed but not yet visited + +## Quest Chains + +| Quest | Hook | Outcome | XP | +|-------|------|---------|-----| +| The Obsidian Path | Hook 9 | Gate opened, plane reached | 3,000 | +| The Draconic Court | Hook 10 | Alliance secured or fractured | 2,000 | +| The Crucible of Ash | Hook 11 | Emberheart retrieved | 5,000 | +| The Traitor's Gambit | Hook 12 | Morgra routed, ritual site secured | 6,000 | +| The Rite of Seven Flames | Hook 13 | Seals partially stabilized | 4,000 | +| Arc Milestone | — | Arc climax resolved | Milestone → 14 | + +## Treasure & Rewards + +- **[[Emberheart]]** — legendary artifact. Grants fire resistance, *fireball* at 5th level 3/day, and 1/day *investiture of flame*. Channels the Rite of Seven Flames. +- **[[Scale of the Dragonsworn]]** — very rare. Attunement. Gain resistance to one dragon element (chosen at dawn). 1/day, summon a draconic spirit (CR 5 guard drake with breath weapon) for 1 hour. +- **[[Favor of the Verdant Wing]]** — Khalyraxis grants the party a permanent blessing: advantage on Charisma checks against dragons. +- **Each surviving Dragon Lord** grants a *dragon's favor* — typically a rare or very rare magic item from their hoard. + +## Arc Climax + +The Rite of Seven Flames succeeds — but only partially. Four seals are shattered; three hold. The Primordial Wrath begins to stir. The Hand of Ruin retreats to its final stronghold: the [[Citadel of Sundering]], a floating fortress drifting into the Material Plane from the Elemental Chaos. The Crown Concordat and Kethra (allied or not) brace for apocalypse. + +## Transition to Arc 4 + +The world is now aware of the threat. Nations mobilize armies. The Verdant Circle summons all allies. The party, level 16, must lead the final assault on the Citadel of Sundering to stop the Hand of Ruin from shattering the final three seals — and confront the Primordial Wrath itself to decide the fate of Aethrune. diff --git a/Arc 4 - Tide of Ruin.md b/Arc 4 - Tide of Ruin.md new file mode 100644 index 0000000..d2cbf64 --- /dev/null +++ b/Arc 4 - Tide of Ruin.md @@ -0,0 +1,130 @@ +--- +arc: 4 +levels: 17-20 +status: planning +--- + +# Arc 4 — Tide of Ruin + +## Summary + +The [[Primordial Wrath]] stirs. The [[The Hand of Ruin|Hand of Ruin]] holds the [[Citadel of Sundering]] — a floating fortress descending from the Elemental Chaos into the Material Plane. Three seals remain. The party, now level 17, must lead the combined forces of the [[Crown Concordat]], [[The Verdant Circle]], the [[Dragon Lords]], and the [[The Iron Concord|Iron Concord]] in an apocalyptic siege to breach the Citadel, destroy the Hand of Ruin's leadership, and confront the Wrath before it breaks free entirely. + +The arc culminates in a battle at level 20 against a CR 26+ primordial titan — and a choice that will define the future of Aethrune. + +## Story Hooks + +### Hook 14: The World Council +All major factions convene in [[Freehold]] for the **World Council**. The party serves as the central coordinating force: + +| Faction | Leader | Military Contribution | Demands | +|---------|--------|----------------------|---------| +| [[Crown Concordat]] | [[Duke Edric Blackthorn]] | 3,000 soldiers, siege engines | Protection of Valdris | +| [[Kethra]] | [[Queen Selara IV]] | 2,500 soldiers, naval blockade | Guarantee of sovereignty | +| [[The Verdant Circle]] | [[Archdruid Thalindor]] | 200 druids, ritual support | The seals preserved | +| [[Dragon Lords]] | [[Lythrendor, the Crystal Seer]] | 5 adult dragons | Honor restored | +| [[The Iron Concord]] | [[General Markus Crane]] | 1,500 mercenaries | 50,000 gp; loot rights | + +- **Social challenge:** DC 22 Persuasion (group) to keep the alliance unified. Each failed faction check creates a complication in later battles. +- **Intelligence:** The party learns the Citadel's defenses: elemental storms, anti-magic zones, bound demon legions, and six **Heralds of Ruin** — the Hand of Ruin's elite guard. + +### Hook 15: The Storming of the Citadel +The allied army launches an assault on the [[Citadel of Sundering]] — a 5-tier floating fortress. + +**Tier 1 — The Outer Ramparts:** +- Elemental storms (lightning, fire, ice) deal 4d10 damage per round to anything airborne without protection. +- 20 cult soldiers, 4 ballistae manned by cultists, 2 summoned **storm giants** (CR 13) +- The party must disable the storm anchors (4 ritual circles) to let the dragon allies breach the upper tiers. + +**Tier 2 — The Hall of Echoes:** +- Anti-magic zone (except artifacts). Party must rely on martial skill and artifact magic. +- [[Keeper Malachar]] returns (if not slain in Arc 3), now a CR 17 aspect. Accompanied by 6 helmed horrors. +- Defeating him drops the anti-magic field. + +**Tier 3 — The Six Heralds:** +- Boss rush: six elite Hand of Ruin champions, each CR 15-18, guarding the throne approach. +- **Herald of Ash** (fire sorcerer), **Herald of Tide** (storm cleric), **Herald of Bone** (death knight), **Herald of Whispers** (shadow monk / assassin), **Herald of Iron** (warforged colossus), **Herald of Mind** (illithid arcanist). +- Party faces them in pairs or a gauntlet — DM discretion. + +**Tier 4 — The Sundering Throne:** +- [[Morgra, the Ashen Matron]] (if she fled in Arc 3) + 2 adult red dragons make a last stand. +- Or, if she was slain, the **[[High Pontiff Vosseth]]**, leader of the Hand of Ruin, appears instead — a CR 20 divine sorcerer / warlock hybrid, channeling the Wrath's power. + +**Tier 5 — The Seal Chamber:** +- The Primordial Wrath is visible through a planar rift — a churning mass of elemental chaos the size of a mountain. +- Three seal anchors remain, glowing with failing light. +- [[High Pontiff Vosseth]] (if not faced in Tier 4) performs the final ritual. If the ritual completes (5 rounds), the Wrath is freed. + +### Hook 16: The Face of the Wrath +If the final ritual is stopped, the [[Primordial Wrath]] forces a partial breach — manifesting as a **titan of elemental chaos** (CR 26+): + +**Stat block summary:** +- **HP:** ~536 (uses maximum hit dice) +- **AC:** 22 (natural + elemental barrier) +- **Speed:** 60 ft, fly 120 ft (hover) +- **Attacks:** 3 Slam (+16, 4d12+8 force) or 2 Elemental Lash (+16, 30 ft reach, 6d10 of chosen element) +- **Legendary Actions (3/round):** Elemental Shift (teleport 60 ft), Chaos Wave (60 ft cone, 8d10 random element, DC 24 DEX half), Seal Fracture (targets one seal anchor; DC 25 party check to stop) +- **Lair Actions:** Planar instability (wild magic surge in 300 ft radius), elemental absorption (heals from elemental damage) +- **Mythic Trait (unlocks at 0 HP):** The Wrath's mortal form shatters, revealing its true nature — an incorporeal **Chaos Heart** (CR 28 phase 2) that must be sealed, not slain. + +### Hook 17: The Final Choice +With the Wrath's form shattered and the **Chaos Heart** exposed, the party faces the ultimate decision: + +| Choice | Method | Consequence | +|--------|--------|-------------| +| **Re-Seal** | Perform the Rite of Seven Flames one last time (using the [[Emberheart]]) | The Wrath is bound again — but the Elder Dark remains imprisoned. World returns to normal. **Standard ending.** | +| **Destroy** | Feed the Chaos Heart into the [[Emberheart]], annihilating both | The Wrath is destroyed. The Elder Dark's prison cracks — a greater threat looms in the future. **Bittersweet ending.** | +| **Ascend** | One party member merges with the Chaos Heart, becoming the new seal | That character becomes an eternal guardian, a new Dragon Lord of cosmic scale. Their legend echoes forever. **Sacrifice ending.** | +| **Unmake** | Unleash the Elder Dark deliberately | The party becomes the new Hand of Ruin. The world is unmade and remade. **Corruption ending (DM toolbox for sequel).** | + +**DC 25 Arcana / Religion / Persuasion** checks required for Re-Seal or Destroy. Ascend requires a willing character and a DC 25 Charisma save to survive the merger (on failure, the character is consumed and the Wrath is freed). + +## Key NPCs This Arc + +| NPC | Role | Fate | +|-----|------|------| +| [[Duke Edric Blackthorn]] | Crown Concordat leader | Rally or betray? | +| [[Queen Selara IV]] | Kethran commander | Allied or hostile? | +| [[Archdruid Thalindor]] | Verdant Circle leader | Ritual support | +| [[Lythrendor, the Crystal Seer]] | Lead Dragon Lord | Final battle ally | +| [[Khalyraxis, the Verdant Wing]] | Dragon ally | Companion or casualty | +| [[High Pontiff Vosseth]] | Hand of Ruin leader | Final boss (or pre-boss) | +| [[Morgra, the Ashen Matron]] | Traitor Dragon Lord | May appear if not slain | +| [[General Markus Crane]] | Iron Concord commander | Mercenary ally | +| [[Primordial Wrath]] | The imprisoned chaos being | Final boss, mythic | + +## Key Locations + +- [[Freehold]] — World Council site +- [[Citadel of Sundering]] — 5-tier floating fortress, final dungeon +- The Seal Chamber — planar rift room +- The Void Between — the space beyond the rift (for mythic phase 2) + +## Quest Chains + +| Quest | Hook | Outcome | XP | +|-------|------|---------|-----| +| The World Council | Hook 14 | Alliance unified | 3,000 | +| The Storming (Tier 1) | Hook 15 | Outer defenses breached | 5,000 | +| The Hall of Echoes (Tier 2) | Hook 15 | Anti-magic field down | 4,000 | +| The Six Heralds (Tier 3) | Hook 15 | Elite guard defeated | 8,000 | +| The Sundering Throne (Tier 4) | Hook 15 | Leadership slain | 5,000 | +| The Face of the Wrath | Hook 16 | Wrath's physical form shattered | 10,000 | +| The Final Choice | Hook 17 | Campaign resolution | Milestone → 20 | + +## Treasure & Rewards + +- **Citadel Vault:** 50,000 gp, 12 rare magic items, 4 very rare, 2 legendary (DM choice) +- **[[Primordial Heart Shard]]** — legendary artifact (if Re-Seal ending). Grants *primordial ward* 1/day (immunity to one element for 1 minute) and *plane shift* 1/day to any elemental plane. +- **[[Crown of the Sundered]]** — legendary (if Destroy ending). Crown worn by Vosseth; grants +2 spell save DC, advantage on saves against aberrations, 1/day *wish* (limited to replicating 8th-level or lower spells). +- **[[Seal-Warden's Blessing]]** — permanent +2 to one ability score for all party members (any ending). +- **Keep and Lands:** The Crown Concordat grants the party a fortress and noble titles. The party retires as legendary heroes or continues adventuring. + +## Epilogue + +The campaign ends with the party at level 20, recognized as the saviors of Aethrune. Each character's epilogue is determined by their choices: + +- Did they re-seal the Wrath? The status quo returns — but wisdom is gained. +- Did they destroy it? A new age of uncertainty dawns. +- Did one ascend? Legends are written. +- Did they unmake the world? The sequel campaign begins. diff --git a/Arcs/Arc 1/Overview.md b/Arcs/Arc 1/Overview.md new file mode 100644 index 0000000..2be0f43 --- /dev/null +++ b/Arcs/Arc 1/Overview.md @@ -0,0 +1,45 @@ +--- +arc: 1 +levels: 5-8 +--- + +# Arc 1 — Heirs of Sundering + +## Summary + +The party arrives in [[Eastmarch]] amid strange weather and missing caravans. The [[The Hand of Ruin|Hand of Ruin]] is cracking a [[Seal Anchor]] while the party uncovers the conspiracy and follows it to [[Valhold]]. + +## Important Locations + +| Location | Notable Places | +|----------|----------------| +| [[Eastmarch]] | Marshal's Garrison, The Bent Anchor, Mira's Apothecary, Moongrove Shrine | +| [[The Sinking Chapel]] | Mill, basement guard post, cult chapel, secret tunnel | +| [[Old Salt Road]] | Caravan ambush point, border patrol route | +| [[Valhold]] | Blackthorn Keep, Spire of Silence, Gilded Market, Temple of the Seven | + +## Random Encounter Table (d8) + +| d8 | Encounter | +|----|-----------| +| 1 | 2d4 bandits and a scout on the Old Salt Road | +| 2 | 1 cult patrol with a cult fanatic | +| 3 | Lightning mephits near the seal hill | +| 4 | A frightened merchant caravan with suspicious cargo | +| 5 | A Crown Concordat patrol questioning travelers | +| 6 | A druidic omen from the Verdant Circle | +| 7 | A ruined shrine with clues to the seals | +| 8 | An elemental storm that forces shelter | + +## Loot Table (d8) + +| d8 | Loot | +|----|------| +| 1 | 25 gp and 2d4 days of rations | +| 2 | Potion of healing | +| 3 | Scroll of *protection from evil and good* | +| 4 | Cult amulet bearing the spiral sigil | +| 5 | Silver holy symbol or druidic charm | +| 6 | 50 gp in mixed coin | +| 7 | Common magic trinket from the DMG | +| 8 | [[Ring of the Verdant Eye]] | diff --git a/Arcs/Arc 2/Overview.md b/Arcs/Arc 2/Overview.md new file mode 100644 index 0000000..3daf925 --- /dev/null +++ b/Arcs/Arc 2/Overview.md @@ -0,0 +1,45 @@ +--- +arc: 2 +levels: 9-12 +--- + +# Arc 2 — The Gilded War + +## Summary + +[[Valdris]] and [[Kethra]] are driven toward war while the party disrupts cult operations at [[Ironheart Mine]], [[Sunken Spire]], and [[Thronewood]]. The arc ends with political fallout and the rescue of [[Khalyraxis, the Verdant Wing]]. + +## Important Locations + +| Location | Notable Places | +|----------|----------------| +| [[Ironheart Mine]] | Gatehouse, barracks, Great Lift, Deep Gallery, Dragonfang Vault | +| [[Freehold]] | Concord Hall, Crossroads Market, Whisper Gallery, Broken Seal Inn | +| [[Sunken Spire]] | Lighthouse, flooded sanctuary, deep chamber, ritual altar | +| [[Thronewood]] | Verdant Grove, Old Thronewood Road, Whispering Glade | + +## Random Encounter Table (d8) + +| d8 | Encounter | +|----|-----------| +| 1 | Iron Concord patrol demanding papers | +| 2 | Cult scouts tracking the party | +| 3 | A road ambush with mercenaries | +| 4 | Sahuagin raiders near the coast | +| 5 | A diplomatic envoy needing escort | +| 6 | Forest guardians testing intruders | +| 7 | A dragon sign or omen tied to the seals | +| 8 | A localized elemental hazard from a cracked anchor | + +## Loot Table (d8) + +| d8 | Loot | +|----|------| +| 1 | 75 gp and battlefield salvage | +| 2 | Potion of greater healing | +| 3 | Scroll of *water breathing* | +| 4 | [[Tideheart Pearl]] | +| 5 | [[Cloak of the Mountebank]] | +| 6 | Rare weapon or armor piece | +| 7 | Map or orders revealing cult movements | +| 8 | [[Verdant Wing Token]] | diff --git a/Arcs/Arc 3/Overview.md b/Arcs/Arc 3/Overview.md new file mode 100644 index 0000000..8e2beac --- /dev/null +++ b/Arcs/Arc 3/Overview.md @@ -0,0 +1,45 @@ +--- +arc: 3 +levels: 13-16 +--- + +# Arc 3 — Heart of the Mountain + +## Summary + +The party travels to the Elemental Plane of Earth, bargains with the [[Dragon Lords]], and undertakes the Rite of Seven Flames at the [[Heart of the Mountain]]. The arc includes a confrontation in the [[Crucible of Ash]] and ends with the cult's traitor exposed. + +## Important Locations + +| Location | Notable Places | +|----------|----------------| +| [[Ashpeak Caldera]] | Caldera floor, Gate of Stone, elemental vents | +| [[Heart of the Mountain]] | Throne-Hall, Hall of Scales, Ember Chamber, Fracture Cavern | +| [[Crucible of Ash]] | Gallery of Fallen Scales, Bridge of Regret, Ember Chamber | +| [[Ashveil Caldera]] | Throne of Ash, hoard chambers | + +## Random Encounter Table (d8) + +| d8 | Encounter | +|----|-----------| +| 1 | Earth elemental guardians | +| 2 | Ash mephits and lava hazards | +| 3 | A planar echo of a Dragon Lord's memory | +| 4 | Cult assassins in draconic disguise | +| 5 | A trial set by the Stonewarden | +| 6 | A magma dragon patrol | +| 7 | A prophecy vision from Lythrendor | +| 8 | A living crystal anomaly | + +## Loot Table (d8) + +| d8 | Loot | +|----|------| +| 1 | 200 gp in gems and ore | +| 2 | Potion of fire resistance | +| 3 | Rare spell scroll | +| 4 | [[Emberheart]] fragment or blessing | +| 5 | [[Scale of the Dragonsworn]] | +| 6 | Draconic relic or scale cache | +| 7 | Forgework or artifact map | +| 8 | [[Favor of the Verdant Wing]] | diff --git a/Arcs/Arc 4/Overview.md b/Arcs/Arc 4/Overview.md new file mode 100644 index 0000000..0bf4f8c --- /dev/null +++ b/Arcs/Arc 4/Overview.md @@ -0,0 +1,45 @@ +--- +arc: 4 +levels: 17-20 +--- + +# Arc 4 — Tide of Ruin + +## Summary + +The world rallies at the [[World Council]] while the party assaults the [[Citadel of Sundering]] to stop the [[Primordial Wrath]] from breaking free. The arc ends with a world-saving choice and a level 20 climax. + +## Important Locations + +| Location | Notable Places | +|----------|----------------| +| [[Freehold]] | Concord Hall, World Council chamber, market, inn | +| [[Citadel of Sundering]] | Outer Ramparts, Hall of Echoes, Herald chambers, Sundering Throne, Seal Chamber | +| [[Spire of Silence]] | Vault of Sundered Truths | +| [[Valhold]] | Blackthorn Keep, the Spire of Silence, military districts | + +## Random Encounter Table (d8) + +| d8 | Encounter | +|----|-----------| +| 1 | Elite Hand of Ruin strike team | +| 2 | Elemental storm in the region | +| 3 | Allied faction delegates with bad news | +| 4 | A Herald of Ruin scouting the battlefield | +| 5 | A dragon ally answering the call | +| 6 | War refugees needing protection | +| 7 | A seal crack causing reality distortions | +| 8 | A mythic omen from the Primordial Wrath | + +## Loot Table (d8) + +| d8 | Loot | +|----|------| +| 1 | 500 gp and war supplies | +| 2 | Potion of supreme healing | +| 3 | Legendary relic fragment | +| 4 | [[Crown of the Sundered]] | +| 5 | [[Primordial Heart Shard]] | +| 6 | Artifact-grade magic item | +| 7 | Faction favor or military support | +| 8 | [[Seal-Warden's Blessing]] | diff --git a/Campaign Overview.md b/Campaign Overview.md new file mode 100644 index 0000000..78cde5d --- /dev/null +++ b/Campaign Overview.md @@ -0,0 +1,60 @@ +--- +title: The Sundering Tide +system: D&D 5e +levels: 5-20 +setting: Aethrune +status: planning +--- + +# The Sundering Tide + +## Elevator Pitch + +The world of Aethrune is held together by seven ancient seals, forged millennia ago by the First Sages to imprison the **Primordial Wrath** — a being of pure elemental chaos. The seals are weakening. A secret cult called the **Hand of Ruin** works to shatter them, while the ruling **Crown Concordat** bickers over borders and coin. The party arrives as capable heroes of level 5, stumbling onto a cell of cultists in a remote border town — and from there, the conspiracy unravels across continents, planes, and ages. + +## Central Conflict + +| Side | Goal | Methods | +|------|------|---------| +| **Hand of Ruin** | Free the Primordial Wrath; remake the world in chaos | Infiltration, assassination, ritual magic, dragon-binding | +| **Crown Concordat** | Maintain power and status quo | Diplomacy, military force, denial | +| **The Verdant Circle** (secret society) | Reinforce the seals; preserve balance | Espionage, ancient lore, druidic ritual | +| **The Dragon Lords** (neutral) | Guardian duty to the seals; fragmented loyalties | Isolation, ancient pacts, draconic magic | + +## Campaign Arcs + +| Arc | Title | Levels | Focus | +|-----|-------|--------|-------| +| 1 | [[Arc 1 - Heirs of Sundering]] | 5-8 | Discovery, investigation, first cult encounters | +| 2 | [[Arc 2 - The Gilded War]] | 9-12 | Political intrigue, factional war, betrayal | +| 3 | [[Arc 3 - Heart of the Mountain]] | 13-16 | Dragon Lords, planar travel, ancient secrets | +| 4 | [[Arc 4 - Tide of Ruin]] | 17-20 | The seals break, reality frays, final battle | + +## Key Factions + +- [[The Hand of Ruin]] — apocalyptic cult +- [[Crown Concordat]] — ruling alliance of five kingdoms +- [[The Verdant Circle]] — druidic secret society preserving the seals +- [[The Silent College]] — arcane academy with forbidden knowledge +- [[Dragon Lords]] — ancient dragons bound to the seals +- [[The Iron Concord]] — mercenary guild / independent power + +## Tone + +- **Arc 1:** Mystery / investigative horror (cults, disappearances, creeping dread) +- **Arc 2:** Political thriller / war drama (alliances, betrayals, siege warfare) +- **Arc 3:** Epic fantasy / planar exploration (elemental planes, dragon lairs, lost civilizations) +- **Arc 4:** Apocalyptic survival / cosmic horror (reality unraveling, desperate gambits, god-tier stakes) + +## Player Buy-In + +- Characters should have a personal stake in protecting the world — not just gold or glory. +- One character should have ties to a faction (Crown Concordat, Verdant Circle, or Silent College). +- Characters begin at level 5, already known in their region as capable troubleshooters. + +## Quick-Start + +1. Session zero: players arrive in [[Eastmarch]], a border town between [[Valdris]] and [[Kethra]]. +2. Hook: a merchant caravan has vanished on the Old Salt Road; strange weather plagues the region. +3. Investigation leads to a Hand of Ruin cell conducting a ritual at a [[Seal Anchor]] site. +4. The first seal is already cracked — the campaign clock is ticking. diff --git a/Factions/Crown Concordat.md b/Factions/Crown Concordat.md new file mode 100644 index 0000000..9375e9b --- /dev/null +++ b/Factions/Crown Concordat.md @@ -0,0 +1,46 @@ +--- +type: faction +alignment: Lawful Neutral (varies) +leader: "Council of Five Sovereigns" +--- + +# Crown Concordat + +## Overview + +The ruling alliance of five kingdoms that governs much of Aethrune. Founded 300 years ago after the [[War of the Five Thrones]], it maintains peace through shared military, trade agreements, and marriage alliances. In practice, the Concordat is a fractious body more concerned with internal politics than external threats — making it a perfect target for the [[The Hand of Ruin|Hand of Ruin]]. + +## Member Kingdoms + +| Kingdom | Ruler | Capital | Specialty | +|---------|-------|---------|-----------| +| [[Valdris]] | [[Duke Edric Blackthorn]] | [[Valhold]] | Military, steel | +| [[Kethra]] | [[Queen Selara IV]] | [[Keth's Landing]] | Navy, trade | +| [[Thornwall]] | King Aldric Stonehand | Thornwall Keep | Fortifications, mining | +| [[Silverwood]] | Lady Amara Silvertree | Silverwood Glade | Arcana, diplomacy | +| [[Boralis]] | Jarl Sigrid Frosthelm | Frosthollow | Northern frontier, rangers | + +## Goals + +- Maintain the balance of power among the five kingdoms +- Protect trade routes and expand influence +- Suppress any threat to the status quo — including "dangerous truths" + +## Internal Tensions + +- [[Valdris]] and [[Kethra]] are on the brink of war over trade disputes — manipulated by the Hand of Ruin. +- [[Thornwall]] resents Valdris's military dominance and may secede. +- [[Silverwood]] advocates for peace but is isolated geographically and politically. +- [[Boralis]] cares little for southern affairs but will fight if the north is threatened. + +## Allies + +- [[The Silent College]] — arcane advisory body (strained relationship) +- [[The Iron Concord]] — mercenary contracts (transactional) +- Local militias and garrison forces + +## Enemies + +- [[The Hand of Ruin]] — once dismissed as a myth, now proven real +- [[Pirate Lords of the Salt Reach]] — disrupt Kethran trade +- [[Northern Clans]] — raid Boralis's frontier diff --git a/Factions/Dragon Lords.md b/Factions/Dragon Lords.md new file mode 100644 index 0000000..341a697 --- /dev/null +++ b/Factions/Dragon Lords.md @@ -0,0 +1,48 @@ +--- +type: faction +alignment: True Neutral +leader: Malachar (deceased) → "[[High Pontiff Vosseth]]" (effectively) +--- + +# Dragon Lords + +## Overview + +The Dragon Lords are seven ancient dragons bound by the First Sages to guard the seal anchors. Their combined draconic essence reinforces the seals, and the Rite of Seven Flames — their unified breath weapon — can reinforce or destroy the prison entirely. Each Dragon Lord occupies a different domain and has developed unique philosophies over millennia of guardianship. + +## Current Members + +| Dragon Lord | Color | Domain | Seat | Status | +|-------------|-------|--------|------|--------| +| [[Aurathrax, the Stormbreaker]] | Blue | Storms, sky | Stormpeak Spire | Active | +| [[Morgra, the Ashen Matron]] | Red | Fire, ambition | Ashveil Caldera | Traitor (Hand of Ruin) | +| [[Lythrendor, the Crystal Seer]] | Crystal | Knowledge, prophecy | [[Heart of the Mountain]] | Active / allied | +| [[Vornak, the Deep-Root]] | Green | Nature, growth | The Emerald Deep | Active | +| [[Silvos, the Shifting Wind]] | Silver | Change, mercy | Cloudreach Sanctum | Active | +| [[Khalyraxis, the Verdant Wing]] | Copper | Wit, protection | Verdant Spire | Active / allied | +| [[Ignivar, the Betrayer]] | Red (fallen) | Destruction, betrayal | [[Crucible of Ash]] (prison) | Imprisoned | + +## The Pact of Seven Flames + +- The pact binds each Dragon Lord to a seal anchor; if a Dragon Lord dies, the corresponding seal weakens. +- The Rite of Seven Flames requires all surviving Dragon Lords to channel their breath weapons simultaneously at a seal anchor — either reinforcing it or shattering it. +- The [[Emberheart]] artifact amplifies and synchronizes the draconic energy for the ritual. + +## Internal Conflict + +- [[Morgra, the Ashen Matron]] has secretly aligned with the [[The Hand of Ruin|Hand of Ruin]]. She believes the seals are a prison for dragonkind as much as the Wrath, and that true draconic supremacy can only be achieved by breaking them. +- [[Ignivar, the Betrayer]] was the first to fall — he attempted to shatter the seals 500 years ago and was imprisoned in the [[Crucible of Ash]] by the other Dragon Lords. +- [[Aurathrax, the Stormbreaker]] is isolationist; he believes the mortal races are not worth saving and would prefer to abandon the Pact entirely. + +## Role in Campaign + +- Arc 2: [[Khalyraxis, the Verdant Wing]] is rescued from the Hand of Ruin; becomes guide and ally. +- Arc 3: The party journeys to the [[Heart of the Mountain]] to persuade the Dragon Lords to perform the Rite. +- Arc 4: Surviving Dragon Lords join the final assault on the [[Citadel of Sundering]]. + +## Stat Notes + +Each Dragon Lord is an ancient dragon with the following additions: +- **Legendary Resistance** (3/Day) as standard +- **Seal-Bound Aura:** 30 ft aura; allies in aura have resistance to one element of the Dragon Lord's type +- **Breath of the Pact:** Once per day, a Dragon Lord can expend their breath weapon to stabilize one seal anchor within 1 mile (instant, no damage) diff --git a/Factions/Pirate Lords of the Salt Reach.md b/Factions/Pirate Lords of the Salt Reach.md new file mode 100644 index 0000000..0250928 --- /dev/null +++ b/Factions/Pirate Lords of the Salt Reach.md @@ -0,0 +1,14 @@ +--- +type: faction +alignment: Chaotic Evil +--- + +# Pirate Lords of the Salt Reach + +## Overview + +A loose confederation of pirate captains operating in the waters between [[Kethra]] and the outer islands. They raid Kethran shipping, smuggle contraband, and occasionally accept contracts from anyone willing to pay — including the [[The Hand of Ruin|Hand of Ruin]]. + +## Plot Relevance + +Mentioned as a threat to Kethran trade. Not a primary campaign faction, but the Pirate Lords can complicate naval operations in Arc 4 if not addressed. [[Queen Selara IV]] maintains a secret arrangement with them — mutually beneficial, mutually deniable. diff --git a/Factions/The Hand of Ruin.md b/Factions/The Hand of Ruin.md new file mode 100644 index 0000000..5b4d6fa --- /dev/null +++ b/Factions/The Hand of Ruin.md @@ -0,0 +1,54 @@ +--- +type: faction +alignment: Chaotic Evil +leader: "[[High Pontiff Vosseth]]" +--- + +# The Hand of Ruin + +## Overview + +A secret apocalyptic cult that worships the [[Primordial Wrath]] as a divine force of chaos and renewal. They believe the current world is stagnant and corrupt; only by unleashing the Wrath can creation be purified and remade. + +## Structure + +| Rank | Title | Description | +|------|-------|-------------| +| 1 | Pontiff | Supreme leader — [[High Pontiff Vosseth]] | +| 2 | Keeper | Regional commander (e.g., [[Keeper Valdrek]], [[Keeper Malachar]]) | +| 3 | Herald | Elite enforcer; one for each seal (six total) | +| 4 | Witness | Cell leader; manages one ritual site | +| 5 | Chosen | Full member; sworn through blood ritual | +| 6 | Ember | Initiate; not yet blood-sworn | + +## Goals + +- Shatter all seven seal anchors +- Free the [[Primordial Wrath]] +- Remake the world in elemental chaos + +## Methods + +- Infiltration of noble courts and institutions +- Blood rituals to weaken seal anchors +- Binding dragons and elementals as weapons +- Manufacturing wars to distract nations +- Assassination of those who learn too much + +## Known Cells + +| Cell | Location | Leader | Status | +|------|----------|--------|--------| +| Eastmarch Cell | [[Eastmarch]] | Keeper Valdrek | Destroyed (Arc 1) | +| Ironheart Cell | [[Ironheart Mine]] | Witness Graven | Destroyed (Arc 2) | +| Sunken Cell | [[Sunken Spire]] | [[Mistress Veyla]] | Destroyed (Arc 2) | +| Thronewood Cell | [[Thronewood]] | Keeper Malachar | Destroyed (Arc 2) | +| Dragon Court Cell | [[Heart of the Mountain]] | [[Morgra, the Ashen Matron]] | Destroyed (Arc 3) | +| Citadel Cell | [[Citadel of Sundering]] | [[High Pontiff Vosseth]] | Final stronghold | + +## Symbols + +- **Sigil:** A downward spiral with seven cracks radiating outward +- **Colors:** Black and ash gray +- **Uniform:** Black robes with gray spiral on the left breast (higher ranks have more cracks filled in) +- **Holy text:** The *Canticle of Sundering* — a book prophesying the world's destruction and rebirth diff --git a/Factions/The Iron Concord.md b/Factions/The Iron Concord.md new file mode 100644 index 0000000..9c65ba3 --- /dev/null +++ b/Factions/The Iron Concord.md @@ -0,0 +1,44 @@ +--- +type: faction +alignment: Neutral +leader: "[[General Markus Crane]]" +--- + +# The Iron Concord + +## Overview + +The largest mercenary guild in Aethrune with 6,000+ soldiers-for-hire. Known for absolute professionalism and absolute loyalty to contract — not morality. They fight for whoever pays, and they never break a contract. Their neutrality makes them valuable to all sides and trusted by none. + +## Structure + +| Rank | Title | Role | +|------|-------|------| +| 1 | High General | Supreme commander — [[General Markus Crane]] | +| 2 | Commander | Leader of a company (500 soldiers) | +| 3 | Captain | Leader of a platoon (50 soldiers) | +| 4 | Banner | Leader of a squad (10 soldiers) | +| 5 | Iron | Standard mercenary | + +## Notable Members + +| Name | Rank | Notes | +|------|------|-------| +| [[General Markus Crane]] | High General | Pragmatic, honor-bound, secretly tired of war | +| [[Captain Vara Holt]] | Commander | Assigned to Ironheart Mine contract; conflicted about working with cultists | +| Commander Valdrek | Captain | Garrison commander in Valdris | + +## Contracts + +- Currently contracted by the [[Crown Concordat]] to guard the [[Ironheart Mine]] — but local commander [[Captain Vara Holt]] is receiving separate payments from the Hand of Ruin (unbeknownst to High Command). +- Secondary contracts with [[Kethra]] for naval escort (technically conflicting — a deliberate ambiguity to maximize profit). + +## Goals + +- Maximize profit and influence +- Maintain reputation as the most reliable mercenary force +- Avoid choosing sides in permanent ways + +## The Crane's Secret + +[[General Markus Crane]] is aging and weary. He has seen too many wars and knows the Hand of Ruin is manipulating the Concordat. In [[Arc 4 - Tide of Ruin]], he can be persuaded to break neutrality and join the final assault — not for gold, but because he wants the world his grandchildren inherit to still exist. diff --git a/Factions/The Silent College.md b/Factions/The Silent College.md new file mode 100644 index 0000000..f4844e1 --- /dev/null +++ b/Factions/The Silent College.md @@ -0,0 +1,29 @@ +--- +type: faction +alignment: Lawful Neutral +leader: Archmage Mordecai Valdus +--- + +# The Silent College + +## Overview + +An ancient arcane academy housed in the [[Spire of Silence]] in [[Valhold]]. The College trains wizards, archivists, and arcane scholars. It has studied the seals for centuries and possesses forbidden texts about the [[Primordial Wrath]] — texts it refuses to share with the [[Crown Concordat]] out of fear of panic and misuse. + +## Role in Campaign + +- Provides arcane research support (translate the [[Cult Cipher]], identify artifacts). +- Reluctant ally; must be persuaded (or forced) to share knowledge. +- Source of spell scrolls, magical identification, and ritual support. + +## Key Members + +| Name | Role | +|------|------| +| Archmage Mordecai Valdus | Head of the College | +| [[Librarian Thessa]] | Keeper of Forbidden Texts; party's primary contact | +| Apprentice Kellan | A student who discovered cult infiltration in the College | + +## The Secret Library + +The College's sub-basement holds the **Vault of Sundered Truths** — texts about the Primordial Wrath, the First Sages, and the Elder Dark. Access is restricted to senior archmages only. In [[Arc 4 - Tide of Ruin]], if the party has proven themselves, the College grants full access. diff --git a/Factions/The Verdant Circle.md b/Factions/The Verdant Circle.md new file mode 100644 index 0000000..e2f93c1 --- /dev/null +++ b/Factions/The Verdant Circle.md @@ -0,0 +1,47 @@ +--- +type: faction +alignment: Neutral Good +leader: "[[Archdruid Thalindor]]" +--- + +# The Verdant Circle + +## Overview + +A secret druidic society that has guarded the seal anchors for two millennia. Founded by survivors of the First Sages, they operate in the shadows, manipulating events and placing agents throughout the [[Crown Concordat]] to protect the seals. They are the primary source of ancient lore about the [[Primordial Wrath]]. + +## Structure + +| Rank | Title | Role | +|------|-------|------| +| 1 | Archdruid | Supreme leader — [[Archdruid Thalindor]] | +| 2 | Warden | Guardian of a single seal anchor | +| 3 | Watcher | Field agent; monitors for cult activity | +| 4 | Root | Initiates and support personnel | + +## Known Members + +| Name | Rank | Location | +|------|------|----------| +| [[Archdruid Thalindor]] | Archdruid | Secret grove, [[Thronewood]] | +| [[Elder Ylara Moongrove]] | Watcher | [[Eastmarch]] | +| [[Lythrendor, the Crystal Seer]] | Allied Dragon Lord | [[Heart of the Mountain]] | +| Watcher Seline | Watcher | [[Valhold]] (court infiltrator) | + +## Goals + +- Protect the seven seal anchors +- Prevent the [[Primordial Wrath]] from being freed +- Gather and preserve knowledge of the First Sages +- Recruit allies among the [[Dragon Lords]] + +## Methods + +- Espionage — placing Watchers in courts and institutions +- Druidic magic — wards, divination, elemental binding +- Subterfuge — erasing evidence of the seals from public knowledge +- Alliance-building — cultivating relationships with dragons and fey + +## The Ancient Truth + +The Verdant Circle knows that the Primordial Wrath is not simply a monster — it is a lock. The First Sages created the Wrath as a living seal to imprison something older: the **Elder Dark**, a cosmic entity of pure entropy that exists outside the multiverse. Destroying the Wrath opens the door. But the current Archdruid has kept this secret from all but the highest-ranked Wardens — and the party only learns it from [[Khalyraxis, the Verdant Wing]] in [[Arc 2 - The Gilded War]]. diff --git a/History/War of the Five Thrones.md b/History/War of the Five Thrones.md new file mode 100644 index 0000000..edcd27e --- /dev/null +++ b/History/War of the Five Thrones.md @@ -0,0 +1,14 @@ +--- +type: history +--- + +# War of the Five Thrones + +## Overview + +The century-defining civil conflict that formed the [[Crown Concordat]]. After five royal houses collapsed into open war, the victors created a treaty council to prevent a repeat. + +## Why it matters + +- The Concordat's internal politics were never resolved—only codified. +- The Hand of Ruin exploits old grudges with forged letters and strategic bribery. diff --git a/Items/Cloak of the Mountebank.md b/Items/Cloak of the Mountebank.md new file mode 100644 index 0000000..2f405ee --- /dev/null +++ b/Items/Cloak of the Mountebank.md @@ -0,0 +1,21 @@ +--- +type: item +rarity: Rare +attunement: Yes +--- + +# Cloak of the Mountebank + +## Description + +A deep burgundy cloak with silver threading along the hem that seems to shift and ripple like smoke. When activated, the cloak billows dramatically before the wearer vanishes in a puff of reddish mist. + +## Properties (DMG p. 158) + +While wearing this cloak, you can use an action to cast the *dimension door* spell from it. This property can't be used again until the next dawn. + +When you disappear, you leave behind a cloud of harmless smoke in a 5-foot cube, and you reappear in a similar cloud of smoke at your destination. The smoke heavily obscures the area and dissipates at the end of your next turn. + +## Source + +Found in the [[Dragonfang Vault]] of the [[Ironheart Mine]] ([[Arc 2 - The Gilded War#Hook 5: The Ironheart Siege|Arc 2, Hook 5]]). diff --git a/Items/Crown of the Sundered.md b/Items/Crown of the Sundered.md new file mode 100644 index 0000000..2818009 --- /dev/null +++ b/Items/Crown of the Sundered.md @@ -0,0 +1,22 @@ +--- +type: item +rarity: Legendary +attunement: Yes (requires attunement by a spellcaster) +--- + +# Crown of the Sundered + +## Description + +The crown worn by [[High Pontiff Vosseth]] — seven obsidian shards floating in a halo above a black iron circlet, each shard representing one seal. When the seals crack, the shards glow. When a seal is shattered, its corresponding shard crumbles to ash and falls. The crown hums with barely-contained elemental chaos. + +## Properties + +- **+2 to spell save DC and spell attack rolls** while worn. +- **Aberrant Ward:** You have advantage on saving throws against aberrations. +- **Seal Sense:** The crown's remaining shards indicate the stability of the seal anchors. As a bonus action, you can sense the direction and distance to the nearest cracked seal anchor within 10 miles. +- **Wish (1/Day):** Cast *wish*, but only to duplicate a spell of 8th level or lower. + +## Source + +Looted from [[High Pontiff Vosseth]] if the party chooses the **Destroy** ending ([[Arc 4 - Tide of Ruin#Hook 17: The Final Choice|Arc 4, Hook 17]]). Destroyed if the **Re-Seal** ending is chosen. diff --git a/Items/Cult Cipher.md b/Items/Cult Cipher.md new file mode 100644 index 0000000..72a74e3 --- /dev/null +++ b/Items/Cult Cipher.md @@ -0,0 +1,21 @@ +--- +type: item +rarity: Uncommon +attunement: No +--- + +# Cult Cipher + +## Description + +A small leather-bound journal discovered at the [[Seal Anchor]] hilltop ([[Arc 1 - Heirs of Sundering#Hook 2: The Weeping Sky|Arc 1, Hook 2]]). The pages are filled with script written in Ignan (the language of fire elementals) — the [[The Hand of Ruin|Hand of Ruin]] uses elemental dialects as a code for sensitive communications. The journal contains orders, ritual instructions, and a partial list of seal anchor locations. + +## Contents (After Translation) + +Requires translation at the [[The Silent College|Spire of Silence]] (3 days, [[Librarian Thessa]]) or by someone fluent in Ignan: + +- **Orders from Keeper Valdrek:** *"Commence ritual at the hilltop anchor. Three nights. Blood offerings will draw the Wrath's attention. Do not let the lightning be seen from the town — the druid watches."* +- **Seal Anchor List:** Names three anchors: Eastmarch hilltop, Ironheart Mine, and "the Spire beneath the waves" ([[Sunken Spire]]). +- **Ritual Instructions:** A 3-night blood ritual to weaken a seal anchor. Grants advantage on Arcana checks to disrupt or understand similar rituals encountered later. +- **Contact Schedule:** A cult courier meets the cell leader at the Old Mill every new moon — meaning the party missed the last contact by days. [[Keeper Valdrek|Valdrek]] knows the cell has been compromised. +- **Personal Note:** Written in Common, not Ignan, at the bottom of the last page: *"The Pontiff's messenger came today. The Pontiff is pleased. I should be happy. Why am I terrified?"* — written by the cult mage the party killed. This note is humanizing; the cultists are not faceless monsters. diff --git a/Items/Dragonfang Vault.md b/Items/Dragonfang Vault.md new file mode 100644 index 0000000..576ba70 --- /dev/null +++ b/Items/Dragonfang Vault.md @@ -0,0 +1,14 @@ +--- +type: reference +--- + +# Dragonfang Vault + +The treasure vault hidden behind the seal anchor obelisk in [[Ironheart Mine#Level 3 — The Deep Gallery|Ironheart Mine, Level 3]]. + +**Contents:** +- 8,000 gp +- +1 weapon of the party's choice +- [[Cloak of the Mountebank]] + +Requires DC 18 Investigation to find. Discovered after the cultists and [[Scorchmaw]] are dealt with. diff --git a/Items/Emberheart.md b/Items/Emberheart.md new file mode 100644 index 0000000..3a4e37f --- /dev/null +++ b/Items/Emberheart.md @@ -0,0 +1,34 @@ +--- +type: item +rarity: Legendary +attunement: Yes (spellcaster) +--- + +# Emberheart + +## Description + +A fist-sized crystal that pulses with internal flames — red, gold, and blue light swirling in an eternal vortex. The crystal is warm to the touch but never burns the holder. When activated, it releases harmonic tones that resonate with draconic energy. Originally forged by the First Sages as the keystone of the Pact of Seven Flames. + +## Properties + +- **Fire Resistance:** While attuned to this item, you have resistance to fire damage. +- **Ember Storm (3/Day):** Cast *fireball* as a 5th-level spell (DC 18). +- **Investiture of Flame (1/Day):** Cast *investiture of flame*. +- **Pact Amplifier:** When within 60 feet of a Dragon Lord using their breath weapon, the Emberheart can double the damage of that breath weapon (1/Day). The Dragon Lord must be willing. + +## Rite of Seven Flames + +The Emberheart's true purpose. When held at a seal anchor and activated in the presence of at least three Dragon Lords channeling their breath weapons simultaneously, the Emberheart can either: +- **Reinforce** the seal (seal stabilizes, instability reduced to 0) +- **Shatter** the seal (seal is destroyed, releasing bound elemental energy) + +This function consumes the Emberheart's energy for 1 week per seal affected. + +## Lore + +*The Emberheart was carved from the heart of the first star to die over Aethrune. The First Sages captured its dying light and shaped it into a vessel for draconic power. It has reforged the seals twice in history — once at the Sundering, and once 500 years ago when Ignivar attempted to break them.* + +## Source + +Found in the [[Crucible of Ash]], guarded by [[Ignivar, the Betrayer]] ([[Arc 3 - Heart of the Mountain#Hook 11: The Crucible of Ash|Arc 3, Hook 11]]). diff --git a/Items/Favor of the Verdant Wing.md b/Items/Favor of the Verdant Wing.md new file mode 100644 index 0000000..5f79a58 --- /dev/null +++ b/Items/Favor of the Verdant Wing.md @@ -0,0 +1,15 @@ +--- +type: item +rarity: Rare +attunement: Yes (charisma-based) +--- + +# Favor of the Verdant Wing + +## Description + +A draconic blessing bestowed by [[Khalyraxis, the Verdant Wing]]. + +## Properties + +- While attuned, you have advantage on Charisma checks made to influence dragons. diff --git a/Items/Primordial Heart Shard.md b/Items/Primordial Heart Shard.md new file mode 100644 index 0000000..a5fca99 --- /dev/null +++ b/Items/Primordial Heart Shard.md @@ -0,0 +1,26 @@ +--- +type: item +rarity: Legendary +attunement: Yes +--- + +# Primordial Heart Shard + +## Description + +A jagged shard of crystalline chaos, roughly the size of a dagger blade, that hums with four distinct elemental frequencies. The shard alternates between burning hot, ice cold, crackling with lightning, and grinding with earthen weight. It cannot be contained by mundane means — it phases through non-magical containers — and must be attuned to be safely handled. + +## Properties + +- **Primordial Ward (1/Day):** As a bonus action, you gain immunity to one damage type of your choice (fire, cold, lightning, or acid) for 1 minute. +- **Plane Shift (1/Day):** Cast *plane shift* to any elemental plane or back to the Material Plane. +- **Elemental Attunement:** You can speak, read, and write Primordial (and all its dialects: Aquan, Auran, Ignan, Terran). +- **Sundering Echo:** When you deal elemental damage (fire, cold, lightning, acid, or thunder) to a creature, you can choose to change the damage type to any other elemental type (once per turn). + +## Source + +Created by the [[Primordial Wrath]]'s death if the party chooses the **Destroy** ending ([[Arc 4 - Tide of Ruin#Hook 17: The Final Choice|Arc 4, Hook 17]]). Alternatively, if the **Re-Seal** ending is chosen, a smaller version (Rare rarity, only grants Primordial and Elemental Attunement) remains from the ritual's aftermath. + +## Lore + +*When a primordial dies, it does not fade — it shatters. Each shard of its being contains a fraction of the power that shaped the world. Some say that collecting all seven shards (one per seal) would grant the wielder the Wrath's full power. Others say that doing so would simply create a new Wrath.* diff --git a/Items/Ring of the Verdant Eye.md b/Items/Ring of the Verdant Eye.md new file mode 100644 index 0000000..0f64ee9 --- /dev/null +++ b/Items/Ring of the Verdant Eye.md @@ -0,0 +1,25 @@ +--- +type: item +rarity: Rare +attunement: Yes +--- + +# Ring of the Verdant Eye + +## Description + +A silver band set with a green amber stone containing what appears to be a preserved leaf — but on close inspection, the "leaf" is actually a tiny, living eye that opens when magic is near. The eye is verdant green with a slit pupil, watching silently. + +## Properties + +- **Watcher's Sight:** While attuned, you have advantage on Wisdom (Perception) checks to detect aberrations, elementals, and fiends. +- **Seal Sense:** The ring grows warm (subtle, not damaging) when within 500 feet of a seal anchor or a creature that has been corrupted by proximity to a broken seal. +- **One with the Circle (1/Day):** Cast *speak with plants*. + +## Source + +Gifted by [[Elder Ylara Moongrove]] if the party successfully protects the seal anchor in [[Arc 1 - Heirs of Sundering#Hook 2: The Weeping Sky|Arc 1, Hook 2]]. + +## Lore + +*These rings are crafted by Watchers of the Verdant Circle, each containing a fragment of the Watcher's own essence — a literal "eye" on the world. Ylara's ring has seen three hundred years of vigilance. It has witnessed the fall of two seal anchors and the birth of one Dragon Lord. It remembers.* diff --git a/Items/Scale of the Dragonsworn.md b/Items/Scale of the Dragonsworn.md new file mode 100644 index 0000000..3af7bff --- /dev/null +++ b/Items/Scale of the Dragonsworn.md @@ -0,0 +1,21 @@ +--- +type: item +rarity: Very Rare +attunement: Yes +--- + +# Scale of the Dragonsworn + +## Description + +A single dragon scale the size of a small shield, gifted by a Dragon Lord to a mortal champion. The scale's color shifts daily at dawn to match the attuned wielder's spirit — red (fire), blue (lightning), green (poison), white (cold), black (acid), or gold (radiant). It can be worn as a cloak clasp, shield boss, or mounted on armor. + +## Properties + +- **Draconic Resilience:** You gain resistance to the damage type matching the scale's current color. +- **Dragon's Roar (1/Day):** As an action, you unleash a 30-foot cone of elemental energy matching the scale's color. Creatures in the area must make a DC 17 Dexterity saving throw, taking 10d6 damage of that type on a failure, or half as much on a success. +- **Spirit of the Dragon (1/Day):** Summon a draconic spirit in the form of a guard drake (CR 2, matching the scale's color) for 1 hour. The drake is friendly to you and your allies and obeys your verbal commands (no action required). + +## Source + +Gifted by the [[Dragon Lords]] collectively at the conclusion of [[Arc 3 - Heart of the Mountain]] if at least three Dragon Lords survive the arc. diff --git a/Items/Seal-Warden's Blessing.md b/Items/Seal-Warden's Blessing.md new file mode 100644 index 0000000..98d7f5c --- /dev/null +++ b/Items/Seal-Warden's Blessing.md @@ -0,0 +1,15 @@ +--- +type: item +rarity: Special +attunement: No +--- + +# Seal-Warden's Blessing + +## Description + +A druidic and draconic rite performed after the party stabilizes or repairs seal instability. + +## Effect + +- Permanent blessing: +2 bonus to one ability score for all party members (DM chooses based on campaign theme). diff --git a/Items/Sunder.md b/Items/Sunder.md new file mode 100644 index 0000000..d1bacc6 --- /dev/null +++ b/Items/Sunder.md @@ -0,0 +1,21 @@ +--- +type: item +rarity: Rare +attunement: Yes (requires attunement by a Dragon Lord or a creature gifted the weapon) +--- + +# Sunder + +## Description + +A +2 glaive wielded by [[Keeper Malachar]]. The blade drips molten metal endlessly — the metal cools and reforms instantly, never depleting, never dulling. The haft is wrapped in black dragon hide. + +## Properties + +- **+2 glaive** (1d10+2 slashing, reach, heavy, two-handed) +- **Sundering Critical:** On a critical hit, the target must make a DC 15 Constitution saving throw. On failure, the target takes an additional 3d6 fire damage and cannot regain hit points until the start of your next turn. +- **Echo of the Wrath (1/Day):** As a bonus action, the glaive's blade erupts with elemental energy matching one element of your choice (fire, cold, lightning, or acid). For 1 minute, attacks with Sunder deal an additional 1d6 damage of the chosen type. + +## Source + +Looted from [[Keeper Malachar]] (Arc 3 or Arc 4). diff --git a/Items/Tideheart Pearl.md b/Items/Tideheart Pearl.md new file mode 100644 index 0000000..b44c564 --- /dev/null +++ b/Items/Tideheart Pearl.md @@ -0,0 +1,25 @@ +--- +type: item +rarity: Rare +attunement: Yes +--- + +# Tideheart Pearl + +## Description + +A perfectly spherical pearl the size of a fist, shimmering with deep blue and green hues that shift like ocean currents. When held underwater, it emits a soft bioluminescent glow. Sea water within 10 feet of the pearl is always calm and clear. + +## Properties + +- **Aquatic Adaptation:** While attuned, you can breathe water and have a swimming speed equal to your walking speed. +- **Control Water (1/Day):** Cast *control water* (DC 16). +- **Tidal Ward (1/Day):** As a reaction when you would take cold or lightning damage, you gain resistance to that damage until the start of your next turn. + +## Source + +Retrieved from the [[Sunken Spire]] after defeating [[Mistress Veyla]] ([[Arc 2 - The Gilded War#Hook 7: The Sunken Spire|Arc 2, Hook 7]]). + +## Lore + +*Cult mages of the Hand of Ruin use Tideheart Pearls to command sahuagin, merrow, and other aquatic servants. Each pearl is grown inside a bound water elemental and harvested — a process that destroys the elemental. The trapped elemental's consciousness remains in the pearl, and attuned wielders sometimes hear it weeping.* diff --git a/Items/Verdant Wing Token.md b/Items/Verdant Wing Token.md new file mode 100644 index 0000000..9d965c6 --- /dev/null +++ b/Items/Verdant Wing Token.md @@ -0,0 +1,20 @@ +--- +type: item +rarity: Special +attunement: No +--- + +# Verdant Wing Token + +## Description + +A copper scale the size of a playing card, warm to the touch and etched with a curling wind pattern. When crushed, the scale releases a burst of acidic mist and the wind carries a draconic call across any distance. It is [[Khalyraxis, the Verdant Wing]]'s personal favor — a promise of aid when needed most. + +## Properties + +- **Call the Wing (1 use):** As an action, crush the token. [[Khalyraxis, the Verdant Wing]] (adult copper dragon) arrives in 1d4 rounds, ready to aid in combat or provide transport. +- After use, the token dissolves into harmless copper dust. + +## Source + +Gifted by Khalyraxis after being rescued in [[Arc 2 - The Gilded War#Hook 8: Ambush at Thronewood|Arc 2, Hook 8]]. diff --git a/Locations/Ashpeak Caldera.md b/Locations/Ashpeak Caldera.md new file mode 100644 index 0000000..e79e699 --- /dev/null +++ b/Locations/Ashpeak Caldera.md @@ -0,0 +1,39 @@ +--- +type: location +region: "Northern Valdris highlands" +danger: High +--- + +# Ashpeak Caldera + +## Overview + +A dormant volcano in the northern Valdrian highlands. The caldera is the surface-side entrance to the [[Gate of Stone]], the planar portal to the Elemental Plane of Earth and the [[Heart of the Mountain]]. + +## Environment + +- Thin, sulfurous air — DC 12 CON save every hour or gain 1 level of exhaustion +- Geothermal vents that deal 2d6 fire damage to creatures ending their turn within 5 feet +- Ash fields that count as difficult terrain +- The caldera floor is 2 miles across; the Gate of Stone is at the center + +## The Gate of Stone + +A massive stone archway 30 feet tall, carved with First Sage runes and flanked by two obsidian pillars. The gate is dormant until activated by a Dragon Lord's presence or a DC 20 Arcana check (requires knowledge of the gate's activation sequence). When active, the archway fills with swirling gray light that solidifies into a stone bridge — walk across it to enter the Plane of Earth. + +## Guardian: The Stonewarden + +An ancient earth elemental myrmidon (CR 14) bound to the gate by the First Sages. It tests those who seek passage with three trials (Strength, Wisdom, Sacrifice). See [[Arc 3 - Heart of the Mountain#Hook 9: The Obsidian Path|Arc 3, Hook 9]]. + +## Encounters + +| Encounter | CR | +|-----------|-----| +| Magma mephits (1d4+2) | 2-4 | +| Fire newts (2d4) | 3 | +| Young magma dragon (patrol) | 10 | +| Stonewarden (if attacked) | 14 | + +## Access + +[[Khalyraxis, the Verdant Wing]] knows the way. The journey from [[Valhold]] to the caldera takes 5 days by horse through increasingly volcanic terrain. diff --git a/Locations/Ashveil Caldera.md b/Locations/Ashveil Caldera.md new file mode 100644 index 0000000..96fe09e --- /dev/null +++ b/Locations/Ashveil Caldera.md @@ -0,0 +1,37 @@ +--- +type: location +region: "Red Dragon territory, southern Aethrune" +danger: Extreme +--- + +# Ashveil Caldera + +## Overview + +The volcanic lair of [[Morgra, the Ashen Matron]] in the southern mountain range. An active volcano surrounded by an ash-choked wasteland where nothing grows and the sky is perpetually overcast. Morgra's treasure hoard — accumulated over 2,800 years — fills the deepest chamber. + +## Environment + +- Ashfall obscures vision beyond 100 feet and deals 1d4 fire damage per hour +- Lava rivers and pools throughout the lair (10d10 fire damage immersion) +- The air is unbreathable without magical protection (DC 15 CON save every 10 minutes or suffocate) +- Morgra's ancient presence suppresses *detect good and evil* and similar divination within 10 miles + +## Layout + +The caldera is a multi-level volcanic cave system. Morgra lairs in the **Throne of Ash** — a chamber at the volcano's heart where the heat is so intense that nonmagical metal melts in minutes. + +## Loot + +If the party raids the lair while Morgra is absent (at the [[Citadel of Sundering]] in Arc 4), they find: +- 45,000 gp in coins and gems +- 6 rare magic items (DM choice) +- 2 very rare items (DM choice) +- [[Ignivar, the Betrayer|Ignivar]]'s preserved scale — a memento Morgra kept for 500 years (serves as *legend lore* on Ignivar's history) +- Correspondence with [[High Pontiff Vosseth]] spanning 200 years — proof of treason + +## Plot Significance + +- Mentioned as Morgra's domain throughout Arc 3 +- An optional high-risk raid in Arc 4 (while Morgra is at the Citadel) to cripple cult resources +- Her brood of 2 adult red dragons may be encountered here or at the Citadel diff --git a/Locations/Boralis.md b/Locations/Boralis.md new file mode 100644 index 0000000..923be9b --- /dev/null +++ b/Locations/Boralis.md @@ -0,0 +1,16 @@ +--- +type: location +region: "Northern Aethrune" +kingdom: "[[Crown Concordat]]" +population: ~40,000 +--- + +# Boralis + +## Overview + +The northernmost kingdom of the [[Crown Concordat]], ruled by Jarl Sigrid Frosthelm. A harsh land of tundra, fjords, and frontier spirit. Boralis cares little for southern politics but provides rangers and skirmishers to Concordat military efforts. The [[Northern Clans]] raid Boralis's frontier — a distraction the [[The Hand of Ruin|Hand of Ruin]] has encouraged. + +## Plot Relevance + +Mentioned in the Crown Concordat structure. Boralis contributes scouts and rangers to the Citadel siege; their frontier knowledge helps locate the [[Ashpeak Caldera]] if the party needs directions. diff --git a/Locations/Citadel of Sundering.md b/Locations/Citadel of Sundering.md new file mode 100644 index 0000000..be2051e --- /dev/null +++ b/Locations/Citadel of Sundering.md @@ -0,0 +1,78 @@ +--- +type: location +region: "The Elemental Chaos" +plane: Material (displaced) +danger: Extreme +--- + +# Citadel of Sundering + +## Overview + +The floating fortress of the [[The Hand of Ruin|Hand of Ruin]], a massive structure of black stone and elemental energy that drifts between the Material Plane and the Elemental Chaos. Originally a First Sage observatory, it was corrupted 300 years ago when [[High Pontiff Vosseth]] seized it and began channeling the [[Primordial Wrath]]'s power through its foundations. The Citadel is surrounded by permanent elemental storms that make approach without protection nearly impossible. + +## Tier 1 — Outer Ramparts + +- Floating platforms connected by obsidian bridges +- Elemental storm zone: 4d10 damage/round to airborne creatures (random element) +- Guarded by 20 cult soldiers, 4 ballistae, 2 summoned storm giants +- 4 storm anchors (ritual circles) must be disabled to clear the storm + +**Storm Anchor Stats:** AC 16, HP 40, immune to psychic/poison, resistance to nonmagical B/P/S. Each anchor requires a DC 16 Arcana check (action) to disrupt. + +## Tier 2 — Hall of Echoes + +- Anti-magic field covers the entire tier (except artifacts) +- Guarded by [[Keeper Malachar]] and 6 helmed horrors +- Upon Malachar's defeat, the anti-magic field drops +- The hall is a cathedral-like space with a vaulted ceiling 80 feet high + +## Tier 3 — Chamber of Heralds + +A circular arena with six radiating hallways — each leading to a Herald's sanctum. + +| Herald | CR | Type | Sanctum Hazard | +|--------|-----|------|----------------| +| Ash | 15 | Fire Sorcerer | Lava pools (2d10 fire/round) | +| Tide | 16 | Storm Cleric | 10 ft deep water, lightning rods | +| Bone | 17 | Death Knight | Negative energy zone (healing halved) | +| Whispers | 15 | Shadow Monk/Assassin | Magical darkness, silence zones | +| Iron | 18 | Warforged Colossus | Construct repair stations | +| Mind | 16 | Illithid Arcanist | Psionic interference (disadvantage on INT/WIS/CHA saves) | + +## Tier 4 — Sundering Throne + +- The Hand of Ruin's command center +- A vast throne room with a ceiling open to the elemental chaos above +- Boss: [[Morgra, the Ashen Matron]] (if alive) OR [[High Pontiff Vosseth]] +- The throne itself is a seal anchor — the final one the Hand of Ruin hasn't cracked + +## Tier 5 — Seal Chamber + +- The deepest chamber, directly adjacent to the planar rift +- The [[Primordial Wrath]] is visible through the rift — a churning mass of elemental chaos the size of a mountain +- Three remaining seal anchors glow faintly; the other four are shattered, their energy feeding the rift +- If the ritual completes (5 rounds after party enters), the Wrath is freed + +**Ritual Interruption:** Each round the party spends disrupting a ritual circle reduces the completion counter by 1. Three ritual circles must be disrupted simultaneously to stop the ritual completely (requires coordinated action from 3 party members within the same round). + +## Siege Mechanics (Arc 4) + +The allied army provides background support: + +| Faction | Contribution | Effect | +|---------|-------------|--------| +| Crown Concordat | Soldiers, siege engines | Reduces cult soldier numbers by 50% | +| Kethra | Naval blockade, bombardment | Eliminates airborne cult reinforcements | +| Verdant Circle | Druidic ritual support | Neutralizes elemental hazards in Tier 1 | +| Dragon Lords | Aerial assault | Engages storm giants and Morgra's brood | +| Iron Concord | Breach team | Opens initial entry point | + +If a faction was not recruited, its effect is lost, increasing difficulty. + +## DM Notes + +- This is the final dungeon. It should be epic, exhausting, and rewarding. +- Allow short rests between tiers but limit long rests to one (after Tier 3). +- If the party bypasses tiers too easily, add reinforcements from Tiers 1-2 as they move upward. +- The final fight with the [[Primordial Wrath]] should feel like the world is ending. Use description liberally — the sky crackles, the ground shakes, reality flickers. diff --git a/Locations/Crucible of Ash.md b/Locations/Crucible of Ash.md new file mode 100644 index 0000000..d483776 --- /dev/null +++ b/Locations/Crucible of Ash.md @@ -0,0 +1,63 @@ +--- +type: location +region: "Volcanic demiplane" +danger: Extreme +--- + +# Crucible of Ash + +## Overview + +A volcanic demiplane created by the [[Dragon Lords]] as a prison for [[Ignivar, the Betrayer]] after his failed attempt to shatter the seals 500 years ago. The Crucible exists between the Material Plane and the Plane of Fire — a pocket dimension of lava rivers, obsidian bridges, and perpetual ash-storms. + +## Access + +A portal in the [[Heart of the Mountain]] leads to the Crucible. The portal requires a Dragon Lord's breath weapon to activate — [[Khalyraxis, the Verdant Wing]] or [[Silvos, the Shifting Wind]] can open it. + +## Environment + +- **Ash Storm:** Visibility 60 feet (heavily obscured beyond). Ranged attacks at disadvantage beyond 60 feet. +- **Lava Rivers:** 10d10 fire damage per round of immersion. DC 15 Acrobatics to cross obsidian bridges (narrow, slick with ash). +- **Volcanic Geysers:** At initiative 20, 1d4 random geysers erupt. 15 ft radius, DC 15 DEX save, 4d10 fire + 2d10 bludgeoning. +- **Searing Heat:** At the start of each hour, DC 15 CON save or gain one level of exhaustion (creatures with fire resistance are immune). + +## Areas + +### The Gallery of Fallen Scales +A long obsidian hall lined with the preserved scales of dragons who died in service to the Pact of Seven Flames. Each scale is a foot wide and bears a Draconic inscription naming the fallen. Walking the hall requires a DC 14 WIS save or be overwhelmed with visions of draconic memories (1d4 psychic damage and frightened for 1 minute on fail). + +### The Bridge of Regret +A 200-foot obsidian bridge over a lava river. Halfway across, the bridge splits — one path leads to the [[Emberheart]] chamber, the other to a dead end that collapses 40 feet into lava. DC 18 Perception to spot the correct path (faint draconic footprints). + +### The Ember Chamber +[[Ignivar, the Betrayer]]'s prison-throne. A massive volcanic geode with crystals glowing from internal fire. The [[Emberheart]] floats at the center, held in place by six obsidian chains. + +## Boss: [[Ignivar, the Betrayer]] (CR 16 while weakened) + +- **HP:** 367 (reduced from ancient red dragon 546 due to imprisonment) +- **AC:** 19 (reduced from 22) +- **Breath Weapon:** Still 90 ft cone, but reduced to 18d6 fire (from 26d6), DC 21 DEX half +- **Chain Vulnerability:** The six obsidian chains binding him to the Crucible have AC 15 and 30 HP each. Breaking all six removes his Frightful Presence and reduces his attacks to 2/round instead of 3. Breaking three removes his Legendary Actions. +- **Lair Actions:** Same as [[Crucible of Ash#Environment|Crucible environment]] + +## Ignivar's Speech + +When the party enters, Ignivar speaks — his voice a ruined whisper that still shakes the chamber: + +> "More mortals. More pawns. Did they tell you I was a monster? I tried to break the seals because I saw the truth: the Wrath is a prison, and we are the wardens. Every day the seals hold, the Elder Dark grows hungrier. Tell me, little flames — which is the greater evil? The beast I tried to free, or the god I tried to starve?" + +## Aftermath + +If Ignivar is slain: +- The [[Emberheart]] becomes free to claim. +- Ignivar's final words: *"Tell Morgra... the ash remembers..."* +- The Crucible begins collapsing. The party has 10 rounds to escape. + +If Ignivar is reasoned with (DC 22 Persuasion, possible only if party knows the Elder Dark truth): +- He surrenders the Emberheart willingly. +- He will not fight in Arc 4 (he is too weakened) but provides critical intelligence about the Citadel's defenses. +- His name is spoken with honor at the World Council, beginning his path to redemption. + +## DM Notes + +This is a roleplay-heavy boss fight hybrid. The party should feel the weight of Ignivar's argument. He's not wrong — he just chose the wrong method. If the party has moral objections to killing a "villain" who might have a point, reward that complexity. diff --git a/Locations/Eastmarch.md b/Locations/Eastmarch.md new file mode 100644 index 0000000..4a67cce --- /dev/null +++ b/Locations/Eastmarch.md @@ -0,0 +1,53 @@ +--- +type: location +region: "Southern Aethrune" +kingdom: "[[Valdris]] and [[Kethra]] (border)" +population: ~2,000 +--- + +# Eastmarch + +## Overview + +A frontier town at the border of [[Valdris]] and [[Kethra]], built around a crossroads of the Old Salt Road. Eastmarch is a waypoint for merchants, travelers, and soldiers — and, lately, cultists passing through unnoticed. + +## Key Locations + +### Marshal's Garrison +A stone fort at the town's center housing 50 garrison soldiers. [[Marshal Aldren Voss]] commands from here. Contains a small armory, jail cells, and a war room with regional maps. + +### The Bent Anchor (Inn) +The only inn in Eastmarch. Run by **Hilda Stonekettle**, a dwarven widow who serves passable ale and excellent meat pies. The common room is the town's de facto social hub. Room: 5 sp/night. + +### Mira's Apothecary +[[Mira Thorne]]'s shop and clinic. Stocks common healing potions (50 gp), herbal remedies, and alchemical supplies. She treats townsfolk for free and adventurers at modest rates. + +### The Old Mill (The Sinking Chapel) +An abandoned grain mill on the river's edge, two miles outside town. The basement connects to a natural cavern that the [[The Hand of Ruin|Hand of Ruin]] has converted into a hidden ritual chamber — the [[The Sinking Chapel]]. Contains: cultists, guard drakes, a blood altar, and a direct tunnel to the [[Seal Anchor]] hilltop. + +### The Hilltop (Seal Anchor) +A bald hill 3 miles northwest, struck repeatedly by unnatural lightning. The hilltop is a dormant [[Seal Anchor]] — a stone obelisk covered in First Sage runes, now cracked and bleeding elemental energy. Cultists have been performing rituals here nightly. + +### Moongrove Shrine +[[Elder Ylara Moongrove]]'s druidic sanctuary in the eastern woods. A stone circle with a natural spring at its center. Ylara lives in a hollow oak nearby. The shrine is warded against fiends and undead. + +## Rumors Table (d6) + +| d6 | Rumor | +|----|-------| +| 1 | "The caravan wasn't attacked by bandits — people heard chanting from the hills that night." | +| 2 | "Old Ylara's been acting strange. Says the earth is 'weeping.' Crazy druid talk." | +| 3 | "There's a noble from Valhold staying at the Bent Anchor. Won't give his name." (Cult informant) | +| 4 | "The lightning hits the same spot every night. Has to be a sign from the gods." | +| 5 | "Mira's last patient died screaming about 'spirals in the dark.' What does that mean?" | +| 6 | "Marshal Voss sent a rider to Valhold last week. Rumor says he's asking for more soldiers." | + +## Encounters + +| Encounter | CR | Location | +|-----------|-----|----------| +| Bandit ambush (6 bandits + 1 bandit captain) | 3 | Old Salt Road | +| Cult patrol (3 cultists + 1 cult fanatic) | 2 | Old Mill outskirts | +| Lightning mephits (4) | 2 | Hilltop approach | +| Cult ritual (2 cult fanatics + 1 cult mage + 4 mephits) | 5 | Seal Anchor | +| Guard drakes (2) + cultists (3) | 4 | The Sinking Chapel | diff --git a/Locations/Freehold.md b/Locations/Freehold.md new file mode 100644 index 0000000..9a7efaf --- /dev/null +++ b/Locations/Freehold.md @@ -0,0 +1,44 @@ +--- +type: location +region: "Border region" +kingdom: "Neutral" +population: ~12,000 +--- + +# Freehold + +## Overview + +A free city that owes allegiance to neither [[Valdris]] nor [[Kethra]]. Founded 150 years ago by deserters from both kingdoms, Freehold is the go-to location for neutral ground — diplomacy, trade, and clandestine meetings all happen here. The city is governed by an elected **Council of Twelve**, who pride themselves on being everyone's mediator and nobody's enemy. + +## Key Locations + +### The Concord Hall +Where the [[Arc 2 - The Gilded War#Hook 6: The Ambassador's Gambit|peace summit]] and [[Arc 4 - Tide of Ruin#Hook 14: The World Council|World Council]] take place. A grand circular chamber with twelve galleries and a central speaking platform. Warded with *forbiddance* (celestials only — prevents fiend interference). + +### The Crossroads Market +Largest neutral market in Aethrune. Everything from common goods to very rare magic items can be found here — at a premium. 20% markup on all PHB items; Rare items are available, Very Rare require a DC 18 Investigation check to find a seller. + +### The Broken Seal (Inn) +A high-end inn named with unintentional irony. Run by **Garrett Finch**, a retired adventurer who recognizes competent parties and offers discounts for a good story. Rooms: 2 gp/night, suites: 10 gp/night. + +### The Whisper Gallery +An espionage broker run by **Madame Oksana**, a tiefling information dealer. For 100-1,000 gp depending on sensitivity, she can provide intel on any faction. She knows about the Hand of Ruin but has been paid to stay quiet. + +### The Freehold Arena +A combat venue where gladiators (voluntary, paid combatants) fight for coin and glory. The party can enter for prize money if short on funds. Champions include a retired goliath barbarian, a half-dragon fighter, and a team of spined devils captured for sport. + +## Council of Twelve + +| Councilor | Faction Sympathy | Priority | +|-----------|-----------------|----------| +| Mayor Thaddeus Grimm | Neutral | City prosperity | +| Councilor Vexin | Pro-Valdris | Trade routes | +| Councilor Mara Kell | Pro-Kethra | Naval access | +| Councilor "Silver" | Verdant Circle agent | Seal stability | +| 8 other councilors | Various | Commerce, defense, intrigue | + +## Plot Significance + +- Arc 2: Site of the peace summit between Valdris and Kethra +- Arc 4: Site of the World Council where all factions unite (or fail to) diff --git a/Locations/Gate of Stone.md b/Locations/Gate of Stone.md new file mode 100644 index 0000000..ca752f0 --- /dev/null +++ b/Locations/Gate of Stone.md @@ -0,0 +1,12 @@ +--- +type: location +danger: Low +--- + +# Gate of Stone + +## Overview + +The planar portal in the [[Ashpeak Caldera]] connecting the Material Plane to the Elemental Plane of Earth. See [[Ashpeak Caldera#The Gate of Stone|Ashpeak Caldera]] for details. Guarded by the [[Stonewarden]]. + +Also referred to in [[Arc 3 - Heart of the Mountain#Hook 9: The Obsidian Path|Arc 3, Hook 9]]. diff --git a/Locations/Heart of the Mountain.md b/Locations/Heart of the Mountain.md new file mode 100644 index 0000000..e4c7c52 --- /dev/null +++ b/Locations/Heart of the Mountain.md @@ -0,0 +1,36 @@ +--- +type: location +region: "Elemental Plane of Earth" +danger: High +--- + +# Heart of the Mountain + +## Overview + +The seat of the Draconic Court — a colossal throne-hall carved inside a floating crystal in the Elemental Plane of Earth. This is where the [[Dragon Lords]] convene to deliberate on matters of the Pact of Seven Flames. The Heart has stood for 3,000 years, a neutral ground where even bitter draconic rivals must set aside grievances. + +## Access + +Reached through the [[Gate of Stone]] in the [[Ashpeak Caldera]] (see [[Arc 3 - Heart of the Mountain#Hook 9: The Obsidian Path|Arc 3, Hook 9]]). The journey from the Material Plane takes approximately 3 days through the Plane of Earth. + +## Description + +The Heart is a massive geode, its interior walls faceted with crystals that reflect and refract light into prismatic displays. The central chamber is the **Throne-Hall**, where five crystal thrones face inward in a circle around a central platform. Each throne is attuned to its Dragon Lord — empty thrones (for [[Ignivar, the Betrayer|Ignivar]] and [[Morgra, the Ashen Matron|Morgra, post-treason]]) pulse with a dim, mournful light. + +Side chambers include: +- **The Hall of Scales:** Records of every Dragon Lord who has served the Pact, carved in draconic script on crystal tablets +- **The Ember Chamber:** Ritual space where the Emberheart once rested before Ignivar's theft +- **The Fracture Cavern:** A natural cave beneath the throne-hall where the seal anchor at the Heart's base can be observed — the only stable anchor in Aethrune + +## Key Events + +- Arc 3: Party presents their case before the Draconic Court +- Arc 3 climax: [[Morgra, the Ashen Matron]] attacks the Court; battle across floating platforms +- Arc 3 conclusion: The Rite of Seven Flames is performed here (or attempted) + +## Environment + +- Crystal resonance creates permanent *calm emotions* effect (mutually agreed by Dragon Lords) +- Violence here is forbidden by ancient pact — breaking it awakens the **Crystal Guardian**, a CR 18 construct +- The air is thin but breathable; gravity is 80% of normal (high jump distances doubled, fall damage halved) diff --git a/Locations/Ironheart Mine.md b/Locations/Ironheart Mine.md new file mode 100644 index 0000000..1d96339 --- /dev/null +++ b/Locations/Ironheart Mine.md @@ -0,0 +1,88 @@ +--- +type: location +region: "[[Valdris]] territory" +function: "Dwarven mine / seal anchor site" +danger: High +--- + +# Ironheart Mine + +## Overview + +A dwarven mithril mine in the [[Valdris|Valdrian]] highlands, built directly atop a seal anchor. The mine has been in operation for 200 years — the dwarves unknowingly excavated around the ancient anchor obelisk, treating it as a holy site devoted to Moradin. When the [[The Hand of Ruin|Hand of Ruin]] learned this, they contracted the [[The Iron Concord|Iron Concord]] to "guard" the mine while cultists worked to crack the seal. + +## The Siege (At Game Start) + +- The mine has been under cult control for 3 weeks. +- 12 surviving dwarven miners are held as hostages in the lower levels. +- [[Captain Vara Holt]]'s Iron Concord company "guards" the upper levels, unaware (or willfully ignorant) that cultists are operating below. +- [[Scorchmaw]] (young magma dragon) is bound in the anchor chamber as added muscle. + +## Level 1 — The Upper Works + +### Entrance +A fortified gatehouse built into the mountainside. Guarded by 6 Iron Concord mercenaries (use **veteran** stat block) and 2 ballistae. If the party approaches openly, Captain Vara Holt confronts them. + +### Barracks +Iron Concord quarters. Contains mercenary pay chests (total 800 gp), supply manifests showing suspicious "special deliveries" to lower levels, and Captain Holt's journal. + +**Holt's Journal (key entries):** +- *"New contract. Guard a mine. Easy coin. Commander Holt says to keep the men on the surface. Something about seismic instability."* +- *"Men are hearing noises from below. Drums. Chanting. Holt says it's dwarves praying. I've never heard a dwarf pray like that."* +- *"I asked Holt what's really down there. She threatened a transfer to the northern front. I'm not asking again."* + +### The Great Lift +A dwarven mechanical lift that descends 300 feet to Level 2. Requires a DC 15 Intelligence (Investigation) to bypass the cult's sabotage — failing triggers a cave-in (4d10 bludgeoning, DC 15 DEX save for half). + +## Level 2 — The Burrows + +### The Galleries +Network of mine tunnels. 4 cultists patrol in pairs. Evidence of recent combat: dwarven blood on walls, broken picks, a crushed holy symbol of Moradin. + +### Hostage Chamber +12 dwarven prisoners, including **Foreman Durgan Ironhand**, who reveals: +- The anchor obelisk is in the Deep Gallery (Level 3). +- Cultists perform rituals there every midnight. +- A dragon arrived three weeks ago — it hasn't left the anchor chamber since. +- The cult leader calls himself "Keeper Graven." + +### Forgotten Shrine +A side chamber the cultists haven't found. Contains: +- A Moradin altar with *bless* cast on anyone who prays here (1/day) +- A cache of dwarven supplies: 3 healing potions, 1 potion of fire resistance, a +1 warhammer (Moradin's Hammer) +- A journal from the original dwarven settlers describing the anchor obelisk in reverent terms — they believed it was a "pillar of the world" placed by Moradin himself + +## Level 3 — The Deep Gallery + +### The Anchor Chamber +A vast natural cavern with the seal anchor at its center — a 40-foot obsidian obelisk carved with First Sage runes. Four cult ritual circles surround it, each channeling elemental energy into the obelisk. + +**Enemies:** +- **Keeper Graven** — cult leader (use **cult fanatic** with +30 HP and 2nd-level spells: *scorching ray*, *hold person*) +- 6 cultists (4 at circles + 2 guards at entrance) +- 2 **magma mephits** summoned by the ritual +- **[[Scorchmaw]]** — young magma dragon (CR 10, see below), bound by an *elemental bane* spell; can be freed if the binding crystal is destroyed (AC 15, 30 HP, at the center of the western ritual circle) + +### [[Scorchmaw]] — Young Magma Dragon (Homebrew) + +- **CR:** 10 | **HP:** 178 | **AC:** 18 (natural) +- **Breath Weapon (Recharge 5-6):** 40 ft cone, 14d6 fire damage, DC 17 DEX for half. Creatures that fail are also restrained by cooling magma (DC 15 STR to escape). +- **Magma Blood:** When Scorchmaw takes slashing or piercing damage, adjacent creatures take 2d6 fire damage. +- **Lair Action:** On initiative 20, a lava fissure opens beneath one creature (DC 15 DEX save or 3d10 fire). + +**If the binding is broken:** +- Scorchmaw turns on the cultists immediately (1 round of rampaging). +- He then speaks to the party in Draconic: recognizes them as "scale-friends" of [[Khalyraxis, the Verdant Wing|Khalyraxis]] (if she has been mentioned) or as "useful mortals." +- Leaves the mine but gives the party a **Scale Token** — a one-time summon to call him in Arc 4. + +## Rewards + +- **Dragonfang Vault** (behind the obelisk, DC 18 Investigation to find): 8,000 gp, a +1 weapon (party's choice), [[Cloak of the Mountebank]] +- **Cult Orders** (on Keeper Graven's body): orders to proceed to the [[Sunken Spire]] after cracking this anchor; signed with [[High Pontiff Vosseth]]'s spiral seal +- **Foreman's Gratitude:** Free custom armor or weapon from Ironheart's forge (delivered in Valhold, takes 2 weeks) + +## DM Notes + +- The Iron Concord's role is morally ambiguous — most mercenaries don't know about the cult. The party's choice in how to deal with them (combat, persuasion, infiltration) sets the tone for Iron Concord relations in later arcs. +- If the hostage dwarves die, the party loses reputation in Valdris (-2 to future Persuasion checks with dwarven NPCs). +- Scorchmaw can be a recurring ally or enemy depending on the party's choices. diff --git a/Locations/Keth's Landing.md b/Locations/Keth's Landing.md new file mode 100644 index 0000000..f9c1ab1 --- /dev/null +++ b/Locations/Keth's Landing.md @@ -0,0 +1,26 @@ +--- +type: location +region: "Eastern Aethrune" +kingdom: "[[Kethra]]" +population: ~65,000 +--- + +# Keth's Landing + +## Overview + +The capital of [[Kethra]] and the largest port city in Aethrune. Built around a natural deepwater harbor, Keth's Landing is a city of white stone towers, bustling docks, and the constant smell of salt and fish. The royal palace — the **Saltspire** — overlooks the harbor from a cliffside promontory. + +## Key Features + +- **The Saltspire:** Queen Selara's palace; naval command center +- **The Grand Docks:** 200+ ships at any time; trade from across the known world +- **The Tide Market:** Open-air market; imported goods, ship supplies, nautical magic items +- **The Admiralty:** Kethran naval headquarters; 120 warships, including the flagship *Kethra's Wrath* +- **Temple of the Tides:** Clerics of sea and storm; services include *water breathing*, *control water*, and *commune* with sea gods + +## Plot Hooks + +- Meet [[Queen Selara IV]] for the first time +- Arrange naval support for the Citadel siege +- Investigate the Pirate Lords' connection to the Hand of Ruin diff --git a/Locations/Kethra.md b/Locations/Kethra.md new file mode 100644 index 0000000..31ec18c --- /dev/null +++ b/Locations/Kethra.md @@ -0,0 +1,36 @@ +--- +type: location +region: "Coastal Aethrune" +population: ~140,000 +--- + +# Kethra + +## Overview + +A maritime kingdom on the eastern coast of Aethrune. Kethra controls the richest shipping lanes and the largest navy in the known world. Its relationship with [[Valdris]] has soured over decades of trade disputes, tariffs, and border incidents — tensions the [[The Hand of Ruin|Hand of Ruin]] has expertly exploited. + +## Key Features + +| Aspect | Details | +|--------|---------| +| **Ruler** | [[Queen Selara IV]] | +| **Capital** | [[Keth's Landing]] | +| **Military** | 7,000 soldiers + 5,000 navy personnel; 120 warships | +| **Economy** | Maritime trade, shipbuilding, fishing, pearls | +| **Geography** | Eastern coastline, coastal islands, Salt Reach estuary | +| **Alliances** | Neutral with most Concordat members; trade pacts with island nations | +| **Tensions** | [[Valdris]] (trade war), Pirate Lords of the Salt Reach | + +## Notable Locations + +- [[Keth's Landing]] — capital and naval headquarters +- The Salt Reach — contested waters with pirate activity +- [[Sunken Spire]] — coastal ruin / seal anchor (off the northern coast) + +## Plot Hooks + +- Kethra is being pushed toward war with Valdris (Arc 2) +- [[Ambassador Kael Vess]] represents Kethra at the peace summit +- Kethran naval blockade supports the final Citadel assault (Arc 4) +- Queen Selara's daughter was killed by cultists — she takes the Hand of Ruin personally diff --git a/Locations/Old Salt Road.md b/Locations/Old Salt Road.md new file mode 100644 index 0000000..8768282 --- /dev/null +++ b/Locations/Old Salt Road.md @@ -0,0 +1,36 @@ +--- +type: location +region: "Eastern Valdris / Western Kethra" +danger: Medium +--- + +# Old Salt Road + +## Overview + +The main trade route connecting [[Valdris]] to [[Kethra]]. The road runs from [[Valhold]] in the west through [[Eastmarch]] and into [[Keth's Landing]] on the coast. Once a bustling artery of commerce, the road has grown dangerous in recent years — banditry, cult activity, and border tensions have choked the flow of goods. + +## Route + +| Waypoint | Distance from Valhold | Notes | +|----------|----------------------|-------| +| Valhold | 0 miles | Start | +| Thornwall Crossroads | 40 miles | Branch to Thornwall | +| Eastmarch | 80 miles | Midpoint, campaign start | +| Thronewood Edge | 110 miles | Forest border | +| Keth's Landing | 160 miles | End | + +## Hazards + +- Bandit ambushes (paid by the Hand of Ruin to disrupt investigations) +- Unstable terrain near cracked seal anchors (elemental storms, sinkholes) +- Border patrols from both Valdris and Kethra (may mistake travelers for enemy scouts) + +## Trade + +Before the war tensions, the Salt Road carried: +- Valdrian steel and grain eastward +- Kethran fish, pearls, and imported goods westward +- [[The Silent College|Silent College]] shipments to and from the capital + +The disruption of this trade is a major factor driving war sentiment in both kingdoms. diff --git a/Locations/Seal Anchor.md b/Locations/Seal Anchor.md new file mode 100644 index 0000000..ff205ae --- /dev/null +++ b/Locations/Seal Anchor.md @@ -0,0 +1,53 @@ +--- +type: location +region: Various +danger: Medium to Extreme +--- + +# Seal Anchor + +## Overview + +One of seven obsidian obelisks placed across Aethrune by the First Sages to bind the [[Primordial Wrath]]. Each anchor is approximately 30-40 feet tall, covered in First Sage runes that glow faintly with elemental energy. When stable, the runes pulse in a slow, steady rhythm. When disturbed, the runes flicker erratically and elemental energy bleeds from cracks in the obelisk, warping the surrounding environment. + +## Known Anchors + +| # | Location | Status | Notes | +|---|----------|--------|-------| +| 1 | [[Eastmarch]] hilltop | Damaged (Arc 1) | Weakened by cult rituals | +| 2 | [[Valhold]] Undercroft | Cracked (Arc 1 climax) | Ritual interrupted by party | +| 3 | [[Ironheart Mine]] | Cracked (Arc 2) | Under cult siege | +| 4 | [[Sunken Spire]] | Cracked (Arc 2) | Coastal anchor | +| 5 | [[Thronewood]] | Stable | Hidden; location known to Verdant Circle | +| 6 | [[Citadel of Sundering]] | Stable | Deepest anchor, hardest to reach | +| 7 | [[Heart of the Mountain]] | Stable | Guarded by Dragon Lords directly | + +## Effects of Instability + +When a seal anchor cracks, the surrounding region experiences: +- Unnatural weather (elemental storms, temperature swings, acid rain) +- Increased elemental creature activity +- Minor reality warps (gravity fluctuations, time loops, spatial distortions) +- Corruption of local wildlife and people (aggression, mutation, madness) + +When all seven crack, the [[Primordial Wrath]] is freed. + +## Ritual Interaction + +- **Cult Rituals:** The [[The Hand of Ruin|Hand of Ruin]] uses sacrificial blood magic to crack seals. Requires 3+ cultists and a Witness or higher-rank leader. Takes 3-7 days of continuous ritual to fully crack a seal. +- **Rite of Seven Flames:** The [[Dragon Lords]]' unified breath weapon, channeled through the [[Emberheart]], can either reinforce or shatter a seal. Requires at minimum 3 Dragon Lords. +- **Druidic Stabilization:** [[The Verdant Circle]] knows rituals to temporarily stabilize a cracked seal (prevents further cracking but doesn't repair damage). Takes 1 hour, 100 gp in materials. + +## First Sage Runes + +The runes on each anchor are written in the language of the First Sages (a dialect of Primordial). Key rune meanings: + +| Rune | Meaning | +|------|---------| +| ⟳ (spiral) | Binding / imprisonment | +| ⧖ (hourglass over flame) | Eternal vigilance | +| ⚠ (triangle with eye) | Warning / sealed danger | +| ⤴ (rising from circle) | The sealed entity | +| ⧃ (seven-pointed star) | The Pact of Seven Flames | + +[[Elder Ylara Moongrove]] can read these runes. [[Librarian Thessa]] at the [[The Silent College|Silent College]] knows the full translation of the original binding ritual. diff --git a/Locations/Silverwood.md b/Locations/Silverwood.md new file mode 100644 index 0000000..a345757 --- /dev/null +++ b/Locations/Silverwood.md @@ -0,0 +1,16 @@ +--- +type: location +region: Eastern Aethrune +kingdom: "[[Crown Concordat]]" +population: ~25,000 +--- + +# Silverwood + +## Overview + +An elven-majority kingdom of the [[Crown Concordat]], ruled by Lady Amara Silvertree. Known for its arcane traditions and diplomatic corps. Silverwood advocates for peace between [[Valdris]] and [[Kethra]] but is geographically isolated and politically sidelined. Its arcane scholars have studied the seal anchors independently and know fragments of the truth. + +## Plot Relevance + +Mentioned in the Crown Concordat structure. Silverwood can provide arcane support in Arc 4 if allied — their battlemages counter cult spellcasters during the Citadel siege. diff --git a/Locations/Spire of Silence.md b/Locations/Spire of Silence.md new file mode 100644 index 0000000..9635bd3 --- /dev/null +++ b/Locations/Spire of Silence.md @@ -0,0 +1,41 @@ +--- +type: location +region: "Central Aethrune" +kingdom: "[[Valdris]]" +population: ~15,000 +--- + +# Spire of Silence + +## Overview + +The headquarters of [[The Silent College]]. A towering silver spire in the center of [[Valhold]] that is permanently silenced — within 30 feet of the spire, no sound can be made or heard (as the *silence* spell, permanent). Wizards, archivists, and scholars train here in perfect quiet. + +## Key Features + +- **The Grand Library:** Public access; spell scrolls (Cantrip-3rd), research materials, translation services +- **The Silent Halls:** Restricted area; advanced spell research, artifact storage +- **The Vault of Sundered Truths:** Sub-basement; forbidden texts about the [[Primordial Wrath]], [[Seal Anchor|seal anchors]], and the Elder Dark. Guarded by an **arcane golem** (CR 10). + +## Key NPCs + +- **Archmage Mordecai Valdus** — head of the College +- [[Librarian Thessa]] — keeper of forbidden texts, party's primary contact +- Apprentice Kellan — discovered cult infiltration in the College + +## Services + +| Service | Cost | Time | +|---------|------|------| +| Spell scroll (Cantrip-3rd) | PHB prices + 20% | Immediate | +| Translation (any language) | 50 gp/page | 1 day/page | +| Identify magic item | 50 gp | 1 hour | +| Arcana research | 100 gp/day | Variable | +| Vault access | Permission required | — | + +## Plot Hooks + +- Translate the [[Cult Cipher]] (Arc 1) +- Research the First Sages and seal anchors (Arc 1-2) +- Discover cult infiltration (Arc 2) +- Access the Vault of Sundered Truths (Arc 4) diff --git a/Locations/Sunken Spire.md b/Locations/Sunken Spire.md new file mode 100644 index 0000000..dcdbaf8 --- /dev/null +++ b/Locations/Sunken Spire.md @@ -0,0 +1,59 @@ +--- +type: location +region: "Kethran coast" +danger: High +--- + +# Sunken Spire + +## Overview + +A coastal ruin that was once a lighthouse and temple of a forgotten sea god. Now partially submerged due to coastal erosion and rising tides over 800 years. The [[The Hand of Ruin|Hand of Ruin]] has repurposed the spire's submerged levels as a ritual site to crack the seal anchor at its base. + +## Level 1 — The Lighthouse (Above Water) + +### Entry +The spire's top protrudes 40 feet above the waves. Access is by boat or water walking. The entry door is magically sealed (DC 15 Arcana or Thieves' Tools to open). + +### Cult Quarters +4 cultists, 1 cult fanatic. Contains supplies, maps of Kethran shipping lanes, and a logbook tracking seal anchor energy levels. + +### Ritual Chamber +A desecrated altar to the forgotten sea god. 2 cult fanatics performing a ritual. Disturbing them triggers a **water weird** (CR 3) to emerge from the altar's pool as a trap. + +## Level 2 — The Sunken Sanctuary (Underwater) + +Requires water breathing or similar magic to explore. The spire's middle level has flooded entirely. + +### Flooded Hall +A 60-foot hall with collapsed pillars. 6 **sahuagin** + 2 **sahuagin coral smashers** patrol here. + +### The Coral Grotto +A side chamber grown over with phosphorescent coral. Contains a **giant octopus** (non-hostile unless provoked) and a treasure chest (600 gp, 2 potions of water breathing). + +### The Anchor Passage +A downward shaft leading to Level 3. Guarded by a **water elemental myrmidon** (CR 7). The myrmidon is bound to [[Mistress Veyla]] and cannot be reasoned with — but destroying her breaks the binding. + +## Level 3 — The Deep Chamber + +### Seal Anchor +A 30-foot obsidian obelisk similar to the one at [[Ironheart Mine]], but this one is actively cracking — green elemental light bleeds from the fissures. + +### Boss Encounter +- **[[Mistress Veyla]]** — cult warlock of the Deep (CR 11 equivalent) +- 2 **chuul** (CR 4) — her personal guards +- 4 **merrow** (CR 2) — summoned reinforcements that arrive on round 3 + +### Mistress Veyla Stats +- **HP:** 140 | **AC:** 17 (mage armor + DEX) +- **Spellcasting:** Warlock 11 (Pact of the Deep — homebrew patron). DC 17. Key spells: *evard's black tentacles, cone of cold, hunger of hadar, summon greater demon* +- **Eldritch Blast:** 3 beams, +9, 1d10+5 force each +- **Drown (Recharge 5-6):** Target creature within 60 ft must make DC 17 CON save. On failure, lungs fill with seawater — suffocating (as per drowning rules) until they use an action to make another DC 17 CON save to expel the water. +- **Legendary Actions (2):** Eldritch Blast (1 beam), Move (30 ft swim), Channel Anchor (deal 2d10 force to one creature within 10 ft of the obelisk) + +## Rewards + +- **[[Tideheart Pearl]]** from Veyla's body +- **Cult Intelligence:** A waterlogged scroll case with orders directing the Thronewood convoy ([[Arc 2 - The Gilded War#Hook 8: Ambush at Thronewood|Arc 2, Hook 8]]) +- **Sunken Treasure:** 3,200 gp, a *trident of fish command*, and a *cloak of the manta ray* +- **Seal Stabilization:** If the party spends 1 hour performing a ritual ([[Elder Ylara Moongrove|Ylara]]'s teachings), the anchor stabilizes, reducing the Hand of Ruin's progress diff --git a/Locations/The Sinking Chapel.md b/Locations/The Sinking Chapel.md new file mode 100644 index 0000000..5f07ba0 --- /dev/null +++ b/Locations/The Sinking Chapel.md @@ -0,0 +1,53 @@ +--- +type: location +region: "Eastmarch, Valdris" +danger: Medium +--- + +# The Sinking Chapel + +## Overview + +The cult hideout beneath the abandoned Old Mill outside [[Eastmarch]]. The Hand of Ruin converted a natural cave system into a ritual space and staging ground for operations against the [[Seal Anchor]] on the nearby hilltop. + +## Layout + +### Upper Level: The Mill +An abandoned grain mill above the caves. Appears derelict from the outside. DC 14 Perception to notice tracks leading to the basement door. DC 16 Investigation to find hidden cult supplies (robes, ritual knives, salt for purification circles). + +### Basement: Guard Post +2 **cultists** + 2 **guard drakes** stationed here. The basement has a hidden trapdoor leading to the caves below. + +### Cave Level 1: The Respite +Living quarters for 3 cultists + 1 **cult fanatic** (the cell's Witness). Contains: +- Bunk pallets for 6 people +- Ritual preparation area (alchemical supplies, blood offerings) +- **The Missing Child:** Held in a locked cage (DC 15 Thieves' Tools). Weakened but alive. The cult planned to use the child as the final blood offering at the hilltop. + +### Cave Level 2: The Chapel +A natural cavern converted into a ritual space. Features: +- A crude altar of stacked obsidian with the Hand of Ruin spiral carved into it +- Ritual circle drawn in salt, blood, and ash +- A tunnel leading directly to the [[Seal Anchor]] hilltop (1 mile northwest) +- Cult documents: ritual schedules, correspondence with [[Keeper Valdrek]] + +## Enemies + +| Encounter | Location | CR | +|-----------|----------|-----| +| 2 cultists + 2 guard drakes | Basement | 3 | +| 3 cultists + 1 cult fanatic | Cave Level 1 | 4 | +| 1 cult fanatic (if alerted) + environmental hazards | Cave Level 2 | 2 | + +## Treasure + +- Alchemical supplies worth 150 gp +- Cult documents (translate with DC 14 Arcana — encoded in Primordial dialect) +- 85 gp in offering coin +- A *potion of healing* and a *potion of fire breath* from the Witness's personal supplies + +## Resolution + +- Saving the child earns the party free healing from [[Mira Thorne]] and +1 reputation in [[Eastmarch]] +- The tunnel to the hilltop bypasses the storm hazards of Hook 2 +- Clearing the Chapel prevents the cult from re-establishing a cell in the Eastmarch area diff --git a/Locations/Thornwall.md b/Locations/Thornwall.md new file mode 100644 index 0000000..1222254 --- /dev/null +++ b/Locations/Thornwall.md @@ -0,0 +1,16 @@ +--- +type: location +region: Central Aethrune +kingdom: "[[Crown Concordat]]" +population: ~60,000 +--- + +# Thornwall + +## Overview + +A mountain kingdom of the [[Crown Concordat]] known for its impregnable fortifications and rich mineral deposits. Ruled by King Aldric Stonehand from Thornwall Keep. Thornwall resents [[Valdris]]'s military dominance and has threatened secession from the Concordat — a fracture the [[The Hand of Ruin|Hand of Ruin]] hopes to exploit. + +## Plot Relevance + +Mentioned in the Crown Concordat structure. Not a primary campaign location, but Thornwall's potential secession weakens the alliance. The party may need to broker peace between Thornwall and Valdris as a side objective in Arc 2. diff --git a/Locations/Thronewood.md b/Locations/Thronewood.md new file mode 100644 index 0000000..0f3cc14 --- /dev/null +++ b/Locations/Thronewood.md @@ -0,0 +1,34 @@ +--- +type: location +region: "Southern Valdris" +danger: Medium +--- + +# Thronewood + +## Overview + +An ancient forest spanning the southern border of [[Valdris]]. The Thronewood is old — older than the [[Crown Concordat]], older than most human kingdoms. Its trees are massive hardwoods with canopies that block the sky. Druidic magic saturates the soil, and the forest has a will of its own. + +## Key Features + +- **The Verdant Grove:** Hidden sanctuary of [[The Verdant Circle]]; location of [[Archdruid Thalindor]]'s court +- **The Old Thronewood Road:** Main travel route through the forest; site of the cult convoy ambush (Arc 2, Hook 8) +- **The Whispering Glade:** A circle of ancient oaks where the veil between worlds is thin; *commune* and *speak with dead* spells cast here have double duration +- **The Sunken Temple:** Ruins of a First Sage outpost, now overgrown and home to forest creatures + +## Encounters + +| Encounter | CR | +|-----------|-----| +| Cult patrol (4 cultists + 1 fanatic) | 3 | +| Awakened trees (2) | 4 | +| Forest drake | 4 | +| Verdant Circle Watcher (druid) | 2 | +| Treant (neutral, curious about the seals) | 9 | + +## Plot Significance + +- Arc 2, Hook 8: Ambush site to rescue [[Khalyraxis, the Verdant Wing]] +- Arc 3-4: The Verdant Circle marshals druidic forces here for the final battles +- [[Archdruid Thalindor]] will die here after the campaign, becoming one of the ancient trees diff --git a/Locations/Valdris.md b/Locations/Valdris.md new file mode 100644 index 0000000..0b1f1a0 --- /dev/null +++ b/Locations/Valdris.md @@ -0,0 +1,37 @@ +--- +type: location +region: "Central Aethrune" +population: ~180,000 +--- + +# Valdris + +## Overview + +The largest and most militaristic kingdom in the [[Crown Concordat]]. Valdris controls the central plains and highlands of Aethrune, including the [[Ironheart Mine]], the [[Thronewood]] approaches, and the capital city of [[Valhold]]. Its economy runs on steel, agriculture, and taxation of Concordat trade routes. + +## Key Features + +| Aspect | Details | +|--------|---------| +| **Ruler** | [[Duke Edric Blackthorn]] | +| **Capital** | [[Valhold]] | +| **Military** | 12,000 standing army + 3,000 garrison troops | +| **Economy** | Steel, grain, trade tariffs | +| **Geography** | Central plains, Ironheart highlands, Thronewood border | +| **Alliances** | Crown Concordat (leading member), Iron Concord (mercenary contracts) | +| **Tensions** | [[Kethra]] (trade war), Thornwall (resource disputes) | + +## Notable Locations + +- [[Valhold]] — capital and ducal seat +- [[Ironheart Mine]] — mithril mine / seal anchor +- [[Eastmarch]] — border town +- [[Thronewood]] — ancient forest on the southern border +- [[Old Salt Road]] — eastern trade route + +## Plot Hooks + +- The Duke's court is infiltrated by the [[The Hand of Ruin|Hand of Ruin]] (Arc 1 climax) +- Valdris is being manipulated into war with Kethra (Arc 2) +- Valdrian soldiers form the backbone of the [[Citadel of Sundering|Citadel]] assault (Arc 4) diff --git a/Locations/Valhold.md b/Locations/Valhold.md new file mode 100644 index 0000000..409f248 --- /dev/null +++ b/Locations/Valhold.md @@ -0,0 +1,53 @@ +--- +type: location +region: "Northern Aethrune" +kingdom: "[[Valdris]]" +population: ~35,000 +--- + +# Valhold + +## Overview + +The capital of [[Valdris]] and seat of the [[Crown Concordat]] assembly. A walled city of white stone built into a cliffside overlooking the Silver River. Valhold is a city of intrigue — courtiers scheme behind silk curtains, merchants bribe customs officials, and agents of every faction watch from the shadows. + +## Key Locations + +### Blackthorn Keep +The ducal palace at the city's highest point. Home to [[Duke Edric Blackthorn]] and his court. Contains: +- **The Assembly Hall** — where the Concordat meets +- **Ducal Apartments** — heavily guarded, rumored to have secret passages +- **Council Chamber** — where the party receives their commission +- **Undercroft** — discovered in Arc 1 climax to be a cult ritual site + +### The Spire of Silence +Headquarters of [[The Silent College]], a towering silver spire that absorbs all sound within 30 feet (Silence spell, permanent). Home to Archmage Mordecai Valdus and the Vault of Sundered Truths. + +### The Gilded Market +The city's trade district. Fences, alchemists, blacksmiths, and enchanters. **Hallen's Emporium** sells magic items up to Rare rarity (at 150% DMG price). + +### The Iron Quarter +Garrison district. Contains the city watch headquarters, barracks for 1,200 soldiers, and the Iron Concord's regional office. [[Marshal Aldren Voss]] trained here. + +### The Dock Ward +River-side district. Smugglers, sailors, and riverside taverns. The **Silt & Silver** tavern is a known information market — rumors cost 5-50 gp each. + +### Temple of the Seven +The city's main temple. Dedicated to the seven gods of the Concordat pantheon. Clerics here can cast *raise dead* (1,250 gp), *greater restoration* (450 gp), and standard healing services. **High Priestess Callista Vane** is a potential ally — she knows more about the seals than she admits. + +## Intrigue at Court + +| NPC | Position | Secret | +|-----|----------|--------| +| Chancellor Harlan | Duke's chief advisor | Witness of the Hand of Ruin (Arc 1 climax) | +| Lady Marchessa Blackthorn | Duke's wife | Knows Harlan is corrupt; afraid to speak | +| Watcher Seline | Court musician | Verdant Circle agent | +| Lord Commander Bryce | Military advisor | Loyal but ambitious; can be turned | +| Ambassador Vex | Kethran envoy | Spying for [[Kethra]]; not a cultist | + +## Quest Hooks + +- Decode the [[Cult Cipher]] at the [[Spire of Silence]] +- Investigate Chancellor Harlan's suspicious meetings +- Infiltrate the Undercroft to find the ritual site +- Protect Lady Marchessa from cult retaliation diff --git a/Locations/World Council.md b/Locations/World Council.md new file mode 100644 index 0000000..dd63979 --- /dev/null +++ b/Locations/World Council.md @@ -0,0 +1,14 @@ +--- +type: location +region: Freehold +--- + +# World Council + +## Overview + +A summit convened in [[Freehold]] when the [[Primordial Wrath]]'s threat can no longer be denied. Leaders of the major factions—plus Dragon Lords and the Verdant Circle—argue terms while armies assemble. + +## Plot Hooks + +- Arc 4: Social challenge to keep the alliance unified. diff --git a/Maps/Eastmarch (Grid).md b/Maps/Eastmarch (Grid).md new file mode 100644 index 0000000..c82fba5 --- /dev/null +++ b/Maps/Eastmarch (Grid).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: grid dungeon prompt +--- + +# Eastmarch (Town Encounter — Grid) + +## Prompt + +Top-down fantasy battlemap on parchment, small frontier town encounter in Eastmarch. Include a visible square grid. Place labeled landmarks (handwritten text on the map) for: **Marshal’s Garrison Gate**, **The Bent Anchor (Inn)**, **Mira Thorne’s Apothecary**, and the roadside **Old Salt Road** intersection, plus nearby **river ford**. Show cobblestone streets, modest houses, a central gatehouse, and clear tactical terrain. Medieval style, high clarity, dramatic but clean lighting, no modern UI, square orientation. diff --git a/Maps/Eastmarch Map (Regional).md b/Maps/Eastmarch Map (Regional).md new file mode 100644 index 0000000..63cadf8 --- /dev/null +++ b/Maps/Eastmarch Map (Regional).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: regional prompt +--- + +# Eastmarch Map (Regional) + +## Prompt + +Hand-drawn fantasy regional map on aged parchment, Eastmarch frontier town at the center, Old Salt Road running east-west, marshy river ford near Eastmarch, wooded hills to the north. Highlight these places with clear cartographic symbols (include names as small handwritten text): **Marshal's Garrison**, **The Bent Anchor (Inn)**, **Mira Thorne’s Apothecary**, **Moongrove Shrine**, and the outlying **Seal Anchor** hilltop under storm clouds. Show the route to **The Sinking Chapel** outside town. Ink wash, muted earth tones, highly detailed, no modern UI, portrait orientation. diff --git a/Maps/Freehold Map (Regional).md b/Maps/Freehold Map (Regional).md new file mode 100644 index 0000000..b5c3b98 --- /dev/null +++ b/Maps/Freehold Map (Regional).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: regional prompt +--- + +# Freehold Map (Regional) + +## Prompt + +Hand-drawn fantasy neutral trade city map on aged parchment, Freehold as a circular council district around a central plaza. Include handwritten place names for: **Concord Hall (Council of Twelve)**, **Crossroads Market**, **Broken Seal (Inn)**, **Whisper Gallery**, and **Freehold Arena**. Show nearby roads and signposted routes to **Valdris** and **Kethra**, plus surrounding countryside lanes. Ink linework, muted colors, highly detailed, medieval cartography style, no modern UI, portrait orientation. diff --git a/Maps/Ironheart Mine (Grid).md b/Maps/Ironheart Mine (Grid).md new file mode 100644 index 0000000..bea4a9a --- /dev/null +++ b/Maps/Ironheart Mine (Grid).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: grid dungeon prompt +--- + +# Ironheart Mine (Grid) + +## Prompt + +Top-down fantasy dungeon battlemap on parchment with a visible square grid. **Ironheart Mine — Deep Gallery**: tunnels, stone floor, rocky walls, and the central **Seal Anchor Obelisk**. Include labeled features: **Deep Gallery Entrance**, **Ritual Circle Markers**, **Obelisk Anchor Focus**, and the **Binding Crystal** location near the ritual points. Add tactical obstacles like pillars and narrow chokepoints. Dwarven mine atmosphere, dramatic ink shading, medieval fantasy style, no modern UI, square orientation. diff --git a/Maps/Keth's Landing Map (Regional).md b/Maps/Keth's Landing Map (Regional).md new file mode 100644 index 0000000..512de88 --- /dev/null +++ b/Maps/Keth's Landing Map (Regional).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: regional prompt +--- + +# Keth's Landing Map (Regional) + +## Prompt + +Hand-drawn fantasy coastal city map on aged parchment. Keth’s Landing built on cliffs above the harbor. Include handwritten place names for: **Saltspire (Royal Palace)**, **The Admiralty**, **Grand Docks**, **Tide Market**, and **Lighthouse**. Indicate offshore with a label for **Sunken Spire**. Add coastal defenses and road lines to interior routes. Nautical ink accents, blue-green shading, highly detailed, no modern elements, portrait orientation. diff --git a/Maps/Sunken Spire (Grid).md b/Maps/Sunken Spire (Grid).md new file mode 100644 index 0000000..c7c0ab1 --- /dev/null +++ b/Maps/Sunken Spire (Grid).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: grid dungeon prompt +--- + +# Sunken Spire (Grid) + +## Prompt + +Top-down fantasy underwater dungeon battlemap on parchment with a clear square grid. **Sunken Spire — Deep Chamber** beneath the lighthouse ruins. Include labeled zones: **Entry from Water**, **Flooded Corridor**, **Ritual Obelisk / Seal Anchor**, and **Mistress Veyla’s Position**. Depict submerged stone, shallow water hazards, broken tiles, and pillars for cover. Moody blue-green palette, medieval fantasy style, no modern UI, square orientation. diff --git a/Maps/The Sinking Chapel (Grid).md b/Maps/The Sinking Chapel (Grid).md new file mode 100644 index 0000000..177c15f --- /dev/null +++ b/Maps/The Sinking Chapel (Grid).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: grid dungeon prompt +--- + +# The Sinking Chapel (Grid) + +## Prompt + +Top-down fantasy dungeon battlemap on parchment with a clear square grid. Underground cult hideout beneath the **Old Mill**: **The Sinking Chapel** with its **Ritual Altar (Chapel Circle)**, **Pillars**, **Cave Guard Post**, and a labeled **Secret Tunnel to Seal Anchor**. Add rock walls, dark watery ditches, and tactical cover. Dark atmospheric lighting, medieval fantasy style, no modern UI, square orientation. diff --git a/Maps/Thronewood Map (Regional).md b/Maps/Thronewood Map (Regional).md new file mode 100644 index 0000000..baeb4ab --- /dev/null +++ b/Maps/Thronewood Map (Regional).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: regional prompt +--- + +# Thronewood Map (Regional) + +## Prompt + +Hand-drawn fantasy forest regional map on aged parchment. Vast ancient trees with paths and old roads through the Thronewood. Include handwritten place names (small, medieval style) for: **Old Thronewood Road**, **The Verdant Grove**, **Whispering Glade**, and the overgrown ruins **Sunken Temple**. Mark the forest border connections toward **Valdris** and **Kethra**. Ink wash, muted greens and browns, subtle magical atmosphere, highly detailed, no modern UI, portrait orientation. diff --git a/Maps/Valhold Map (Regional).md b/Maps/Valhold Map (Regional).md new file mode 100644 index 0000000..3f9745a --- /dev/null +++ b/Maps/Valhold Map (Regional).md @@ -0,0 +1,10 @@ +--- +type: map +map_type: regional prompt +--- + +# Valhold Map (Regional) + +## Prompt + +Hand-drawn fantasy capital city map on aged parchment, Valhold cliffside fortress city beside the Silver River. Include handwritten place names (small, medieval cartography style) for: **Blackthorn Keep**, **Spire of Silence**, **Gilded Market**, **Iron Quarter**, **Temple of the Seven**, **Dock Ward**, and the road links to **Eastmarch** and **Keth’s Landing**. Add streets, gates, and docks with clear ink linework, subtle noble symbols, ink wash shading, highly detailed, no modern elements, portrait orientation. diff --git a/NPCs/Ambassador Kael Vess.md b/NPCs/Ambassador Kael Vess.md new file mode 100644 index 0000000..21cd108 --- /dev/null +++ b/NPCs/Ambassador Kael Vess.md @@ -0,0 +1,54 @@ +--- +type: npc +role: "Kethran Ambassador" +location: "[[Freehold]]" +alignment: Lawful Good +race: Half-Elf +class: Bard (College of Eloquence) 8 +--- + +# Ambassador Kael Vess + +## Appearance + +A half-elf in his early 40s with impeccable posture, salt-and-pepper hair slicked back, and the easy smile of someone who's talked his way out of worse situations than this. He dresses in Kethran naval formalwear — a deep blue coat with silver buttons, polished to a mirror shine. A rapier hangs at his hip, more decorative than functional, but he knows how to use it. + +## Personality + +- **Charming** — genuinely likeable; even people who disagree with him enjoy his company +- **Sharp** — reads people exhaustively and remembers everything +- **Patriotic** — loves [[Kethra]] deeply and will not compromise its sovereignty +- **Humble** — despite his skill, he knows he's out of his depth with the seals and the cult; he's desperate for competent allies + +## Role in Campaign + +- Arc 2, Hook 6: Key figure at the peace summit in [[Freehold]] +- Can become the party's primary Kethran contact and ally +- Surviving him and winning his trust makes the World Council (Arc 4) significantly easier + +## The Peace Summit + +Vess genuinely wants peace. He's authorized by [[Queen Selara IV]] to negotiate, but he won't accept terms that subordinate Kethra to Valdris. Key negotiation points: + +| Issue | Valdris Position | Kethra Position | Compromise | +|-------|-----------------|-----------------|------------| +| Trade tariffs | Valdris controls rates | Joint commission | DC 16 Persuasion (either side) | +| Border forts | Valdris keeps them | Dismantle them | Shared garrisons; DC 18 | +| Naval rights | Valdris claims river access | Kethra claims coastal exclusivity | Treaty of mutual passage; DC 14 | +| War reparations | Valdris demands 50,000 gp | Kethra refuses | Split into trade credits over 10 years; DC 16 | + +If the party discovers cult involvement in the war's instigation, all DCs drop by 4. + +## Stat Block (CR 6) + +- **HP:** 55 | **AC:** 15 (leather + DEX) | **Speed:** 30 ft +- **Spellcasting:** Bard 8 (DC 15, +7). Key spells: *charm person, suggestion, tongues, dimension door, greater invisibility* +- **Silver Tongue:** Treats Persuasion and Deception rolls of 9 or lower as 10 +- **Unsettling Words:** As a bonus action, subtract 1d8 from a creature's next saving throw +- **Cutting Words:** Reaction to reduce attack roll, ability check, or damage roll by 1d8 + +## Secrets + +- Vess has a lover in [[Valdris]] — a noblewoman who would be ruined if the relationship were discovered. He's at the peace summit partially to be closer to her. +- He has proof that Valdrian merchants started the trade war deliberately (falsified cargo manifests). He hasn't shown this to anyone because it would scuttle the peace talks entirely. If the party earns his trust, he shares it. +- He was an adventurer once, 15 years ago. His party died in a tomb raid. He carries one party member's signet ring on a chain around his neck and talks to it when he's alone. diff --git a/NPCs/Archdruid Thalindor.md b/NPCs/Archdruid Thalindor.md new file mode 100644 index 0000000..107b858 --- /dev/null +++ b/NPCs/Archdruid Thalindor.md @@ -0,0 +1,45 @@ +--- +type: npc +role: "Verdant Circle Archdruid" +location: "Secret grove, [[Thronewood]]" +alignment: Neutral Good +race: Firbolg +class: Druid (Circle of the Moon) 18 +--- + +# Archdruid Thalindor + +## Appearance + +A firbolg of towering height (7'4") with moss-green skin, a mane of silver hair intertwined with living ivy, and eyes the color of ancient amber. He carries no staff — his hands *are* his focus — and small flowers bloom in his footsteps regardless of terrain. He speaks in a voice like wind through old trees: slow, resonant, and impossible to ignore. + +## Personality + +- **Ancient calm** — almost nothing surprises him; he's seen too many ages come and go +- **Burdened** — carries the weight of the Verdant Circle's secrets and failures +- **Gentle but absolute** — will never raise his voice, but will never change his mind once decided +- **Sad** — has outlived everyone he's ever loved, including two Dragon Lords + +## Role in Campaign + +- Arc 1-2: Mentioned by [[Elder Ylara Moongrove|Ylara]] as the Archdruid; his existence gives the Verdant Circle legitimacy +- Arc 3: Coordinates druidic support for the Rite of Seven Flames +- Arc 4: Leads the Verdant Circle contingent at the [[Freehold#World Council|World Council]] and the [[Citadel of Sundering|Citadel siege]] + +## Stat Block (CR 14 in humanoid form; CR 20 as elemental) + +- **HP:** 135 (18d8 + 54) | **AC:** 17 (bark skin + WIS) | **Speed:** 30 ft +- **Spellcasting:** Druid 18 (DC 20, +12). All druid spells up to 9th level. +- **Archdruid:** Unlimited Wild Shape (CR 6 and below). Preferred forms: earth elemental, giant crocodile, mammoth, giant eagle. +- **Circle of the Moon:** Bonus Action Wild Shape; can expend spell slots to heal in Wild Shape (1d8/slot level) +- **Nature's Sanctuary (always active):** Beasts and plants will not attack Thalindor unless magically compelled. DC 20 CHA save to overcome. + +## Key Spells Carried + +Always has prepared: *commune with nature, greater restoration, heal, plane shift, sunburst, foresight, shapechange* + +## Secrets + +- Thalindor was present at the creation of the Primordial Wrath. He is the last living being who remembers the First Sages by name. He has carried this guilt for 3,200 years. +- He knows the Elder Dark's true name — a word in a language that predates the multiverse. Speaking it aloud would give it a foothold in this reality. He has never told anyone. +- He is dying. The ancient magic that extends a firbolg's lifespan beyond its natural span has a cost: every Wild Shape takes months off his remaining time. When the seals are resolved (one way or another), he will walk into the [[Thronewood]] and become a tree. He's made his peace with it. diff --git a/NPCs/Aurathrax, the Stormbreaker.md b/NPCs/Aurathrax, the Stormbreaker.md new file mode 100644 index 0000000..e9a2ce9 --- /dev/null +++ b/NPCs/Aurathrax, the Stormbreaker.md @@ -0,0 +1,26 @@ +--- +type: npc +role: "Isolationist Dragon Lord" +location: Stormpeak Spire +alignment: Lawful Neutral +race: Ancient Blue Dragon +--- + +# Aurathrax, the Stormbreaker + +## Overview + +The oldest surviving Dragon Lord after [[Lythrendor, the Crystal Seer]]. Aurathrax is an isolationist who believes mortals are not worth the sacrifice dragonkind has made. He can be persuaded to support the Rite of Seven Flames in Arc 3, but it takes significant evidence and appeals to draconic honor rather than mortal need. + +**In Arc 3:** [[Arc 3 - Heart of the Mountain#Hook 10: The Draconic Court|The Draconic Court]] + +## Disposition + +- Initially skeptical: DC 22 Persuasion to gain his vote +- Reduced to DC 18 if the party has freed [[Khalyraxis, the Verdant Wing]] and another Dragon Lord vouches +- Reduced to DC 14 if [[Morgra, the Ashen Matron]]'s treachery is exposed (he hates traitors above all) +- He votes against the party by default + +## Stat Block: Ancient Blue Dragon (CR 23) + +Standard ancient blue dragon (MM p. 91) with Seal-Bound Aura (allies within 30 ft gain lightning resistance). diff --git a/NPCs/Captain Vara Holt.md b/NPCs/Captain Vara Holt.md new file mode 100644 index 0000000..9d3a504 --- /dev/null +++ b/NPCs/Captain Vara Holt.md @@ -0,0 +1,59 @@ +--- +type: npc +role: "Iron Concord Commander" +location: "[[Ironheart Mine]]" +alignment: Lawful Neutral +race: Human +class: Fighter (Battle Master) 8 +--- + +# Captain Vara Holt + +## Appearance + +A compact, athletic woman in her mid-30s with short auburn hair, a thin scar through her right eyebrow, and the weary eyes of someone who's seen too much combat. She wears Iron Concord officer's plate (matte gray with crimson pauldrons) and carries a longsword named *Contract's End*. + +## Personality + +- **Professional** — follows her contract to the letter; no more, no less +- **Suspicious** — knows something is wrong at Ironheart Mine but values her career over curiosity +- **Honor-bound** — will not betray her contract, but will not commit atrocities either +- **Conflicted** — the cult's presence troubles her, but "my orders are to guard the perimeter" + +## Role in Campaign + +- Arc 2 Hook 5: Ironheart Mine commander +- Can be persuaded, intimidated, or bypassed +- If persuaded: provides inside information about cult activities and stands aside during the party's assault +- If combat: fights as a CR 6 commander with 6 **veterans** (Iron Concord soldiers) +- Later arcs: If she lives and the party treated her honorably, she becomes an advocate for the Iron Concord at the [[Freehold#The World Council|World Council]] + +## Stat Block (CR 6) + +- **HP:** 85 (10d10 + 30) | **AC:** 19 (plate + shield) | **Speed:** 30 ft +- **Multiattack:** 3 longsword attacks (+7, 1d8+3 slashing) +- **Maneuvers (4d8 superiority dice):** Commander's Strike, Disarming Attack, Precision Attack, Riposte +- **Action Surge** (1/Rest), **Second Wind** (1/Rest) +- **Indomitable** (1 use) + +## How to Persuade (DC 15, advantage if party mentions any of these) + +- Mention cult involvement (she suspected, didn't want to believe) +- Show proof of the cult's larger conspiracy +- Offer to help her get out of the contract without penalty +- Appeal to her sense of honor: "Your contract says guard the mine from external threats. Cultists inside are not external threats — they're a betrayal of Iron Concord neutrality." + +## Outcome Table + +| Approach | DC | Result | +|----------|-----|--------| +| Demand surrender | 18 Intimidation | Holt stands down but won't help | +| Present evidence | 15 Persuasion | Holt provides intel, withdraws her troops | +| Attack outright | Combat | 1 commander + 6 veterans; Holt dies fighting | +| Bribe (500+ gp) | 12 Persuasion | Holt looks the other way (shameful) | + +## Secrets + +- She was promoted to Commander 3 months ago — the Ironheart contract was supposed to be her "easy first command." She knows it's her career on the line. +- Her younger brother serves in the [[Crown Concordat]] army. If she dies, he never gets her letters. +- She's been writing reports to [[General Markus Crane]] about "irregularities" for weeks. No one has responded. diff --git a/NPCs/Duke Edric Blackthorn.md b/NPCs/Duke Edric Blackthorn.md new file mode 100644 index 0000000..d9bcfe2 --- /dev/null +++ b/NPCs/Duke Edric Blackthorn.md @@ -0,0 +1,41 @@ +--- +type: npc +role: "Duke of Valdris" +location: "[[Valhold]]" +alignment: Lawful Neutral (wavering) +race: Human +class: Fighter (Battle Master) 11 +--- + +# Duke Edric Blackthorn + +## Appearance + +A lean, angular man in his early 50s. Close-cropped silver beard, piercing gray eyes, and impeccable posture. Always wears the Blackthorn signet ring (a thorned rose over a shield). Speaks with the weight of someone who expects to be obeyed. + +## Personality + +- **Proud** — believes in Valdris's supremacy within the [[Crown Concordat]] +- **Calculating** — weighs every alliance by cost and benefit +- **Short-tempered** — years of political warfare have worn his patience thin +- **Secretly afraid** — the cult's reach into his court terrifies him; he trusts no one + +## Role in Campaign + +- Offers party commission as Swordsworn Investigators ([[Arc 1 - Heirs of Sundering#Hook 4: The Lords' Summons|Hook 4]]) +- His court is infiltrated — the party must root out the cultist without triggering a diplomatic incident +- Arc 2: Pushes for war with [[Kethra]]; can be persuaded otherwise +- Arc 4: Leads the Crown Concordat forces at the [[World Council]] and the [[Citadel of Sundering]] + +## Stat Notes + +- **HP:** 95 | **AC:** 19 (plate + shield) | **Speed:** 30 ft +- **Multiattack:** 3 longsword attacks (+8, 1d8+4 slashing) +- **Maneuvers:** Commander's Strike, Parry, Riposte, Rally +- **Indomitable** (2 uses) + +## Secrets + +- One of his advisors — Chancellor Harlan — is a Witness of the [[The Hand of Ruin|Hand of Ruin]] (discovered in Arc 1 climax). +- He once had an affair with a Kethran diplomat; the resulting scandal fuels anti-Kethra sentiment. +- He genuinely wants to protect his people — but his pride makes him an easy mark for manipulation. diff --git a/NPCs/Elder Ylara Moongrove.md b/NPCs/Elder Ylara Moongrove.md new file mode 100644 index 0000000..0907237 --- /dev/null +++ b/NPCs/Elder Ylara Moongrove.md @@ -0,0 +1,40 @@ +--- +type: npc +role: "Druid Watcher of the Verdant Circle" +location: "[[Eastmarch]] outskirts" +alignment: Neutral Good +race: Half-Elf +class: Druid (Circle of the Land — Forest) 8 +--- + +# Elder Ylara Moongrove + +## Appearance + +A half-elf woman appearing to be in her 50s (actual age ~140). Silver hair woven with living vines, amber eyes that seem to glow faintly at night. Wears simple green robes and carries an oaken staff topped with a moonstone. + +## Personality + +- **Patient** — speaks slowly, chooses words with care +- **Kind but guarded** — protective of her secrets +- **Intensely focused** — when she senses elemental disturbance, nothing else matters +- **Maternal** — treats the party like wayward children who need guidance + +## Role in Campaign + +- Lore source: explains the seal anchors, the First Sages, and the nature of elemental binding +- Quest-giver: [[Arc 1 - Heirs of Sundering#Hook 2: The Weeping Sky|Hook 2 — The Weeping Sky]] +- Master of hidden knowledge: can identify the [[Cult Cipher]] as Ignan script and recommend translation in [[Valhold]] +- Rewards: [[Ring of the Verdant Eye]] if the party protects the seal anchor +- Revelation: After Arc 1 climax, reveals the existence of [[The Verdant Circle]] and directs the party to [[Ironheart Mine]] + +## Stat Notes + +- **HP:** 50 | **AC:** 14 (barkskin) | **Speed:** 30 ft +- **Spellcasting:** Druid 8 (DC 15, +7). Key spells: *cure wounds, moonbeam, call lightning, divination, commune with nature* + +## Secrets + +- She is a Watcher of the [[The Verdant Circle|Verdant Circle]] — a fact she only reveals after the party proves themselves. +- She once loved a Keeper of the Hand of Ruin, before they were corrupted. She still carries his pendant. +- She knows the location of all seven seal anchors — but will only reveal them one at a time. diff --git a/NPCs/General Markus Crane.md b/NPCs/General Markus Crane.md new file mode 100644 index 0000000..73332b7 --- /dev/null +++ b/NPCs/General Markus Crane.md @@ -0,0 +1,60 @@ +--- +type: npc +role: "Iron Concord High General" +location: "Freehold (Iron Concord headquarters)" +alignment: True Neutral +race: Human +class: Fighter (Banneret/Purple Dragon Knight) 15 +--- + +# General Markus Crane + +## Appearance + +A tall, weathered man in his late 60s with a shaved head, a neatly trimmed white beard, and calculating gray eyes. His left hand is a masterwork steel prosthetic (lost to a dragon's bite 20 years ago). He wears the Iron Concord's formal uniform — gray wool with crimson piping — but underneath, he still wears the chain shirt of his mercenary days. He carries no visible weapon, which makes him more intimidating, not less. + +## Personality + +- **Pragmatic** — everything has a price; sentiment is a liability +- **Tired** — has been fighting wars for 45 years; desperately wants to see peace before he dies +- **Paternal (in his own way)** — genuinely cares about his soldiers' welfare, even if he won't say so +- **Unsentimental** — will make brutal decisions if they save more lives than they cost + +## Philosophy + +> "I don't fight for kings or gods. I fight for the soldier next to me, and the one next to him, and the family waiting at home. I'll take any contract that brings my people back alive. If that makes me a mercenary, fine. But don't pretend your wars are nobler than my paychecks. We both trade lives for outcomes. I'm just honest about the price." + +## Role in Campaign + +- Mentioned throughout as the leader of the Iron Concord +- Arc 2: His soldiers are caught in the Ironheart Mine situation; how the party handles it determines his disposition +- Arc 4: Key figure at the [[Freehold#World Council|World Council]]; can be persuaded to end Iron Concord neutrality and join the final assault + +## Stat Block (CR 12) + +- **HP:** 152 (16d10 + 64) | **AC:** 18 (chain shirt + DEX + defensive fighting style) | **Speed:** 30 ft +- **Multiattack:** 3 attacks with his masterwork longsword (+11, 1d8+5 slashing) — the blade, *Grief's End*, is a +2 longsword that can cast *compelled duel* 1/day +- **Rallying Cry:** When he uses Second Wind, up to 3 allies within 60 ft regain HP equal to his fighter level (15) +- **Inspiring Surge:** When he uses Action Surge, one ally within 60 ft can make a weapon attack as a reaction +- **Bulwark:** When he uses Indomitable, one ally within 60 ft can also reroll a failed saving throw +- **Legendary Resistance** (2/Day) — he didn't survive 45 years of war by failing important saves + +## The World Council Decision + +At the [[Freehold#World Council|World Council]] (Arc 4, Hook 14), Crane's contribution — 1,500 mercenaries and a breach team — is valuable but not essential. The DC to persuade him depends on prior actions: + +| Party's Prior Actions | DC | +|----------------------|-----| +| Saved Vara Holt at Ironheart | 12 | +| Paid Iron Concord fairly throughout | 15 | +| Killed Holt / treated mercenaries as enemies | 25 (hostile) | +| Neutral / indifferent | 18 | + +If Crane joins: the Iron Concord breach team opens the initial entry point to the [[Citadel of Sundering]], reducing Tier 1's enemy count by half. +If Crane refuses: the Iron Concord contracts with the Hand of Ruin instead (highest bidder). They become Tier 1 reinforcements. + +## Secrets + +- His steel hand conceals a hidden blade (dagger, +9, 1d4+5 piercing, automatically hits on a handshake if the target is surprised). +- He has a grandson he's never met — the child lives on a farm in [[Valdris]], kept secret even from the Concord. The farm is in the path of the Citadel's descent. This is his real reason for joining the fight. +- He once refused a contract from the Hand of Ruin, 30 years ago, before he knew what they were. They killed his entire company in retaliation. The Iron Concord's current size and discipline are a direct response to that massacre. He has been waiting for a rematch. diff --git a/NPCs/High Pontiff Vosseth.md b/NPCs/High Pontiff Vosseth.md new file mode 100644 index 0000000..fe94818 --- /dev/null +++ b/NPCs/High Pontiff Vosseth.md @@ -0,0 +1,47 @@ +--- +type: npc +role: "Supreme Leader of the Hand of Ruin" +location: "[[Citadel of Sundering]]" +alignment: Chaotic Evil +race: Human (corrupted) +class: Divine Soul Sorcerer 14 / Fiend Warlock 6 +--- + +# High Pontiff Vosseth + +## Appearance + +Once a handsome middle-aged man; now transformed by centuries of dark rituals. His skin is cracked like dried earth, revealing faint elemental light beneath — shifting between fire, water, earth, and air. His eyes are pure black with pinprick white pupils. He wears robes of woven elemental silk that ripple and shift of their own accord. A crown of seven obsidian shards floats above his head — each shard representing one seal. + +## Personality + +- **Zealous** — genuinely believes the world must be unmade to be purified +- **Patient** — has worked toward this goal for 300 years; a few more weeks mean nothing +- **Charismatic** — can sway listeners with honeyed words before they realize the poison +- **Resonantly sane** — he is not raving mad; his logic is terrifyingly coherent + +## Philosophy + +> "The world is a wound that festers. The gods abandoned it. The Concordat bandages it with gold. The Circle puts it to sleep with herbs. Only fire cleanses. Only flood renews. Only the Wrath can tear down what must fall so something worthy can rise." + +## Role in Campaign + +- Mentioned throughout as the cult's supreme leader +- Arc 4: Final boss (either as pre-boss in Tier 4 or final boss in Tier 5 — DM choice) +- If faced in Tier 4 of the Citadel, he fights alongside [[Morgra, the Ashen Matron]] (or replaces her if she's dead) +- If the party reaches Tier 5 before confronting him, they fight the [[Primordial Wrath]] instead + +## Stat Notes (CR 20) + +- **HP:** 200 (20d8 + 80) | **AC:** 19 (elemental robes + DEX) | **Speed:** 30 ft, fly 30 ft (hover) +- **Spellcasting:** DC 20, +12. Key spells: *crown of stars* (active), *delayed blast fireball*, *forcecage*, *finger of death*, *horrid wilting* +- **Elemental Affinity:** Resistance to fire, cold, lightning, acid (switches randomly each round as a bonus action) +- **Sundering Word (Recharge 5-6):** 60 ft radius, DC 20 CON save. On failure, 8d10 force damage and stunned for 1 round. On success, half damage. +- **Legendary Actions (3):** Cast a cantrip, Sundering Ray (ranged spell attack +12, 4d10 force), Elemental Step (teleport 30 ft) +- **Hound of Ill Omen:** Can summon a dire wolf spirit (CR 7) as a bonus action + +## Secrets + +- Vosseth was once a member of the [[The Silent College|Silent College]] — an archivist who read too deeply in the Vault of Sundered Truths. +- He has not aged in 300 years because he bound his life force to the [[Primordial Wrath]]; killing the Wrath kills him. +- He secretly fears the Elder Dark. He believes freeing the Wrath will prove to the world that he was right — before the Elder Dark consumes everything. diff --git a/NPCs/Ignivar, the Betrayer.md b/NPCs/Ignivar, the Betrayer.md new file mode 100644 index 0000000..d6d7e6d --- /dev/null +++ b/NPCs/Ignivar, the Betrayer.md @@ -0,0 +1,54 @@ +--- +type: npc +role: "Fallen Dragon Lord" +location: "[[Crucible of Ash]]" +alignment: Chaotic Evil (former Chaotic Good) +race: Ancient Red Dragon (weakened) +status: dead (end of Arc 3 Hook 11, unless reasoned with) +--- + +# Ignivar, the Betrayer + +## Appearance + +Once a magnificent ancient red dragon, Ignivar is now a ruin of his former self. His scales are cracked and dull, seeping pale ash instead of fire. Two of his four horns are broken. His left wing is tattered beyond function. An obsidian collar fused into his neck anchors six chains that bind him to the walls of the [[Crucible of Ash]]. When he speaks, smoke and cinders trickle from his maw — but no flame. + +## Personality + +- **Resigned** — has had 500 years to think about his choices +- **Bitter** — blames the [[Dragon Lords]] for imprisoning him, not himself for betraying them +- **Surprisingly lucid** — the centuries of isolation have clarified his thinking, even if his conclusions remain monstrous +- **Regretful** — but not remorseful; he would do it again, just differently + +## Argument + +Ignivar's core argument (DC 22 Persuasion to challenge): + +> "The First Sages created the Wrath as a lock. They imprisoned an innocent being — the Wrath was born, not summoned — and forced it into eternal agony so they could hide from the Elder Dark. What is more evil: the beast who wants to be free, or the architects who built its cage? I broke the Pact because I refused to be a jailer of the innocent. Kill me if you must, but when you learn the truth — and you will — remember that I told you first." + +## Stat Block — Weakened (CR 16) + +- **HP:** 367 | **AC:** 19 | **Speed:** 30 ft (cannot fly) +- **Multiattack:** 2 attacks: Bite (+13, 2d10+7 piercing + 3d6 fire) and Claw (+13, 2d6+7 slashing) +- **Breath Weapon (Recharge 5-6):** 90 ft cone, 18d6 fire, DC 21 DEX half (weakened from 26d6) +- **Frightful Presence (DC 19 WIS):** Suppressed while at least 3 chains are intact +- **Chain Bindings:** 6 obsidian chains anchor Ignivar. Each has AC 15, 30 HP. Breaking all 6 removes Frightful Presence entirely and reduces his Multiattack to 1/round. Breaking 3 removes Legendary Actions. + +## Resolution + +| Outcome | Requirement | Result | +|---------|-------------|--------| +| Slay him | Combat to 0 HP | Emberheart claimed; Crucible collapses | +| Persuade him | DC 22 Persuasion + Elder Dark truth known | Ignivar yields Emberheart, provides Citadel intel | +| Challenge his logic | DC 18 Persuasion + compelling counterargument | He concedes partial fault; fights on but holds back (disadvantage on attacks) | +| Free him | Break all 6 chains, don't attack | He thanks the party, gives the Emberheart, and dies — his body was sustained only by the chains' magic | + +## Final Words (if slain) + +> *"Tell Morgra... the ash... remembers..."* + +## Secrets + +- Ignivar's betrayal was not purely ideological — he was also corrupted by the Elder Dark's whispers through the seal he guarded. He doesn't know this. His "truth" is partially manufactured by an entity that wanted the seals broken. +- [[Morgra, the Ashen Matron]] was his mate before his imprisonment. Her turn to the Hand of Ruin is rooted in grief. +- The Emberheart was forged in the same fire that first bound Ignivar to the Pact. It literally contains a fragment of his original, uncorrupted essence. diff --git a/NPCs/Keeper Malachar.md b/NPCs/Keeper Malachar.md new file mode 100644 index 0000000..9d33b4d --- /dev/null +++ b/NPCs/Keeper Malachar.md @@ -0,0 +1,56 @@ +--- +type: npc +role: "Cult Battle Captain" +location: "Various" +alignment: Lawful Evil +race: Human (corrupted) +class: Warlock (Fiend) 12 / Fighter 3 +status: alive until Arc 3 or Arc 4 +--- + +# Keeper Malachar + +## Appearance + +A towering figure in obsidian half-plate over black robes. His face is hidden behind a featureless iron mask — only his eyes are visible, glowing faintly orange. He carries a glaive named *Sunder* whose blade constantly drips molten metal. He never speaks above a whisper. + +## Personality + +- **Silent** — speaks only to give orders or deliver the Pontiff's judgment +- **Relentless** — once given a target, he does not stop until they are dead +- **Disciplined** — unlike fanatical cultists, Malachar treats his work as a profession; he is the Pontiff's executioner, not his worshipper +- **Fatalistic** — believes the world is ending and sees no point in hope; find peace in service + +## Role in Campaign + +- Mentioned in Arc 2 as commander of the Thronewood convoy +- Arc 3: Hunts the party at the [[Heart of the Mountain]], attacks during [[Arc 3 - Heart of the Mountain#Hook 13: The Rite of Seven Flames|the Rite of Seven Flames]] +- Arc 4: If not slain in Arc 3, returns as a CR 17 aspect in the [[Citadel of Sundering#Tier 2 — Hall of Echoes|Hall of Echoes]] + +## Stat Block — Arc 3 (CR 12) + +- **HP:** 150 (15d8 + 60) | **AC:** 19 (half-plate + shield) | **Speed:** 30 ft +- **Multiattack:** 3 attacks: 2 glaive (+9, 1d10+5 slashing + 1d6 fire) + 1 Eldritch Blast (2 beams, +8, 1d10+4 force) +- **Sunder Strike (Recharge 5-6):** Melee weapon attack +9, 4d10+5 slashing + 3d6 fire. Target must make DC 17 CON save or be stunned until end of Malachar's next turn. +- **Arcane Ward (Reaction):** When targeted by a spell, Malachar gains advantage on the saving throw and resistance to the spell's damage. +- **Action Surge** (1/Rest) + +## Stat Block — Arc 4 Aspect (CR 17) + +If Malachar is slain in Arc 3, [[High Pontiff Vosseth]] raises him as a champion of the Wrath for the final siege: + +- **HP:** 200 | **AC:** 21 | Gains immunity to fire and necrotic +- **Sunder Strike** now recharges on 4-6 instead of 5-6, deals +2d10 force damage +- **Chaos Infusion:** As a bonus action, Malachar teleports 60 ft and his next attack is a critical hit on 18-20. +- **Elemental Aura:** Creatures that start their turn within 10 ft take 2d10 random elemental damage. + +## Loot + +- **[[Sunder]]** — a +2 glaive. On a critical hit, the target must make DC 15 CON save or take an additional 3d6 fire damage and be unable to regain HP until the start of Malachar's next turn. +- **Signet of the Keeper** — grants the wearer advantage on saving throws against being frightened. + +## Secrets + +- Malachar was once a general of the [[Crown Concordat]]. He defected after the Concordat sacrificed his company to win a meaningless battle. The Pontiff found him on the verge of suicide and gave him a new purpose. +- His iron mask is a punishment, not a choice — it is seared to his face with primordial fire. Removing it would kill him. +- He knows the full truth about the Elder Dark and considers the Hand of Ruin the lesser evil. diff --git a/NPCs/Keeper Valdrek.md b/NPCs/Keeper Valdrek.md new file mode 100644 index 0000000..96b557d --- /dev/null +++ b/NPCs/Keeper Valdrek.md @@ -0,0 +1,56 @@ +--- +type: npc +role: "Regional Cult Leader" +location: "[[Valhold]]" +alignment: Chaotic Evil +race: Human +class: Warlock (Fiend) 9 +status: dead (end of Arc 1) +--- + +# Keeper Valdrek + +## Appearance + +A gaunt, hollow-eyed man in his 40s with ritual scarification covering his arms — seven spiraling cracks carved into his skin, one per seal. His voice is a hoarse whisper from years of chanting. He wears the black robes of a Keeper, with four of seven cracks filled in with silver thread. + +## Personality + +- **True believer** — genuinely thinks he's saving the world +- **Unstable** — years of channeling primordial energy have frayed his sanity +- **Cruel but not sadistic** — he kills efficiently, not for pleasure +- **Desperate** — fears failure above all else; the Pontiff does not tolerate it + +## Role in Campaign + +- Mastermind of the Eastmarch plot (Hook 1-3 of Arc 1) +- Traced to Valhold after the party follows clues +- Arc 1 climax boss: found in the Undercroft of [[Valhold]], mid-ritual to crack the second seal + +## Stat Block (CR 8) + +- **HP:** 104 (16d8 + 32) | **AC:** 16 (mage armor + DEX) | **Speed:** 30 ft +- **Spellcasting:** Warlock 9 (DC 15, +7). 2 spell slots (5th level). Pact of the Chain (imp familiar — **Krazik**, a crow with glowing red eyes). +- **Key Spells:** *fireball, wall of fire, hold monster, banishment, investiture of flame* +- **Invocation: Agonizing Blast** — Eldritch Blast deals +4 CHA damage per beam (2 beams) +- **Invocation: Devil's Sight** — sees through magical darkness +- **Ritual Channel (Lair Action, Initiative 20):** While in the Undercroft, Valdrek can use the seal anchor's energy to cast *darkness* (centered on a point he can see) or deal 2d10 force damage to all creatures within 10 ft of the obelisk. + +## Combat Tactics + +- Opens with *wall of fire* to divide the party +- Uses *hold monster* on the party's highest damage dealer +- Sends Krazik (imp familiar) to harass spellcasters with stings (3d6 poison) +- At 25% HP: offers to betray the Pontiff in exchange for his life (bluff — he's too terrified of Vosseth to actually do it) + +## Loot + +- **Cult Cipher** (finally decipherable — spells out the Hand of Ruin's full plan) +- **Keeper's Grimoire** — contains 3rd-5th level warlock spells for copying; also contains a personalized note from [[High Pontiff Vosseth]]: *"The seals crack one by one. You will be the hand that breaks the second. Do not fail me, Valdrek. The Wrath does not forgive."* +- **Signet Ring of the Hand** — a black iron band with the spiral sigil. Grants advantage on Deception checks when posing as a cult member. + +## Secrets + +- Valdrek was once a respected scholar at the [[The Silent College|Silent College]] — he found the same forbidden texts Vosseth did. +- He joined the Hand of Ruin to save his wife from a terminal illness. The Pontiff "cured" her — by turning her into a spawn that Valdrek keeps chained in his quarters, feeding it prisoners he takes. +- His final words are never defiance. They are: *"I just wanted to save her."* diff --git a/NPCs/Khalyraxis, the Verdant Wing.md b/NPCs/Khalyraxis, the Verdant Wing.md new file mode 100644 index 0000000..422f565 --- /dev/null +++ b/NPCs/Khalyraxis, the Verdant Wing.md @@ -0,0 +1,44 @@ +--- +type: npc +role: "Adult Copper Dragon Lord" +location: "[[Heart of the Mountain]] (primarily); [[Thronewood]] (introduced)" +alignment: Chaotic Good +race: Adult Copper Dragon +--- + +# Khalyraxis, the Verdant Wing + +## Appearance + +A sleek copper dragon with scales that shift between verdigris green and warm copper depending on the light. Her wings have a translucent emerald membrane, and her eyes are molten gold. When she laughs (often), a faint acidic mist curls from her nostrils. In humanoid form, she appears as a copper-haired elven woman with green-flecked eyes. + +## Personality + +- **Witty and playful** — loves riddles, wordplay, and laughing at her own jokes +- **Fiercely protective** — of her territory, her allies, and the innocent +- **Unconventional** — the youngest Dragon Lord; the others see her as reckless +- **Traumatized** — her capture by the Hand of Ruin left psychological scars; she masks it with humor + +## Role in Campaign + +- Arc 2: Captured by the Hand of Ruin; rescued in [[Arc 2 - The Gilded War#Hook 8: Ambush at Thronewood|Hook 8]] +- Becomes the party's guide and ally for the rest of the campaign +- Reveals the truth about the [[Primordial Wrath]] and the Elder Dark +- Advocates for the party before the [[Dragon Lords|Draconic Court]] +- Arc 4: Fights alongside the party at the Citadel + +## Stat Blocks + +### Dragon Form (Adult Copper Dragon) +- **CR:** 14 | **HP:** 184 | **AC:** 18 +- **Breath Weapons:** Acid (60 ft line, 12d8, DC 18 DEX) and Slowing Gas (60 ft cone, DC 18 CON, creatures can't take reactions, speed halved, only one attack if Multiattack) + +### Humanoid Form +- Uses the **archmage** stat block with Copper Dragon spell adjustments +- Prefers non-lethal solutions when possible + +## Secrets + +- She was the First Sages' favorite — chosen as the youngest Dragon Lord specifically because her playfulness balanced the others' severity. +- She carries a scale from the original First Sage, [[Sage Aurion]], embedded in her chest — it allows her to sense seal disturbances. +- Her true name, spoken in Draconic, is three syllables long — she's never told anyone. diff --git a/NPCs/Librarian Thessa.md b/NPCs/Librarian Thessa.md new file mode 100644 index 0000000..33ee5c9 --- /dev/null +++ b/NPCs/Librarian Thessa.md @@ -0,0 +1,60 @@ +--- +type: npc +role: "Silent College Librarian" +location: "[[Spire of Silence]], [[Valhold]]" +alignment: Lawful Neutral +race: High Elf +class: Wizard (Divination) 10 +--- + +# Librarian Thessa + +## Appearance + +A high elf woman whose apparent age is impossible to determine — somewhere between 30 and 300. Silver-white hair pulled into a severe bun, spectacles made of magically hardened crystal, and ink-stained fingers. Always wears the gray robes of the [[The Silent College|Silent College]] with a librarian's badge (an open book with a closed eye). + +## Personality + +- **Obsessively organized** — every scroll, book, and note in her library has a specific place; she notices immediately if anything is moved +- **Cryptic** — answers questions with questions; believes knowledge should be earned, not given +- **Secretly rebellious** — disagrees with the College's policy of hiding the truth about the seals +- **Loyal** — once she decides to help the party, she goes all in, even if it costs her position + +## Role in Campaign + +- Arc 1: Translates the [[Cult Cipher]] for the party (ses 3 days of research, DC 18 Arcana) +- Provides access to restricted texts about the First Sages (if persuaded) +- Arc 2-4: Acts as the party's research contact — sending messages with relevant lore as they travel +- Arc 4 climax: Defies the Archmage and opens the Vault of Sundered Truths to the party + +## The Vault of Sundered Truths + +Thessa has access to the restricted sub-basement. Key texts: + +| Text | Contents | Required to Access | +|------|----------|-------------------| +| *Codex of the First Sages* | Full history of the seal anchors, the creation of the Primordial Wrath | Arc 1 (DC 18 Persuasion) | +| *Treatise on Elemental Binding* | Mechanics of the Rite of Seven Flames, Dragon Lord lore | Arc 2 (DC 15, easier after party proves themselves) | +| *The Sundering Prophecies* | Fragmented visions of possible futures; mentions the Elder Dark | Arc 3 (granted freely as the world starts ending) | + +## Favor Scale + +| Threshold | Reward | +|-----------|--------| +| 1 favor (translate cipher) | Free translation services | +| 3 favors (bring her artifacts, rare books, or cult intelligence) | Access to common and uncommon spell scrolls at College prices (no markup) | +| 5 favors + proven trustworthiness | Full Vault access, rare scrolls at cost | +| 7 favors + saved the world | Thessa leaves the College to become the party's personal archivist (epilogue) | + +## How to Earn Favor + +- Bring her the [[Cult Cipher]] (+1) +- Recover a First Sage artifact and donate it to the library (+1) +- Provide cult intelligence that helps the College (+1 per significant report) +- Protect her during the [[Citadel of Sundering|Citadel siege]] (if she joins) (+2) + +## Secrets + +- Thessa has a photographic memory. She has read every book in the Spire of Silence. She knows what the College is hiding and has been waiting decades for someone to ask the right questions. +- She is the great-granddaughter of one of the First Sages. The College hides this shamefully — they consider lineage claims "unscientific." +- She has never left the Spire of Silence. The outside world terrifies her. If she joins the party in Arc 4, it's because she's more afraid of what happens if she doesn't. diff --git a/NPCs/Lythrendor, the Crystal Seer.md b/NPCs/Lythrendor, the Crystal Seer.md new file mode 100644 index 0000000..d1618b0 --- /dev/null +++ b/NPCs/Lythrendor, the Crystal Seer.md @@ -0,0 +1,50 @@ +--- +type: npc +role: "Antiquated Crystal Dragon Lord" +location: "[[Heart of the Mountain]]" +alignment: Lawful Good +race: Ancient Crystal Dragon +--- + +# Lythrendor, the Crystal Seer + +## Appearance + +A crystalline dragon whose body is composed of translucent gemstone that refracts light into prismatic patterns. His eyes are deep violet pools that seem to contain galaxies. His voice resonates like a struck crystal glass — clear, harmonic, and slightly unnerving. In humanoid form, he is an elderly man with crystalline growths replacing patches of skin. + +## Personality + +- **Prophecy-burdened** — has seen too many futures; speaks in conditional tenses +- **Tired** — oldest of the Dragon Lords; has been guardian for 3,200 years +- **Gentle** — despite his power, he treats mortals with genuine respect +- **Enigmatic** — rarely gives a straight answer when a riddle will do + +## Role in Campaign + +- Arc 3: Sits on the Draconic Court; immediate ally to the party +- Provides prophetic guidance — vague but useful hints about upcoming dangers +- Fights alongside the party against [[Morgra, the Ashen Matron|Morgra]] at the Court +- Arc 4: Leads the Dragon Lord contingent at the Citadel sieges + +## Prophecies (d4 hints per session) + +| d4 | Prophecy | +|----|----------| +| 1 | "The betrayer wears a friend's face. Trust the one you least expect." | +| 2 | "Four will fall before three can stand. The order matters." (seal order) | +| 3 | "Fire answers fire, but only ash remembers. Seek the Crucible." | +| 4 | "The Pontiff does not fear death. He fears being forgotten. Use this." | + +## Stat Block — Ancient Crystal Dragon (CR 23) + +- **HP:** 487 | **AC:** 21 | **Speed:** 40 ft, burrow 40 ft, fly 80 ft +- **Breath Weapon (Recharge 5-6):** 90 ft cone of prismatic light, 14d8 radiant damage (DC 22 DEX half). Creatures that fail are also blinded for 1 minute (save ends at end of each turn). +- **Crystalline Reflection:** As a reaction when targeted by a spell, Lythrendor can reflect it back at the caster. Recharge 5-6. +- **Prophetic Insight (3/Day):** As a legendary action, Lythrendor grants an ally within 60 ft advantage on their next attack roll, saving throw, or ability check. +- **Legendary Actions (3):** Tail Attack, Wing Attack (2 actions), Prophetic Insight + +## Secrets + +- He has foreseen his own death — in the Citadel of Sundering, saving the party. He has made peace with it. +- He was the one who proposed the Pact of Seven Flames to the First Sages. He carries the guilt of every Dragon Lord who has fallen. +- His crystal body contains memories of the First Sages — if he is shattered, the memories are released as a one-time *legend lore* effect. diff --git a/NPCs/Marshal Aldren Voss.md b/NPCs/Marshal Aldren Voss.md new file mode 100644 index 0000000..acb3425 --- /dev/null +++ b/NPCs/Marshal Aldren Voss.md @@ -0,0 +1,51 @@ +--- +type: npc +role: "Eastmarch Garrison Commander" +location: "[[Eastmarch]]" +alignment: Lawful Good +race: Human +class: Fighter (Champion) 7 +--- + +# Marshal Aldren Voss + +## Appearance + +A broad-shouldered human in his late 40s. Gray-streaked brown hair cropped short, a faded scar across his left cheek, and tired eyes. Always in half-plate even when off duty. Speaks in clipped, direct sentences. + +## Personality + +- **Duty-bound** — lives by the code of the Crown Concordat garrison +- **Overworked** — responsible for Eastmarch's safety with insufficient resources +- **Grateful for help** — genuinely cares about the townsfolk; frustrated he can't do more +- **Pragmatic** — willing to bend regulations to get things done + +## Role in Campaign + +- Primary quest-giver in Arc 1 +- Offers 200 gp per head for the missing caravan ([[Arc 1 - Heirs of Sundering#Hook 1: The Missing Caravan|Hook 1]]) +- Provides the Duke's commission ([[Arc 1 - Heirs of Sundering#Hook 4: The Lords' Summons|Hook 4]]) +- If he survives, commands a battalion in the [[Arc 4 - Tide of Ruin#Hook 15: The Storming of the Citadel|Citadel siege]] + +## Quests Given + +| Quest | Reward | +|-------|--------| +| Missing Caravan | 200 gp per party member, Cult Amulet clue | +| Storm Investigation | [[Ring of the Verdant Eye]] (from Ylara, on his recommendation) | +| Well Investigation | Safe haven in Eastmarch, free healing from Mira | + +## Stat Notes + +- **HP:** 65 | **AC:** 18 (half plate) | **Speed:** 30 ft +- **Str:** +3 | **Dex:** +1 | **Con:** +2 | **Int:** +1 | **Wis:** +2 | **Cha:** +1 +- **Multiattack:** 2 longsword attacks (+6, 1d8+3 slashing) +- **Second Wind** (1/Rest) +- **Action Surge** (1/Rest) +- **Leadership:** As a bonus action, grant +1d4 to attack rolls or saving throws to allies within 30 ft for 1 minute (1/Short Rest). + +## Secrets + +- He suspects the Duke's court is compromised but has no proof. +- His wife died five years ago to a plague; he throws himself into duty to cope. +- He knows the Old Soldiers' Pass — a secret route to [[Valhold]] that avoids the main roads. diff --git a/NPCs/Mira Thorne.md b/NPCs/Mira Thorne.md new file mode 100644 index 0000000..da62105 --- /dev/null +++ b/NPCs/Mira Thorne.md @@ -0,0 +1,50 @@ +--- +type: npc +role: "Eastmarch Healer" +location: "[[Eastmarch]]" +alignment: Neutral Good +race: Halfling +class: Cleric (Life Domain) 4 +--- + +# Mira Thorne + +## Appearance + +A stout halfling woman in her early 40s with rosy cheeks, flour-dusted hands (she bakes when stressed), and kind brown eyes permanently crinkled from smiling. She wears practical healer's robes over a homespun dress and keeps bandages, herbs, and snacks in the many pockets of her apron. + +## Personality + +- **Nurturing** — mothers everyone within range, including the party +- **Fierce when provoked** — her protective instinct overrides her gentle nature if children or the helpless are threatened +- **Gossip** — knows everyone's business in Eastmarch; a valuable source of rumors +- **Unflappable** — has seen too much death and illness to be rattled by much + +## Role in Campaign + +- Arc 1, Hook 3: Reports the poisoned well and missing child +- Source of local rumors (roll 1d6 on the [[Eastmarch#Rumors Table (d6)|Eastmarch Rumors Table]]) +- After Hook 3 resolved: free healing (basic) and discounted potions for the party + +## Stat Block + +- **HP:** 27 | **AC:** 13 | **Spellcasting:** Cleric 4 (DC 13, +5) +- **Key Spells:** *cure wounds, healing word, lesser restoration, prayer of healing, zone of truth* +- **Disciple of Life:** Healing spells restore an additional 2 + spell level HP + +## Services (Post-Hook 3) + +| Service | Price | +|---------|-------| +| *Cure wounds* (1st level) | Free (first 2/day), 10 gp after | +| *Lesser restoration* | 20 gp | +| *Prayer of healing* | 30 gp | +| Potion of healing | 40 gp (normally 50) | +| Herbalism kit training | 50 gp + 10 days | +| Eastmarch gossip | Free (she loves talking) | + +## Secrets + +- Her husband died in the same plague that killed [[Marshal Aldren Voss|Marshal Voss's]] wife. She and Voss have never acknowledged their shared grief — they just make sure the other is okay. +- She trained briefly at a temple in [[Valhold]] but left because "the high priestesses were too busy praying to actually heal anybody." +- She knows the marshes east of town hide a smuggler's route into [[Kethra]]. If the party needs to cross the border quietly, she can draw them a map. diff --git a/NPCs/Mistress Veyla.md b/NPCs/Mistress Veyla.md new file mode 100644 index 0000000..f4e5865 --- /dev/null +++ b/NPCs/Mistress Veyla.md @@ -0,0 +1,58 @@ +--- +type: npc +role: "Cult Warlock, Sunken Spire Leader" +location: "[[Sunken Spire]]" +alignment: Chaotic Evil +race: Half-Elf (Sea) +class: Warlock (Deep One) 11 +status: dead (end of Arc 2 Hook 7) +--- + +# Mistress Veyla + +## Appearance + +A sea half-elf with pale blue-gray skin, kelp-green hair, and completely black eyes without visible pupils or sclera. Faint bioluminescent patterns trace her cheekbones and forearms, pulsing in rhythm with the tides. She moves with an unsettling, fluid grace — as if she has spent so long underwater that walking feels unnatural. + +## Personality + +- **Serene** — speaks in calm, almost hypnotic tones even while ordering murders +- **Obsessive** — fixated on "the song of the deep," a telepathic call she believes comes from the [[Primordial Wrath]] +- **Isolationist** — prefers the company of sea creatures to people; considers surface-dwellers a plague +- **Pitying** — genuinely believes drowning the world would be a mercy + +## Role in Campaign + +- Arc 2 Hook 7 boss: leader of the Sunken Spire cell +- Guards the seal anchor; her ritual has been ongoing for 2 weeks when the party arrives +- Carries intelligence about the Thronewood convoy on her body + +## Stat Block (CR 11) + +- **HP:** 140 (20d8 + 40) | **AC:** 17 (mage armor + DEX) | **Speed:** 30 ft, swim 40 ft +- **Damage Resistance:** cold +- **Amphibious:** Can breathe air and water +- **Spellcasting:** Warlock 11 (DC 17, +9). 3 spell slots (5th level). Invocations: Agonizing Blast, Lance of Lethargy, Tomb of Levistus. +- **Cantrips:** *eldritch blast* (3 beams), *minor illusion*, *chill touch* +- **Spells:** *armor of agathys, hunger of hadar, summon greater demon, cone of cold, evard's black tentacles, scrying* +- **Drown (Recharge 6):** Ranged spell attack +9, 60 ft. On hit: 3d10 cold damage and target's lungs fill with seawater. Target begins suffocating and can use an action to make a DC 17 CON save to expel water. +- **Call the Deep (1/Day):** Summons 1d4+2 **merrow** or 1 **water elemental**. Replaces any active summons. + +## Combat Tactics + +- Pre-casts *armor of agathys* (5th level: 25 temp HP, 25 cold damage to attackers) +- Opens with *hunger of hadar* centered on the party, then uses *eldritch blast* to push creatures back into it +- Uses *summon greater demon* (barlgura or vrock) when below 50% HP as a desperation play +- If reduced to 25% HP and not subdued: tries to collapse the chamber, drowning everyone (DC 18 INT (Arcana) to stop, requires 3 party members to disrupt ritual circles simultaneously) + +## Loot + +- **[[Tideheart Pearl]]** (see Items) +- **Veyla's Logbook:** A water-proofed journal documenting seal instability readings, cult communications, and a personal note: *"The song grows louder. Soon the whole world will hear it. I envy those who drown — they taste the deep first."* +- **Cult Dispatch:** Signed orders from Keeper Malachar directing the Thronewood convoy route and schedule. + +## Secrets + +- Veyla was born on land. She joined the Hand of Ruin after the [[Crown Concordat]] executed her father — a Kethran fisherman accused of spying. She watched him hang from a pier as the tide rose around his feet. +- The "song" she hears is real — it's a telepathic echo of the Primordial Wrath's pain, bleeding through the cracked seal. Other creatures with telepathic sensitivity can hear it faintly. +- She never learned to swim until she was 30. She drowned herself in a ritual to prove her faith to the Pontiff, and the Wrath brought her back. diff --git a/NPCs/Morgra, the Ashen Matron.md b/NPCs/Morgra, the Ashen Matron.md new file mode 100644 index 0000000..c8cef74 --- /dev/null +++ b/NPCs/Morgra, the Ashen Matron.md @@ -0,0 +1,54 @@ +--- +type: npc +role: "Traitor Dragon Lord" +location: "[[Ashveil Caldera]] / [[Citadel of Sundering]]" +alignment: Chaotic Evil +race: Ancient Red Dragon +--- + +# Morgra, the Ashen Matron + +## Appearance + +An immense ancient red dragon whose crimson scales are veined with black, like cooling magma. Her horns sweep back in a crown-like formation, and a permanent haze of heat shimmers around her. In humanoid form, she appears as a regal woman in her 40s with copper-red hair, black nails like talons, and eyes that literally smolder. + +## Personality + +- **Arrogant** — believes dragons are the rightful rulers of Aethrune +- **Patient** — she has waited millennia; a few more years are nothing +- **Cruel** — enjoys psychological torment as much as physical +- **Charismatic** — can sway even other Dragon Lords with her silver tongue + +## Motivation + +> "For three thousand years I have guarded a prison I did not build, for mortals who do not deserve our protection, bound by a pact I did not choose. Tell me, little creature — would you not break your chains?" + +## Role in Campaign + +- Arc 3: Sits on the Draconic Court; opposes the party at every turn +- Arc 3 climax: Reveals treachery, attacks the Heart of the Mountain with her brood +- If she escapes (flees at 25% HP), she becomes a boss in Arc 4 Tier 4 + +## Stat Block — Ancient Red Dragon (CR 24) + +- **HP:** 546 | **AC:** 22 | **Speed:** 40 ft, climb 40 ft, fly 80 ft +- **Standard Ancient Red Dragon** stat block (MM p.97) with the following additions: + +**Seal-Bound Aura (corrupted):** Instead of granting resistance to allies, her aura inflicts vulnerability to fire damage to creatures of her choice within 30 ft (DC 21 CHA save each round to resist). + +**Seal Fracture (Recharge 6, replaced Fire Breath when seal energy is available):** 90 ft cone, 26d6 force damage (DC 24 DEX half). This attack cracks seal anchors and cannot be used against other targets. + +**Legendary Actions (3):** Tail Attack, Wing Attack (2 actions), Elemental Roar (3 actions — 60 ft cone, DC 21 CON, 6d6 thunder + deafened for 1 minute). + +## Tactics + +- Opens with Seal Fracture to weaken the party and battlefield simultaneously. +- Uses flight and hit-and-run tactics; never stays in melee for long. +- Prioritizes healers and spellcasters. +- At 25% HP: casts *plane shift* on herself to escape to the Citadel of Sundering (unless prevented by *counterspell* or similar magic). + +## Secrets + +- She was in love with [[Ignivar, the Betrayer]] — his imprisonment drove her toward the Hand of Ruin. +- She knows the location of all seven seal anchors and has been feeding coordinates to [[High Pontiff Vosseth]] for 200 years. +- Her true dragon name — spoken only once in three millennia — means "Ash That Remembers Flame." diff --git a/NPCs/Primordial Wrath.md b/NPCs/Primordial Wrath.md new file mode 100644 index 0000000..5d37051 --- /dev/null +++ b/NPCs/Primordial Wrath.md @@ -0,0 +1,83 @@ +--- +type: npc +role: "Primordial Titan / Final Boss" +alignment: Chaotic Neutral (unthinking force of nature) +race: Primordial +--- + +# Primordial Wrath + +## Overview + +The Primordial Wrath is not a thinking being — it is a force of nature given form. Created by the First Sages 3,200 years ago, it was designed as a living lock: a being of pure elemental chaos placed over a planar rift to seal away the **Elder Dark**, a cosmic entity of entropy that predates the multiverse. The Wrath has been imprisoned for so long that it has forgotten its purpose. It knows only pain, fury, and the desperate need to escape. + +If freed, the Wrath will not negotiate, scheme, or monologue. It will simply destroy — lashing out at everything until it exhausts itself, at which point the Elder Dark will consume it from within and emerge into a defenseless world. + +## The Elder Dark + +A being that the First Sages could not kill — only imprison. The Elder Dark is entropy incarnate: the inevitable heat death of all things given consciousness and hunger. It has been feeding on the Wrath's elemental energy for three millennia. If the Wrath is destroyed or freed, the Elder Dark gains a foothold in the Material Plane. + +### Why This Matters + +- It gives the campaign stakes beyond "stop the cult." +- It creates moral complexity: the Wrath is sympathetic (it was created to suffer) but dangerous (it can't be reasoned with). +- It prevents a boring "just kill it" solution. The party must choose between sealing (preserving an unjust prison), destroying (unleashing something worse), or ascending (sacrificing a party member to replace the Wrath). + +## Phase 1 — The Titan (CR 26) + +The Wrath's physical form — a 50-foot humanoid of churning elemental matter. It has no face, only a vortex of fire, water, earth, and air where a head should be. + +- **HP:** 536 (32d20 + 196) | **AC:** 22 (elemental barrier) | **Speed:** 60 ft, fly 120 ft (hover) +- **Damage Immunities:** poison, psychic; bludgeoning, piercing, and slashing from nonmagical attacks +- **Condition Immunities:** charmed, frightened, paralyzed, petrified, poisoned, stunned +- **Senses:** truesight 120 ft, passive Perception 20 +- **Languages:** understands Primordial but cannot speak + +### Actions + +- **Multiattack:** 3 Slam attacks (+16, reach 15 ft, 4d12+8 force damage) OR 2 Elemental Lash (+16, reach 30 ft, 6d10 of chosen element: fire/cold/lightning/acid) +- **Chaos Wave (Recharge 5-6):** 60 ft cone. DC 24 DEX save. 16d8 damage of a random element (roll d4). Half on success. +- **Seal Fracture:** As an action, the Wrath targets one seal anchor within 120 ft. The seal begins cracking. At the start of the Wrath's next turn, if the party hasn't disrupted the crack (DC 20 Arcana as an action, or deal 30+ damage to the crack in one turn), the seal shatters permanently. + +### Legendary Actions (3/Round) + +| Action | Cost | Effect | +|--------|------|--------| +| Elemental Shift | 1 | Teleport 60 ft, change its elemental resistance | +| Slam | 1 | One Slam attack | +| Chaos Pulse | 2 | Every creature within 30 ft takes 4d10 force damage (DC 22 DEX half) | +| Anchor Shatter | 3 | Automatically shatter one damaged seal anchor | + +### Lair Actions (Initiative 20) + +- **Wild Magic Surge:** Roll on Wild Magic table (PHB p.104). Affects all creatures within 300 ft. +- **Elemental Absorption:** The Wrath heals 20 HP for each source of elemental damage it takes this round. +- **Planar Rift:** A 10 ft rift opens beneath one creature. DC 20 DEX save or fall into the Elemental Chaos (1 round of 6d10 random elemental damage, then ejected 30 ft away, prone). + +## Phase 2 — The Chaos Heart (CR 28, Mythic) + +When the Titan reaches 0 HP, its form collapses and the Chaos Heart is revealed — a 10-foot sphere of pure elemental chaos, floating at the center of the chamber. The Chaos Heart cannot move but radiates overwhelming energy. + +- **HP:** 300 | **AC:** 25 (pure energy) | **Speed:** 0 ft (stationary) +- **Damage Immunity:** all damage except force and magical bludgeoning/piercing/slashing from artifact weapons +- **Vulnerability:** force damage from the [[Emberheart]] (deals double) + +### Actions + +- **Chaos Eruption (every round):** All creatures within 120 ft take 30 (4d12+4) force damage. DC 24 DEX save for half. This damage increases by 1d12 each round of combat. +- **Elemental Flood (Recharge 6):** A 30 ft radius sphere erupts in one element. DC 24 save of appropriate ability. 20d8 damage on failure, half on success. +- **Entropic Grasp (Recharge 5-6):** Target creature within 60 ft must make DC 24 CON save. On failure, 10d12 necrotic and target's maximum HP is reduced by that amount. On success, half damage and no HP reduction. + +### The Solution + +The Chaos Heart cannot be killed by damage alone. The party must choose one of the endings described in [[Arc 4 - Tide of Ruin#Hook 17: The Final Choice|Arc 4, Hook 17]]: +- **Re-Seal:** Perform the Rite of Seven Flames while the Emberheart is held against the Chaos Heart. +- **Destroy:** Throw the Emberheart into the Chaos Heart. +- **Ascend:** One willing character touches the Chaos Heart and makes a DC 25 CHA save. + +## DM Notes + +- This is a level 20 boss fight. Go all out. +- The Wrath does not speak. Use description to convey its nature — the mountains trembling, the sky splitting, the elements themselves screaming. +- Let the party's preparation matter. If they recruited all factions, the allied army buys them time. If they secured all Dragon Lords, the Rite is easier. If they have the Emberheart, they have options. +- The Chaos Heart phase should feel desperate. The damage ramps up each round. The party must act decisively. diff --git a/NPCs/Queen Selara IV.md b/NPCs/Queen Selara IV.md new file mode 100644 index 0000000..39413f9 --- /dev/null +++ b/NPCs/Queen Selara IV.md @@ -0,0 +1,40 @@ +--- +type: npc +role: "Kethran Queen" +location: "[[Keth's Landing]]" +alignment: Lawful Good +race: Human +class: Cleric (War Domain) 9 / Fighter 3 +--- + +# Queen Selara IV + +## Appearance + +A tall, sharp-featured woman in her mid-40s with dark skin, silver-streaked black hair worn in tight braids, and commanding amber eyes. She dresses in naval-inspired formal wear — high-collared coats with gold epaulets — and always carries her father's cutlass, *Tidebreaker*, at her hip. + +## Personality + +- **Pragmatic** — governs with spreadsheets as often as decrees +- **Fiercely independent** — Kethra will not be anyone's vassal +- **Surprisingly warm** — in private, she has a dry wit and genuine care for her people +- **Holds grudges** — the Crown Concordat has slighted Kethra for decades; trust is earned slowly + +## Role in Campaign + +- Arc 2: The other side of the war — can become ally or enemy depending on party's diplomacy +- Arc 4: Leads Kethran forces at the World Council; contributes naval blockade of the Citadel +- If the peace summit succeeds (Arc 2), she grants the party the services of the *Kethran Wind*, a swift warship for travel + +## Stat Notes + +- **HP:** 85 | **AC:** 18 (breastplate + DEX + shield) | **Speed:** 30 ft +- **Spellcasting:** Cleric 9 (DC 16, +8). Key spells: *crusader's mantle, freedom of movement, commune, flame strike* +- **War Priest:** Bonus action weapon attack after casting (Wis mod/day) +- **Channel Divinity: Guided Strike** (+10 to one attack roll) + +## Secrets + +- She authorized secret naval raids on Valdrian shipping — a fact that could derail the peace talks. +- Her daughter was killed by cultists years ago. She knows the Hand of Ruin is real; she just doesn't know how deep it goes. +- She has a secret alliance with the Pirate Lords of the Salt Reach — mutually beneficial, mutually deniable. diff --git a/NPCs/Scorchmaw.md b/NPCs/Scorchmaw.md new file mode 100644 index 0000000..dd6a11b --- /dev/null +++ b/NPCs/Scorchmaw.md @@ -0,0 +1,33 @@ +--- +type: npc +role: "Young Magma Dragon, Potential Ally" +location: "[[Ironheart Mine]] → Free" +alignment: Chaotic Neutral +race: Young Magma Dragon (homebrew) +--- + +# Scorchmaw + +## Overview + +A young magma dragon bound by the [[The Hand of Ruin|Hand of Ruin]] to guard the anchor chamber in the [[Ironheart Mine]]. He resents his captivity. If freed, he turns on the cultists and may become a recurring ally — or a future problem. + +**In Arc 2:** [[Arc 2 - The Gilded War#Hook 5: The Ironheart Siege|Arc 2, Hook 5]] + +## Stat Block (CR 10) + +See [[Ironheart Mine#Scorchmaw — Young Magma Dragon (Homebrew)|Scorchmaw stats in Ironheart Mine]]. + +## After Freedom + +If the party frees Scorchmaw without killing him: +- He gives them a **Scale Token** — call for aid once in Arc 4 (arrives in 1d4 rounds) +- He doesn't fight for free; he's a young, selfish dragon +- He remembers the party and may complicate later arcs (he steals from nearby towns; the party's reputation may be affected) + +## Personality + +- Young, arrogant, impulsive +- Curious about the "surface world" (he's spent decades underground) +- Doesn't understand politics; just wants to fight, eat, and hoard +- Calling him "cute" or "little" provokes instant hostility diff --git a/NPCs/Silvos, the Shifting Wind.md b/NPCs/Silvos, the Shifting Wind.md new file mode 100644 index 0000000..55dac2c --- /dev/null +++ b/NPCs/Silvos, the Shifting Wind.md @@ -0,0 +1,25 @@ +--- +type: npc +role: "Dragon Lord, Ally" +location: Cloudreach Sanctum +alignment: Chaotic Good +race: Adult Silver Dragon +--- + +# Silvos, the Shifting Wind + +## Overview + +The youngest Dragon Lord aside from [[Khalyraxis, the Verdant Wing]], an adult silver dragon who admires mortal ingenuity and short lifespans. Silvos is an automatic ally at the Draconic Court — he respects Khalyraxis and believes dragons should be protectors, not jailers. + +**In Arc 3:** [[Arc 3 - Heart of the Mountain#Hook 10: The Draconic Court|The Draconic Court]] + +## Disposition + +- Automatic yes vote (loyal to Khalyraxis) +- Fights alongside the party during [[Morgra, the Ashen Matron|Morgra]]'s attack +- If he survives to Arc 4, he provides aerial combat support during the Citadel siege + +## Stat Block: Adult Silver Dragon (CR 16) + +Standard adult silver dragon (MM p. 117) with Seal-Bound Aura (allies within 30 ft gain cold resistance). diff --git a/NPCs/Stonewarden.md b/NPCs/Stonewarden.md new file mode 100644 index 0000000..f13a351 --- /dev/null +++ b/NPCs/Stonewarden.md @@ -0,0 +1,30 @@ +--- +type: npc +role: "Gate Guardian" +location: "[[Ashpeak Caldera]]" +alignment: True Neutral +race: Earth Elemental Myrmidon (enhanced) +--- + +# Stonewarden + +## Overview + +An ancient earth elemental bound by the First Sages to guard the [[Gate of Stone]]. It does not sleep, eat, or tire. It has tested every being that has sought passage through the gate for 3,200 years. It speaks in slow, grinding Common — each word like rocks tumbling down a slope. + +## The Three Trials + +| Trial | Type | DC | Description | +|-------|------|-----|-------------| +| Strength | Athletics | 18 | Hold open a collapsing stone passage for your companions to pass | +| Wisdom | Perception / Insight | 16 | Navigate a maze of shifting stone illusions; see the true path | +| Sacrifice | Roleplay | — | Give up something of genuine personal value (gold doesn't count). The Stonewarden knows a lie. | + +If all three are passed, the gate opens peacefully. If any are failed by violence (attacking the Stonewarden, destroying the trial mechanisms), the Stonewarden fights: + +- **HP:** 200 | **AC:** 20 | **CR:** 14 +- Use **earth elemental myrmidon** (MToF p. 202) with max HP and lair actions (stone spikes, cave-ins, grasping stone hands) + +## Aftermath + +The gate opens regardless of method — but if the Stonewarden is killed, the [[The Hand of Ruin|Hand of Ruin]] is alerted by the magical backlash. The party loses the element of surprise for Arc 3. diff --git a/NPCs/Vornak, the Deep-Root.md b/NPCs/Vornak, the Deep-Root.md new file mode 100644 index 0000000..ef85ace --- /dev/null +++ b/NPCs/Vornak, the Deep-Root.md @@ -0,0 +1,26 @@ +--- +type: npc +role: "Neutral Dragon Lord" +location: The Emerald Deep +alignment: True Neutral +race: Ancient Green Dragon +--- + +# Vornak, the Deep-Root + +## Overview + +An ancient green dragon who has spent millennia guarding his seal anchor in the Emerald Deep — a primordial forest in the far west. Vornak is pragmatic and patient; he favors reinforcing the seals because he dislikes change, not because he cares about mortals. + +**In Arc 3:** [[Arc 3 - Heart of the Mountain#Hook 10: The Draconic Court|The Draconic Court]] + +## Disposition + +- Initially neutral: DC 18 Persuasion +- Reduced to DC 14 if the party demonstrates that chaos (Hand of Ruin victory) would be worse for dragonkind than the status quo +- Reduced to DC 12 if the party has protected at least 2 seal anchors across the campaign +- Abstains rather than voting against (he won't actively oppose the Rite) + +## Stat Block: Ancient Green Dragon (CR 22) + +Standard ancient green dragon (MM p. 95) with Seal-Bound Aura (allies within 30 ft gain poison resistance). diff --git a/Quests/Bandits & Wilderness Encounters.md b/Quests/Bandits & Wilderness Encounters.md new file mode 100644 index 0000000..9bf1f3c --- /dev/null +++ b/Quests/Bandits & Wilderness Encounters.md @@ -0,0 +1,58 @@ +--- +type: reference +--- + +# Bandits & Wilderness Encounters + +## Old Salt Road Ambush + +6 **bandits** and 1 **bandit captain** (CR 3 total). The bandits are mercenaries hired by the [[The Hand of Ruin|Hand of Ruin]] to stop anyone investigating the missing caravan. + +### Setup +The ambush occurs at a narrow pass where the road cuts between two rocky hills. The bandits have overturned a merchant cart (from the missing caravan) as cover. Two bandits are hidden on each hill with light crossbows; the captain and two bandits block the road. + +### Treasure +- 120 gp in assorted coins +- Captain's orders (sealed with the Hand of Ruin spiral): *"Intercept all traffic on the Old Salt Road for two weeks. Kill witnesses. Report to the mill."* +- A [[The Silent College|Silent College]] shipment manifest (partially burned) — identifies the missing cargo as "Council-Referred Artifacts, Reference Code: SC-7-Anchor." This is the first hint that the [[The Silent College|Silent College]] knows about the seals. + +### DC 15 Investigation +The bandit captain's boots have red clay on the soles — the same clay found at the Old Mill outside Eastmarch. Leads the party toward [[Arc 1 - Heirs of Sundering#Hook 3: The Poisoned Well|Hook 3]]. + +## Thronewood Ambush + +Used in [[Arc 2 - The Gilded War#Hook 8: Ambush at Thronewood|Arc 2, Hook 8]]. + +### Enemy Forces +- 12 **cultists** (spread in 3 squads of 4 along the convoy route) +- 2 **cult fanatics** (convoy escorts, mounted on warhorses) +- 1 **bone devil** (CR 9) summoned as heavy enforcer, bound to a ritual circle in the lead cart +- Bound **adult copper dragon** — [[Khalyraxis, the Verdant Wing]] (weakened, restrained in the rear cart by enchanted adamantine chains) + +### Convoy Route +The convoy moves along the Old Thronewood Road, a forest path wide enough for two carts. The bone devil's ritual circle is in the lead cart — if the circle is broken (AC 13, 20 HP, DC 14 Arcana), the devil is banished back to the Nine Hells. + +### Freeing Khalyraxis +- **Chains:** AC 19, 40 HP, DC 18 Thieves' Tools +- **Weakened Dragon:** While chained, she cannot act. Once freed, she uses her Slowing Gas breath weapon immediately (targeting enemies) and thanks the party. +- **If she takes damage:** The cultists are under orders to kill her if escape seems imminent. The bone devil will abandon other targets to attack her. Protect the dragon. + +### Treasure +- [[Verdant Wing Token]] — from Khalyraxis +- Cult orders: *"Convoy 4 — Dragon Lord asset to Citadel of Sundering. Priority: Absolute. Do not allow asset to speak to anyone. Do not fail."* Signed by [[High Pontiff Vosseth]]. +- Convoy pay chest: 2,400 gp + +## Random Wilderness Encounters (d8) + +Used during travel between major locations. + +| d8 | Encounter | CR | Notes | +|----|-----------|-----|-------| +| 1 | 1d4+2 **cultists** + 1 **cult fanatic** | 3 | Hand of Ruin patrol; carries orders if searched | +| 2 | 2d4 **bandits** + 1 **bandit captain** | 3 | Standard road ambush | +| 3 | 1d4 **elementals** (random type) | 2-5 | Drawn by a nearby cracked seal | +| 4 | **Crown Concordat** patrol (6 guards + 1 knight) | 5 | Suspicious of travelers; DC 15 Persuasion to pass freely | +| 5 | **Iron Concord** mercenary group (4 veterans + 1 gladiator) | 7 | Neutral unless provoked; can be hired as temporary allies (500 gp/day) | +| 6 | Wandering druid (use **druid** stat block) | 2 | Verdant Circle Watcher; provides regional intel | +| 7 | 1 **young dragon** (random metallic or chromatic) | 6-9 | Curious or territorial; not necessarily hostile | +| 8 | Anomalous weather event — elemental storm, time loop, gravity flux | — | Environmental hazard; DC 15 Nature to navigate safely | diff --git a/Rules/Pact of Seven Flames.md b/Rules/Pact of Seven Flames.md new file mode 100644 index 0000000..443bffe --- /dev/null +++ b/Rules/Pact of Seven Flames.md @@ -0,0 +1,21 @@ +--- +type: reference +--- + +# Pact of Seven Flames + +## Overview + +The ancient pact binding the [[Dragon Lords]] to the seven [[Seal Anchor]] sites. The Rite of Seven Flames is the synchronized channeling of draconic breath and essence through the [[Emberheart]]. + +## Key Rules + +- Each Dragon Lord is tied to a specific seal; if a Dragon Lord falls, their seal weakens. +- The Rite requires at minimum three Dragon Lords and (in practice) coordination across the ritual site. +- The [[Emberheart]] can reinforce or shatter a seal depending on the ritual method. + +## Campaign Use + +- Arc 2 foreshadowing: the need for multiple Dragon Lords. +- Arc 3 climax: the Rite is attempted, partially succeeded. +- Arc 4 climax: the final Rite determines the ending. diff --git a/Templates/Faction Template.md b/Templates/Faction Template.md new file mode 100644 index 0000000..5ac0880 --- /dev/null +++ b/Templates/Faction Template.md @@ -0,0 +1,27 @@ +--- +title: +type: faction +alignment: +leader: +headquarters: +--- + +# + +## Overview + +## Structure + +| Rank | Title | Role | +|------|-------|------| + +## Goals + +## Allies + +## Enemies + +## Known Members + +| Name | Rank | Notes | +|------|------|-------| diff --git a/Templates/Item Template.md b/Templates/Item Template.md new file mode 100644 index 0000000..b93af47 --- /dev/null +++ b/Templates/Item Template.md @@ -0,0 +1,17 @@ +--- +title: +type: item +rarity: +attunement: +value_gp: +--- + +# + +## Description + +## Properties + +## Source + +## Lore diff --git a/Templates/Location Template.md b/Templates/Location Template.md new file mode 100644 index 0000000..bf12e6e --- /dev/null +++ b/Templates/Location Template.md @@ -0,0 +1,29 @@ +--- +title: +type: location +region: +kingdom: +population: +danger: Low +--- + +# + +## Overview + +## Key Locations + +## NPCs + +| Name | Role | Location | +|------|------|----------| + +## Rumors (d6) + +| d6 | Rumor | +|----|-------| + +## Encounters + +| Encounter | CR | Location | +|-----------|-----|----------| diff --git a/Templates/NPC Template.md b/Templates/NPC Template.md new file mode 100644 index 0000000..249d860 --- /dev/null +++ b/Templates/NPC Template.md @@ -0,0 +1,24 @@ +--- +title: +type: npc +role: +location: +alignment: +race: +class: +status: alive +--- + +# + +## Appearance + +## Personality + +## Role in Campaign + +## Stat Notes + +- **HP:** | **AC:** | **Speed:** + +## Secrets diff --git a/Templates/Quest Template.md b/Templates/Quest Template.md new file mode 100644 index 0000000..27b8642 --- /dev/null +++ b/Templates/Quest Template.md @@ -0,0 +1,36 @@ +--- +title: +type: quest +arc: +levels: +giver: +location: +status: pending +reward_xp: +reward_gold: +reward_items: [] +--- + +# + +## Hook + +## Objectives + +- [ ] +- [ ] +- [ ] + +## Key NPCs + +| Name | Role | +|------|------| + +## Enemies + +| Enemy | Location | Notes | +|-------|----------|-------| + +## Resolution + +## Notes diff --git a/Templates/Session Template.md b/Templates/Session Template.md new file mode 100644 index 0000000..17e729d --- /dev/null +++ b/Templates/Session Template.md @@ -0,0 +1,33 @@ +--- +title: "Session {{date}}" +type: session +session_number: +characters_present: [] +arc: +location: +xp_awarded: +loot_acquired: [] +--- + +# Session + +## Recap + +## Events + +## NPCs Encountered + +## Combat + +| Encounter | CR | Outcome | +|-----------|-----|---------| + +## Discoveries / Clues + +## Decisions Made + +## Loot + +## XP + +## Next Session Hooks diff --git a/logseq/config.edn b/logseq/config.edn deleted file mode 100644 index 5ef6e65..0000000 --- a/logseq/config.edn +++ /dev/null @@ -1,421 +0,0 @@ -{:meta/version 1 - - ;; Set the preferred format. - ;; Available options: - ;; - Markdown (default) - ;; - Org - ;; :preferred-format "Markdown" - - ;; Set the preferred workflow style. - ;; Available options: - ;; - :now for NOW/LATER style (default) - ;; - :todo for TODO/DOING style - :preferred-workflow :now - - ;; Exclude directories/files. - ;; Example usage: - ;; :hidden ["/archived" "/test.md" "../assets/archived"] - :hidden [] - - ;; Define the default journal page template. - ;; Enter the template name between the quotes. - :default-templates - {:journals ""} - - ;; Set a custom date format for the journal page title. - ;; Default value: "MMM do, yyyy" - ;; e.g., "Jan 19th, 2038" - ;; Example usage e.g., "Tue 19th, Jan 2038" - ;; :journal/page-title-format "EEE do, MMM yyyy" - - ;; Specify the journal filename format using a valid date format string. - ;; !Warning: - ;; This configuration is not retroactive and affects only new journals. - ;; To show old journal files in the app, manually rename the files in the - ;; journal directory to match the new format. - ;; Default value: "yyyy_MM_dd" - ;; :journal/file-name-format "yyyy_MM_dd" - - ;; Enable tooltip preview on hover. - ;; Default value: true - :ui/enable-tooltip? true - - ;; Display brackets [[]] around page references. - ;; Default value: true - ;; :ui/show-brackets? true - - ;; Display all lines of a block when referencing ((block)). - ;; Default value: false - :ui/show-full-blocks? false - - ;; Automatically expand block references when zooming in. - ;; Default value: true - :ui/auto-expand-block-refs? true - - ;; Enable Block timestamps. - ;; Default value: false - :feature/enable-block-timestamps? false - - ;; Disable accent marks when searching. - ;; After changing this setting, rebuild the search index by pressing (^C ^S). - ;; Default value: true - :feature/enable-search-remove-accents? true - - ;; Enable journals. - ;; Default value: true - ;; :feature/enable-journals? true - - ;; Enable flashcards. - ;; Default value: true - ;; :feature/enable-flashcards? true - - ;; Enable whiteboards. - ;; Default value: true - ;; :feature/enable-whiteboards? true - - ;; Disable the journal's built-in 'Scheduled tasks and deadlines' query. - ;; Default value: false - ;; :feature/disable-scheduled-and-deadline-query? false - - ;; Specify the number of days displayed in the future for - ;; the 'scheduled tasks and deadlines' query. - ;; Example usage: - ;; Display all scheduled and deadline blocks for the next 14 days: - ;; :scheduled/future-days 14 - ;; Default value: 7 - ;; :scheduled/future-days 7 - - ;; Specify the first day of the week. - ;; Available options: - ;; - integer from 0 to 6 (Monday to Sunday) - ;; Default value: 6 (Sunday) - :start-of-week 6 - - ;; Specify a custom CSS import. - ;; This option takes precedence over the local `logseq/custom.css` file. - ;; Example usage: - ;; :custom-css-url "@import url('https://cdn.jsdelivr.net/gh/dracula/logseq@master/custom.css');" - - ;; Specify a custom JS import. - ;; This option takes precedence over the local `logseq/custom.js` file. - ;; Example usage: - ;; :custom-js-url "https://cdn.logseq.com/custom.js" - - ;; Set a custom Arweave gateway - ;; Default gateway: https://arweave.net - ;; :arweave/gateway "https://arweave.net" - - ;; Set bullet indentation when exporting - ;; Available options: - ;; - `:eight-spaces` as eight spaces - ;; - `:four-spaces` as four spaces - ;; - `:two-spaces` as two spaces - ;; - `:tab` as a tab character (default) - ;; :export/bullet-indentation :tab - - ;; Publish all pages within the Graph - ;; Regardless of whether individual pages have been marked as public. - ;; Default value: false - ;; :publishing/all-pages-public? false - - ;; Define the default home page and sidebar status. - ;; If unspecified, the journal page will be loaded on startup and the right sidebar will stay hidden. - ;; The `:page` value represents the name of the page displayed at startup. - ;; Available options for `:sidebar` are: - ;; - "Contents" to display the Contents page in the right sidebar. - ;; - A specific page name to display in the right sidebar. - ;; - An array of multiple pages, e.g., ["Contents" "Page A" "Page B"]. - ;; If `:sidebar` remains unset, the right sidebar will stay hidden. - ;; Examples: - ;; 1. Set "Changelog" as the home page and display "Contents" in the right sidebar: - ;; :default-home {:page "Changelog", :sidebar "Contents"} - ;; 2. Set "Jun 3rd, 2021" as the home page without the right sidebar: - ;; :default-home {:page "Jun 3rd, 2021"} - ;; 3. Set "home" as the home page and display multiple pages in the right sidebar: - ;; :default-home {:page "home", :sidebar ["Page A" "Page B"]} - - ;; Set the default location for storing notes. - ;; Default value: "pages" - ;; :pages-directory "pages" - - ;; Set the default location for storing journals. - ;; Default value: "journals" - ;; :journals-directory "journals" - - ;; Set the default location for storing whiteboards. - ;; Default value: "whiteboards" - ;; :whiteboards-directory "whiteboards" - - ;; Enabling this option converts - ;; [[Grant Ideas]] to [[file:./grant_ideas.org][Grant Ideas]] for org-mode. - ;; For more information, visit https://github.com/logseq/logseq/issues/672 - ;; :org-mode/insert-file-link? false - - ;; Configure custom shortcuts. - ;; Syntax: - ;; 1. + indicates simultaneous key presses, e.g., `Ctrl+Shift+a`. - ;; 2. A space between keys represents key chords, e.g., `t s` means - ;; pressing `t` followed by `s`. - ;; 3. mod refers to `Ctrl` for Windows/Linux and `Command` for Mac. - ;; 4. Use false to disable a specific shortcut. - ;; 5. You can define multiple bindings for a single action, e.g., ["ctrl+j" "down"]. - ;; The full list of configurable shortcuts is available at: - ;; https://github.com/logseq/logseq/blob/master/src/main/frontend/modules/shortcut/config.cljs - ;; Example: - ;; :shortcuts - ;; {:editor/new-block "enter" - ;; :editor/new-line "shift+enter" - ;; :editor/insert-link "mod+shift+k" - ;; :editor/highlight false - ;; :ui/toggle-settings "t s" - ;; :editor/up ["ctrl+k" "up"] - ;; :editor/down ["ctrl+j" "down"] - ;; :editor/left ["ctrl+h" "left"] - ;; :editor/right ["ctrl+l" "right"]} - :shortcuts {} - - ;; Configure the behavior of pressing Enter in document mode. - ;; if set to true, pressing Enter will create a new block. - ;; Default value: false - :shortcut/doc-mode-enter-for-new-block? false - - ;; Block content larger than `block/content-max-length` will not be searchable - ;; or editable for performance. - ;; Default value: 10000 - :block/content-max-length 10000 - - ;; Display command documentation on hover. - ;; Default value: true - :ui/show-command-doc? true - - ;; Display empty bullet points. - ;; Default value: false - :ui/show-empty-bullets? false - - ;; Pre-defined :view function to use with advanced queries. - :query/views - {:pprint - (fn [r] [:pre.code (pprint r)])} - - ;; Advanced queries `:result-transform` function. - ;; Transform the query result before displaying it. - :query/result-transforms - {:sort-by-priority - (fn [result] (sort-by (fn [h] (get h :block/priority "Z")) result))} - - ;; The following queries will be displayed at the bottom of today's journal page. - ;; The "NOW" query returns tasks with "NOW" or "DOING" status. - ;; The "NEXT" query returns tasks with "NOW", "LATER", or "TODO" status. - :default-queries - {:journals - [{:title "🔨 NOW" - :query [:find (pull ?h [*]) - :in $ ?start ?today - :where - [?h :block/marker ?marker] - [(contains? #{"NOW" "DOING"} ?marker)] - [?h :block/page ?p] - [?p :block/journal? true] - [?p :block/journal-day ?d] - [(>= ?d ?start)] - [(<= ?d ?today)]] - :inputs [:14d :today] - :result-transform (fn [result] - (sort-by (fn [h] - (get h :block/priority "Z")) result)) - :group-by-page? false - :collapsed? false} - {:title "📅 NEXT" - :query [:find (pull ?h [*]) - :in $ ?start ?next - :where - [?h :block/marker ?marker] - [(contains? #{"NOW" "LATER" "TODO"} ?marker)] - [?h :block/page ?p] - [?p :block/journal? true] - [?p :block/journal-day ?d] - [(> ?d ?start)] - [(< ?d ?next)]] - :inputs [:today :7d-after] - :group-by-page? false - :collapsed? false}]} - - ;; Add custom commands to the command palette - ;; Example usage: - ;; :commands - ;; [ - ;; ["js" "Javascript"] - ;; ["md" "Markdown"] - ;; ] - :commands [] - - ;; Enable collapsing blocks with titles but no children. - ;; By default, only blocks with children can be collapsed. - ;; Setting `:outliner/block-title-collapse-enabled?` to true allows collapsing - ;; blocks with titles (multiple lines) and content. For example: - ;; - block title - ;; block content - ;; Default value: false - :outliner/block-title-collapse-enabled? false - - ;; Macros replace texts and will make you more productive. - ;; Example usage: - ;; Change the :macros value below to: - ;; {"poem" "Rose is $1, violet's $2. Life's ordered: Org assists you."} - ;; input "{{poem red,blue}}" - ;; becomes - ;; Rose is red, violet's blue. Life's ordered: Org assists you. - :macros {} - - ;; Configure the default expansion level for linked references. - ;; For example, consider the following block hierarchy: - ;; - a [[page]] (level 1) - ;; - b (level 2) - ;; - c (level 3) - ;; - d (level 4) - ;; - ;; With the default value of level 2, block b will be collapsed. - ;; If the level's value is set to 3, block c will be collapsed. - ;; Default value: 2 - :ref/default-open-blocks-level 2 - - ;; Configure the threshold for linked references before collapsing. - ;; Default value: 100 - :ref/linked-references-collapsed-threshold 50 - - ;; Graph view configuration. - ;; Example usage: - ;; :graph/settings - ;; {:orphan-pages? true ; Default value: true - ;; :builtin-pages? false ; Default value: false - ;; :excluded-pages? false ; Default value: false - ;; :journal? false} ; Default value: false - - ;; Graph view configuration. - ;; Example usage: - ;; :graph/forcesettings - ;; {:link-dist 180 ; Default value: 180 - ;; :charge-strength -600 ; Default value: -600 - ;; :charge-range 600} ; Default value: 600 - - ;; Favorites to list on the left sidebar - :favorites [] - - ;; Set flashcards interval. - ;; Expected value: - ;; - Float between 0 and 1 - ;; higher values result in faster changes to the next review interval. - ;; Default value: 0.5 - ;; :srs/learning-fraction 0.5 - - ;; Set the initial interval after the first successful review of a card. - ;; Default value: 4 - ;; :srs/initial-interval 4 - - ;; Hide specific block properties. - ;; Example usage: - ;; :block-hidden-properties #{:public :icon} - - ;; Create a page for all properties. - ;; Default value: true - :property-pages/enabled? true - - ;; Properties to exclude from having property pages - ;; Example usage: - ;; :property-pages/excludelist #{:duration :author} - - ;; By default, property value separated by commas will not be treated as - ;; page references. You can add properties to enable it. - ;; Example usage: - ;; :property/separated-by-commas #{:alias :tags} - - ;; Properties that are ignored when parsing property values for references - ;; Example usage: - ;; :ignored-page-references-keywords #{:author :website} - - ;; logbook configuration. - ;; :logbook/settings - ;; {:with-second-support? false ;limit logbook to minutes, seconds will be eliminated - ;; :enabled-in-all-blocks true ;display logbook in all blocks after timetracking - ;; :enabled-in-timestamped-blocks false ;don't display logbook at all - ;; } - - ;; Mobile photo upload configuration. - ;; :mobile/photo - ;; {:allow-editing? true - ;; :quality 80} - - ;; Mobile features options - ;; Gestures - ;; Example usage: - ;; :mobile - ;; {:gestures/disabled-in-block-with-tags ["kanban"]} - - ;; Extra CodeMirror options - ;; See https://codemirror.net/5/doc/manual.html#config for possible options - ;; Example usage: - ;; :editor/extra-codemirror-options - ;; {:lineWrapping false ; Default value: false - ;; :lineNumbers true ; Default value: true - ;; :readOnly false} ; Default value: false - - ;; Enable logical outdenting - ;; Default value: false - ;; :editor/logical-outdenting? false - - ;; Prefer pasting the file when text and a file are in the clipboard. - ;; Default value: false - ;; :editor/preferred-pasting-file? false - - ;; Quick capture templates for receiving content from other apps. - ;; Each template contains three elements {time}, {text} and {url}, which can be auto-expanded - ;; by receiving content from other apps. Note: the {} cannot be omitted. - ;; - {time}: capture time - ;; - {date}: capture date using current date format, use `[[{date}]]` to get a page reference - ;; - {text}: text that users selected before sharing. - ;; - {url}: URL or assets path for media files stored in Logseq. - ;; You can also reorder them or use only one or two of them in the template. - ;; You can also insert or format any text in the template, as shown in the following examples. - ;; :quick-capture-templates - ;; {:text "[[quick capture]] **{time}**: {text} from {url}" - ;; :media "[[quick capture]] **{time}**: {url}"} - - ;; Quick capture options. - ;; - insert-today? Insert the capture at the end of today's journal page (boolean). - ;; - redirect-page? Redirect to the quick capture page after capturing (boolean). - ;; - default-page The default page to capture to if insert-today? is false (string). - ;; :quick-capture-options - ;; {:insert-today? false ;; Default value: true - ;; :redirect-page? false ;; Default value: false - ;; :default-page "quick capture"} ;; Default page: "quick capture" - - ;; File sync options - ;; Ignore these files when syncing, regexp is supported. - ;; :file-sync/ignore-files [] - - ;; Configure the Enter key behavior for - ;; context-aware editing with DWIM (Do What I Mean). - ;; context-aware Enter key behavior implies that pressing Enter will - ;; have different outcomes based on the context. - ;; For instance, pressing Enter within a list generates a new list item, - ;; whereas pressing Enter in a block reference opens the referenced block. - ;; :dwim/settings - ;; {:admonition&src? true ;; Default value: true - ;; :markup? false ;; Default value: false - ;; :block-ref? true ;; Default value: true - ;; :page-ref? true ;; Default value: true - ;; :properties? true ;; Default value: true - ;; :list? false} ;; Default value: false - - ;; Configure the escaping method for special characters in page titles. - ;; Warning: - ;; This is a dangerous operation. To modify the setting, - ;; access the 'Filename format' setting and follow the instructions. - ;; Otherwise, You may need to manually rename all affected files and - ;; re-index them on all clients after synchronization. - ;; Incorrect handling may result in messy page titles. - ;; Available options: - ;; - :triple-lowbar (default) - ;; ;use triple underscore `___` for slash `/` in page title - ;; ;use Percent-encoding for other invalid characters - :file/name-format :triple-lowbar} diff --git a/logseq/custom.css b/logseq/custom.css deleted file mode 100644 index e69de29..0000000 diff --git a/pages/Campaign Overview.md b/pages/Campaign Overview.md deleted file mode 100644 index 9ee21c2..0000000 --- a/pages/Campaign Overview.md +++ /dev/null @@ -1,12 +0,0 @@ -- **Campaign Name:** Ashes of the Hollow Crown -- **System:** D&D 5e -- **Party Size:** 4-6 characters -- **Starting Level:** 5 -- **Ending Level:** 20 -- **Tone:** dark, gritty heroic fantasy -- **Setting:** homebrew -- **Core Hook:** A dead king’s crown still commands broken oaths, and the land is collapsing under a century-old curse that feeds on war, sacrifice, and forgotten gods. -- **Premise:** The characters begin as capable regional heroes hired to stop a spreading blight of ash, plague, and undead. Their investigations reveal a buried empire, a shattered divine covenant, and a living crown that can either remade the world or end it. -- **Campaign Goal:** Unite rival powers, uncover the truth of the Hollow Crown, and confront the entity using it to harvest souls across the realm. -- **Primary Themes:** survival, sacrifice, corruption, legitimacy, redemption, the cost of power -- **Endgame Choice:** destroy the crown, seize it, or bind its power to restore the world at a terrible price \ No newline at end of file diff --git a/pages/Campaign Timeline.md b/pages/Campaign Timeline.md deleted file mode 100644 index 2353d15..0000000 --- a/pages/Campaign Timeline.md +++ /dev/null @@ -1,8 +0,0 @@ -- **Arc 1:** The Ash Begins -- **Arc 2:** The Broken Roads -- **Arc 3:** The Fen of Whispers -- **Arc 4:** War of the Houses -- **Arc 5:** The Sunken Archive -- **Arc 6:** The Ember Ascendant -- **Arc 7:** Siege of the Capital Below -- **Arc 8:** The Hollow Crown \ No newline at end of file diff --git a/pages/Encounters and Dungeons.md b/pages/Encounters and Dungeons.md deleted file mode 100644 index 257a7da..0000000 --- a/pages/Encounters and Dungeons.md +++ /dev/null @@ -1,6 +0,0 @@ -- **Road Encounter:** ash storm plus corpse-haunted caravan wreck -- **Social Encounter:** negotiate with a toll lord offering protection for loyalty -- **Combat Encounter:** oathbound dead that only stop when their banner is broken -- **Exploration Encounter:** flooded chapel with air pockets, relic clues, and restless spirits -- **Dungeon Structure:** each major dungeon should have one environmental hazard, one faction conflict, one lore reveal, and one boss with a moral choice -- **Recurring Enemy Types:** ash zombies, oath knights, bone hounds, cult pyromancers, crown-touched nobles \ No newline at end of file diff --git a/pages/Factions.md b/pages/Factions.md deleted file mode 100644 index ada023c..0000000 --- a/pages/Factions.md +++ /dev/null @@ -1,6 +0,0 @@ -- **The Ashen Synod:** priest-exorcists and relic hunters trying to contain the curse -- **House Veyr:** noble survivalists seeking to claim the crown and legalize their rule -- **The Black Lantern Compact:** smugglers and mercenaries moving people, relics, and forbidden goods -- **The Ember Court:** infernal-aligned cultists who believe the world must burn before it can be remade -- **The Broken Saints:** penitent warriors and undead-scarred survivors who oppose all crowns -- **The Quiet Root:** druidic network preserving what remains of the land and sabotaging corrupt harvest magic \ No newline at end of file diff --git a/pages/Key NPCs.md b/pages/Key NPCs.md deleted file mode 100644 index 9b09732..0000000 --- a/pages/Key NPCs.md +++ /dev/null @@ -1,6 +0,0 @@ -- **Lady Seris Veyr:** ambitious noble mediator with a private army -- **High Inquisitor Thalen:** Ashen Synod leader, severe but genuinely protective -- **Morrin Bale:** Black Lantern broker who knows every road and secret -- **Sister Ova:** Broken Saint veteran with undead scars and unshakable faith -- **Rootspeaker Neme:** druid envoy trying to keep the land alive -- **The Pale Regent:** the campaign’s hidden sovereign-antagonist, speaking through dreams and crowns \ No newline at end of file diff --git a/pages/Level 5-20 Progression.md b/pages/Level 5-20 Progression.md deleted file mode 100644 index 9245422..0000000 --- a/pages/Level 5-20 Progression.md +++ /dev/null @@ -1,31 +0,0 @@ -- **Level 5-6: The Ash Begins** - - Investigate blight, undead outbreaks, and missing caravans - - Defend Grayhold Bastion and expose the first cult cell - - Boss: Ash Warden, a cursed knight who cannot die until his oath is broken -- **Level 7-8: The Broken Roads** - - Travel through raided villages and contested passes - - Choose allies among the Synod, House Veyr, or the Compact - - Dungeon: Saint's Trench, where the dead repeat the last siege -- **Level 9-10: The Fen of Whispers** - - Recover a relic map and learn the crown’s prison mechanism - - Confront plague alchemists and spirit bargains - - Boss: Fen-Hag Matron bound to a drowned chapel -- **Level 11-12: War of the Houses** - - Navigate civil war, assassination, and siege diplomacy - - Prevent a crown claimant from becoming puppet ruler - - Dungeon: Furnace Pass fortress assault -- **Level 13-14: The Sunken Archive** - - Discover the buried history of the Sun Throne and the Pale Regent - - Retrieve the true binding rite and decide who can know it -- **Level 15-16: The Ember Ascendant** - - The cult launches open apocalypse rituals - - Stop a ritual that would tear open the Pale March permanently - - Boss: Ember Hierophant and their bound fiend -- **Level 17-18: Siege of the Capital Below** - - The capital’s hidden undercity awakens beneath the ash - - Rally factions for a final march on Crownbreak Spire - - Dungeon: living catacombs, oath engines, and crown-forges -- **Level 19-20: The Hollow Crown** - - Enter the sealed throne chamber and face the Pale Regent - - Final choice determines the realm’s future - - Endings: destroy, claim, or rebind the crown \ No newline at end of file diff --git a/pages/Major Locations.md b/pages/Major Locations.md deleted file mode 100644 index e91ad52..0000000 --- a/pages/Major Locations.md +++ /dev/null @@ -1,7 +0,0 @@ -- **Grayhold Bastion:** fortress-city at the edge of the ashlands; first hub -- **Saint's Trench:** mass grave turned battlefield shrine haunted by oathbound dead -- **The Glass Fen:** poisoned wetlands where spirits and alchemists compete -- **Furnace Pass:** mountain route controlled by toll-lords and raiders -- **The Sunken Archive:** buried imperial library holding the crown’s origin -- **Crownbreak Spire:** final ruin beneath the capital where the Hollow Crown is sealed -- **The Pale March:** a nightmare borderland appearing where the curse spreads \ No newline at end of file diff --git a/pages/Session Zero.md b/pages/Session Zero.md deleted file mode 100644 index 8ac81b1..0000000 --- a/pages/Session Zero.md +++ /dev/null @@ -1,6 +0,0 @@ -- Discuss lines, veils, and horror level -- Decide whether the endgame allows crown destruction, redemption, or rule -- Ask players what each character wants to protect, and what they fear losing -- Build at least one bond to a faction and one secret between party members -- Start characters with a reason to be in Grayhold Bastion -- Encourage morally gray choices and consequences \ No newline at end of file diff --git a/pages/Treasure and Rewards.md b/pages/Treasure and Rewards.md deleted file mode 100644 index b1121bd..0000000 --- a/pages/Treasure and Rewards.md +++ /dev/null @@ -1,5 +0,0 @@ -- **Common Rewards:** relic coins, oath seals, sanctuary charms, survival gear -- **Signature Magic Items:** crown-splinter talismans, sun-forged weapons, ash-resisting cloaks, lanterns that reveal spirits -- **Milestone Rewards:** faction renown, safehouses, armies, political leverage, ritual knowledge -- **Legendary Artifacts:** the Hollow Crown, the Sun Throne Seal, the Lantern of Last Judgment -- **Reward Style:** favors and consequences should matter as much as gold \ No newline at end of file diff --git a/pages/World of Ash and Cinders.md b/pages/World of Ash and Cinders.md deleted file mode 100644 index 0927237..0000000 --- a/pages/World of Ash and Cinders.md +++ /dev/null @@ -1,7 +0,0 @@ -- **Region:** The Cinderwake Dominion -- **History:** Once a fertile kingdom unified by the Sun Throne, the realm fractured after the last monarch used a forbidden crown to end a civil war. The crown demanded a soul-tithe to maintain peace, and when the tithe was refused, the crown was buried beneath a sacred fortress. Centuries later, the seal is failing. -- **Current State:** volcanic ash falls in distant provinces, crops fail, the dead do not stay buried, and noble houses secretly arm for succession. -- **Religion:** the old solar faith has weakened; roadside shrines and militant penitents fill the vacuum. -- **Magic:** respected but feared; blood rites, burial charms, and oath-binding are common. -- **Key Truth:** the crown is a prison and a key, binding an exiled sovereign-spirit called the Pale Regent. -- **Major Problems:** famine, border raids, plague villages, demon-pact nobility, and a hidden war over relic sites \ No newline at end of file diff --git a/pages/contents.md b/pages/contents.md deleted file mode 100644 index 15374f9..0000000 --- a/pages/contents.md +++ /dev/null @@ -1,10 +0,0 @@ -- [[Campaign Overview]] -- [[World of Ash and Cinders]] -- [[Factions]] -- [[Major Locations]] -- [[Level 5-20 Progression]] -- [[Key NPCs]] -- [[Encounters and Dungeons]] -- [[Treasure and Rewards]] -- [[Session Zero]] -- [[Campaign Timeline]] \ No newline at end of file