varU=Object.create;varw=Object.defineProperty;varW=Object.getOwnPropertyDescriptor;varV=Object.getOwnPropertyNames;varq=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;varv=n=>w(n,"__esModule",{value:!0});var_=(n,t)=>{v(n);for(vareint)w(n,e,{get:t[e],enumerable:!0})},K=(n,t,e)=>{if(t&&typeoft=="object"||typeoft=="function")for(letlofV(t))!j.call(n,l)&&l!=="default"&&w(n,l,{get:()=>t[l],enumerable:!(e=W(t,l))||e.enumerable});returnn},N=n=>K(v(w(n!=null?U(q(n)):{},"default",n&&n.__esModule&&"default"inn?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);varm=(n,t,e)=>newPromise((l,r)=>{vars=a=>{try{o(e.next(a))}catch(h){r(h)}},i=a=>{try{o(e.throw(a))}catch(h){r(h)}},o=a=>a.done?l(a.value):Promise.resolve(a.value).then(s,i);o((e=e.apply(n,t)).next())});_(exports,{ColumnInsertModal:()=>x,default:()=>M});varu=N(require("obsidian"));varI=N(require("obsidian")),J=n=>n=="yes"||n=="true",Q=(n,t)=>{if(t=="string")returnn;if(t=="boolean")returnJ(n);if(t=="number")returnparseFloat(n)};functionT(n,t,e,l){letr=newI.Setting(n).setName(t[1].name).setDesc(t[1].desc);typeoft[1].value=="boolean"?r.addToggle(s=>s.setValue(e).onChange(i=>{l(i,t[0])})):r.addText(s=>s.setPlaceholder(String(t[1].value)).setValue(String(e)).onChange(i=>{l(Q(i,typeoft[1].value),t[0])}))}functionL(n,t,e){let{containerEl:l}=n;l.empty(),l.createEl("h2",{text:"Settings for "+e});letr=Object.entries(t);for(letsofr)T(l,s,n.plugin.settings[s[0]].value,(i,o)=>{n.plugin.settings[o].value=i,n.plugin.saveSettings()})}functionD(n,t){returnm(this,null,function*(){returnnewPromise((e,l)=>{n.settings=t,n.loadData().then(r=>{r&&Object.entries(r).forEach(i=>{n.settings[i[0]].value=i[1]})}).then(e).catch(l)})})}functionP(n,t){returnm(this,null,function*(){lete={};Object.entries(n.settings).forEach(l=>{e[l[0]]=l[1].value,l[1].onChange(l[1].value)}),yieldn.saveData(e)})}varX="Obsidian Columns",E="col",O=E+"-md",Y="!!!",A="===";vark="--obsidian-columns-min-width",G="--obsidian-columns-def-span",Z="`",b={wrapSize:{value:100,name:"Minimum width of column",desc:"Columns will have this minimum width before wrapping to a new row. 0 disables column wrapping. Useful for smaller devices",onChange:n=>{document.querySelector(":root").style.setProperty(k,n.toString()+"px")}},defaultSpan:{value:1,name:"The default span of an item",desc:"The default width of a column. If the minimum width is specified, the width of the column will be multiplied by this setting.",onChange:n=>{document.querySelector(":root").style.setProperty(G,n.toString())}}},B=(n,t=["`"],e=A)=>{letl=n.split(`
`),r=!1;e:for(let s of l)for(let i of t){if(s.contains(i))break e;if(s==e){let o=n.split(e+`
`).map(e=>e.split(";")).reduce((e,l)=>(e.push(...l),e)).map(e=>e.split("=").map(l=>l.trim()).slice(0,2)).forEach(e=>{t[e[0]]=e[1]}),t},$=n=>{let t=0,e=n.split("");for(let l of e)if(l==Z)t++;else break;return t},ee=n=>{let t=n.split(`
`),e=[],l=0,r=0,s=[];for(let i of t){let o=$(i);if(r=o<3?0:o,l==0&&r==0&&i.startsWith(A)){e.push(s.join(`
`)-1})}}});let t=(e,l)=>{for(let r of Array.from(e.children))if(r!=null&&!(r.nodeName!="UL"&&r.nodeName!="OL"))for(let s of Array.from(r.children)){if(s==null)continue;if(!s.textContent.trim().startsWith(Y+E)){t(s,l);continue}r.removeChild(s);let i=e.createEl("div",{cls:"columnParent"}),o=new u.MarkdownRenderChild(i);l.addChild(o);let a=s.querySelector("ul, ol");if(a!=null)for(let h of Array.from(a.children)){let d=i.createEl("div",{cls:"columnChild"}),f=new u.MarkdownRenderChild(d);l.addChild(f);let y=parseFloat(h.textContent.split(`
`)[0].split(" ")[0]);isNaN(y)&&(y=this.settings.defaultSpan.value),this.applyStyle(d,this.generateCssString(y));let S=!1;t(h,l);for(let g of Array.from(h.childNodes))S&&d.appendChild(g),g.nodeName=="#text"&&(S=!0);this.processChild(d)}}};this.registerMarkdownPostProcessor((e,l)=>{t(e,l)})})}applyPotentialBorderStyling(t,e){var r,s;if(t.borderColor!=null||t.borderStyle!=null||t.borderWidth!=null||t.borderRadius!=null||t.borderPadding!=null){let i={};i.borderColor=(r=t.borderColor)!=null?r:"white",i.borderStyle=(s=t.borderStyle)!=null?s:"solid",i.borderWidth=this.parseBorderSizeInput(t.borderWidth,"1px"),i.borderRadius=this.parseBorderSizeInput(t.borderRadius),i.padding=this.parseBorderSizeInput(t.borderPadding),this.applyStyle(e,i)}}parseBorderSizeInput(t,e="0"){return t==null?e:+t?t+"px":t}onunload(){}loadSettings(){return m(this,null,function*(){yield D(this,b);let t=document.querySelector(":root");console.log(this.settings.wrapSize.value.toString()),t.style.setProperty(k,this.settings.wrapSize.value.toString()+"px"),t.style.setProperty(G,this.settings.defaultSpan.value.toString())})}saveSettings(){return m(this,null,function*(){yield P(this,b)})}},z={numberOfColumns:{value:2,name:"Number of Columns",desc:"Number of Columns to be made"}},x=class extends u.Modal{constructor(t,e){super(t);this.onSubmit=e}onOpen(){let{contentEl:t}=this;t.createEl("h1",{text:"Create a Column Wrapper"});let e=z,l=Object.entries(z);for(let r of l)T(t,r,"",(s,i)=>{e[i].value=s});new u.Setting(t).addButton(r=>r.setButtonText("Submit").setCta().onClick(()=>{this.close(),this.onSubmit(e)}))}onClose(){let{contentEl:t}=this;t.empty()}},F=class extends u.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}display(){L(this,b,X)}};