`);let s=this.editor.getCursor();this.editor.setCursor(s.line-3)}catch{new Z.Notice("There was an issue inserting the admonition.")}this.close()})).addExtraButton(r=>{r.setIcon("cross").setTooltip("Cancel").onClick(()=>this.close()),r.extraSettingsEl.setAttr("tabindex",0),r.extraSettingsEl.onkeydown=t=>{t.key=="Enter"&&this.close()}})}buildAdmonition(){if(this.admonitionEl.empty(),this.type&&this.plugin.admonitions[this.type]){let c=this.plugin.admonitions[this.type];this.element=this.plugin.getAdmonitionElement(this.type,this.title,c.icon,c.injectColor??this.plugin.data.injectColor?c.color:null,this.collapse),this.element.createDiv({cls:"admonition-content",text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla."}),this.admonitionEl.appendChild(this.element)}}};var w3=`(functionwebpackUniversalModuleDefinition(root,factory){
});`;var W3=a1(require("obsidian"));var H3={};var L3={};var V3={};var b3={};var i4={"Admonition Settings":"Admonition Settings","Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors.":"Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors."," Markdown Syntax Highlighting":" Markdown Syntax Highlighting","Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk.":"Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk."," Sync Links to Metadata Cache":" Sync Links to Metadata Cache","Allows admonitions to be created using ":"Allows admonitions to be created using "," or ":" or ",", instead of using a code block.":", instead of using a code block."," Enable Non-codeblock Admonitions":" Enable Non-codeblock Admonitions","Collapsible by Default":"Collapsible by Default","All admonitions will be collapsible by default. Use ":"All admonitions will be collapsible by default. Use "," to prevent.":" to prevent.","Default Collapse Type":"Default Collapse Type","Collapsible admonitions will be either opened or closed.":"Collapsible admonitions will be either opened or closed.","Add Copy Button":"Add Copy Button","Add a 'copy content' button to admonitions.":"Add a 'copy content' button to admonitions.","Add New":"Add New","Add a new Admonition type.":"Add a new Admonition type.","Add Additional":"Add Additional","Register Commands":"Register Commands","Unregister Commands":"Unregister Commands",Edit:"Edit",Delete:"Delete","Admonition Type":"Admonition Type","Admonition Title":"Admonition Title","This will be the default title for this admonition type.":"This will be the default title for this admonition type.","Admonition type cannot be empty.":"Admonition type cannot be empty.","Admonition type cannot include spaces.":"Admonition type cannot include spaces.","Types must be a valid CSS selector.":"Types must be a valid CSS selector.","Invalid icon name.":"Invalid icon name.","Icon cannot be empty.":"Icon cannot be empty.","Upload Image":"Upload Image","There was an error parsing the image.":"There was an error parsing the image.","Admonition Icon":"Admonition Icon",Color:"Color",Save:"Save","No Admonition Title by Default":"No Admonition Title by Default","The admonition will have no title unless ":"The admonition will have no title unless "," is explicitly provided.":" is explicitly provided.","Show Copy Button":"Show Copy Button","A copy button will be added to the admonition.":"A copy button will be added to the admonition.","Parse Titles as Markdown":"Parse Titles as Markdown","Admonition Titles will be rendered as markdown.":"Admonition Titles will be rendered as markdown."};var N3={};var A3={};var B3={};var y3={};var S3={};var F3={};var Q3={};var U3={};var I3={};var k3={};var E3={};var D3={};var R3={};var T3={};var Z3={};var G3={};var P3={"Admonition Settings":"Admonition \u8BBE\u7F6E","Use Obsidian's markdown syntax highlighter in admonition code blocks. This setting is experimental and could cause errors.":"\u5728 admonition \u4EE3\u7801\u5757\u4E2D\u4F7F\u7528 Obsidian \u7684 markdown \u7CFB\u7EDF\u7EA7\u9AD8\u4EAE\u3002\u8BE5\u8BBE\u7F6E\u4E3A\u5B9E\u9A8C\u6027\uFF0C\u53EF\u80FD\u4F1A\u5F15\u53D1\u9519\u8BEF"," Markdown Syntax Highlighting":" Markdown \u7CFB\u7EDF\u9AD8\u4EAE","Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk.":"Try to sync internal links to the metadata cache to display in graph view. This setting could have unintended consequences. Use at your own risk."," Sync Links to Metadata Cache":" Sync Links to Metadata Cache","Allows admonitions to be created using ":"\u5141\u8BB8 admonitions \u521B\u5EFA\u4F7F\u7528"," or ":"\u6216",", instead of using a code block.":"\uFF0C\u800C\u975E\u4EE3\u7801\u5757","
`),v=s[f.lineStart];if(!/^> \[!.+\]/.test(v))return;let[,m,z,p]=v.match(/^> \[!(\w+)(?::[ ]?(.+))?\](x|\+|\-)?/)??[];if(!m||!this.admonitions[m]&&!Object.keys(this.admonitions).map(M=>M.toLowerCase()).includes(m.toLowerCase())||(m in this.admonitions||(m=Object.keys(this.admonitions).find(M=>M.toLowerCase()==m.toLowerCase())),!m))return;let h;switch(p){case"+":{h="open";break}case"-":{h="closed";break}case"x":break;default:h=this.data.autoCollapse?this.data.defaultCollapseType:null}let g=this.getAdmonitionElement(m,z??this.admonitions[m].title??`${m[0].toUpperCase()}${m.slice(1).toLowerCase()}`,this.admonitions[m].icon,this.admonitions[m].color,h),u=s.slice(f.lineStart+1,f.lineEnd+1).join(`
`).replace(/> /g,""),C=this.getAdmonitionContentElement(m,g,u);H.MarkdownRenderer.renderMarkdown(u,C,t.sourcePath,null),r.firstElementChild.replaceWith(g)});let c=d2.StateEffect.define();class e extends _.WidgetType{constructor(t,f,s,v){super();this.type=t;this.title=f;this.collapse=s;this.content=v}eq(t){return this.type==t.type&&this.title==t.title&&this.collapse==t.collapse&&this.content==t.content}toDOM(t){let f=i.getAdmonitionElement(this.type,this.title??i.admonitions[this.type].title??this.type[0].toUpperCase()+this.type.slice(1).toLowerCase(),i.admonitions[this.type].icon,i.admonitions[this.type].color,this.collapse),s=createDiv(`cm-embed-blockadmonition-parentadmonition-${this.type}-parent`);s.appendChild(f);let v=s.createDiv({cls:"edit-block-button",attr:{"aria-label":"Edit this block"}});(0,H.setIcon)(v,"code-glyph"),v.onclick=()=>{let p=t.posAtDOM(f);t.dispatch({selection:{head:p,anchor:p}})};let m=this.content.replace(/^> /gm,""),z=i.getAdmonitionContentElement(this.type,f,m);return H.MarkdownRenderer.renderMarkdown(m,z,"",null),s}}class l{constructor(t){this.cache=Object.create(null);this.editor=t}async compute(t){let f=[];for(let s of t){let v=this.cache[s.value];v||(v=this.cache[s.value]=_.Decoration.replace({inclusive:!0,widget:new e(s.type,s.title,s.collapse,s.value),block:!0,from:s.from,to:s.to})),f.push(v.range(s.from,s.to))}return _.Decoration.set(f,!0)}async updateDecos(t){let f=await this.compute(t);(f||this.editor.state.field(n).size)&&this.editor.dispatch({effects:[c.of(f??_.Decoration.none)]})}clearDecos(){this.editor.dispatch({effects:[c.of(_.Decoration.none)]})}}let i=this,o=_.ViewPlugin.fromClass(class{constructor(r){this.source=!1;this.manager=new l(r),this.build(r)}update(r){if(!r.heightChanged&&!!i.data.livePreviewMS){if(!r4(r.view.state)){this.source==!1&&(this.source=!0,this.manager.updateDecos([]));return}(r.docChanged||r.viewportChanged||r.selectionSet||this.source==!0)&&(this.source=!1,this.build(r.view))}}destroy(){}build(r){if(!i.data.allowMSSyntax||!i.data.livePreviewMS)return;let t=[];if(!!r4(r.state)){for(let{from:f,to:s}of r.visibleRanges)(0,q3.syntaxTree)(r.state).iterate({from:f,to:s,enter:(m,z,p)=>{let h=m.prop(Y3.tokenClassNodeProp);if(!new Set(h?.split(" ")).has("quote"))return;let C=r.state.doc.sliceString(z).split(`
`),B=z+M.length+y.length+1;t.push({from:z,to:B,value:y,title:b,type:d,collapse:N})}});this.manager.updateDecos(t)}}}),n=d2.StateField.define({create(){return _.Decoration.none},update(r,t){return t.effects.reduce((f,s)=>s.is(c)?s.value.update({filter:(v,m,z)=>!J3(t.newSelection.ranges,z.spec.from,z.spec.to)}):f,r.map(t.changes))},provide:r=>_.EditorView.decorations.from(r)});this.registerEditorExtension([o,n])}enableMarkdownProcessor(){if(!this.data.enableMarkdownProcessor)return;let c=new RegExp(`(!{3,}|\\?{3,}\\+?)ad-(${this.types.join("|")})(\\s[\\s\\S]+)?`),e=new RegExp("\\-{3,} admonition"),l=!1,i,o=new Map,n=new Map,r=new Map;Object.values(this.admonitions).filter(({command:t})=>t).forEach(t=>{this.registerCommandsFor(t)}),this.registerMarkdownPostProcessor(async(t,f)=>{if(!!this.data.enableMarkdownProcessor){if(e.test(t.textContent)&&l){l=!1;let s=createDiv();if(i&&r.has(i)&&o.has(r.get(i))&&t.children[0].textContent.replace(e,"").length){s.innerHTML=t.children[0].outerHTML.replace(new RegExp(`(<br>)?\\n?${e.source}`),"");let v=o.get(r.get(i)).contentEl;v&&v.appendChild(s.children[0])}t.children[0].detach();return}if(!(!c.test(t.textContent)&&!l)){if(!l){if(!(Array.from(t.children).find(v=>c.test(v.textContent))instanceof HTMLParagraphElement))return;l=!0;let s=new H.MarkdownRenderChild(t);i=R2(),r.set(i,s),o.set(s,{contentEl:null,elements:[],loaded:!1}),s.onload=async()=>{let v=t.textContent,[,m,z,p=z[0].toUpperCase()+z.slice(1).toLowerCase()]=v.match(c)??[];if(!z)return;let h;/\?{3,}/.test(m)&&(h=/\+/.test(m)?"open":"closed"),(p.trim()===""||p==='""')&&h!==void 0&&h!=="none"&&(p=z[0].toUpperCase()+z.slice(1).toLowerCase(),new H.Notice("An admonition must have a title if it is collapsible."));let g=this.admonitions[z],u=await this.getAdmonitionElementAsync(z,p.trim(),g.icon,g.injectColor??this.data.injectColor?g.color:null,h),M=u.createDiv("admonition-content-holder").createDiv("admonition-content");s.containerEl.appendChild(u);for(let d of o.get(s)?.elements)M.appendChild(d);o.set(s,{...o.get(s),contentEl:M,loaded:!0})},s.onunload=()=>{r.delete(i),o.delete(s)},f.addChild(s),t.children[0].detach();return}if(i&&r.get(i)){let s=r.get(i);if(o.set(s,{...o.get(s),elements:[...o.get(s).elements,...Array.from(t.children)]}),n.set(t,s),o.get(s)?.loaded)for(let v of o.get(s)?.elements)o.get(s).contentEl.appendChild(v)}}}})}disableMarkdownProcessor(){Object.values(this.admonitions).filter(({command:c})=>c).forEach(c=>{this.registerCommandsFor(c)})}unregisterCommandsFor(c){c.command=!1,this.app.commands.findCommand(`obsidian-admonition:insert-${c.type}`)&&(delete this.app.commands.editorCommands[`obsidian-admonition:insert-${c.type}`],delete this.app.commands.editorCommands[`obsidian-admonition:insert-${c.type}-with-title`],delete this.app.commands.commands[`obsidian-admonition:insert-${c.type}`],delete this.app.commands.commands[`obsidian-admonition:insert-${c.type}-with-title`])}registerCommandsFor(c){c.command=!0,this.addCommand({id:`insert-${c.type}`,name:`Insert${c.type}`,editorCheckCallback:(e,l,i)=>{if(e)return c.command;if(c.command)try{l.getDoc().replaceSelection(`\`\`\`ad-${c.type}
`);let o=l.getCursor();l.setCursor(o.line-2)}catch{new H.Notice("There was an issue inserting the admonition.")}}}),this.addCommand({id:`insert-${c.type}-with-title`,name:`Insert${c.type}WithTitle`,editorCheckCallback:(e,l,i)=>{if(e)return c.command;if(c.command)try{l.getDoc().replaceSelection(`\`\`\`ad-${c.type}
`);let o=l.getCursor();l.setCursor(o.line-3)}catch{new H.Notice("There was an issue inserting the admonition.")}}}),this.data.enableMarkdownProcessor&&this.addCommand({id:`insert-non-${c.type}`,name:`InsertNon-codeblock${c.type}`,editorCheckCallback:(e,l,i)=>{if(e)return c.command&&this.data.enableMarkdownProcessor;if(c.command)try{l.getDoc().replaceSelection(`!!!ad-${c.type}
`);let o=l.getCursor();l.setCursor(o.line-2)}catch{new H.Notice("There was an issue inserting the admonition.")}}})}turnOnSyntaxHighlighting(c=Object.keys(this.admonitions)){!this.data.syntaxHighlight||(c.forEach(e=>{if(this.data.syntaxHighlight){let[,l]=`${e}`.match(/^([\w+#-]*)[^\n`]*$/);window.CodeMirror.defineMode(`ad-${l}`,(i,o)=>window.CodeMirror.getMode({},"hypermd"))}}),this.app.workspace.layoutReady?this.layoutReady():this.app.workspace.onLayoutReady(this.layoutReady.bind(this)))}turnOffSyntaxHighlighting(c=Object.keys(this.admonitions)){c.forEach(e=>{window.CodeMirror.modes.hasOwnProperty(`ad-${e}`)&&deletewindow.CodeMirror.modes[`ad-${e}`]}),this.app.workspace.layoutReady?this.layoutReady():this.app.workspace.onLayoutReady(this.layoutReady.bind(this))}layoutReady(){this.app.workspace.off("layout-ready",this.layoutReady.bind(this)),this.refreshLeaves()}refreshLeaves(){this.app.workspace.iterateCodeMirrors(c=>c.setOption("mode",c.getOption("mode")))}asyncpostprocessor(c,e,l,i){if(!!this.admonitions[c])try{leto=typeofi=="string"?i:i?.sourcePath??this.app.workspace.getActiveFile()?.path??"",{title:n,collapse:r,content:t,icon:f,color:s}=_4(c,e,this.admonitions[c]),v=newRegExp(`^!!! ad-(${this.types.join("|")})$`,"gm"),m=t.match(v)||[];if(m.length){letC=[T2(t,0,m[0])];for(letd=1;d<m.length;d++)C.push(T2(t,C[d-1].end,m[d]));letM=t.split(`
`);for(let d of C.reverse())M.splice(d.start,d.end-d.start+1,`\`\`\`ad-${d.type}