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.

107 lines
34 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
If you want to view the source, visit the plugin's github repository:
https://github.com/kometenstaub/customizable-page-header-buttons
This plugin is MIT-licensed:
MIT License
Copyright (c) 2021-2022 kometenstaub
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.
This plugin uses feather icons (https://github.com/feathericons/feather). Feather icons is MIT-licensed:
The MIT License (MIT)
Copyright (c) 2013-2017 Cole Bemis
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.
The feather icons npm module uses itself the 'class names' npm package (https://github.com/JedWatson/classnames).
It is MIT-licensed:
The MIT License (MIT)
Copyright (c) 2018 Jed Watson
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.
The commandSuggester, iconPicker, addFeatherIcons function, Obsidian icon names and the biggest part of the settings tab have been adapted from the Obsidian Customizable Sidebar Plugin (https://github.com/phibr0/obsidian-customizable-sidebar).
It is MIT-licensed:
MIT License
Copyright (c) 2021 Phillip
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.
*/
var Q=Object.create;var E=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var M=n=>E(n,"__esModule",{value:!0});var Z=(n,i)=>{M(n);for(var t in i)E(n,t,{get:i[t],enumerable:!0})},ee=(n,i,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of W(i))!Y.call(n,e)&&e!=="default"&&E(n,e,{get:()=>i[e],enumerable:!(t=V(i,e))||t.enumerable});return n},T=n=>ee(M(E(n!=null?Q(X(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var u=(n,i,t)=>new Promise((e,l)=>{var s=d=>{try{o(t.next(d))}catch(g){l(g)}},c=d=>{try{o(t.throw(d))}catch(g){l(g)}},o=d=>d.done?e(d.value):Promise.resolve(d.value).then(s,c);o((t=t.apply(n,i)).next())});Z(exports,{default:()=>D});var y=T(require("obsidian"));var a=T(require("obsidian"));var K=T(require("obsidian"));var v=T(require("obsidian"));var k=T(require("obsidian"));var q=["add-note-glyph","any-key","audio-file","blocks","bold-glyph","box-glyph","bracket-glyph","broken-link","bullet-list-glyph","bullet-list","calendar-glyph","calendar-with-checkmark","check-in-circle","check-small","checkbox-glyph","checkmark","clock-glyph","clock","cloud","code-glyph","command-glyph","compress-glyph","create-new","cross-in-box","cross","crossed-star","dice-glyph","dice","document","documents","dot-network","double-down-arrow-glyph","double-up-arrow-glyph","down-arrow-with-tail","down-chevron-glyph","down-curly-arrow-glyph","duplicate-glyph","enlarge-glyph","enter","exit-fullscreen","expand-vertically","file-explorer-glyph","filled-pin","folder","forward-arrow","fullscreen","gear","github-glyph","go-to-file","graph-glyph","hashtag","heading-glyph","help","highlight-glyph","horizontal-split","image-file","image-glyph","import-glyph","indent-glyph","info","install","italic-glyph","keyboard-glyph","languages","left-arrow-with-tail","left-arrow","left-chevron-glyph","lines-of-text","link-glyph","link","links-coming-in","links-going-out","logo-crystal","magnifying-glass","merge-files-glyph","merge-files","microphone-filled","microphone","minus-with-circle","navigate-glyph","note-glyph","number-list-glyph","open-elsewhere-glyph","open-vault","pane-layout","paper-plane-glyph","paper-plane","paste-text","paste","paused","pdf-file","pencil","percent-sign-glyph","pin","play-audio-glyph","plus-minus-glyph","plus-with-circle","popup-open","presentation-glyph","presentation","price-tag-glyph","question-mark-glyph","quote-glyph","reading-glasses","redo-glyph","reset","restore-file-glyph","right-arrow-with-tail","right-arrow","right-chevron-glyph","right-triangle","run-command","scissors-glyph","scissors","search-glyph","search","select-all-text","sheets-in-box","split","stacked-levels","star-glyph","star-list","star","stop-audio-glyph","strikethrough-glyph","switch","sync-small","sync","tag-glyph","three-horizontal-bars","tomorrow-glyph","trash","two-blank-pages","undo-glyph","unindent-glyph","up-and-down-arrows","up-arrow-with-tail","up-chevron-glyph","up-curly-arrow-glyph","uppercase-lowercase-a","vault","vertical-split","vertical-three-dots","wand-glyph","wand","workspace-glyph","wrench-screwdriver-glyph","yesterday-glyph"],r="page-header-button",w="titlebar-button",C="titlebar-center",S=[w,r];function te(n){return n.includes(":")?n.split(":")[1].trim():n}function O(){let n=24;return k.Platform.isMobile?n=24:k.Platform.isDesktop&&(n=18),n}function x(n,i,t,e,l,s="a"){let c=te(n),o=l.concat([i]),d=createEl(s,{cls:o,attr:{"aria-label-position":"bottom","aria-label":c}});return(0,k.setIcon)(d,t,e),d}function L(n){for(let i=n.length;i>=0;i--)n[i]&&n[i].remove()}function I(n,i,t){let e=n.getElementsByClassName(`${t} ${r} ${i}`);e[0]&&e[0].remove()}function H(){return document.getElementsByClassName("titlebar-text")[0].getText()}function f(n){let i=document.getElementsByClassName(`${r} ${C}`)[0];i!==void 0&&(i.classList.remove(r,C),i.addClass("titlebar-text"),i.innerHTML=n)}function b(){let i=A().getElementsByClassName(`${r} ${w}`);L(i)}function _(){let n=document.getElementsByClassName("titlebar-text")[0];return n.classList.remove("titlebar-text"),n.addClasses([r,C]),n.innerHTML="",n}function j(){let n=document.getElementsByClassName("workspace-leaf-content");for(let i=0;i<n.length;i++){let e=n[i].getElementsByClassName(r);e.length>0&&L(e)}}function z(n){let i=document.getElementsByClassName("workspace-leaf-content");for(let t=0;t<i.length;t++){let e=i[t];I(e,n,"view-action")}}function $(){h(),p()}function h(){let i=R().getElementsByClassName(r);i.length>0&&L(i)}function p(){let i=P().getElementsByClassName(r);i.length>0&&L(i)}function F(n){let i=R();I(i,n,w)}function U(n){let i=P();I(i,n,w)}function G(n){let i=A();I(i,n,w)}function R(){return document.getElementsByClassName("titlebar-button-container mod-left")[0]}function P(){return document.getElementsByClassName("titlebar-button-container mod-right")[0]}function A(){return document.getElementsByClassName(`${r} ${C}`)[0]}var m=class extends v.FuzzySuggestModal{constructor(i,t,e,l=-1){super(i.app);this.plugin=i,this.command=t,this.type=e,this.index=l,this.setPlaceholder("Please pick an icon")}cap(i){return i.split(" ").map(e=>e[0].toUpperCase()+e.substring(1)).join(" ")}getItems(){return this.plugin.iconList}getItemText(i){return this.cap(i.replace("lucide-","").replace(/-/gi," "))}renderSuggestion(i,t){t.addClass("CS-icon-container");let e=t.createDiv({cls:"CS-icon"});(0,v.setIcon)(e,i.item),super.renderSuggestion(i,t)}onChooseItem(i){return u(this,null,function*(){let{id:t,name:e}=this.command,{settings:l}=this.plugin,s=0;if(this.type==="page"){let c="both";this.index===-1?c="both":c=l.enabledButtons[this.index].showButtons;let o={id:t,icon:i,name:e,showButtons:c};this.index===-1?l.enabledButtons.push(o):(l.enabledButtons[this.index]=o,new v.Notice("This change will take effect for new panes only."))}else{let c={id:t,icon:i,name:e};if(this.index===-1)if(this.type==="title-left")l.titleLeft.push(c);else if(this.type==="title-right")l.titleRight.push(c);else{let o=l.titleCenter.length;o!==0&&(s=o),l.titleCenter.push(c)}else if(this.type==="title-left")l.titleLeft[this.index]=c;else if(this.type==="title-right")l.titleRight[this.index]=c;else{let o=l.titleCenter.length;o!==0&&(s=o),l.titleCenter[this.index]=c}}yield this.plugin.saveSettings(),this.type==="title-left"?(h(),this.plugin.addLeftTitleBarButtons()):this.type==="title-right"?(p(),this.plugin.addRightTitleBarButtons()):s===0?this.plugin.addInitialCenterTitleBarButtons():l.titleCenter.length===0?f(this.plugin.titlebarText):(b(),this.plugin.addCenterTitleBarButtons()),setTimeout(()=>{dispatchEvent(new Event("TopBar-addedCommand"))},100)})}};var B=class extends K.FuzzySuggestModal{constructor(i,t){super(i.app);this.plugin=i,this.type=t}pushToSettings(i,t,e){e==="titleRight"||e==="titleLeft"||e==="titleCenter"?i[e].push({id:t.id,icon:t.icon,name:t.name}):i.enabledButtons.push({id:t.id,icon:t.icon,name:t.name,showButtons:"both"})}getItems(){return this.app.commands.listCommands()}getItemText(i){return i.name}onChooseItem(i,t){return u(this,null,function*(){let{settings:e}=this.plugin,l=0;if(i.icon!==void 0){if(this.type==="page")this.pushToSettings(e,i,"enabledSettings");else if(this.type==="title-left")this.pushToSettings(e,i,"titleLeft");else if(this.type==="title-right")this.pushToSettings(e,i,"titleRight");else{let s=this.plugin.settings.titleCenter.length;s!==0&&(l=s),this.pushToSettings(e,i,"titleCenter")}yield this.plugin.saveSettings(),this.type==="title-left"?(h(),this.plugin.addLeftTitleBarButtons()):this.type==="title-right"?(p(),this.plugin.addRightTitleBarButtons()):this.type==="title-center"&&(l===0?this.plugin.addInitialCenterTitleBarButtons():this.plugin.settings.titleCenter.length===0?f(this.plugin.titlebarText):(b(),this.plugin.addCenterTitleBarButtons())),setTimeout(()=>{dispatchEvent(new Event("TopBar-addedCommand"))},100)}else new m(this.plugin,i,this.type).open()})}};var N=class extends a.PluginSettingTab{constructor(i,t){super(i,t);this.plugin=t,this.plugin.listener=()=>{this.display()},this.containerEl.addClass("page-header-button"),addEventListener("TopBar-addedCommand",this.plugin.listener)}display(){let{containerEl:i}=this,{settings:t}=this.plugin;i.empty(),i.createEl("h3",{text:"Page Header Buttons"}),i.createEl("p",{text:"The buttons are added in the order in which they are shown here. This only takes effect after a reload."}),new a.Setting(i).setName("Show buttons on desktop").setDesc("By default, the buttons will only be shown in Obsidian Mobile. It requires a reload after being toggled to take effect.").addToggle(e=>{e.setValue(t.desktop).onChange(l=>u(this,null,function*(){if(t.desktop=l,yield this.plugin.saveSettings(),this.display(),!l){for(let s of t.enabledButtons)s.showButtons="mobile";yield this.plugin.saveSettings()}}))}),new a.Setting(i).setName("Add Button").setDesc("Add a new button left to the switch edit/preview mode toggle.").addButton(e=>{e.setButtonText("Add Command").onClick(()=>{new B(this.plugin,"page").open()})});for(let e=0;e<t.enabledButtons.length;e++){let l=t.enabledButtons[e],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(i).setName(l.name);t.desktop&&c.addDropdown(o=>{o.addOption("both","Add button for both mobile and desktop.").addOption("mobile","Add button only for mobile.").addOption("desktop","Add button only for desktop.").setValue(l.showButtons).onChange(d=>u(this,null,function*(){l.showButtons=d,t.enabledButtons[e]=l,yield this.plugin.saveSettings(),d==="desktop"&&a.Platform.isMobile?z(l.id):d==="mobile"&&a.Platform.isDesktop&&z(l.id)}))}),e>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(()=>u(this,null,function*(){t.enabledButtons[e]=t.enabledButtons[e-1],t.enabledButtons[e-1]=l,yield this.plugin.saveSettings(),this.display()}))}),e<t.enabledButtons.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(()=>u(this,null,function*(){t.enabledButtons[e]=t.enabledButtons[e+1],t.enabledButtons[e+1]=l,yield this.plugin.saveSettings(),this.display()}))}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(()=>u(this,null,function*(){t.enabledButtons.remove(l),z(l.id),yield this.plugin.saveSettings(),this.display()}))}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=t.enabledButtons.findIndex(g=>g===l);new m(this.plugin,l,"page",d).open()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}if(a.Platform.isDesktopApp){i.createEl("br"),i.createEl("h3",{text:"Titlebar buttons"}),i.createEl("h4",{text:"Left titlebar"}),new a.Setting(i).setName("Add Button").setDesc("Add a new button right to the back/forward buttons.").addButton(e=>{e.setButtonText("Add Command").onClick(()=>{new B(this.plugin,"title-left").open()})});for(let e=0;e<t.titleLeft.length;e++){let l=t.titleLeft[e],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(i).setName(l.name);e>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(()=>u(this,null,function*(){t.titleLeft[e]=t.titleLeft[e-1],t.titleLeft[e-1]=l,yield this.plugin.saveSettings(),h(),this.plugin.addLeftTitleBarButtons(),this.display()}))}),e<t.titleLeft.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(()=>u(this,null,function*(){t.titleLeft[e]=t.titleLeft[e+1],t.titleLeft[e+1]=l,yield this.plugin.saveSettings(),h(),this.plugin.addLeftTitleBarButtons(),this.display()}))}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(()=>u(this,null,function*(){t.titleLeft.remove(l),yield this.plugin.saveSettings(),F(l.id),this.display()}))}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=t.titleLeft.findIndex(g=>g===l);new m(this.plugin,l,"title-left",d).open(),h(),this.plugin.addLeftTitleBarButtons()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}i.createEl("h4",{text:"Right titlebar"}),new a.Setting(i).setName("Add Button").setDesc("Add a new button left to the minimize/maximize/close buttons.").addButton(e=>{e.setButtonText("Add Command").onClick(()=>{new B(this.plugin,"title-right").open()})});for(let e=0;e<t.titleRight.length;e++){let l=t.titleRight[e],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(i).setName(l.name);e>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(()=>u(this,null,function*(){t.titleRight[e]=t.titleRight[e-1],t.titleRight[e-1]=l,yield this.plugin.saveSettings(),p(),this.plugin.addRightTitleBarButtons(),this.display()}))}),e<t.titleRight.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(()=>u(this,null,function*(){t.titleRight[e]=t.titleRight[e+1],t.titleRight[e+1]=l,yield this.plugin.saveSettings(),p(),this.plugin.addRightTitleBarButtons(),this.display()}))}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(()=>u(this,null,function*(){t.titleRight.remove(l),yield this.plugin.saveSettings(),U(l.id),this.display()}))}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=t.titleRight.findIndex(g=>g===l);new m(this.plugin,l,"title-right",d).open(),p(),this.plugin.addRightTitleBarButtons()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}i.createEl("h4",{text:"Center titlebar"}),new a.Setting(i).setName("Add Button").setDesc("Add a new button to the center titlebar.").addButton(e=>{e.setButtonText("Add Command").onClick(()=>{new B(this.plugin,"title-center").open()})});for(let e=0;e<t.titleCenter.length;e++){let l=t.titleCenter[e],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(i).setName(l.name);e>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(()=>u(this,null,function*(){t.titleCenter[e]=t.titleCenter[e-1],t.titleCenter[e-1]=l,yield this.plugin.saveSettings(),b(),this.plugin.addCenterTitleBarButtons(),this.display()}))}),e<t.titleCenter.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(()=>u(this,null,function*(){t.titleCenter[e]=t.titleCenter[e+1],t.titleCenter[e+1]=l,yield this.plugin.saveSettings(),b(),this.plugin.addCenterTitleBarButtons(),this.display()}))}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(()=>u(this,null,function*(){t.titleCenter.remove(l),yield this.plugin.saveSettings(),this.plugin.settings.titleCenter.length===0?f(this.plugin.titlebarText):G(l.id),this.display()}))}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=t.titleCenter.findIndex(g=>g===l);new m(this.plugin,l,"title-center",d).open()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}}}};var J=["lucide-activity","lucide-airplay","lucide-alarm-check","lucide-alarm-clock-off","lucide-alarm-clock","lucide-alarm-minus","lucide-alarm-plus","lucide-album","lucide-alert-circle","lucide-alert-octagon","lucide-alert-triangle","lucide-align-center-horizontal","lucide-align-center","lucide-align-center-vertical","lucide-align-end-horizontal","lucide-align-end-vertical","lucide-align-horizontal-distribute-center","lucide-align-horizontal-distribute-end","lucide-align-horizontal-distribute-start","lucide-align-horizontal-justify-center","lucide-align-horizontal-justify-end","lucide-align-horizontal-justify-start","lucide-align-horizontal-space-around","lucide-align-horizontal-space-between","lucide-align-justify","lucide-align-left","lucide-align-right","lucide-align-start-horizontal","lucide-align-start-vertical","lucide-align-vertical-distribute-center","lucide-align-vertical-distribute-end","lucide-align-vertical-distribute-start","lucide-align-vertical-justify-center","lucide-align-vertical-justify-end","lucide-align-vertical-justify-start","lucide-align-vertical-space-around","lucide-align-vertical-space-between","lucide-anchor","lucide-aperture","lucide-archive","lucide-arrow-big-down","lucide-arrow-big-left","lucide-arrow-big-right","lucide-arrow-big-up","lucide-arrow-down-circle","lucide-arrow-down-left","lucide-arrow-down-right","lucide-arrow-down","lucide-arrow-left-circle","lucide-arrow-left-right","lucide-arrow-left","lucide-arrow-right-circle","lucide-arrow-right","lucide-arrow-up-circle","lucide-arrow-up-left","lucide-arrow-up-right","lucide-arrow-up","lucide-asterisk","lucide-at-sign","lucide-award","lucide-axe","lucide-banknote","lucide-bar-chart-2","lucide-bar-chart","lucide-baseline","lucide-battery-charging","lucide-battery-full","lucide-battery-low","lucide-battery-medium","lucide-battery","lucide-beaker","lucide-bell-minus","lucide-bell-off","lucide-bell-plus","lucide-bell-ring","lucide-bell","lucide-bike","lucide-binary","lucide-bitcoin","lucide-bluetooth-connected","lucide-bluetooth-off","lucide-bluetooth-searching","lucide-bluetooth","lucide-bold","lucide-bookmark-minus","lucide-bookmark-plus","lucide-bookmark","lucide-book-open","lucide-book","lucide-bot","lucide-box-select","lucide-box","lucide-briefcase","lucide-brush","lucide-bug","lucide-building","lucide-bus","lucide-calculator","lucide-calendar","lucide-camera-off","lucide-camera","lucide-carrot","lucide-car","lucide-cast","lucide-check-circle-2","lucide-check-circle","lucide-check-square","lucide-check","lucide-chevron-down","lucide-chevron-first","lucide-chevron-last","lucide-chevron-left","lucide-chevron-right","lucide-chevrons-down","lucide-chevrons-down-up","lucide-chevrons-left","lucide-chevrons-right","lucide-chevrons-up-down","lucide-chevrons-up","lucide-chevron-up","lucide-chrome","lucide-circle-slashed","lucide-circle","lucide-clipboard-check","lucide-clipboard-copy","lucide-clipboard-list","lucide-clipboard","lucide-clipboard-x","lucide-clock-1","lucide-clock-2","lucide-clock-3","lucide-clock-4","lucide-clock-5","lucide-clock-6","lucide-clock-7","lucide-clock-8","lucide-clock-9","lucide-clock-10","lucide-clock-11","lucide-clock-12","lucide-clock","lucide-cloud-drizzle","lucide-cloud-fog","lucide-cloud-hail","lucide-cloud-lightning","lucide-cloud-moon","lucide-cloud-off","lucide-cloud-rain","lucide-cloud-rain-wind","lucide-cloud-snow","lucide-cloud-sun","lucide-cloud","lucide-cloudy","lucide-clover","lucide-code-2","lucide-codepen","lucide-codesandbox","lucide-code","lucide-coffee","lucide-coins","lucide-columns","lucide-command","lucide-compass","lucide-contact","lucide-contrast","lucide-cookie","lucide-copyleft","lucide-copyright","lucide-copy","lucide-corner-down-left","lucide-corner-down-right","lucide-corner-left-down","lucide-corner-left-up","lucide-corner-right-down","lucide-corner-right-up","lucide-corner-up-left","lucide-corner-up-right","lucide-cpu","lucide-credit-card","lucide-crop","lucide-crosshair","lucide-cross","lucide-crown","lucide-currency","lucide-database","lucide-delete","lucide-disc","lucide-divide-circle","lucide-divide-square","lucide-divide","lucide-dollar-sign","lucide-download-cloud","lucide-download","lucide-dribbble","lucide-droplets","lucide-droplet","lucide-drumstick","lucide-edit-2","lucide-edit-3","lucide-edit","lucide-egg","lucide-equal-not","lucide-equal","lucide-euro","lucide-expand","lucide-external-link","lucide-eye-off","lucide-eye","lucide-facebook","lucide-fast-forward","lucide-feather","lucide-figma","lucide-file-check-2","lucide-file-check","lucide-file-code","lucide-file-digit","lucide-file-input","lucide-file-minus-2","lucide-file-minus","lucide-file-output","lucide-file-plus-2","lucide-file-plus","lucide-file-search","lucide-files","lucide-file","lucide-file-text","lucide-file-x-2","lucide-file-x","lucide-film","lucide-filter","lucide-flag","lucide-flag-triangle-left","lucide-flag-triangle-right","lucide-flame","lucide-flashlight-off","lucide-flashlight","lucide-flask-conical","lucide-flask-round","lucide-folder-minus","lucide-folder-open","lucide-folder-plus","lucide-folder","lucide-form-input","lucide-forward","lucide-framer","lucide-frown","lucide-function-square","lucide-gamepad-2","lucide-gamepad","lucide-gauge","lucide-gavel","lucide-gem","lucide-ghost","lucide-gift","lucide-git-branch-plus","lucide-git-branch","lucide-git-commit","lucide-github","lucide-gitlab","lucide-git-merge","lucide-git-pull-request","lucide-glasses","lucide-globe-2","lucide-globe","lucide-grab","lucide-graduation-cap","lucide-grid","lucide-grip-horizontal","lucide-grip-vertical","lucide-hammer","lucide-hand-metal","lucide-hand","lucide-hard-drive","lucide-hard-hat","lucide-hash","lucide-haze","lucide-headphones","lucide-heart","lucide-help-circle","lucide-hexagon","lucide-highlighter","lucide-history","lucide-home","lucide-image-minus","lucide-image-off","lucide-image-plus","lucide-image","lucide-import","lucide-inbox","lucide-indent","lucide-indian-rupee","lucide-infinity","lucide-info","lucide-inspect","lucide-instagram","lucide-italic","lucide-japanese-yen","lucide-keyboard","lucide-key","lucide-landmark","lucide-languages","lucide-laptop-2","lucide-laptop","lucide-lasso-select","lucide-lasso","lucide-layers","lucide-layout-dashboard","lucide-layout-grid","lucide-layout-list","lucide-layout","lucide-layout-template","lucide-library","lucide-life-buoy","lucide-lightbulb-off","lucide-lightbulb","lucide-link-2-off","lucide-link-2","lucide-linkedin","lucide-link","lucide-list-checks","lucide-list-minus","lucide-list-ordered","lucide-list-plus","lucide-list","lucide-list-x","lucide-loader-2","lucide-loader","lucide-locate-fixed","lucide-locate-off","lucide-locate","lucide-lock","lucide-log-in","lucide-log-out","lucide-mail","lucide-map-pin","lucide-map","lucide-maximize-2","lucide-maximize","lucide-megaphone","lucide-meh","lucide-menu","lucide-message-circle","lucide-message-square","lucide-mic-off","lucide-mic","lucide-minimize-2","lucide-minimize","lucide-minus-circle","lucide-minus-square","lucide-minus","lucide-monitor-off","lucide-monitor-speaker","lucide-monitor","lucide-moon","lucide-more-horizontal","lucide-more-vertical","lucide-mountain-snow","lucide-mountain","lucide-mouse-pointer-2","lucide-mouse-pointer-click","lucide-mouse-pointer","lucide-move-diagonal-2","lucide-move-diagonal","lucide-move-horizontal","lucide-move","lucide-move-vertical","lucide-music","lucide-navigation-2","lucide-navigation","lucide-network","lucide-octagon","lucide-option","lucide-outdent","lucide-package-check","lucide-package-minus","lucide-package-plus","lucide-package-search","lucide-package","lucide-package-x","lucide-palette","lucide-palmtree","lucide-paperclip","lucide-pause-circle","lucide-pause-octagon","lucide-pause","lucide-pencil","lucide-pen-tool","lucide-percent","lucide-person-standing","lucide-phone-call","lucide-phone-forwarded","lucide-phone-incoming","lucide-phone-missed","lucide-phone-off","lucide-phone-outgoing","lucide-phone","lucide-pie-chart","lucide-piggy-bank","lucide-pin","lucide-pipette","lucide-plane","lucide-play-circle","lucide-play","lucide-plug-zap","lucide-plus-circle","lucide-plus-square","lucide-plus","lucide-pocket","lucide-podcast","lucide-pointer","lucide-pound-sterling","lucide-power-off","lucide-power","lucide-printer","lucide-qr-code","lucide-quote","lucide-radio-receiver","lucide-radio","lucide-redo","lucide-refresh-ccw","lucide-refresh-cw","lucide-regex","lucide-repeat-1","lucide-repeat","lucide-reply-all","lucide-reply","lucide-rewind","lucide-rocking-chair","lucide-rotate-ccw","lucide-rotate-cw","lucide-rss","lucide-ruler","lucide-russian-ruble","lucide-save","lucide-scale","lucide-scan-line","lucide-scan","lucide-scissors","lucide-screen-share-off","lucide-screen-share","lucide-search","lucide-send","lucide-separator-horizontal","lucide-separator-vertical","lucide-server-crash","lucide-server-off","lucide-server","lucide-settings-2","lucide-settings","lucide-share-2","lucide-share","lucide-sheet","lucide-shield-alert","lucide-shield-check","lucide-shield-close","lucide-shield-off","lucide-shield","lucide-shirt","lucide-shopping-bag","lucide-shopping-cart","lucide-shovel","lucide-shrink","lucide-shuffle","lucide-sidebar-close","lucide-sidebar-open","lucide-sidebar","lucide-sigma","lucide-signal-high","lucide-signal-low","lucide-signal-medium","lucide-signal","lucide-signal-zero","lucide-skip-back","lucide-skip-forward","lucide-skull","lucide-slack","lucide-slash","lucide-sliders","lucide-smartphone-charging","lucide-smartphone","lucide-smile","lucide-snowflake","lucide-sort-asc","lucide-sort-desc","lucide-speaker","lucide-sprout","lucide-square","lucide-star-half","lucide-star","lucide-stop-circle","lucide-stretch-horizontal","lucide-stretch-vertical","lucide-strikethrough","lucide-subscript","lucide-sunrise","lucide-sunset","lucide-sun","lucide-superscript","lucide-swiss-franc","lucide-switch-camera","lucide-table","lucide-tablet","lucide-tag","lucide-target","lucide-tent","lucide-terminal-square","lucide-terminal","lucide-text-cursor-input","lucide-text-cursor","lucide-thermometer-snowflake","lucide-thermometer-sun","lucide-thermometer","lucide-thumbs-down","lucide-thumbs-up","lucide-ticket","lucide-timer-off","lucide-timer-reset","lucide-timer","lucide-toggle-left","lucide-toggle-right","lucide-tornado","lucide-trash-2","lucide-trash","lucide-trello","lucide-trending-down","lucide-trending-up","lucide-triangle","lucide-truck","lucide-tv-2","lucide-tv","lucide-twitch","lucide-twitter","lucide-type","lucide-umbrella","lucide-underline","lucide-undo","lucide-unlink-2","lucide-unlink","lucide-unlock","lucide-upload-cloud","lucide-upload","lucide-user-check","lucide-user-minus","lucide-user-plus","lucide-users","lucide-user","lucide-user-x","lucide-verified","lucide-vibrate","lucide-video-off","lucide-video","lucide-view","lucide-voicemail","lucide-volume-1","lucide-volume-2","lucide-volume","lucide-volume-x","lucide-wallet","lucide-wand","lucide-watch","lucide-waves","lucide-webcam","lucide-wifi-off","lucide-wifi","lucide-wind","lucide-wrap-text","lucide-wrench","lucide-x-circle","lucide-x-octagon","lucide-x-square","lucide-x","lucide-youtube","lucide-zap-off","lucide-zap","lucide-zoom-in","lucide-zoom-out"];var ie={enabledButtons:[],desktop:!1,titleLeft:[],titleRight:[],titleCenter:[]},D=class extends y.Plugin{constructor(){super(...arguments);this.iconList=q.concat(J)}addPageHeaderButton(i,t){let{id:e,icon:l,name:s}=t,c=O(),d=x(s,e,l,c,["view-action",r]);i.prepend(d),this.registerDomEvent(d,"click",()=>{this.app.commands.executeCommandById(e)})}addLeftTitleBarButton(i,t){let{id:e,icon:l,name:s}=t,o=x(s,e,l,15,S,"div");i.append(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(e)})}addRightTitleBarButton(i,t){let{id:e,icon:l,name:s}=t,o=x(s,e,l,15,S,"div");i.prepend(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(e)})}addCenterTitleBarButton(i,t){let{id:e,icon:l,name:s}=t,o=x(s,e,l,15,S,"div");i.append(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(e)})}addLeftTitleBarButtons(){if(this.settings.titleLeft.length>0){let i=R();for(let t of this.settings.titleLeft)this.addLeftTitleBarButton(i,t)}}addRightTitleBarButtons(){if(this.settings.titleRight.length>0){let i=P();for(let t=this.settings.titleRight.length-1;t>=0;t--)this.addRightTitleBarButton(i,this.settings.titleRight[t])}}addInitialCenterTitleBarButtons(){if(this.settings.titleCenter.length>0){let i=_();for(let t of this.settings.titleCenter)this.addCenterTitleBarButton(i,t)}}addCenterTitleBarButtons(){if(this.settings.titleCenter.length>0){let i=A();for(let t of this.settings.titleCenter)this.addCenterTitleBarButton(i,t)}}onload(){return u(this,null,function*(){console.log("loading Customizable Page Header Plugin"),yield this.loadSettings(),this.addSettingTab(new N(this.app,this)),this.app.workspace.onLayoutReady(()=>{y.Platform.isDesktopApp&&(this.addLeftTitleBarButtons(),this.addRightTitleBarButtons(),this.titlebarText=H(),this.settings.titleCenter.length>0&&this.addInitialCenterTitleBarButtons())}),(y.Platform.isMobile||this.settings.desktop)&&this.registerEvent(this.app.workspace.on("file-open",()=>{let t=document.getElementsByClassName("workspace-leaf mod-active")[0].getElementsByClassName("view-actions")[0];for(let e=this.settings.enabledButtons.length-1;e>=0;e--)(this.settings.enabledButtons[e].showButtons==="both"||this.settings.enabledButtons[e].showButtons==="mobile"&&y.Platform.isMobile||this.settings.enabledButtons[e].showButtons==="desktop"&&y.Platform.isDesktop)&&(t.getElementsByClassName(`view-action page-header-button ${this.settings.enabledButtons[e].id}`)[0]||this.addPageHeaderButton(t,this.settings.enabledButtons[e]))}))})}onunload(){console.log("unloading Customizable Page Header Plugin"),j(),$(),f(this.titlebarText),globalThis.removeEventListener("TopBar-addedCommand",this.listener)}loadSettings(){return u(this,null,function*(){this.settings=Object.assign({},ie,yield this.loadData())})}saveSettings(){return u(this,null,function*(){yield this.saveData(this.settings)})}};