You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
254 KiB

var je=Object.create;var K=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var Ke=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ge=(i,t)=>{for(var e in t)K(i,e,{get:t[e],enumerable:!0})},pe=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Je(t))!Qe.call(i,s)&&s!==e&&K(i,s,{get:()=>t[s],enumerable:!(n=qe(t,s))||n.enumerable});return i};var Ze=(i,t,e)=>(e=i!=null?je(We(i)):{},pe(t||!i||!i.__esModule?K(e,"default",{value:i,enumerable:!0}):e,i)),Xe=i=>pe(K({},"__esModule",{value:!0}),i);var a=(i,t,e)=>new Promise((n,s)=>{var o=g=>{try{l(e.next(g))}catch(u){s(u)}},r=g=>{try{l(e.throw(g))}catch(u){s(u)}},l=g=>g.done?n(g.value):Promise.resolve(g.value).then(o,r);l((e=e.apply(i,t)).next())});var ze=Ke(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var f=require("obsidian"),ae="YYYY-MM-DD",re="gggg-[W]ww",Ne="YYYY-MM",Ee="YYYY-[Q]Q",Le="YYYY";function z(i){var e,n;let t=window.app.plugins.getPlugin("periodic-notes");return t&&((n=(e=t.settings)==null?void 0:e[i])==null?void 0:n.enabled)}function _(){var i,t,e,n;try{let{internalPlugins:s,plugins:o}=window.app;if(z("daily")){let{format:u,folder:m,template:d}=((t=(i=o.getPlugin("periodic-notes"))==null?void 0:i.settings)==null?void 0:t.daily)||{};return{format:u||ae,folder:(m==null?void 0:m.trim())||"",template:(d==null?void 0:d.trim())||""}}let{folder:r,format:l,template:g}=((n=(e=s.getPluginById("daily-notes"))==null?void 0:e.instance)==null?void 0:n.options)||{};return{format:l||ae,folder:(r==null?void 0:r.trim())||"",template:(g==null?void 0:g.trim())||""}}catch(s){console.info("No custom daily note settings found!",s)}}function H(){var i,t,e,n,s,o,r;try{let l=window.app.plugins,g=(i=l.getPlugin("calendar"))==null?void 0:i.options,u=(e=(t=l.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.weekly;if(z("weekly"))return{format:u.format||re,folder:((n=u.folder)==null?void 0:n.trim())||"",template:((s=u.template)==null?void 0:s.trim())||""};let m=g||{};return{format:m.weeklyNoteFormat||re,folder:((o=m.weeklyNoteFolder)==null?void 0:o.trim())||"",template:((r=m.weeklyNoteTemplate)==null?void 0:r.trim())||""}}catch(l){console.info("No custom weekly note settings found!",l)}}function V(){var t,e,n,s;let i=window.app.plugins;try{let o=z("monthly")&&((e=(t=i.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.monthly)||{};return{format:o.format||Ne,folder:((n=o.folder)==null?void 0:n.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom monthly note settings found!",o)}}function Y(){var t,e,n,s;let i=window.app.plugins;try{let o=z("quarterly")&&((e=(t=i.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.quarterly)||{};return{format:o.format||Ee,folder:((n=o.folder)==null?void 0:n.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom quarterly note settings found!",o)}}function j(){var t,e,n,s;let i=window.app.plugins;try{let o=z("yearly")&&((e=(t=i.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.yearly)||{};return{format:o.format||Le,folder:((n=o.folder)==null?void 0:n.trim())||"",template:((s=o.template)==null?void 0:s.trim())||""}}catch(o){console.info("No custom yearly note settings found!",o)}}function Ie(...i){let t=[];for(let n=0,s=i.length;n<s;n++)t=t.concat(i[n].split("/"));let e=[];for(let n=0,s=t.length;n<s;n++){let o=t[n];!o||o==="."||e.push(o)}return t[0]===""&&e.unshift(""),e.join("/")}function st(i){let t=i.substring(i.lastIndexOf("/")+1);return t.lastIndexOf(".")!=-1&&(t=t.substring(0,t.lastIndexOf("."))),t}function ot(i){return a(this,null,function*(){let t=i.replace(/\\/g,"/").split("/");if(t.pop(),t.length){let e=Ie(...t);window.app.vault.getAbstractFileByPath(e)||(yield window.app.vault.createFolder(e))}})}function q(i,t){return a(this,null,function*(){t.endsWith(".md")||(t+=".md");let e=f.normalizePath(Ie(i,t));return yield ot(e),e})}function D(i)
3 years ago
${t}
${s}`,e*1e3);n&&(o.noticeEl.oncontextmenu=()=>a(this,null,function*(){n()}))}function X(){return a(this,null,function*(){try{let i=yield fetch("https://obsidian.md/?"+Math.random());return i.status>=200&&i.status<300}catch(i){return!1}})}var x=(i,t,e)=>a(void 0,null,function*(){let n=yield L(t,!0,i.settings.debuggingMode);if(n||(n=yield L(t,!1,i.settings.debuggingMode)),!n)return p(i,"There is no theme.css or theme-beta.css file in the root path of this repository, so there is no theme to install."),!1;let s=yield be(t,i.settings.debuggingMode);if(!s)return p(i,"There is no manifest.json file in the root path of this repository, so theme cannot be installed."),!1;let o=yield JSON.parse(s),r=(0,N.normalizePath)(it(i)+o.name),l=i.app.vault.adapter;(yield l.exists(r))===!1&&(yield l.mkdir(r)),yield l.write((0,N.normalizePath)(r+"/theme.css"),n),yield l.write((0,N.normalizePath)(r+"/manifest.json"),s),Se(i,t,M(n));let g="";return e?(yield ve(i,t,n),g=`${o.name} theme installed from ${t}. `,setTimeout(()=>{i.app.customCss.setTheme(o.name)},500)):g=`${o.name} theme updated from ${t}.`,i.log(g+`[Theme Info](https://github.com/${t})`,!1),p(i,`${g}`,20,()=>a(void 0,null,function*(){window.open(`https://github.com/${t}`)})),!0}),I=(i,t)=>a(void 0,null,function*(){if((yield X())===!1){console.log("BRAT: No internet detected.");return}let e,n="Checking for beta theme updates STARTED";i.log(n,!0),t&&i.settings.notificationsEnabled&&(e=new N.Notice(`BRAT
${n}`,3e4));for(let o of i.settings.themesList){let r=yield R(o.repo,!0,i.settings.debuggingMode);r==="0"&&(r=yield R(o.repo,!1,i.settings.debuggingMode)),r!==o.lastUpdate&&(yield x(i,o.repo,!1))}let s="Checking for beta theme updates COMPLETED";i.log(s,!0),t&&(i.settings.notificationsEnabled&&e.hide(),p(i,s))}),ee=(i,t)=>a(void 0,null,function*(){i.settings.themesList=i.settings.themesList.filter(n=>n.repo!=t),i.saveSettings();let e=`Removed ${t} from BRAT themes list and will no longer be updated. However, the theme files still exist in the vault. To remove them, go into Settings > Appearance and remove the theme.`;i.log(e,!0),p(i,`${e}`)}),it=i=>(0,N.normalizePath)(i.app.vault.configDir+"/themes")+"/";var te=require("obsidian");var k=(i,t=!0)=>{let e=t?40:30,n=i.createEl("div");n.style.float="right",t===!1?(n.style.padding="10px",n.style.paddingLeft="15px",n.style.paddingRight="15px"):(n.style.padding="15px",n.style.paddingLeft="15px",n.style.paddingRight="15px",n.style.marginLeft="15px");let s=n.createSpan("coffee");s.addClass("ex-coffee-span");let r=s.createEl("a",{href:"https://bit.ly/o42-kofi"}).createEl("img",{attr:{src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3"}});r.height=e;let l=n.createSpan("coffee");l.addClass("ex-twitter-span"),l.style.paddingLeft="10px";let u=l.createEl("a",{href:"https://bit.ly/o42-twitter"}).createEl("img",{attr:{src:"https://cdn.cdnlogo.com/logos/t/96/twitter-icon.svg"}});u.height=e;let m=n.createSpan("coffee");m.addClass("ex-twitter-span"),m.style.paddingLeft="10px",m.style.right="0";let h=m.createEl("a",{href:"https://bit.ly/o42-medium"}).createEl("img",{attr:{src:"https://miro.medium.com/v2/resize:fill:176:176/1*sHhtYhaCe2Uc3IU0IgKwIQ.png"}});return h.height=e,n};var E=class extends te.Modal{constructor(e,n=!1){super(e.app);this.plugin=e,this.address="",this.openSettingsTabAfterwards=n}submitForm(){return a(this,null,function*(){if(this.address==="")return;let e=this.address.replace("https://github.com/","");if(yield Ce(this.plugin,e)){p(this.plugin,"This plugin is already in the list for beta testing",10);return}(yield x(this.plugin,e,!0))&&this.close()})}onOpen(){this.contentEl.createEl("h4",{text:"Github repository for beta theme:"}),this.contentEl.createEl("form",{},e=>{e.addClass("brat-modal"),new te.Setting(e).addText(o=>{o.setPlaceholder("Repository (example: https://github.com/GitubUserName/repository-name"),o.onChange(r=>{this.address=r.trim()}),o.inputEl.addEventListener("keydown",r=>a(this,null,function*(){r.key==="Enter"&&this.address!==" "&&(r.preventDefault(),yield this.submitForm())})),o.inputEl.style.width="100%",window.setTimeout(()=>{let r=document.querySelector(".setting-item-info");r&&r.remove(),o.inputEl.focus()},10)}),e.createDiv("modal-button-container",o=>{o.createEl("button",{attr:{type:"button"},text:"Never mind"}).addEventListener("click",()=>this.close()),o.createEl("button",{attr:{type:"submit"},cls:"mod-cta",text:"Add Theme"})});let n=e.createDiv();n.style.borderTop="1px solid #ccc",n.style.marginTop="30px";let s=n.createSpan();s.innerHTML="BRAT by <a href='https://bit.ly/o42-twitter'>TFTHacker</a>",s.style.fontStyle="italic",n.appendChild(s),k(n,!1),window.setTimeout(()=>{e.querySelectorAll(".brat-modal .setting-item-info").forEach(r=>{r.remove()})},50),e.addEventListener("submit",o=>a(this,null,function*(){o.preventDefault(),this.address!==""&&(yield this.submitForm())}))})}onClose(){return a(this,null,function*(){this.openSettingsTabAfterwards&&(yield this.plugin.app.setting.open(),yield this.plugin.app.setting.openTabById("obsidian42-brat"))})}};var ne=class extends v.PluginSettingTab{constructor(e,n){super(e,n);this.plugin=n}display(){let{containerEl:e}=this;e.empty(),k(e,!0),e.createEl("h1",{text:this.plugin.appName}),e.createEl("h2",{text:"by TfTHacker"}),new v.Setting(e).setName("Auto-update plugins at startup").setDesc("If enabled all beta plugins will be checked for updates each time Obsidian starts. Note: this does not update frozen version plugins.").addToggle(s=>{s.setValue(this.plugin.settings.updateAtStartup),s.onChange(o=>a(this,null,func
The version attribute for the release is missing from the manifest file`,15),null):(n&&p(this.plugin,`${t}
The plugin id attribute for the release is missing from the manifest file`,15),null):(n&&p(this.plugin,`${t}
This does not seem to be an obsidian plugin, as there is no manifest.json file.`,15),null)})}getAllReleaseFiles(t,e,n,s=""){return a(this,null,function*(){let o=s===""?e.version:s,r=n||s!=="";return{mainJs:yield G(t,o,"main.js",this.plugin.settings.debuggingMode),manifest:r?yield G(t,o,"manifest.json",this.plugin.settings.debuggingMode):"",styles:yield G(t,o,"styles.css",this.plugin.settings.debuggingMode)}})}writeReleaseFilesToPluginFolder(t,e){return a(this,null,function*(){let n=(0,A.normalizePath)(this.plugin.app.vault.configDir+"/plugins/"+t)+"/",s=this.plugin.app.vault.adapter;((yield s.exists(n))===!1||!(yield s.exists(n+"manifest.json")))&&(yield s.mkdir(n)),yield s.write(n+"main.js",e.mainJs),yield s.write(n+"manifest.json",e.manifest),e.styles&&(yield s.write(n+"styles.css",e.styles))})}addPlugin(t,e=!1,n=!1,s=!1,o=""){return a(this,null,function*(){var m;let l=yield this.validateRepository(t,!0,!1),g=!!l;if(g===!1&&(l=yield this.validateRepository(t,!1,!0)),l===null){let d=`${t}
A manifest.json or manifest-beta.json file does not exist in the root directory of the repository. This plugin cannot be installed.`;return this.plugin.log(d,!0),p(this.plugin,`${d}`,10),!1}if(!l.hasOwnProperty("version")){let d=`${t}
The manifest${g?"-beta":""}.json file in the root directory of the repository does not have a version number in the file. This plugin cannot be installed.`;return this.plugin.log(d,!0),p(this.plugin,`${d}`,10),!1}if(l.hasOwnProperty("minAppVersion")&&!(0,A.requireApiVersion)(l.minAppVersion)){let d=`Plugin: ${t}
2 years ago
The manifest${g?"-beta":""}.json for this plugin indicates that the Obsidian version of the app needs to be ${l.minAppVersion}, but this installation of Obsidian is ${A.apiVersion}.
You will need to update your Obsidian to use this plugin or contact the plugin developer for more information.`;return this.plugin.log(d,!0),p(this.plugin,`${d}`,30),!1}let u=()=>a(this,null,function*(){let d=yield this.getAllReleaseFiles(t,l,g,o);if((g||d.manifest==="")&&(d.manifest=JSON.stringify(l)),d.mainJs===null){let h=`${t}
The release is not complete and cannot be download. main.js is missing from the Release`;return this.plugin.log(h,!0),p(this.plugin,`${h}`,10),null}return d});if(e===!1){let d=yield u();if(d===null)return!1;yield this.writeReleaseFilesToPluginFolder(l.id,d),yield Te(this.plugin,t,o),yield this.plugin.app.plugins.loadManifests();let h=o===""?"":` (version: ${o})`,T=`${t}${h}
The plugin has been registered with BRAT. You may still need to enable it the Community Plugin List.`;this.plugin.log(T,!0),p(this.plugin,T,10)}else{let d=this.plugin.app.vault.configDir+"/plugins/"+l.id+"/",h="";try{h=yield this.plugin.app.vault.adapter.read(d+"manifest.json")}catch(w){if(w.errno===-4058||w.errno===-2)return yield this.addPlugin(t,!1,g,!1,o),!0;console.log("BRAT - Local Manifest Load",l.id,JSON.stringify(w,null,2))}if(o!==""||this.plugin.settings.pluginSubListFrozenVersion.map(w=>w.repo).includes(t))return p(this.plugin,`The version of ${t} is frozen, not updating.`,3),!1;let T=yield JSON.parse(h);if(T.version!==l.version){let w=yield u();if(w===null)return!1;if(n){let b=`There is an update available for ${l.id} from version ${T.version} to ${l.version}. `;this.plugin.log(b+`[Release Info](https://github.com/${t}/releases/tag/${l.version})`,!1),p(this.plugin,b,30,()=>a(this,null,function*(){window.open(`https://github.com/${t}/releases/tag/${l.version}`)}))}else{yield this.writeReleaseFilesToPluginFolder(l.id,w),yield this.plugin.app.plugins.loadManifests(),(m=this.plugin.app.plugins.plugins[l.id])!=null&&m.manifest&&(yield this.reloadPlugin(l.id));let b=`${l.id}
Plugin has been updated from version ${T.version} to ${l.version}. `;this.plugin.log(b+`[Release Info](https://github.com/${t}/releases/tag/${l.version})`,!1),p(this.plugin,b,30,()=>a(this,null,function*(){window.open(`https://github.com/${t}/releases/tag/${l.version}`)}))}}else s&&p(this.plugin,`No update available for ${t}`,3)}return!0})}reloadPlugin(t){return a(this,null,function*(){let e=this.plugin.app.plugins;try{yield e.disablePlugin(t),yield e.enablePlugin(t)}catch(n){this.plugin.settings.debuggingMode&&console.log("reload plugin",n)}})}updatePlugin(t,e=!1,n=!1){return a(this,null,function*(){let s=yield this.addPlugin(t,!0,e,n);return s===!1&&e===!1&&p(this.plugin,`${t}
Update of plugin failed.`),s})}checkForUpdatesAndInstallUpdates(t=!1,e=!1){return a(this,null,function*(){if((yield X())===!1){console.log("BRAT: No internet detected.");return}let n,s="Checking for plugin updates STARTED";this.plugin.log(s,!0),t&&this.plugin.settings.notificationsEnabled&&(n=new A.Notice(`BRAT
${s}`,3e4));let o=new Set(this.plugin.settings.pluginSubListFrozenVersion.map(l=>l.repo));for(let l of this.plugin.settings.pluginList)o.has(l)||(yield this.updatePlugin(l,e));let r="Checking for plugin updates COMPLETED";this.plugin.log(r,!0),t&&(n.hide(),p(this.plugin,r,10))})}deletePlugin(t){return a(this,null,function*(){let e=`Removed ${t} from BRAT plugin list`;this.plugin.log(e,!0),this.plugin.settings.pluginList=this.plugin.settings.pluginList.filter(n=>n!=t),this.plugin.settings.pluginSubListFrozenVersion=this.plugin.settings.pluginSubListFrozenVersion.filter(n=>n.repo!=t),this.plugin.saveSettings()})}getEnabledDisabledPlugins(t){let e=this.plugin.app.plugins,n=Object.values(e.manifests),s=Object.values(e.plugins).map(o=>o.manifest);return t?n.filter(o=>s.find(r=>o.id===r.id)):n.filter(o=>!s.find(r=>o.id===r.id))}};var Fe=require("obsidian");function Ae(){(0,Fe.addIcon)("BratIcon",'<path fill="currentColor" stroke="currentColor" d="M 41.667969 41.667969 C 41.667969 39.367188 39.800781 37.5 37.5 37.5 C 35.199219 37.5 33.332031 39.367188 33.332031 41.667969 C 33.332031 43.96875 35.199219 45.832031 37.5 45.832031 C 39.800781 45.832031 41.667969 43.96875 41.667969 41.667969 Z M 60.417969 58.582031 C 59.460938 58.023438 58.320312 57.867188 57.25 58.148438 C 56.179688 58.429688 55.265625 59.125 54.707031 60.082031 C 53.746094 61.777344 51.949219 62.820312 50 62.820312 C 48.050781 62.820312 46.253906 61.777344 45.292969 60.082031 C 44.734375 59.125 43.820312 58.429688 42.75 58.148438 C 41.679688 57.867188 40.539062 58.023438 39.582031 58.582031 C 37.597656 59.726562 36.910156 62.257812 38.042969 64.25 C 40.5 68.53125 45.0625 71.171875 50 71.171875 C 54.9375 71.171875 59.5 68.53125 61.957031 64.25 C 63.089844 62.257812 62.402344 59.726562 60.417969 58.582031 Z M 62.5 37.5 C 60.199219 37.5 58.332031 39.367188 58.332031 41.667969 C 58.332031 43.96875 60.199219 45.832031 62.5 45.832031 C 64.800781 45.832031 66.667969 43.96875 66.667969 41.667969 C 66.667969 39.367188 64.800781 37.5 62.5 37.5 Z M 50 8.332031 C 26.988281 8.332031 8.332031 26.988281 8.332031 50 C 8.332031 73.011719 26.988281 91.667969 50 91.667969 C 73.011719 91.667969 91.667969 73.011719 91.667969 50 C 91.667969 26.988281 73.011719 8.332031 50 8.332031 Z M 50 83.332031 C 33.988281 83.402344 20.191406 72.078125 17.136719 56.363281 C 14.078125 40.644531 22.628906 24.976562 37.5 19.042969 C 37.457031 19.636719 37.457031 20.238281 37.5 20.832031 C 37.5 27.738281 43.097656 33.332031 50 33.332031 C 52.300781 33.332031 54.167969 31.46875 54.167969 29.167969 C 54.167969 26.867188 52.300781 25 50 25 C 47.699219 25 45.832031 23.132812 45.832031 20.832031 C 45.832031 18.53125 47.699219 16.667969 50 16.667969 C 68.410156 16.667969 83.332031 31.589844 83.332031 50 C 83.332031 68.410156 68.410156 83.332031 50 83.332031 Z M 50 83.332031 " />')}var J=require("obsidian"),_e=Ze(ze());function He(i,t,e=!1){if(i.settings.debuggingMode&&console.log("BRAT: "+t),i.settings.loggingEnabled){if(i.settings.loggingVerboseEnabled===!1&&e===!0)return;{let n=i.settings.loggingPath+".md",s="[["+(0,J.moment)().format((0,_e.getDailyNoteSettings)().format).toString()+"]] "+(0,J.moment)().format("HH:mm"),o=J.Platform.isDesktop?window.require("os").hostname():"MOBILE",r=s+" "+o+" "+t.replace(`
`," ")+`
`;setTimeout(()=>a(this,null,function*(){if((yield i.app.vault.adapter.exists(n))===!0){let l=yield i.app.vault.adapter.read(n);r=r+l;let g=i.app.vault.getAbstractFileByPath(n);yield i.app.vault.modify(g,r)}else yield i.app.vault.create(n,r)}),10)}}}var Ve=require("obsidian");var S=class extends Ve.FuzzySuggestModal{constructor(e){super(e.app);this.scope.register(["Shift"],"Enter",n=>this.enterTrigger(n)),this.scope.register(["Ctrl"],"Enter",n=>this.enterTrigger(n))}setSuggesterData(e){this.data=e}display(e){return a(this,null,function*(){this.callbackFunction=e,this.open()})}getItems(){return this.data}getItemText(e){return e.display}onChooseItem(){}renderSuggestion(e,n){n.createEl("div",{text:e.item.display})}enterTrigger(e){let n=document.querySelector(".suggestion-item.is-selected div").textContent,s=this.data.find(o=>o.display===n);s&&(this.invokeCallback(s,e),this.close())}onChooseSuggestion(e,n){this.invokeCallback(e.item,n)}invokeCallback(e,n){this.callbackFunction(e,n)}};var W=class{constructor(t){this.bratCommands=[{id:"BRAT-AddBetaPlugin",icon:"BratIcon",name:"Plugins: Add a beta plugin for testing",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.displayAddNewPluginModal(!1,!1)})},{id:"BRAT-AddBetaPluginWithFrozenVersion",icon:"BratIcon",name:"Plugins: Add a beta plugin with frozen version based on a release tag",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.displayAddNewPluginModal(!1,!0)})},{id:"BRAT-checkForUpdatesAndUpdate",icon:"BratIcon",name:"Plugins: Check for updates to all beta plugins and UPDATE",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.checkForUpdatesAndInstallUpdates(!0,!1)})},{id:"BRAT-checkForUpdatesAndDontUpdate",icon:"BratIcon",name:"Plugins: Only check for updates to beta plugins, but don't Update",showInRibbon:!0,callback:()=>a(this,null,function*(){yield this.plugin.betaPlugins.checkForUpdatesAndInstallUpdates(!0,!0)})},{id:"BRAT-updateOnePlugin",icon:"BratIcon",name:"Plugins: Choose a single plugin version to update",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=new Set(this.plugin.settings.pluginSubListFrozenVersion.map(s=>s.repo)),e=Object.values(this.plugin.settings.pluginList).filter(s=>!t.has(s)).map(s=>({display:s,info:s})),n=new S(this.plugin);n.setSuggesterData(e),yield n.display(s=>a(this,null,function*(){let o=`Checking for updates for ${s.info}`;this.plugin.log(o,!0),p(this.plugin,`
${o}`,3),yield this.plugin.betaPlugins.updatePlugin(s.info,!1,!0)}))})},{id:"BRAT-restartPlugin",icon:"BratIcon",name:"Plugins: Restart a plugin that is already installed",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=Object.values(this.plugin.app.plugins.manifests).map(n=>({display:n.id,info:n.id})),e=new S(this.plugin);e.setSuggesterData(t),yield e.display(n=>a(this,null,function*(){p(this.plugin,`${n.info}
Plugin reloading .....`,5),yield this.plugin.betaPlugins.reloadPlugin(n.info)}))})},{id:"BRAT-disablePlugin",icon:"BratIcon",name:"Plugins: Disable a plugin - toggle it off",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=this.plugin.betaPlugins.getEnabledDisabledPlugins(!0).map(n=>({display:`${n.name} (${n.id})`,info:n.id})),e=new S(this.plugin);e.setSuggesterData(t),yield e.display(n=>a(this,null,function*(){this.plugin.log(`${n.display} plugin disabled`,!1),this.plugin.settings.debuggingMode&&console.log(n.info),yield this.plugin.app.plugins.disablePluginAndSave(n.info)}))})},{id:"BRAT-enablePlugin",icon:"BratIcon",name:"Plugins: Enable a plugin - toggle it on",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=this.plugin.betaPlugins.getEnabledDisabledPlugins(!1).map(n=>({display:`${n.name} (${n.id})`,info:n.id})),e=new S(this.plugin);e.setSuggesterData(t),yield e.display(n=>a(this,null,function*(){this.plugin.log(`${n.display} plugin enabled`,!1),yield this.plugin.app.plugins.enablePluginAndSave(n.info)}))})},{id:"BRAT-openGitHubZRepository",icon:"BratIcon",name:"Plugins: Open the GitHub repository for a plugin",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=yield fe(this.plugin.settings.debuggingMode),e=Object.values(t).map(o=>({display:`Plugin: ${o.name} (${o.repo})`,info:o.repo})),n=Object.values(this.plugin.settings.pluginList).map(o=>({display:"BRAT: "+o,info:o}));e.forEach(o=>n.push(o));let s=new S(this.plugin);s.setSuggesterData(n),yield s.display(o=>a(this,null,function*(){o.info&&window.open(`https://github.com/${o.info}`)}))})},{id:"BRAT-openGitHubRepoTheme",icon:"BratIcon",name:"Themes: Open the GitHub repository for a theme (appearance)",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=yield he(this.plugin.settings.debuggingMode),e=Object.values(t).map(s=>({display:`Theme: ${s.name} (${s.repo})`,info:s.repo})),n=new S(this.plugin);n.setSuggesterData(e),yield n.display(s=>a(this,null,function*(){s.info&&window.open(`https://github.com/${s.info}`)}))})},{id:"BRAT-opentPluginSettings",icon:"BratIcon",name:"Plugins: Open Plugin Settings Tab",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=this.plugin.app.setting,e=Object.values(t.pluginTabs).map(o=>({display:"Plugin: "+o.name,info:o.id})),n=new S(this.plugin),s=Object.values(t.settingTabs).map(o=>({display:"Core: "+o.name,info:o.id}));e.forEach(o=>s.push(o)),n.setSuggesterData(s),yield n.display(o=>a(this,null,function*(){t.open(),t.openTabById(o.info)}))})},{id:"BRAT-GrabBetaTheme",icon:"BratIcon",name:"Themes: Grab a beta theme for testing from a Github repository",showInRibbon:!0,callback:()=>a(this,null,function*(){new E(this.plugin).open()})},{id:"BRAT-updateBetaThemes",icon:"BratIcon",name:"Themes: Update beta themes",showInRibbon:!0,callback:()=>a(this,null,function*(){return yield I(this.plugin,!0)})},{id:"BRAT-allCommands",icon:"BratIcon",name:"All Commands list",showInRibbon:!1,callback:()=>a(this,null,function*(){return this.ribbonDisplayCommands()})}];this.plugin=t,this.bratCommands.forEach(e=>a(this,null,function*(){this.plugin.addCommand({id:e.id,name:e.name,icon:e.icon,callback:()=>a(this,null,function*(){yield e.callback()})})}))}ribbonDisplayCommands(){return a(this,null,function*(){let t=[];this.bratCommands.forEach(r=>{r.showInRibbon&&t.push({display:r.name,info:r.callback})});let e=new S(this.plugin),n=this.plugin.app.setting,s=Object.values(n.settingTabs).map(r=>({display:"Core: "+r.name,info:()=>a(this,null,function*(){n.open(),n.openTabById(r.id)})})),o=Object.values(n.pluginTabs).map(r=>({display:"Plugin: "+r.name,info:()=>a(this,null,function*(){n.open(),n.openTabById(r.id)})}));t.push({display:"---- Core Plugin Settings ----",info:()=>a(this,null,function*(){yield this.ribbonDisplayCommands()})}),s.forEach(r=>t.push(r)),t.push({display:"---- Plugin Settings ----",info:()=>a(this,null,function*(){yield this.ribbonDisplayCommands()})}),o.forEach(r=>t.push(r)),e.setSuggesterData(t),yield e.display(r=>a(this,null,function*(){return yield r.info()}))})}};var Q=class{constructor(t){th
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vbm9kZV9tb2R1bGVzL29ic2lkaWFuLWRhaWx5LW5vdGVzLWludGVyZmFjZS9kaXN0L21haW4uanMiLCAiLi4vc3JjL21haW4udHMiLCAiLi4vc3JjL3VpL1NldHRpbmdzVGFiLnRzIiwgIi4uL3NyYy9mZWF0dXJlcy90aGVtZXMudHMiLCAiLi4vc3JjL2ZlYXR1cmVzL2dpdGh1YlV0aWxzLnRzIiwgIi4uL3NyYy91aS9zZXR0aW5ncy50cyIsICIuLi9zcmMvdXRpbHMvbm90aWZpY2F0aW9ucy50cyIsICIuLi9zcmMvdXRpbHMvaW50ZXJuZXRjb25uZWN0aW9uLnRzIiwgIi4uL3NyYy91aS9BZGROZXdUaGVtZS50cyIsICIuLi9zcmMvdWkvUHJvbW90aW9uYWwudHMiLCAiLi4vc3JjL3VpL0FkZE5ld1BsdWdpbk1vZGFsLnRzIiwgIi4uL3NyYy9mZWF0dXJlcy9CZXRhUGx1Z2lucy50cyIsICIuLi9zcmMvdWkvaWNvbnMudHMiLCAiLi4vc3JjL3V0aWxzL2xvZ2dpbmcudHMiLCAiLi4vc3JjL3VpL0dlbmVyaWNGdXp6eVN1Z2dlc3Rlci50cyIsICIuLi9zcmM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