/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var $t=Object.defineProperty;var hr=Object.getOwnPropertyDescriptor;var gr=Object.getOwnPropertyNames;var xr=Object.prototype.hasOwnProperty;var Lr=(t,e,a)=>e in t?$t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var Ir=(t,e)=>{for(var a in e)$t(t,a,{get:e[a],enumerable:!0})},Cr=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of gr(e))!xr.call(t,r)&&r!==a&&$t(t,r,{get:()=>e[r],enumerable:!(o=hr(e,r))||o.enumerable});return t};var br=t=>Cr($t({},"__esModule",{value:!0}),t);var X=(t,e,a)=>(Lr(t,typeof e!="symbol"?e+"":e,a),a);var Bl={};Ir(Bl,{default:()=>Sa});module.exports=br(Bl);var ur=require("obsidian");var wr=require("obsidian");var lo="obsidian-vertical-tabs-view";var Wt=t=>{console.log(`[${lo}]: ${t}`)};var oe=require("obsidian");var so={left:"left",right:"right"},wa={TARGET:{directory:"directory",title:"title"},CONDITION:{startsWith:"starts with",endsWith:"ends with",includes:"includes",equals:"equals",regexp:"regexp"}},va={matchConfig:{target:"title",condition:"startsWith",value:""},priority:1,icon:"file"};var zt=require("obsidian"),no=(t,e,a,o,r)=>new zt.Setting(t).setName(e).setDesc(a).addText(l=>l.setValue(o).onChange(r)),$e=(t,e,a,o,r)=>new zt.Setting(t).setName(e).setDesc(a).addToggle(l=>l.setValue(o).onChange(r)),uo=(t,e,a,o,r,l)=>new zt.Setting(t).setName(e).setDesc(a).addDropdown(s=>{s.addOptions(o).setValue(r).onChange(l)});var io={defaultPosition:"left",showDirectory:!0,showCloseIcon:!0,showPinnedIcon:!0,showPinIconIfNotPinned:!0,showTabIcon:!0,customizeTabIcon:!1,defaultTabIcon:"file",tabIconRules:[]},Xt=class extends oe.PluginSettingTab{constructor(a,o){super(a,o);this.plugin=o,this.settings=structuredClone(o.settings)}save(){this.plugin.saveSettings(this.settings)}display(){let{containerEl:a}=this;if(a.empty(),uo(a,"Default position","Default position of vertical tabs view opened",so,this.settings.defaultPosition,o=>{this.settings.defaultPosition=o,this.save()}),$e(a,"Show directory","",this.settings.showDirectory,o=>{this.settings.showDirectory=o,this.save()}),$e(a,"Show close icon","",this.settings.showCloseIcon,o=>{this.settings.showCloseIcon=o,this.save()}),$e(a,"Show pinned icon","",this.settings.showPinnedIcon,o=>{this.settings.showPinnedIcon=o,this.save()}),$e(a,"Show pin icon if not pinned","",this.settings.showPinIconIfNotPinned,o=>{this.settings.showPinIconIfNotPinned=o,this.save()}),$e(a,"Show tab icon","",this.settings.showTabIcon,o=>{this.settings.showTabIcon=o,this.save(),this.display()}),$e(a,"Customize tab icon","",this.settings.customizeTabIcon,o=>{this.settings.customizeTabIcon=o,this.save(),this.display()}),this.settings.customizeTabIcon){let{previewIconWrapper:o,previewIcon:r,previewIconText:l}=this.createPreviewIcon(this.settings.defaultTabIcon);no(a,"Default tab icon","If you clear this field, icon will be hidden by default.",this.settings.defaultTabIcon,i=>{this.settings.defaultTabIcon=i,this.save(),(0,oe.setIcon)(r,i),r.children.length===0?l.innerText="Not found.":l.innerText="Preview: "}).setDesc("See https://lucide.dev/icons for available icons.").controlEl.prepend(o),new oe.Setting(a).setName("Icon rules for override icon");let n=a.createEl("div");n.className="vertical-tabs-view-settings-tab-icon-rules",this.settings.tabIconRules.length===0&&this.settings.tabIconRules.push(structuredClone(va)),this.settings.tabIconRules.forEach((i,d)=>{this.addTabIconRule(n,i,d)}),new oe.Setting(n).addButton(i=>{i.setButtonText("Add").onClick(async()=>{this.settings.tabIconRules.push(structuredClone(va)),this.display()})}).setClass("vertical-tabs-view-settings-tab-icon-rules-add-btn")}}createPreviewIcon(a){let o=document.createElement("div");o.className="vertical-tabs-view-settings-tab-preview-icon-wrapper";let r=document.createElement("div");r.className="vertical-tabs-view-settings-tab-preview-icon-text",r.innerText="Preview: ";let l=document.createElement("div");return(0,oe.setIcon)(l,a),l.children.length===0?r.innerText="Icon not found":r.innerText="Preview: ",o.setChildrenInPlace([r,l]),{previewIconWrapper:o,previewIcon:l,previewIconText:r}}addTabIconRule(a,o,r){let l=a.createEl("div");l.className="vertical-tabs-view-settings-tab-icon-rule-wrapper";let s=l.createEl("div");s.className="vertical-tabs-view-settings-tab-icon-rule-match-config-wrapper",new oe.Setting(s).addDropdown(f=>{f.addOptions(wa.TARGET).setValue(o.matchConfig.target).onChange(async h=>{o.matchConfig.target=h,this.save()})}).setName("Match target"),new oe.Setting(s).addDropdown(f=>{f.addOptions(wa.CONDITION).setValue(o.matchConfig.condition).onChange(async h=>{o.matchConfig.condition=h,this.save()})}).setName("Match condition"),new oe.Setting(s).addText(f=>{f.setValue(o.matchConfig.value).onChange(h=>{o.matchConfig.value=h,this.save()})}).setName("Match value").setDesc("For regexp, write like: /foo/i"),new oe.Setting(s).addSlider(f=>{f.setLimits(1,100,1).setValue(o.priority).onChange(h=>{o.priority=h,this.save()}).setDynamicTooltip()}).setName("Priority").setDesc("If there are multiple configs with the same priority, the one defined first will be prioritized.");let{previewIconWrapper:n,previewIcon:u,previewIconText:i}=this.createPreviewIcon(o.icon);new oe.Setting(s).addText(f=>{f.setValue(o.icon).onChange(h=>{o.icon=h,this.save(),(0,oe.setIcon)(u,h),u.children.length===0?i.innerText="Icon not found":i.innerText="Preview: "})}).setName("Icon").setDesc("See https://lucide.dev/icons for available icons.").controlEl.prepend(n);let p=l.createEl("div");p.className="vertical-tabs-view-settings-tab-icon-rule-remove-btn-wrapper";let x=p.createEl("button");x.setText("Remove"),x.onclick=()=>{this.settings.tabIconRules.splice(r,1),this.save(),this.display()}}};var sr=require("obsidian");var ya=async(t,e)=>{t.workspace.setActiveLeaf(e,{focus:!0})},fo=async(t,e)=>{let a=t.workspace.getLeafById(e);if(a)return await ya(t,a),a};function ge(){}function re(t,e){for(let a in e)t[a]=e[a];return t}function _a(t){return t()}function jt(){return Object.create(null)}function ue(t){t.forEach(_a)}function Ct(t){return typeof t=="function"}function xe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function co(t){return Object.keys(t).length===0}function Qe(t,e,a,o){if(t){let r=po(t,e,a,o);return t[0](r)}}function po(t,e,a,o){return t[1]&&o?re(a.ctx.slice(),t[1](o(e))):a.ctx}function et(t,e,a,o){if(t[2]&&o){let r=t[2](o(a));if(e.dirty===void 0)return r;if(typeof r=="object"){let l=[],s=Math.max(e.dirty.length,r.length);for(let n=0;n32){let e=[],a=t.ctx.length/32;for(let o=0;o{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(a=>{var o;for(let r of a)ot.entries.set(r.target,r),(o=this._listeners.get(r.target))==null||o(r)})}};ot.entries="WeakMap"in Ta?new WeakMap:void 0;var Kt=!1;function mo(){Kt=!0}function ho(){Kt=!1}function _r(t,e,a,o){for(;t>1);a(r)<=o?t=r+1:e=r}return t}function kr(t){if(t.hydrate_init)return;t.hydrate_init=!0;let e=t.childNodes;if(t.nodeName==="HEAD"){let u=[];for(let i=0;i0&&e[a[r]].claim_order<=i?r+1:_r(1,r,x=>e[a[x]].claim_order,i))-1;o[u]=a[d]+1;let p=d+1;a[p]=u,r=Math.max(p,r)}let l=[],s=[],n=e.length-1;for(let u=a[r]+1;u!=0;u=o[u-1]){for(l.push(e[u-1]);n>=u;n--)s.push(e[n]);n--}for(;n>=0;n--)s.push(e[n]);l.reverse(),s.sort((u,i)=>u.claim_order-i.claim_order);for(let u=0,i=0;u=l[i].claim_order;)i++;let d=it.removeEventListener(e,a,o)}function N(t,e,a){a==null?t.removeAttribute(e):t.getAttribute(e)!==a&&t.setAttribute(e,a)}function vt(t,e){for(let a in e)N(t,a,e[a])}function yt(t){return Array.from(t.childNodes)}function Dr(t){t.claim_info===void 0&&(t.claim_info={last_index:0,total_claimed:0})}function Fr(t,e,a,o,r=!1){Dr(t);let l=(()=>{for(let s=t.claim_info.last_index;s=0;s--){let n=t[s];if(e(n)){let u=a(n);return u===void 0?t.splice(s,1):t[s]=u,r?u===void 0&&t.claim_info.last_index--:t.claim_info.last_index=s,n}}return o()})();return l.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,l}function Ar(t,e,a,o){return Fr(t,r=>r.nodeName===e,r=>{let l=[];for(let s=0;sr.removeAttribute(s))},()=>o(e))}function Da(t,e,a){return Ar(t,e,a,Jt)}function Fa(t,e){e=""+e,t.data!==e&&(t.data=e)}function _t(t,e,a){t.classList.toggle(e,!!a)}function Lo(t){let e={};return t.childNodes.forEach(a=>{e[a.slot||"default"]=!0}),e}var Oe;function De(t){Oe=t}function Co(){if(!Oe)throw new Error("Function called outside component initialization");return Oe}function Aa(t){Co().$$.on_mount.push(t)}var ze=[];var Qt=[],st=[],bo=[],Rr=Promise.resolve(),Ba=!1;function So(){Ba||(Ba=!0,Rr.then(ea))}function kt(t){st.push(t)}var Pa=new Set,lt=0;function ea(){if(lt!==0)return;let t=Oe;do{try{for(;ltt.indexOf(o)===-1?e.push(o):a.push(o)),a.forEach(o=>o()),st=e}var ta=new Set,Xe;function Tt(){Xe={r:0,c:[],p:Xe}}function Dt(){Xe.r||ue(Xe.c),Xe=Xe.p}function B(t,e){t&&t.i&&(ta.delete(t),t.i(e))}function q(t,e,a,o){if(t&&t.o){if(ta.has(t))return;ta.add(t),Xe.c.push(()=>{ta.delete(t),o&&(a&&t.d(1),o())}),t.o(e)}else o&&o()}function Me(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function je(t,e){let a={},o={},r={$$scope:1},l=t.length;for(;l--;){let s=t[l],n=e[l];if(n){for(let u in s)u in n||(o[u]=1);for(let u in n)r[u]||(a[u]=n[u],r[u]=1);t[l]=n}else for(let u in s)r[u]=1}for(let s in o)s in a||(a[s]=void 0);return a}function aa(t){return typeof t=="object"&&t!==null?t:{}}var Hr=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Nr=new Set([...Hr]);function Re(t){t&&t.c()}function oa(t,e){t&&t.l(e)}function Fe(t,e,a){let{fragment:o,after_update:r}=t.$$;o&&o.m(e,a),kt(()=>{let l=t.$$.on_mount.map(_a).filter(Ct);t.$$.on_destroy?t.$$.on_destroy.push(...l):ue(l),t.$$.on_mount=[]}),r.forEach(kt)}function Ae(t,e){let a=t.$$;a.fragment!==null&&(wo(a.after_update),ue(a.on_destroy),a.fragment&&a.fragment.d(e),a.on_destroy=a.fragment=null,a.ctx=[])}function Vr(t,e){t.$$.dirty[0]===-1&&(ze.push(t),So(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let h=f.length?f[0]:x;return i.ctx&&r(i.ctx[p],i.ctx[p]=h)&&(!i.skip_bound&&i.bound[p]&&i.bound[p](h),d&&Vr(t,p)),x}):[],i.update(),d=!0,ue(i.before_update),i.fragment=o?o(i.ctx):!1,e.target){if(e.hydrate){mo();let p=yt(e.target);i.fragment&&i.fragment.l(p),p.forEach($)}else i.fragment&&i.fragment.c();e.intro&&B(t.$$.fragment),Fe(t,e.target,e.anchor),ho(),ea()}De(u)}var Gr;typeof HTMLElement=="function"&&(Gr=class extends HTMLElement{constructor(e,a,o){super();X(this,"$$ctor");X(this,"$$s");X(this,"$$c");X(this,"$$cn",!1);X(this,"$$d",{});X(this,"$$r",!1);X(this,"$$p_d",{});X(this,"$$l",{});X(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=a,o&&this.attachShadow({mode:"open"})}addEventListener(e,a,o){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(a),this.$$c){let r=this.$$c.$on(e,a);this.$$l_u.set(a,r)}super.addEventListener(e,a,o)}removeEventListener(e,a,o){if(super.removeEventListener(e,a,o),this.$$c){let r=this.$$l_u.get(a);r&&(r(),this.$$l_u.delete(a))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=J("slot"),l!=="default"&&N(s,"name",l)},m:function(i,d){Le(i,s,d)},d:function(i){i&&$(s)}}}};if(await Promise.resolve(),!this.$$cn)return;let a={},o=Lo(this);for(let l of this.$$s)l in o&&(a[l]=[e(l)]);for(let l of this.attributes){let s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=Ea(s,l.value,this.$$p_d,"toProp"))}this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:a,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){let s=Ea(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let l in this.$$l)for(let s of this.$$l[l]){let n=this.$$c.$on(l,s);this.$$l_u.set(s,n)}this.$$l={}}}attributeChangedCallback(e,a,o){var r;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ea(e,o,this.$$p_d,"toProp"),(r=this.$$c)==null||r.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(a=>this.$$p_d[a].attribute===e||!this.$$p_d[a].attribute&&a.toLowerCase()===e)||e}});function Ea(t,e,a,o){var l;let r=(l=a[t])==null?void 0:l.type;if(e=r==="Boolean"&&typeof e!="boolean"?e!=null:e,!o||!a[t])return e;if(o==="toAttribute")switch(r){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(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ie=class{constructor(){X(this,"$$");X(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=ge}$on(e,a){if(!Ct(a))return ge;let o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(a),()=>{let r=o.indexOf(a);r!==-1&&o.splice(r,1)}}$set(e){this.$$set&&!co(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var vo="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(vo);function le(t,e,a,o){function r(l){return l instanceof a?l:new a(function(s){s(l)})}return new(a||(a=Promise))(function(l,s){function n(d){try{i(o.next(d))}catch(p){s(p)}}function u(d){try{i(o.throw(d))}catch(p){s(p)}}function i(d){d.done?l(d.value):r(d.value).then(n,u)}i((o=o.apply(t,e||[])).next())})}var be=require("obsidian");function yo(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),a.push.apply(a,o)}return a}function ye(t){for(var e=1;e=0)&&(a[r]=t[r]);return a}function zr(t,e){if(t==null)return{};var a=Wr(t,e),o,r;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(a[o]=t[o])}return a}var Xr="1.15.0";function Pe(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var Ee=Pe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ut=Pe(/Edge/i),_o=Pe(/firefox/i),Bt=Pe(/safari/i)&&!Pe(/chrome/i)&&!Pe(/android/i),Eo=Pe(/iP(ad|od|hone)/i),Oo=Pe(/chrome/i)&&Pe(/android/i),Mo={capture:!1,passive:!1};function T(t,e,a){t.addEventListener(e,a,!Ee&&Mo)}function _(t,e,a){t.removeEventListener(e,a,!Ee&&Mo)}function pa(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(a){return!1}return!1}}function jr(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function we(t,e,a,o){if(t){a=a||document;do{if(e!=null&&(e[0]===">"?t.parentNode===a&&pa(t,e):pa(t,e))||o&&t===a)return t;if(t===a)break}while(t=jr(t))}return null}var ko=/\s+/g;function ie(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(ko," ").replace(" "+e+" "," ");t.className=(o+(a?" "+e:"")).replace(ko," ")}}function C(t,e,a){var o=t&&t.style;if(o){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),e===void 0?a:a[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=a+(typeof a=="string"?"":"px")}}function ft(t,e){var a="";if(typeof t=="string")a=t;else do{var o=C(t,"transform");o&&o!=="none"&&(a=o+" "+a)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(a)}function Ro(t,e,a){if(t){var o=t.getElementsByTagName(e),r=0,l=o.length;if(a)for(;r=l:s=r<=l,!s)return o;if(o===ve())break;o=qe(o,!1)}return!1}function ct(t,e,a,o){for(var r=0,l=0,s=t.children;l2&&arguments[2]!==void 0?arguments[2]:{},r=o.evt,l=zr(o,al);Ht.pluginEvent.bind(b)(e,a,ye({dragEl:g,parentEl:R,ghostEl:w,rootEl:E,nextEl:Ze,lastDownEl:ia,cloneEl:O,cloneHidden:Ne,dragStarted:Ft,putSortable:K,activeSortable:b.active,originalEvent:r,oldIndex:dt,oldDraggableIndex:Ot,newIndex:de,newDraggableIndex:He,hideGhostForTarget:$o,unhideGhostForTarget:Wo,cloneNowHidden:function(){Ne=!0},cloneNowShown:function(){Ne=!1},dispatchSortableEvent:function(n){te({sortable:a,name:n,originalEvent:r})}},l))};function te(t){tl(ye({putSortable:K,cloneEl:O,targetEl:g,rootEl:E,oldIndex:dt,oldDraggableIndex:Ot,newIndex:de,newDraggableIndex:He},t))}var g,R,w,E,Ze,ia,O,Ne,dt,de,Ot,He,ra,K,it=!1,ma=!1,ha=[],Ke,Ce,Ra,Ua,Fo,Ao,Ft,ut,Mt,Rt=!1,la=!1,da,Q,Ha=[],$a=!1,ga=[],La=typeof document!="undefined",sa=Eo,Po=Ut||Ee?"cssFloat":"float",ol=La&&!Oo&&!Eo&&"draggable"in document.createElement("div"),qo=function(){if(La){if(Ee)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Vo=function(e,a){var o=C(e),r=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),l=ct(e,0,a),s=ct(e,1,a),n=l&&C(l),u=s&&C(s),i=n&&parseInt(n.marginLeft)+parseInt(n.marginRight)+W(l).width,d=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+W(s).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(l&&n.float&&n.float!=="none"){var p=n.float==="left"?"left":"right";return s&&(u.clear==="both"||u.clear===p)?"vertical":"horizontal"}return l&&(n.display==="block"||n.display==="flex"||n.display==="table"||n.display==="grid"||i>=r&&o[Po]==="none"||s&&o[Po]==="none"&&i+d>r)?"vertical":"horizontal"},rl=function(e,a,o){var r=o?e.left:e.top,l=o?e.right:e.bottom,s=o?e.width:e.height,n=o?a.left:a.top,u=o?a.right:a.bottom,i=o?a.width:a.height;return r===n||l===u||r+s/2===n+i/2},ll=function(e,a){var o;return ha.some(function(r){var l=r[fe].options.emptyInsertThreshold;if(!(!l||ja(r))){var s=W(r),n=e>=s.left-l&&e<=s.right+l,u=a>=s.top-l&&a<=s.bottom+l;if(n&&u)return o=r}}),o},Go=function(e){function a(l,s){return function(n,u,i,d){var p=n.options.group.name&&u.options.group.name&&n.options.group.name===u.options.group.name;if(l==null&&(s||p))return!0;if(l==null||l===!1)return!1;if(s&&l==="clone")return l;if(typeof l=="function")return a(l(n,u,i,d),s)(n,u,i,d);var x=(s?n:u).options.group.name;return l===!0||typeof l=="string"&&l===x||l.join&&l.indexOf(x)>-1}}var o={},r=e.group;(!r||ua(r)!="object")&&(r={name:r}),o.name=r.name,o.checkPull=a(r.pull,!0),o.checkPut=a(r.put),o.revertClone=r.revertClone,e.group=o},$o=function(){!qo&&w&&C(w,"display","none")},Wo=function(){!qo&&w&&C(w,"display","")};La&&!Oo&&document.addEventListener("click",function(t){if(ma)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ma=!1,!1},!0);var Ye=function(e){if(g){e=e.touches?e.touches[0]:e;var a=ll(e.clientX,e.clientY);if(a){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r]);o.target=o.rootEl=a,o.preventDefault=void 0,o.stopPropagation=void 0,a[fe]._onDragOver(o)}}},sl=function(e){g&&g.parentNode[fe]._isOutsideThisEl(e.target)};function b(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Be({},e),t[fe]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Vo(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,n){s.setData("Text",n.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:b.supportPointer!==!1&&"PointerEvent"in window&&!Bt,emptyInsertThreshold:5};Ht.initializePlugins(this,t,a);for(var o in a)!(o in e)&&(e[o]=a[o]);Go(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:ol,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?T(t,"pointerdown",this._onTapStart):(T(t,"mousedown",this._onTapStart),T(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(T(t,"dragover",this),T(t,"dragenter",this)),ha.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Be(this,Jr())}b.prototype={constructor:b,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(ut=null)},_getDirection:function(e,a){return typeof this.options.direction=="function"?this.options.direction.call(this,e,a,g):this.options.direction},_onTapStart:function(e){if(e.cancelable){var a=this,o=this.el,r=this.options,l=r.preventOnFilter,s=e.type,n=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(n||e).target,i=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,d=r.filter;if(ml(o),!g&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||r.disabled)&&!i.isContentEditable&&!(!this.nativeDraggable&&Bt&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=we(u,r.draggable,o,!1),!(u&&u.animated)&&ia!==u)){if(dt=me(u),Ot=me(u,r.draggable),typeof d=="function"){if(d.call(this,e,u,this)){te({sortable:a,rootEl:i,name:"filter",targetEl:u,toEl:o,fromEl:o}),se("filter",a,{evt:e}),l&&e.cancelable&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(p){if(p=we(i,p.trim(),o,!1),p)return te({sortable:a,rootEl:p,name:"filter",targetEl:u,fromEl:o,toEl:o}),se("filter",a,{evt:e}),!0}),d)){l&&e.cancelable&&e.preventDefault();return}r.handle&&!we(i,r.handle,o,!1)||this._prepareDragStart(e,n,u)}}},_prepareDragStart:function(e,a,o){var r=this,l=r.el,s=r.options,n=l.ownerDocument,u;if(o&&!g&&o.parentNode===l){var i=W(o);if(E=l,g=o,R=g.parentNode,Ze=g.nextSibling,ia=o,ra=s.group,b.dragged=g,Ke={target:g,clientX:(a||e).clientX,clientY:(a||e).clientY},Fo=Ke.clientX-i.left,Ao=Ke.clientY-i.top,this._lastX=(a||e).clientX,this._lastY=(a||e).clientY,g.style["will-change"]="all",u=function(){if(se("delayEnded",r,{evt:e}),b.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!_o&&r.nativeDraggable&&(g.draggable=!0),r._triggerDragStart(e,a),te({sortable:r,name:"choose",originalEvent:e}),ie(g,s.chosenClass,!0)},s.ignore.split(",").forEach(function(d){Ro(g,d.trim(),Na)}),T(n,"dragover",Ye),T(n,"mousemove",Ye),T(n,"touchmove",Ye),T(n,"mouseup",r._onDrop),T(n,"touchend",r._onDrop),T(n,"touchcancel",r._onDrop),_o&&this.nativeDraggable&&(this.options.touchStartThreshold=4,g.draggable=!0),se("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(Ut||Ee))){if(b.eventCanceled){this._onDrop();return}T(n,"mouseup",r._disableDelayedDrag),T(n,"touchend",r._disableDelayedDrag),T(n,"touchcancel",r._disableDelayedDrag),T(n,"mousemove",r._delayedDragTouchMoveHandler),T(n,"touchmove",r._delayedDragTouchMoveHandler),s.supportPointer&&T(n,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(u,s.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var a=e.touches?e.touches[0]:e;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){g&&Na(g),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;_(e,"mouseup",this._disableDelayedDrag),_(e,"touchend",this._disableDelayedDrag),_(e,"touchcancel",this._disableDelayedDrag),_(e,"mousemove",this._delayedDragTouchMoveHandler),_(e,"touchmove",this._delayedDragTouchMoveHandler),_(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,a){a=a||e.pointerType=="touch"&&e,!this.nativeDraggable||a?this.options.supportPointer?T(document,"pointermove",this._onTouchMove):a?T(document,"touchmove",this._onTouchMove):T(document,"mousemove",this._onTouchMove):(T(g,"dragend",this),T(E,"dragstart",this._onDragStart));try{document.selection?fa(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,a){if(it=!1,E&&g){se("dragStarted",this,{evt:a}),this.nativeDraggable&&T(document,"dragover",sl);var o=this.options;!e&&ie(g,o.dragClass,!1),ie(g,o.ghostClass,!0),b.active=this,e&&this._appendGhost(),te({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(Ce){this._lastX=Ce.clientX,this._lastY=Ce.clientY,$o();for(var e=document.elementFromPoint(Ce.clientX,Ce.clientY),a=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ce.clientX,Ce.clientY),e!==a);)a=e;if(g.parentNode[fe]._isOutsideThisEl(e),a)do{if(a[fe]){var o=void 0;if(o=a[fe]._onDragOver({clientX:Ce.clientX,clientY:Ce.clientY,target:e,rootEl:a}),o&&!this.options.dragoverBubble)break}e=a}while(a=a.parentNode);Wo()}},_onTouchMove:function(e){if(Ke){var a=this.options,o=a.fallbackTolerance,r=a.fallbackOffset,l=e.touches?e.touches[0]:e,s=w&&ft(w,!0),n=w&&s&&s.a,u=w&&s&&s.d,i=sa&&Q&&Do(Q),d=(l.clientX-Ke.clientX+r.x)/(n||1)+(i?i[0]-Ha[0]:0)/(n||1),p=(l.clientY-Ke.clientY+r.y)/(u||1)+(i?i[1]-Ha[1]:0)/(u||1);if(!b.active&&!it){if(o&&Math.max(Math.abs(l.clientX-this._lastX),Math.abs(l.clientY-this._lastY))=0&&(te({rootEl:R,name:"add",toEl:R,fromEl:E,originalEvent:e}),te({sortable:this,name:"remove",toEl:R,originalEvent:e}),te({rootEl:R,name:"sort",toEl:R,fromEl:E,originalEvent:e}),te({sortable:this,name:"sort",toEl:R,originalEvent:e})),K&&K.save()):de!==dt&&de>=0&&(te({sortable:this,name:"update",toEl:R,originalEvent:e}),te({sortable:this,name:"sort",toEl:R,originalEvent:e})),b.active&&((de==null||de===-1)&&(de=dt,He=Ot),te({sortable:this,name:"end",toEl:R,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){se("nulling",this),E=g=R=w=Ze=O=ia=Ne=Ke=Ce=Ft=de=He=dt=Ot=ut=Mt=K=ra=b.dragged=b.ghost=b.clone=b.active=null,ga.forEach(function(e){e.checked=!0}),ga.length=Ra=Ua=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":g&&(this._onDragOver(e),nl(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],a,o=this.el.children,r=0,l=o.length,s=this.options;ro.right+r||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+r}function fl(t,e,a,o,r,l,s,n){var u=o?t.clientY:t.clientX,i=o?a.height:a.width,d=o?a.top:a.left,p=o?a.bottom:a.right,x=!1;if(!s){if(n&&dad+i*l/2:up-da)return-Mt}else if(u>d+i*(1-r)/2&&up-i*l/2)?u>d+i/2?1:-1:0}function cl(t){return me(g){a(7,e=re(re({},e),Te(f))),a(6,r=ka(e,o)),"name"in f&&a(0,n=f.name),"color"in f&&a(1,u=f.color),"size"in f&&a(2,i=f.size),"strokeWidth"in f&&a(3,d=f.strokeWidth),"absoluteStrokeWidth"in f&&a(4,p=f.absoluteStrokeWidth),"iconNode"in f&&a(5,x=f.iconNode),"$$scope"in f&&a(8,s=f.$$scope)},e=Te(e),[n,u,i,d,p,x,r,e,s,l]}var Qa=class extends Ie{constructor(e){super(),Ue(this,e,xl,gl,xe,{name:0,color:1,size:2,strokeWidth:3,absoluteStrokeWidth:4,iconNode:5})}},Ia=Qa;function Ll(t){let e,a=t[2].default,o=Qe(a,t,t[3],null);return{c(){o&&o.c()},l(r){o&&o.l(r)},m(r,l){o&&o.m(r,l),e=!0},p(r,l){o&&o.p&&(!e||l&8)&&tt(o,a,r,r[3],e?et(a,r[3],l,null):at(r[3]),null)},i(r){e||(B(o,r),e=!0)},o(r){q(o,r),e=!1},d(r){o&&o.d(r)}}}function Il(t){let e,a,o=[{name:"pin"},t[1],{iconNode:t[0]}],r={$$slots:{default:[Ll]},$$scope:{ctx:t}};for(let l=0;l{a(1,e=re(re({},e),Te(s))),"$$scope"in s&&a(3,r=s.$$scope)},e=Te(e),[l,e,o,r]}var eo=class extends Ie{constructor(e){super(),Ue(this,e,Cl,Il,xe,{})}},pt=eo;function bl(t){let e,a=t[2].default,o=Qe(a,t,t[3],null);return{c(){o&&o.c()},l(r){o&&o.l(r)},m(r,l){o&&o.m(r,l),e=!0},p(r,l){o&&o.p&&(!e||l&8)&&tt(o,a,r,r[3],e?et(a,r[3],l,null):at(r[3]),null)},i(r){e||(B(o,r),e=!0)},o(r){q(o,r),e=!1},d(r){o&&o.d(r)}}}function Sl(t){let e,a,o=[{name:"x"},t[1],{iconNode:t[0]}],r={$$slots:{default:[bl]},$$scope:{ctx:t}};for(let l=0;l{a(1,e=re(re({},e),Te(s))),"$$scope"in s&&a(3,r=s.$$scope)},e=Te(e),[l,e,o,r]}var to=class extends Ie{constructor(e){super(),Ue(this,e,wl,Sl,xe,{})}},Nt=to;var mt=[];function Ca(t,e=ge){let a,o=new Set;function r(n){if(xe(t,n)&&(t=n,a)){let u=!mt.length;for(let i of o)i[1](),mt.push(i,t);if(u){for(let i=0;i{o.delete(i),o.size===0&&a&&(a(),a=null)}}return{set:r,update:l,subscribe:s}}var vl=Ca(),yl=Ca([]),_l=Ca(),ae={plugin:vl,leaves:yl,activeLeafId:_l};var Yo=(t,e,a,o)=>{let r=s=>{if(o[s])return o[s];let[n,u,i]=s.split("/"),d=new RegExp(u,i);return o[s]=d,d},l=(s,n)=>{if(s.matchConfig.condition==="startsWith"&&n.startsWith(s.matchConfig.value)||s.matchConfig.condition==="endsWith"&&n.endsWith(s.matchConfig.value)||s.matchConfig.condition==="includes"&&n.includes(s.matchConfig.value)||s.matchConfig.condition==="equals"&&n===s.matchConfig.value||s.matchConfig.condition==="regexp"&&r(s.matchConfig.value).test(n))return!0};return t.find(s=>{if(s.matchConfig.target==="directory")return l(s,e);if(s.matchConfig.target==="title")return l(s,a)})};var Zo=(t,e)=>t.vault.getAbstractFileByPath(e),qt=async(t,e,a)=>{let o=Zo(t,e);if(o)return await t.vault.trash(o,a)},ao=async(t,e)=>{let a=Zo(t,e);if(a)return await t.vault.delete(a)};function kl(t){go(t,"svelte-fthq2i",":root{--ctx-menu-font-size:0.9rem;--ctx-menu-margin:0.25rem 0;--ctx-menu-padding:0;--ctx-menu-item-padding:0 0.5rem;--ctx-menu-divider-margin:0.2rem 0}")}function Jo(t,e,a){let o=t.slice();return o[42]=e[a],o}function Qo(t){let e,a,o,r,l;a=new Nt({});function s(...n){return t[16](t[42],...n)}return{c(){e=J("div"),Re(a.$$.fragment),N(e,"class","vertical-tabs-view-list-item-close-btn vertical-tabs-view-list-item-icon")},m(n,u){Le(n,e,u),Fe(a,e,null),o=!0,r||(l=We(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(B(a.$$.fragment,n),o=!0)},o(n){q(a.$$.fragment,n),o=!1},d(n){n&&$(e),Ae(a),r=!1,l()}}}function er(t){let e,a=t[5](t[42])+"",o;return{c(){e=J("span"),o=St(a),N(e,"class","vertical-tabs-view-list-item-dirname")},m(r,l){Le(r,e,l),ee(e,o)},p(r,l){l[0]&1&&a!==(a=r[5](r[42])+"")&&Fa(o,a)},d(r){r&&$(e)}}}function Tl(t){let e,a,o,r,l;a=new pt({});function s(){return t[18](t[42])}return{c(){e=J("div"),Re(a.$$.fragment),N(e,"class","vertical-tabs-view-list-item-icon vertical-tabs-view-list-item-icon-pinned vertical-tabs-view-list-item-pin-btn vertical-tabs-view-list-item-pin-btn-pin")},m(n,u){Le(n,e,u),Fe(a,e,null),o=!0,r||(l=We(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(B(a.$$.fragment,n),o=!0)},o(n){q(a.$$.fragment,n),o=!1},d(n){n&&$(e),Ae(a),r=!1,l()}}}function Dl(t){let e,a,o,r,l;a=new pt({});function s(){return t[17](t[42])}return{c(){e=J("div"),Re(a.$$.fragment),N(e,"class","vertical-tabs-view-list-item-icon vertical-tabs-view-list-item-pin-btn vertical-tabs-view-list-item-pin-btn-pin")},m(n,u){Le(n,e,u),Fe(a,e,null),o=!0,r||(l=We(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(B(a.$$.fragment,n),o=!0)},o(n){q(a.$$.fragment,n),o=!1},d(n){n&&$(e),Ae(a),r=!1,l()}}}function tr(t){let e,a,o,r,l,s,n,u,i=t[6](t[42])+"",d,p,x,f,h,I,v,G,U,y=t[3].showCloseIcon&&Qo(t),k=t[3].showDirectory&&er(t),Y=[Dl,Tl],M=[];function ne(P,A){return P[3].showPinIconIfNotPinned&&!P[42].pinned?0:P[3].showPinnedIcon&&P[42].pinned?1:-1}~(f=ne(t,[-1,-1]))&&(h=M[f]=Y[f](t));function _e(...P){return t[19](t[42],...P)}function j(...P){return t[20](t[42],...P)}return{c(){e=J("li"),a=J("div"),y&&y.c(),o=rt(),r=J("div"),l=rt(),s=J("div"),k&&k.c(),n=rt(),u=J("span"),d=St(i),p=rt(),x=J("div"),h&&h.c(),N(r,"class","vertical-tabs-view-list-item-tab-icon vertical-tabs-view-list-item-icon"),N(u,"class","vertical-tabs-view-list-item-title"),N(s,"class","vertical-tabs-view-list-item-name-container"),N(a,"class","vertical-tabs-view-list-item-left-container"),N(x,"class","vertical-tabs-view-list-item-right-container"),N(e,"data-leaf-id",I=t[42].id),N(e,"class","vertical-tabs-view-list-item"),_t(e,"selected",t[2].includes(t[42].id)),_t(e,"focused",t[42].id===t[1])},m(P,A){Le(P,e,A),ee(e,a),y&&y.m(a,null),ee(a,o),ee(a,r),ee(a,l),ee(a,s),k&&k.m(s,null),ee(s,n),ee(s,u),ee(u,d),ee(e,p),ee(e,x),~f&&M[f].m(x,null),v=!0,G||(U=[We(e,"mousedown",_e),We(e,"contextmenu",j)],G=!0)},p(P,A){t=P,t[3].showCloseIcon?y?(y.p(t,A),A[0]&8&&B(y,1)):(y=Qo(t),y.c(),B(y,1),y.m(a,o)):y&&(Tt(),q(y,1,1,()=>{y=null}),Dt()),t[3].showDirectory?k?k.p(t,A):(k=er(t),k.c(),k.m(s,n)):k&&(k.d(1),k=null),(!v||A[0]&1)&&i!==(i=t[6](t[42])+"")&&Fa(d,i);let ce=f;f=ne(t,A),f===ce?~f&&M[f].p(t,A):(h&&(Tt(),q(M[ce],1,1,()=>{M[ce]=null}),Dt()),~f?(h=M[f],h?h.p(t,A):(h=M[f]=Y[f](t),h.c()),B(h,1),h.m(x,null)):h=null),(!v||A[0]&1&&I!==(I=t[42].id))&&N(e,"data-leaf-id",I),(!v||A[0]&5)&&_t(e,"selected",t[2].includes(t[42].id)),(!v||A[0]&3)&&_t(e,"focused",t[42].id===t[1])},i(P){v||(B(y),B(h),v=!0)},o(P){q(y),q(h),v=!1},d(P){P&&$(e),y&&y.d(),k&&k.d(),~f&&M[f].d(),G=!1,ue(U)}}}function ar(t){let e;return{c(){e=J("div"),N(e,"class","vertical-tabs-view-list-mobile-margin-block")},m(a,o){Le(a,e,o)},d(a){a&&$(e)}}}function Fl(t){let e,a,o,r=Me(t[0]),l=[];for(let u=0;uq(l[u],1,1,()=>{l[u]=null}),n=t[0].length>0&&be.Platform.isMobile&&ar(t);return{c(){e=J("ul");for(let u=0;u0&&be.Platform.isMobile?n||(n=ar(u),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i(u){if(!o){for(let i=0;i{a(15,n=c)}),ae.leaves.subscribe(c=>{a(0,u=c)}),ae.activeLeafId.subscribe(c=>{a(1,i=c)});let{view:p}=e,{state:x={tabIdToIndex:{},sortedTabIds:[]}}=e,f,{viewContentId:h}=e,{updateView:I}=e,v={},G=c=>{var m,L;let S=(m=c.view)===null||m===void 0?void 0:m.file;return S&&((L=S.parent)===null||L===void 0?void 0:L.path)||""},U=c=>{var m;let L=(m=c.view)===null||m===void 0?void 0:m.file;if(!L)return"";let S=c.view.titleContainerEl.querySelectorAll(`.${c.view.titleEl.className}`),H=Array.from(S).find(Z=>{if(!Z.hasAttribute("hidden"))return Z});return(H==null?void 0:H.getText())||L.name},y=c=>{var m;if(c.detach(),c.id===i)if(c.id===u[0].id&&u[1])a(1,i=u[1].id);else if(c.id===((m=u.at(-1))===null||m===void 0?void 0:m.id)&&u.at(-2))a(1,i=u.at(-2).id);else{let L=x.tabIdToIndex[c.id];u[L-1]&&a(1,i=u[L-1].id)}},k=(c,m)=>le(void 0,void 0,void 0,function*(){var L,S;if(c.stopPropagation(),c.button===1){y(m);return}if(c.button!==2&&!(c.target instanceof SVGElement))if(c.shiftKey){let H=x.tabIdToIndex[m.id],Z=x.tabIdToIndex[i],xt=Math.min(H,Z),pe=Math.max(H,Z),F=[];for(let D=xt;D<=pe;D++){let z=u[D];z&&F.push(z.id)}a(2,d=Array.from(new Set([...d,...F])))}else c.metaKey?(d.length||a(2,d=[i]),d.includes(m.id)?a(2,d=d.filter(H=>H!==m.id)):a(2,d=[...d,m.id])):(a(2,d=[]),yield ya(n.app,m),a(1,i=m.id),n.app.isMobile&&(!((L=n.app.workspace.leftSplit)===null||L===void 0)&&L.collapsed||n.app.workspace.leftSplit.collapse(),!((S=n.app.workspace.rightSplit)===null||S===void 0)&&S.collapsed||n.app.workspace.rightSplit.collapse()))}),Y=(c,m)=>le(void 0,void 0,void 0,function*(){let L=new Set(c);for(let S of u){if(L.has(S.id)){let H=m(S);H instanceof Promise&&(yield H.catch(console.error)),L.delete(S.id)}if(L.size===0){I.bind(p)();return}}I.bind(p)()}),M=c=>le(void 0,void 0,void 0,function*(){yield Y(c,m=>m.detach())}),ne=c=>{y(c)},_e=c=>le(void 0,void 0,void 0,function*(){let m=u.filter(L=>!c.includes(L.id)).map(L=>L.id);yield M(m)}),j=c=>{let m=x.tabIdToIndex[c.id],L=x.tabIdToIndex[i];0<=L&&L{S.detach()})},P=c=>{let m=x.tabIdToIndex[c.id],L=x.tabIdToIndex[i];m+1<=L&&L<=u.length-1&&a(1,i=u[m].id),u.slice(m+1,u.length).forEach(S=>{S.detach()})},A=(c,m)=>{c.setPinned(m),I.bind(p)()},ce=(c,m)=>Y(c,L=>L.setPinned(m)),he=c=>le(void 0,void 0,void 0,function*(){let m=c.view.file;m.deleted||(yield ao(n.app,m.path),I.bind(p)())}),ke=c=>le(void 0,void 0,void 0,function*(){return Y(c,m=>le(void 0,void 0,void 0,function*(){let L=m.view.file;L.deleted||(yield ao(n.app,L.path))}))}),Ve=c=>le(void 0,void 0,void 0,function*(){yield qt(n.app,c.view.file.path,!0),I.bind(p)()}),Se=c=>le(void 0,void 0,void 0,function*(){return Y(c,m=>le(void 0,void 0,void 0,function*(){yield qt(n.app,m.view.file.path,!0)}))}),Je=c=>le(void 0,void 0,void 0,function*(){yield qt(n.app,c.view.file.path,!1),I.bind(p)()}),Ge=c=>le(void 0,void 0,void 0,function*(){return Y(c,m=>le(void 0,void 0,void 0,function*(){yield qt(n.app,m.view.file.path,!1)}))});function Vt(){var c;let m=document.querySelector(`li[data-leaf-id="${i}"]`);if(!m)return;let L=m.getBoundingClientRect();if(!L)return;let S=(c=m.parentElement)===null||c===void 0?void 0:c.getBoundingClientRect();S&&(L.top>S.top||L.bottom{a(11,x.tabIdToIndex={},x),a(11,x.sortedTabIds=[],x),c.forEach((m,L)=>{a(11,x.tabIdToIndex[m.id]=L,x),x.sortedTabIds.push(m.id)}),localStorage.setItem(s.LIST_STATE,JSON.stringify(x))},gt=()=>{u.forEach(c=>{let m=`li[data-leaf-id="${c.id}"] .${l}`,L=document.querySelector(m);if(!L)return;if(o.showTabIcon)L.removeClass("_hidden");else{L.addClass("_hidden");return}if(!o.customizeTabIcon){let Z=n.app.workspace.getLeafById(c.id).tabHeaderInnerIconEl.firstChild.cloneNode(!0);if(!Z)return;if(Z){L.setChildrenInPlace([Z]);return}}let S=Yo(r,G(c),U(c),v);S?(0,be.setIcon)(L,S.icon):o.defaultTabIcon?(0,be.setIcon)(L,o.defaultTabIcon):c.getViewState().type==="markdown"&&(0,be.setIcon)(L,"")})};Aa(()=>{Xo.create(f,{group:"vertical-tabs-view-list",delay:100,delayOnTouchOnly:!0,touchStartThreshold:3,animation:150,draggable:".vertical-tabs-view-list-item",direction:"vertical",ghostClass:"vertical-tabs-view-list-item-ghost",chosenClass:"vertical-tabs-view-list-item-chosen",forceFallback:!be.Platform.isDesktop,fallbackOnBody:!be.Platform.isDesktop,onChange:c=>{let m=document.querySelector(`#${h}`);if(!m)return;let L=m.getBoundingClientRect(),S=c.item.getBoundingClientRect(),H=S.height*2;S.top{if(c.oldIndex==null||c.newIndex==null)return;let m=Math.min(c.oldIndex,c.newIndex),L=Math.max(c.oldIndex,c.newIndex);for(let S=m;S<=L;S++){let Z=f.children[S].getAttribute("data-leaf-id");Z&&(a(11,x.tabIdToIndex[Z]=S,x),a(11,x.sortedTabIds[S]=Z,x),localStorage.setItem(s.LIST_STATE,JSON.stringify(x)))}}}),gt(),Vt()});let Gt=c=>{let m=new be.Menu,L=d.length>1&&d.includes(c.id),S=L?d:[c.id],H=L?`${S.length} tabs`:"tab",Z=Array.from(new Set(u.filter(F=>S.includes(F.id)).map(F=>{var D;let z=F.view.file,Lt=((D=z.parent)===null||D===void 0?void 0:D.path)||"",It=z.name;return`${Lt}${It}`}))),xt=L&&Z.length?`${Z.length} files`:"file",pe=()=>{a(2,d=[])};if(m.addItem(F=>F.setTitle(`Close ${H}`).setIcon("x").onClick(D=>{D.preventDefault(),L?M(S):y(c)})),m.addItem(F=>{let D=u.length-S.length;return F.setTitle(`Close others (${D} unselected tabs)`).setIcon("x").onClick(z=>{z.preventDefault(),_e(S),pe()})}),m.addItem(F=>F.setTitle("Close all tabs above").setIcon("x").onClick(D=>{D.preventDefault(),j(c),pe()})),m.addItem(F=>F.setTitle("Close all tabs below").setIcon("x").onClick(D=>{D.preventDefault(),P(c),pe()})),m.addSeparator(),L){let F=[],D=[];u.forEach(z=>{z.pinned&&S.includes(z.id)?F.push(z):!z.pinned&&S.includes(z.id)&&D.push(z)}),D.length&&m.addItem(z=>z.setTitle(`Pin ${D.length} tabs`).setIcon("pin").onClick(Lt=>{Lt.preventDefault(),ce(D.map(It=>It.id),!0),pe()})),F.length&&m.addItem(z=>z.setTitle(`Unpin ${F.length} tabs`).setIcon("pin-off").onClick(Lt=>{Lt.preventDefault(),ce(F.map(It=>It.id),!1),pe()}))}else c.pinned||m.addItem(F=>F.setTitle("Pin").setIcon("pin").onClick(D=>{D.preventDefault(),A(c,!0),pe()})),c.pinned&&m.addItem(F=>F.setTitle("Unpin").setIcon("pin-off").onClick(D=>{D.preventDefault(),A(c,!1),pe()}));return m.addSeparator(),m.addItem(F=>F.setTitle(`Trash ${xt} to local`).setIcon("trash").onClick(D=>{D.preventDefault(),L?Ge(S):Je(c),pe()})),m.addItem(F=>F.setTitle(`Trash ${xt} to system`).setIcon("trash").onClick(D=>{D.preventDefault(),L?Se(S):Ve(c),pe()})),m.addItem(F=>F.setTitle(`Delete ${xt}`).setIcon("trash-2").onClick(D=>{D.preventDefault(),L?ke(S):he(c),pe()})),m},ir=(c,m)=>ne(c),dr=c=>A(c,!0),fr=c=>A(c,!1),cr=(c,m)=>k(m,c),pr=(c,m)=>{Gt(c).showAtMouseEvent(m)};function mr(c){Qt[c?"unshift":"push"](()=>{f=c,a(4,f)})}return t.$$set=c=>{"view"in c&&a(12,p=c.view),"state"in c&&a(11,x=c.state),"viewContentId"in c&&a(13,h=c.viewContentId),"updateView"in c&&a(14,I=c.updateView)},t.$$.update=()=>{if(t.$$.dirty[0]&32768){e:a(3,o=n.settings)}if(t.$$.dirty[0]&8){e:r=o.tabIconRules.slice().sort((c,m)=>m.priority-c.priority)}if(t.$$.dirty[0]&1){e:a(0,u)}if(t.$$.dirty[0]&2){e:a(1,i)}if(t.$$.dirty[0]&4){e:a(2,d)}if(t.$$.dirty[0]&1){e:ro(u),gt()}if(t.$$.dirty[0]&2){e:i&&Vt()}},[u,i,d,o,f,G,U,k,ne,A,Gt,x,p,h,I,n,ir,dr,fr,cr,pr,mr]}var oo=class extends Ie{constructor(e){super(),Ue(this,e,Al,Fl,xe,{view:12,state:11,viewContentId:13,updateView:14},kl,[-1,-1])}},rr=oo;var nr="vertical-tabs-view",lr=nr+"-content",Pl={LIST_STATE:nr+"list-state"},ht="vertical-tabs-view",ba=class extends sr.ItemView{constructor(a,o){super(o);this.state={tabIdToIndex:{},sortedTabIds:[]};this.plugin=a,this.settings=a.settings;let r=localStorage.getItem(Pl.LIST_STATE);if(r)try{this.state=JSON.parse(r)}catch(l){console.error(l)}this.registerEvent(this.app.workspace.on("layout-change",()=>{let l=this.getActiveLeaf();ae.activeLeafId.set(l.id),this.updateView()})),this.registerEvent(this.app.workspace.on("active-leaf-change",l=>{!l||l.getViewState().type===ht||ae.activeLeafId.set(l.id)}))}setSettings(a){this.plugin.settings=a,ae.plugin.set(this.plugin),this.updateView()}getViewType(){return ht}getIcon(){return"list"}getDisplayText(){return"Vertical Tabs"}async onClose(){this.Tabs.$destroy()}async onOpen(){ae.plugin.set(this.plugin),ae.leaves.set(this.getSortedLeaves()),ae.activeLeafId.set(this.getActiveLeaf().id);let a=this.contentEl;a.id=lr,this.Tabs=new rr({target:this.contentEl,props:{view:this,state:this.state,updateView:this.updateView,viewContentId:lr}})}getActiveLeaf(){return this.app.workspace.getMostRecentLeaf()}async setActiveLeafById(a){await fo(this.app,a),ae.activeLeafId.set(a)}updateView(){ae.plugin.set(this.plugin);let a=this.getSortedLeaves();a.forEach(o=>{o.on("pinned-change",()=>{ae.leaves.set(a)})}),ae.leaves.set(a)}getActiveLeafIndex(){let a=this.getActiveLeaf();return a?this.state.tabIdToIndex[a.id]:0}async cycleNextTab(){let a=this.getActiveLeafIndex();if(a==null)return;let o=(a+1)%this.state.sortedTabIds.length;await this.setActiveLeafById(this.state.sortedTabIds[o])}async cyclePreviousTab(){let a=this.getActiveLeafIndex();if(a==null)return;let o=(a-1)%this.state.sortedTabIds.length;o<0&&(o+=this.state.sortedTabIds.length),await this.setActiveLeafById(this.state.sortedTabIds[o])}collectLeafIds(a,o=[]){return a.forEach(r=>{if(r.type==="leaf")o.push(r.id);else if("children"in r&&Array.isArray(r.children))return this.collectLeafIds(r.children,o)}),o}getLeaves(){let a=[],o=this.app.workspace.rootSplit,r=this.collectLeafIds(o.children);return this.app.workspace.iterateRootLeaves(l=>{r.includes(l.id)&&a.push(l)}),a}getSortedLeaves(){return this.getLeaves().slice().sort((a,o)=>{var s,n;let r=(s=this.state.tabIdToIndex[a.id])!=null?s:1/0,l=(n=this.state.tabIdToIndex[o.id])!=null?n:1/0;return r-l})}};var Sa=class extends ur.Plugin{async onload(){Wt("loading..."),await this.loadSettings(),this.addSettingTab(new Xt(this.app,this)),this.addCommands(),this.app.workspace.onLayoutReady(async()=>{this.registerViewExtension()}),Wt("loaded.")}onunload(){Wt("unloaded.")}async loadSettings(){let a=await this.loadData();this.settings=Object.assign({},io,a),this.settings.tabIconRules.length===0&&"tabIconConfigs"in this.settings&&Array.isArray(this.settings.tabIconConfigs)&&this.settings.tabIconConfigs.length>0&&(this.settings.tabIconRules=structuredClone(this.settings.tabIconConfigs),delete this.settings.tabIconConfigs,this.saveSettings(this.settings)),a&&!a.hasOwnProperty("customizeTabIcon")&&a.tabIconRules.length>0&&(this.settings.customizeTabIcon=!0)}async saveSettings(a){await this.saveData(a),this.settings=a;let o=this.getView();o&&o.updateView()}addCommands(){this.addCommand({id:"show-tabs-view",name:"Show vertical tabs view",callback:async()=>{this.openViewLeaf()}}),this.addCommand({id:"cycle-previous-tab",name:"Cycle previous tab",callback:async()=>{let a=this.getView();a&&await a.cyclePreviousTab()}}),this.addCommand({id:"cycle-next-tab",name:"Cycle next tab",callback:async()=>{let a=this.getView();a&&await a.cycleNextTab()}})}registerViewExtension(){this.registerView(ht,a=>new ba(this,a))}getView(){let a=this.app.workspace.getLeavesOfType(ht)[0];if(a)return a.view}async openViewLeaf(){let a=()=>this.settings.defaultPosition==="left"?this.app.workspace.getLeftLeaf(!1):this.settings.defaultPosition==="right"?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1),o=this.getView();if(o)return o.updateView(),this.app.workspace.revealLeaf(o.leaf);let r=a();await r.setViewState({type:ht,active:!0}),this.app.workspace.revealLeaf(r)}}; /*! Bundled license information: sortablejs/modular/sortable.esm.js: (**! * Sortable 1.15.0 * @author RubaXa * @author owenm * @license MIT *) */