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.

24 lines
44 KiB

2 years ago
var He=Object.create;var V=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Qe=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Ge=(s,t)=>{for(var e in t)V(s,e,{get:t[e],enumerable:!0})},ce=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qe(t))!We.call(s,i)&&i!==e&&V(s,i,{get:()=>t[i],enumerable:!(n=je(t,i))||n.enumerable});return s};var Ke=(s,t,e)=>(e=s!=null?He(Je(s)):{},ce(t||!s||!s.__esModule?V(e,"default",{value:s,enumerable:!0}):e,s)),Ze=s=>ce(V({},"__esModule",{value:!0}),s);var a=(s,t,e)=>new Promise((n,i)=>{var o=g=>{try{l(e.next(g))}catch(c){i(c)}},r=g=>{try{l(e.throw(g))}catch(c){i(c)}},l=g=>g.done?n(g.value):Promise.resolve(g.value).then(o,r);l((e=e.apply(s,t)).next())});var ze=Qe(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});var p=require("obsidian"),se="YYYY-MM-DD",oe="gggg-[W]ww",Ce="YYYY-MM",Ee="YYYY-[Q]Q",Ie="YYYY";function R(s){var e,n;let t=window.app.plugins.getPlugin("periodic-notes");return t&&((n=(e=t.settings)==null?void 0:e[s])==null?void 0:n.enabled)}function k(){var s,t,e,n;try{let{internalPlugins:i,plugins:o}=window.app;if(R("daily")){let{format:c,folder:h,template:d}=((t=(s=o.getPlugin("periodic-notes"))==null?void 0:s.settings)==null?void 0:t.daily)||{};return{format:c||se,folder:(h==null?void 0:h.trim())||"",template:(d==null?void 0:d.trim())||""}}let{folder:r,format:l,template:g}=((n=(e=i.getPluginById("daily-notes"))==null?void 0:e.instance)==null?void 0:n.options)||{};return{format:l||se,folder:(r==null?void 0:r.trim())||"",template:(g==null?void 0:g.trim())||""}}catch(i){console.info("No custom daily note settings found!",i)}}function M(){var s,t,e,n,i,o,r;try{let l=window.app.plugins,g=(s=l.getPlugin("calendar"))==null?void 0:s.options,c=(e=(t=l.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.weekly;if(R("weekly"))return{format:c.format||oe,folder:((n=c.folder)==null?void 0:n.trim())||"",template:((i=c.template)==null?void 0:i.trim())||""};let h=g||{};return{format:h.weeklyNoteFormat||oe,folder:((o=h.weeklyNoteFolder)==null?void 0:o.trim())||"",template:((r=h.weeklyNoteTemplate)==null?void 0:r.trim())||""}}catch(l){console.info("No custom weekly note settings found!",l)}}function O(){var t,e,n,i;let s=window.app.plugins;try{let o=R("monthly")&&((e=(t=s.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.monthly)||{};return{format:o.format||Ce,folder:((n=o.folder)==null?void 0:n.trim())||"",template:((i=o.template)==null?void 0:i.trim())||""}}catch(o){console.info("No custom monthly note settings found!",o)}}function $(){var t,e,n,i;let s=window.app.plugins;try{let o=R("quarterly")&&((e=(t=s.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:((i=o.template)==null?void 0:i.trim())||""}}catch(o){console.info("No custom quarterly note settings found!",o)}}function x(){var t,e,n,i;let s=window.app.plugins;try{let o=R("yearly")&&((e=(t=s.getPlugin("periodic-notes"))==null?void 0:t.settings)==null?void 0:e.yearly)||{};return{format:o.format||Ie,folder:((n=o.folder)==null?void 0:n.trim())||"",template:((i=o.template)==null?void 0:i.trim())||""}}catch(o){console.info("No custom yearly note settings found!",o)}}function Le(...s){let t=[];for(let n=0,i=s.length;n<i;n++)t=t.concat(s[n].split("/"));let e=[];for(let n=0,i=t.length;n<i;n++){let o=t[n];!o||o==="."||e.push(o)}return t[0]===""&&e.unshift(""),e.join("/")}function nt(s){let t=s.substring(s.lastIndexOf("/")+1);return t.lastIndexOf(".")!=-1&&(t=t.substring(0,t.lastIndexOf("."))),t}function it(s){return a(this,null,function*(){let t=s.replace(/\\/g,"/").split("/");if(t.pop(),t.length){let e=Le(...t);window.app.vault.getAbstractFileByPath(e)||(yield window.app.vault.createFolder(e))}})}function U(s,t){return a(this,null,function*(){t.endsWith(".md")||(t+=".md");let e=p.normalizePath(Le(s,t));return yield it(e),e})}function E(s)
3 years ago
${t}
2 years ago
${i}`,e*1e3);n&&(o.noticeEl.oncontextmenu=()=>a(this,null,function*(){n()}))}function J(){return a(this,null,function*(){try{let s=yield fetch("https://obsidian.md/?"+Math.random());return s.status>=200&&s.status<300}catch(s){return!1}})}var Pe=s=>(0,W.normalizePath)(s.app.vault.configDir+"/themes")+"/",ie=(s,t,e="")=>a(void 0,null,function*(){let n=yield ne(t,s.settings.debuggingMode);if(!n)return m(s,"There is no obsidian.css file in the root path of this repository, so there is no theme to install."),!1;yield ve(s,e,n);let i=`${e} theme installed from ${t}. `;return s.log(i+`[Theme Info](https://github.com/${t})`,!1),m(s,`${i}`,10,()=>a(void 0,null,function*(){window.open(`https://github.com/${t}`)})),setTimeout(()=>{s.app.customCss.setTheme(e)},500),!0}),ve=(s,t,e)=>a(void 0,null,function*(){let n=Pe(s),i=s.app.vault.adapter;(yield i.exists(n))===!1&&(yield i.mkdir(n)),yield i.write(n+t+".css",e)}),Se=s=>a(void 0,null,function*(){let t=yield H(s.settings.debuggingMode),e=Object.values(t).map(i=>({display:`Theme: ${i.name} (${i.repo})`,info:i})),n=new S(s);n.setSuggesterData(e),yield n.display(i=>a(void 0,null,function*(){yield ie(s,i.info.repo,i.info.name)}))}),Q=s=>("BRAT-"+s.replace("/","----")).substr(0,100),Ne=(s,t)=>a(void 0,null,function*(){s.settings.themesList=s.settings.themesList.filter(n=>n.repo!=t),s.saveSettings(),yield s.app.vault.adapter.remove(Pe(s)+Q(t)+".css");let e=`Removed ${t} from BRAT themes list and deleted from vault`;s.log(e,!0),m(s,`${e}`)}),G=(s,t)=>a(void 0,null,function*(){if((yield J())===!1){console.log("BRAT: No internet detected.");return}let e,n="Checking for beta theme updates STARTED";s.log(n,!0),t&&s.settings.notificationsEnabled&&(e=new W.Notice(`BRAT
2 years ago
${n}`,3e4));for(let o of s.settings.themesList){let r=yield j(o.repo,"obsidian.css");r!==o.lastUpdate&&(yield tt(s,o.repo,o.lastUpdate,r))}let i="Checking for beta theme updates COMPLETED";s.log(i,!0),t&&(s.settings.notificationsEnabled&&e.hide(),m(s,i))}),tt=(s,t,e="",n="")=>a(void 0,null,function*(){let i=yield ne(t,s.settings.debuggingMode);if(!i)return m(s,"There is no obsidian.css file in the root path of the ${cssGithubRepository} repository, so this theme cannot be updated."),!1;let o=Q(t);yield ve(s,o,i),Te(s,t,n);let r=`${o} theme updated from ${t}. From date: ${e} to ${n} `;return s.log(r+`[Theme Info](https://github.com/${t})`,!1),m(s,`${r}`,20,()=>a(void 0,null,function*(){window.open(`https://github.com/${t}`)})),!0});var K=require("obsidian");var C=class extends K.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 ye(this.plugin,e)){m(this.plugin,"This plugin is already in the list for beta testing",10);return}(yield ie(this.plugin,e,Q(e)))&&(yield we(this.plugin,e),this.close())})}onOpen(){this.contentEl.createEl("h4",{text:"Github repository for beta theme:"}),this.contentEl.createEl("form",{},e=>{new K.Setting(e).addText(n=>{n.setPlaceholder("Repository (example: https://github.com/GitubUserName/repository-name"),n.onChange(i=>{this.address=i.trim()}),n.inputEl.addEventListener("keydown",i=>a(this,null,function*(){i.key==="Enter"&&this.address!==" "&&(i.preventDefault(),yield this.submitForm())})),n.inputEl.style.width="100%",window.setTimeout(()=>{let i=document.querySelector(".setting-item-info");i&&i.remove(),n.inputEl.focus()},10)}),e.createDiv("modal-button-container",n=>{n.createEl("button",{attr:{type:"button"},text:"Never mind"}).addEventListener("click",()=>this.close()),n.createEl("button",{attr:{type:"submit"},cls:"mod-cta",text:"Add Theme"})}),e.addEventListener("submit",n=>a(this,null,function*(){n.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 Z=class extends v.PluginSettingTab{constructor(e,n){super(e,n);this.plugin=n}display(){let{containerEl:e}=this;e.empty(),e.createEl("h2",{text:this.plugin.appName}),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(i=>{i.setValue(this.plugin.settings.updateAtStartup),i.onChange(o=>a(this,null,function*(){this.plugin.settings.updateAtStartup=o,yield this.plugin.saveSettings()}))}),new v.Setting(e).setName("Auto-update themes at startup").setDesc("If enabled all beta themes will be checked for updates each time Obsidian starts.").addToggle(i=>{i.setValue(this.plugin.settings.updateThemesAtStartup),i.onChange(o=>a(this,null,function*(){this.plugin.settings.updateThemesAtStartup=o,yield this.plugin.saveSettings()}))}),new v.Setting(e).setName("Ribbon Button").setDesc("Toggle ribbon button off and on.").addToggle(i=>{i.setValue(this.plugin.settings.ribbonIconEnabled),i.onChange(o=>a(this,null,function*(){this.plugin.settings.ribbonIconEnabled=o,this.plugin.settings.ribbonIconEnabled===!1?this.plugin.ribbonIcon.remove():this.plugin.showRibbonButton(),yield this.plugin.saveSettings()}))}),e.createEl("hr"),e.createEl("h2",{text:"Beta Plugin List"}),e.createEl("div",{text:'The following is a list of beta plugins added via the command palette "Add a beta plugin for testing" or "Add a beta plugin with frozen version for testing". A frozen version is a specific release of a plugin based on its releease tag. '}),e.createEl("p"),e.createEl("div",{text:"Click the x button next to a plugin to remove it from the list."}),e.createEl("p"),e.createEl("span").createEl("b",{text:"Note: "}),e.createSpan({text:"This does not delete th
3 years ago
The version attribute for the release is missing from the manifest file`,15),null):(n&&m(this.plugin,`${t}
The plugin id attribute for the release is missing from the manifest file`,15),null):(n&&m(this.plugin,`${t}
2 years ago
This does not seem to be an obsidian plugin, as there is no manifest.json file.`,15),null)})}getAllReleaseFiles(t,e,n,i=""){return a(this,null,function*(){let o=i===""?e.version:i,r=n||i!=="";return{mainJs:yield Y(t,o,"main.js",this.plugin.settings.debuggingMode),manifest:r?yield Y(t,o,"manifest.json",this.plugin.settings.debuggingMode):"",styles:yield Y(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)+"/",i=this.plugin.app.vault.adapter;((yield i.exists(n))===!1||!(yield i.exists(n+"manifest.json")))&&(yield i.mkdir(n)),yield i.write(n+"main.js",e.mainJs),yield i.write(n+"manifest.json",e.manifest),e.styles&&(yield i.write(n+"styles.css",e.styles))})}addPlugin(t,e=!1,n=!1,i=!1,o=""){return a(this,null,function*(){var h;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}
3 years ago
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),m(this.plugin,`${d}`,10),!1}if(!l.hasOwnProperty("version")){let d=`${t}
2 years ago
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),m(this.plugin,`${d}`,10),!1}if(l.hasOwnProperty("minAppVersion")&&!(0,A.requireApiVersion)(l.minAppVersion)){let d=`Plugin: ${t}
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),m(this.plugin,`${d}`,30),!1}let c=()=>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 b=`${t}
The release is not complete and cannot be download. main.js is missing from the Release`;return this.plugin.log(b,!0),m(this.plugin,`${b}`,10),null}return d});if(e===!1){let d=yield c();if(d===null)return!1;yield this.writeReleaseFilesToPluginFolder(l.id,d),yield he(this.plugin,t,o),yield this.plugin.app.plugins.loadManifests();let b=o===""?"":` (version: ${o})`,T=`${t}${b}
The plugin has been registered with BRAT. You may still need to enable it the Community Plugin List.`;this.plugin.log(T,!0),m(this.plugin,T,10)}else{let d=this.plugin.app.vault.configDir+"/plugins/"+l.id+"/",b="";try{b=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 m(this.plugin,`The version of ${t} is frozen, not updating.`,3),!1;let T=yield JSON.parse(b);if(T.version!==l.version){let w=yield c();if(w===null)return!1;if(n){let f=`There is an update available for ${l.id} from version ${T.version} to ${l.version}. `;this.plugin.log(f+`[Release Info](https://github.com/${t}/releases/tag/${l.version})`,!1),m(this.plugin,f,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(),(h=this.plugin.app.plugins.plugins[l.id])!=null&&h.manifest&&(yield this.reloadPlugin(l.id));let f=`${l.id}
Plugin has been updated from version ${T.version} to ${l.version}. `;this.plugin.log(f+`[Release Info](https://github.com/${t}/releases/tag/${l.version})`,!1),m(this.plugin,f,30,()=>a(this,null,function*(){window.open(`https://github.com/${t}/releases/tag/${l.version}`)}))}}else i&&m(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 i=yield this.addPlugin(t,!0,e,n);return i===!1&&e===!1&&m(this.plugin,`${t}
Update of plugin failed.`),i})}checkForUpdatesAndInstallUpdates(t=!1,e=!1){return a(this,null,function*(){if((yield J())===!1){console.log("BRAT: No internet detected.");return}let n,i="Checking for plugin updates STARTED";this.plugin.log(i,!0),t&&this.plugin.settings.notificationsEnabled&&(n=new A.Notice(`BRAT
${i}`,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(),m(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),i=Object.values(e.plugins).map(o=>o.manifest);return t?n.filter(o=>i.find(r=>o.id===r.id)):n.filter(o=>!i.find(r=>o.id===r.id))}};var Ae=require("obsidian");function Fe(){(0,Ae.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 z=require("obsidian"),_e=Ke(ze());function Ve(s,t,e=!1){if(s.settings.debuggingMode&&console.log("BRAT: "+t),s.settings.loggingEnabled){if(s.settings.loggingVerboseEnabled===!1&&e===!0)return;{let n=s.settings.loggingPath+".md",i="[["+(0,z.moment)().format((0,_e.getDailyNoteSettings)().format).toString()+"]] "+(0,z.moment)().format("HH:mm"),o=z.Platform.isDesktop?window.require("os").hostname():"MOBILE",r=i+" "+o+" "+t.replace(`
`," ")+`
2 years ago
`;setTimeout(()=>a(this,null,function*(){if((yield s.app.vault.adapter.exists(n))===!0){let l=yield s.app.vault.adapter.read(n);r=r+l;let g=s.app.vault.getAbstractFileByPath(n);yield s.app.vault.modify(g,r)}else yield s.app.vault.create(n,r)}),10)}}}var _=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(i=>i.repo)),e=Object.values(this.plugin.settings.pluginList).filter(i=>!t.has(i)).map(i=>({display:i,info:i})),n=new S(this.plugin);n.setSuggesterData(e),yield n.display(i=>a(this,null,function*(){let o=`Checking for updates for ${i.info}`;this.plugin.log(o,!0),m(this.plugin,`
3 years ago
${o}`,3),yield this.plugin.betaPlugins.updatePlugin(i.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*(){m(this.plugin,`${n.info}
2 years ago
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 pe(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 i=new S(this.plugin);i.setSuggesterData(n),yield i.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 H(this.plugin.settings.debuggingMode),e=Object.values(t).map(i=>({display:`Theme: ${i.name} (${i.repo})`,info:i.repo})),n=new S(this.plugin);n.setSuggesterData(e),yield n.display(i=>a(this,null,function*(){i.info&&window.open(`https://github.com/${i.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),i=Object.values(t.settingTabs).map(o=>({display:"Core: "+o.name,info:o.id}));e.forEach(o=>i.push(o)),n.setSuggesterData(i),yield n.display(o=>a(this,null,function*(){t.open(),t.openTabById(o.info)}))})},{id:"BRAT-GrabCommunityTheme",icon:"BratIcon",name:"Themes: Grab a community theme",showInRibbon:!0,callback:()=>a(this,null,function*(){return yield Se(this.plugin)})},{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 C(this.plugin).open()})},{id:"BRAT-updateBetaThemes",icon:"BratIcon",name:"Themes: Update beta themes",showInRibbon:!0,callback:()=>a(this,null,function*(){return yield G(this.plugin,!0)})},{id:"BRAT-switchTheme",icon:"BratIcon",name:"Themes: Switch Active Theme ",showInRibbon:!0,callback:()=>a(this,null,function*(){let t=Object.values(this.plugin.app.customCss.themes).map(n=>({display:n,info:n}));t.unshift({display:"Obsidian Default Theme",info:""});let e=new S(this.plugin);e.setSuggesterData(t),yield e.display(n=>a(this,null,function*(){this.plugin.log(`Switched to theme ${n.display}`,!1),this.plugin.app.customCss.setTheme(n.info)}))})},{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,i=Object.values(n.settingTabs).map(r=>({displa